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.

Cleaning up 2d Projections

Started by lhgray, October 24, 2012, 03:44:03 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

lhgray

I prefer to model/design in 3d space, but when I need shop drawings with dimensions I create front/top/side 2d projections, clean them up and add dimensions. The problem is the clean-up. Generally, in the resulting 2d projection, there are multiple copies of most entities that result from overlapping features in the 3d view.

Is there a macro or some other easy way to remove all but one of the identical overlapping entities? The "enable hidden line cleanup" option is only available if I wish to create a 2d projection with hidden lines removed. I presume this was intended to cleanup these overlapping entities. I want to preserve the hidden features and subsequently change the line type to hidden. With multiple overlapping entities, changing the line type to hidden does not display properly.

JJG

At this time, I don't know any efficient tool to remove overlapping entities ...

but the problem is not only overlapping lines : it is to delete the "micro" lines that are created too :
for that, there's something here :  http://forum.designcad.com/index.php?topic=3797.0
;)

magic

Hi lhgray,

At the bottom of the Tools menu there's a 2D Lines Cleanup menu item. That might be, what you're looking for.
It's a kind of magic!




Dr PR

lhgray,

I have found that it is far too much trouble to try to clean up a 2D projection drawing.

Instead, I use the projection as a pattern and trace over the parts I want to keep on another layer. This may sound like a lot of extra work, and it is, but it is faster and far more effective than trying to pick out all of the duplicate lines in a projection.

This is especially true with projections of 3D objects containing grids (pipe bends, etc.) where there may be thousands of tiny lines, all duplicated several times. Even the hidden lines cleanup function leaves behind a huge number of these "flyspecks."

After the tracing is complete I delete the original projections, and the file sizes decrease dramatically.

If you have any plans to use the drawing for NC milling you really need to get rid of all the duplicate lines.

Phil
DesignCAD user since 1987

lhgray

Quote from: JJG on October 24, 2012, 10:38:36 PM
At this time, I don't know any efficient tool to remove overlapping entities ...

but the problem is not only overlapping lines : it is to delete the "micro" lines that are created too :
for that, there's something here :  http://forum.designcad.com/index.php?topic=3797.0
;)

Thank you for pointing these out. They will be helpful, but I don't think they will solve my issues entirely.

lhgray

Quote from: magic on October 24, 2012, 10:39:44 PM
Hi lhgray,

At the bottom of the Tools menu there's a 2D Lines Cleanup menu item. That might be, what you're looking for.

How new is this item? After all these years using DesignCad, I can't believe that I missed this. One of my habits when using a new program or even an update, is to scan all of the menus and test the features.

Thank you for pointing this out, although I don't think this will resolve identical overlapping entities.

Lar

I actually wrote a macro for this (back around 2005, but not for public consumption) that usually takes out about 50 % of the lines. Imagine a file that started with 50,000 lines and ends up with 25,000, imagine if you had manually removed that many lines. However, these files are still left with many overlapping lines. The problem is that many lines overlap but don't start and end at the same locations. Let's take 2 lines where one starts where the other ends, so it looks like one long line. Many other lines would also be hidden in those 2 lines. Many of these inner lines would start somewhere inside of the first line and end somewhere inside the 2nd line. My macro has no way of determining a continuous run of lines and deciding which of those lines should be kept and which should be deleted.

The reason I wrote the macro was because I was forced to use '2d hidden line projection's because paper space was such a mess. Since then paper space has been cleaned up enough to make it usable so I would use a hidden line view frame instead. Paper space still has a few issues but overall it displays changes to the drawings instantly, which is a huge advantage in the field of architecture.

However, paper space has no way of displaying hidden lines as dashes. Dcad can display a 'hidden view dashed lines' image on the screen but you can't save the image other than by using 'print screen' or some other screen image capturing software, which means you can't easily control the scale of the image.

Actually, I now remember employing the technique of saving images of the plans and elevations (this was before paper space got cleaned up). The issue here is the image size so it prints without jaggies but it is a lot simpler than learning paper space. The images may not look good on the dcad screen but they print very nicely. I would dimension the actual entities on a separate layer, put very tiny pointmarks at the opposite corners of the areas to take the image from, save the image (with the dimension layer off), then load it back on a separate layer by  snapping onto the pointmarks. This ensured the scale of the bitmap was correct and the dimensions printed clearly. For elevations I would duplicate the pointmarks in the XY plane, load the images by snapping to them,  then duplicate the dimensions using the point marks as a guide. For 3d views scale did not matter but I would capture any dimensions in the image.

I'm not sure if these techniques are practical for NC milling but they work very well for architectural drawings. Paper space view frames would print better than saved images and use up far less file space.

Lar

lhgray

Quote from: Dr PR on October 25, 2012, 01:02:32 AM
lhgray,

I have found that it is far too much trouble to try to clean up a 2D projection drawing.

Instead, I use the projection as a pattern and trace over the parts I want to keep on another layer. This may sound like a lot of extra work, and it is, but it is faster and far more effective than trying to pick out all of the duplicate lines in a projection.

This is especially true with projections of 3D objects containing grids (pipe bends, etc.) where there may be thousands of tiny lines, all duplicated several times. Even the hidden lines cleanup function leaves behind a huge number of these "flyspecks."

After the tracing is complete I delete the original projections, and the file sizes decrease dramatically.

If you have any plans to use the drawing for NC milling you really need to get rid of all the duplicate lines.

Phil

I was thinking about doing this before I sent my original post but I hoped for a more automated process.

Thank you for the insights into you workflow, so I will explain a little about mine.

