News:

Please note new Forum URL: forum.designcad.com

Main Menu
DesignCAD 3D Max 2027 box
Now available

DesignCAD 2027

Hatches that follow their boundaries, an on-screen dial to turn your model, and a way to find any command by name, in a clean Windows 11 look.

Intermixing 2-D and 3-D

Started by j-wetzel, March 31, 2015, 07:58:29 AM

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

Bob P

Sorry!  I posted that without testing it.  ("Not mine" is my excuse...)  :-X

This one works for me.

' DeleteDuplicateLines.d3m
' This simple macro removes duplicate lines the first two points of which lie on top of each other in the drawing
' This macro could take a LONG time to complete on a complicated drawing.

' Turn off Error Reporting
   Sys(0) = 0

Input "Tolerance for matching points:ENTER for .001 ", tol
if tol=0 then tol=.001

' Loop through all the objects in the drawing, populate progress indicator in status line
   for a = 1 to Sys(9)
   F$ = a/Sys(9)*100
   print "Working, Please Wait . . .", f$ , " % done, - ", sys(80), "duplicates found."


' Select the first object
    Entity a

' Determine if entity a is a line, if not, skip to next entity
    getattr a, type
    if type <> 1 then next a

' Get the point values for this object

      if Sys(1) > 1 then
         pointval OneX1 OneY1 OneZ1 1
         pointval OneX2 OneY2 OneZ2 2
         end if

' Loop through the rest of the objects

      c = a + 1
      for d = C to Sys(9)
            Entity d

' Get the point values for that object
            if Sys(1) > 1 then
               PointVal TwoX1 TwoY1 TwoZ1 1
               PointVal TwoX2 TwoY2 TwoZ2 2
           
' Compare Point Locations of the 2 Items
               if ((abs(OneX1-TwoX1)<tol AND abs(OneY1-TwoY1)<tol AND abs(OneZ1-TwoZ1)<tol) and (abs(OneX2-TwoX2)<tol AND abs(OneY2-TwoY2)<tol AND abs(OneZ2-TwoZ2)<tol)) then dup = 1
               if ((abs(OneX1-TwoX2)<tol AND abs(OneY1-TwoY2)<tol AND abs(OneZ1-TwoZ2)<tol) and (abs(OneX2-TwoX1)<tol AND abs(OneY2-TwoY1)<tol AND abs(OneZ2-TwoZ1)<tol)) then dup = 1
               If dup = 1 then

' Select the duplicate object
                  getattr d, type, select
                  if select = 0 then
                        select = 1
                        putattr d, type, select
                        f = f + 1
                        endif
                  dup = 0
                  endif
               endif
      next c
  next a


>Regenerate
{
}

Precision 0

print "Completed,", sys(80),  "duplicate entities found. "

Sys(1027) = 4 'Yes/No MessageBox style


Message "Press Enter to delete ", sys(80),  " lines,   N to keep"

If Sys(1028) = 6 Then

  ' Delete them
   >SelectDelete
   {
   }

>Regenerate
{
}
WClose

f$ = f
Sys(1027) = 0
Message "Finished !! " + f$ + " duplicate lines removed."

end if
End

samdavo

Bob
yep that one's much better - still has a problem when lines AB and BC are collinear with line ABC - but no biggie.  thanks

j-wetzel

  You guys and your macros!  I finally realized that with my limited, aged brain I should do the drawing in 2-D, which is where I'm most comfortable.  I pointmarked the significant points in the 3-D drawing with a colored pointmark, copied those pointmarks, pasted them into a new 2-D drawing, and then simply drew the connecting lines one-by-one.  Now everything is in the same layer (#1), and I can adjust the line characteristics as I want them.  Then for the tilted projection, I can simply scale the section plane in one direction to "simulate" the tilting of the plane in 3-D (it is, after all, a simple similarity mapping).  All this is familiar, and I'm comfortable with it.
  Thanks so much to all of you.  I truly appreciate your help.
--Jack

samdavo

#33
Of course you can also make one set of lines different to another, using "two shades of grey", as well as line styles.

Reminds me, I was on a plane recently, and I mentioned to the lady beside me that I had read 50 Shades of Grey - and she asked me what it was about.  A said "it's about a bloke who is a dominatrix",  she asked "what's that?"  I said "someone who likes to dominate in sex". 

And a kid in the row ahead who overheard turned around and said "why, what did the insects do to him?"
(2 cents)

PS Jack,  Maybe you can slip that 'joke' into your paper :)

PS Maybe that should be dominator? or male dominatrix? whatever.

prl

Quote from: samdavo on April 09, 2015, 02:11:40 PM
Reminds me, I was on a plane recently, and I 

I was on a plane recently, standing next to a normal line.  It was facetinating.   :)

samdavo

#35
Sure thing - but speaking planely,
yesterday's eccentric is today's normal, if you follow my line.
Take this topic for example lol.

At least we all now know what a Rupert is :)   (other than Rupert Murdoch etc).
I still think solids that are "non-Rupert" should have their own name - like maybe they are "Bill" for example.  Or maybe "Fred".   (or maybe "Jack" - in honour of JW and his pioneering work here :) )
cheers