I do something similar for simpler 3d models. From a complex assembly model, I save a 3d model of each individual component, then trace the relevant faces of the item in an new layer. Then in 3d, I rotate each trace about the X or Y axis, never both, so they are oriented into the desired 2d view. The I 'flatten' each trace by setting the 'Z' value of the bounding box of each trace to zero. This creates a projection parallel to the XY plane. Then I move all of the traces so they are on the XY plane. As a result I have a 3d model and 2d projections in the same file which can be dimensioned properly and easily.

This is a little to much work for my current situation, so I will bite the bullet and proceed as you suggest.


lhgray

#8
Quote from: Lar on October 25, 2012, 07:09:35 AM
I actually wrote a macro for this (back around 2005, but not for public consumption) that usually takes out about 50 % of the lines. Imagine a file that started with 50,000 lines and ends up with 25,000, imagine if you had manually removed that many lines. However, these files are still left with many overlapping lines. The problem is that many lines overlap but don't start and end at the same locations. Let's take 2 lines where one starts where the other ends, so it looks like one long line. Many other lines would also be hidden in those 2 lines. Many of these inner lines would start somewhere inside of the first line and end somewhere inside the 2nd line. My macro has no way of determining a continuous run of lines and deciding which of those lines should be kept and which should be deleted.

The reason I wrote the macro was because I was forced to use '2d hidden line projection's because paper space was such a mess. Since then paper space has been cleaned up enough to make it usable so I would use a hidden line view frame instead. Paper space still has a few issues but overall it displays changes to the drawings instantly, which is a huge advantage in the field of architecture.

However, paper space has no way of displaying hidden lines as dashes. Dcad can display a 'hidden view dashed lines' image on the screen but you can't save the image other than by using 'print screen' or some other screen image capturing software, which means you can't easily control the scale of the image.

Actually, I now remember employing the technique of saving images of the plans and elevations (this was before paper space got cleaned up). The issue here is the image size so it prints without jaggies but it is a lot simpler than learning paper space. The images may not look good on the dcad screen but they print very nicely. I would dimension the actual entities on a separate layer, put very tiny pointmarks at the opposite corners of the areas to take the image from, save the image (with the dimension layer off), then load it back on a separate layer by  snapping onto the pointmarks. This ensured the scale of the bitmap was correct and the dimensions printed clearly. For elevations I would duplicate the pointmarks in the XY plane, load the images by snapping to them,  then duplicate the dimensions using the point marks as a guide. For 3d views scale did not matter but I would capture any dimensions in the image.

I'm not sure if these techniques are practical for NC milling but they work very well for architectural drawings. Paper space view frames would print better than saved images and use up far less file space.

Lar

Thank you for the reply. Maybe I should have explained what I was trying to achieve. Although I do prepare a lot of drawings for NC production, that is not the case here. I was attempting to generate two 2d projections, one with hidden lines removed for each view. Then I was going to copy the wireframe projection over the hidden projection into a different layer and convert the wireframe projection's line type to a hidden line type. I was hoping to end up with a view with hidden lines showing in the 2d projection. The idea is sound, it works, except for the fact that the overlapping lines prevent the dashed or hidden linetype from displaying properly. Thus the desire to remove the overlapping lines. I have also noticed in the 2d projection, some of the lines, even though they are single entities will not display the hidden line type properly. This baffles me.

Again, thanks for the effort.

Dr PR

lhgray,

That's a clever idea (setting the bounding box Z value to zero) for generating perspective projections on the fly. I'll have to remember that.

Thanks.

Phil
DesignCAD user since 1987

Bob P

If you want to try Lars' macro, I think this is it.

' 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

JJG

Quote from: lhgray on October 25, 2012, 09:49:00 AM
Thank you for the reply. Maybe I should have explained what I was trying to achieve. Although I do prepare a lot of drawings for NC production, that is not the case here. I was attempting to generate two 2d projections, one with hidden lines removed for each view. Then I was going to copy the wireframe projection over the hidden projection into a different layer and convert the wireframe projection's line type to a hidden line type. I was hoping to end up with a view with hidden lines showing in the 2d projection. The idea is sound, it works, except for the fact that the overlapping lines prevent the dashed or hidden linetype from displaying properly. Thus the desire to remove the overlapping lines. I have also noticed in the 2d projection, some of the lines, even though they are single entities will not display the hidden line type properly. This baffles me.

Again, thanks for the effort.

For this (wireframe projection over the hidden projection into a different layer and convert the wireframe projection's line type to a hidden line type) , I've though the same issue since about 8-10 years ago, but there is another problem i told from in this topic :  http://forum.designcad.com/index.php?topic=2408.0  and maybe you don't take care of.

That is why, rather than converting the wireframe projection to hidden line type, I convert it to continuious line type, tickness 0 (or small), color gray, then I place hidden behind the rhidden projection.
The result is very readable, and ultimately even better than the hiddentype line.

For those who are even more demanding, you can even add an image of the concerned solid(s) behind it, the result becomes "top"!

Lar

Quote from: Bob P on October 25, 2012, 10:44:22 AM
If you want to try Lars' macro, I think this is it.
...

That's definitely not my macro, Bob. That macro only finds lines that share end points. My macro finds these as well as shorter bits of lines that lay on top of the longer line.

Lar

JJG

Ihgray,

This other topic may interest you too : http://forum.designcad.com/index.php?topic=4465.msg26721;topicseen#msg26721

There are some interesting advices in about 2D projections.

Shipmodeler

#14
Oh, the Holy Grail of DesignCad 3D.  Wouldn't it be wonderful if the program had a feature that would clean up in 2D all needless lines generated in 3D?  I do what DrPR does.  It's time consuming, but right now it is the only way I know of to get a clean 2D out of 3D.
"A man can never say he has truly lived until he has built a model ship"
Ronald Reagan