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 1 Guest are viewing this topic.

DrollTroll

If you don't have "Align to any angle" checked, think of it as just drawing the front face of a 3D box. The rectangle will be aligned along the current horizontal and vertical axis (depending on your view angles).
25 years with DesignCAD

j-wetzel

  Thanks again to all you knowledgable folks.  I now have the 2-D drawings that I can use, but (inevitably) I've encountered lots of things that I need to do but cannot figure out how to do.
  The attached DC file shows three of the four figures (i.e., drawings) I need for the icosahedron, but I cannot get DC to do what I want to do.  The problem appears to be that the 2-D drawings inherit layer structure from their 3-D progenitors; and I simply cannot manipulate the layers.  There has to be a way to simply eliminate the layer structure, the assigned colors, the established line types and unchangeable widths!  There is just no way I can transform these drawings into something I can use, because I can't figure out how to work with anything in the way I am used to with a pure one-layer 2-D drawing.
  For example, a closer look at the top right corner of P1 in the combined drawing (on the right) shows that it is just barely outside the side of the projection Pi.  I want to draw a disk about that corner and copy and rescale it nearby, to show the detail larger.  I've done this before with other drawings, but I simply cannot get the commands to work.
  I would truly appreciate some wise words from you gentle experts.
--Jack

samdavo

#17
JW,
I note that you have already flattened your drawing, so that makes it pretty easy to add the detail at top right.   I enclose a dcd with that sketch zoomed 5 times, then I used "D" section trim to get rid of most of the unwanted areas, then drew a circle, and trimmed the now-broken lines to the edge of that circle.   Any help?

As for controlling layers, you can use L to makes layers editable or not, (same as locked or not - well opposite in reality),  and visible or not.  If a layer is the only one editable, you can select entities in that layer, and change them to another colour, linetype, thickness etc.

PS re-reading your post, I suspect you have some locked layers there.

samdavo

#18
If you want a couple of macros that will handle those layers,  then

aa.d3m will make all visible layers editable - run that,

then select the part of the drawing you want to change

then selto1a.d3m will change all lines etc in the selection to layer 1 and black lines (if you have a white background) or white lines ( if you have a black background). Refer jpeg - where I only changed the blownup detail to white lines. (2 cents)

PS (edit) I have reposted aa.d3m because I had saved it as txt instead of d3m (apologies for any confusion). 

samdavo

#19
But the quickest way to have all black lines - for a screensnip (and this one doesn't change your layers or the original colours) is to run aa.d3m ( to select all layers),

then to run prl's macro qs2.d3m.    This temporarily changes the selection colour to black, and selects everything - then when you press anykey, (or simply left click anywhere), you have your original colours again.

By the way, you will probably be aware of this, but I would argue that the quickest way to get a screensnip (assuming Windows 7 or 8 ) is to use Snipping Tool  (Start\ go to Search programs, and start typing "Sn.." - and rightclick the snipping tool and Pin to Taskbar (2 cents)  - easier than Print screen imo.

samdavo

#20
Quote from: prl on April 01, 2015, 09:35:31 AM
And regarding the 2dtext, yes that is the trick I was aiming for.  The 2dtext is simply a convenient entity that is always perpendicular to the view.

A movie - Using 2dtext to create a temporary workplane normal to the viewing window
Wow - ANOTHER great trick - thanks prl et al. :)

samdavo

#21
JW
Here's a twigged version of qs2.d3m called qs4.d3m which changes all lines (temporarily) to black but now on a white background  (where qs2.d3m uses a light aqua-blue background) - and I have changed P1 to phantom lines.   Also enclose the screensnap. 

The layers and colours of your dcd file are pretty much unchanged except for a couple of small lines (and PS I probably got these wrong when I added them back,  in particular the small line at the centre of P1).

PS There is a way to get rid of ": isothingo" in the title of the drawing as seen when opened - but I forget how - others will hopefully know.

PS (edit) One advantage of using qs4.d3m,  where qs = quick shade,   is that it does NOT change the layers and colours.  By that I mean that I note you have P0 on layer 2 and P1 on layer 7 -  and that also applies where they are superimposed.   HENCE if you want to select all of layer 2,  you can easily do so (by locking all others),  and then eg change those lines to phantom - which is what I have done. 

Dr PR

Jack,

You don't need to mess with macros - it is easy and fast to just use the built in commands.

To get everything on one layer:

1. Open the "Layers" dialog (press the "L" key).

2. Click "Show All." This makes all layers visible.

3. Click "Unlock All." This makes all layers editable (unlocked).

4. Make the layer active where you want all of the entities in the drawing to end up. To do this find the column with the little "pencil" icon at the top. Left click in the box for the desired layer in that column.

5. Now click the "OK" button at the bottom of the Layers dialog box.

6. Select everything. Use the "Edit/Select All" menu item or press "Ctrl A".

7. Now find the "Layer Toolbox" at the top of the screen. If it isn't visible use "View/Show-Hide" and click beside the "Layer Toolbox" to put an "X" in the box.

8. Click on the Layer Toolbox "Apply Layer To Selection" (A+) button. This will move all of the selected items to the current layer.

****

To change colors:

9. Select everything as in steps 1-6 above. Skip this if everything is already selected.

10. While everything is selected open the "Info Box" by pressing "Ctrl I."

11. At the upper left is a color tile. Click it. This opens the "Color" dialog. You can select preset colors, click in the rainbow color palette to choose a new color, or type in the decimal RGB color values.

12. Click "OK" to close the "Color" dialog.

13. Click the "X" button at the upper right of the Info Box to close it.

Now everything that was selected is the same color.

****

To change line styles:

14. Select the items you want to change (steps 1-6 above).

15. Open the Info Box (Ctrl I).

16. Just below half way down the dialog is a box with line styles. Click the black down arrow "v" to open the pull-down list.

17. Click on the desired line style for the selected items.

18. If you have selected a dashed line style you can fiddle with the "Line Scale" numbers to change the length of dashes and spaces.

19. Click the "X" at the upper right of the Info Box to close it.

Now everything has the selected line style.

****

Another easy way to change the color/line style/etc. of a selected object is to open the Info Box and use the "finger" tool that is just to the right of the color tile. Click the "finger" and the cursor changes to a finger.

Point at any object on the screen and left click. The selected objects will take on the color, line style, material, etc. of the object that you point to.

This method is especially useful for changing line styles and colors if you first create a new object with all of the desired properties. Then select everything and click the "finger" on the new object to transfer it's properties to all of the selected objects.

****

You can do a great deal of things with the Layers Dialog and the Info Box.

Phil

DesignCAD user since 1987

samdavo

#23
OK, I have a question as well. It regards aspect ratio of images. 
...   So I thought I would save as image for better resolution  (File\Image\ Image Save).  i.e. rather than Screen-Snip.
I carefully marked out the corners of a rectangle 15.5 x 10,  and then tried to save as an image, with one side 1550 pixels (the other side automatically became 1000 pixels - so I thought all was looking promising).
Then when I saved the image (as jpeg), and looked at it, it was clearer, BUT it has a significant vertical stretch (?)

Ahh if I open with Paint, it has the correct aspect ratio.  Must be "problem belong Windows Photo Viewer"  (as they say in PNG).

Dr PR

Sam,

I haven't seen that one - yet. I have saved bazillions of images with "File/Image/Save Image File" and haven't noticed any aspect ratio distortion.

Phil
DesignCAD user since 1987

samdavo

Another quick question.  (Pretty trivial) ... I suppose, if lines are overlaid upon each other - so that dotted /dashed / phantom etc lines start to appear almost solid,  that there is no option but to trace them with single lines.(?)  Or is there a macro?   Not forgetting that some of those lines are multi-segment / bent.   Another option I guess would be to break all multisegment lines, then delete each line multiple times until it finally disappeared, and then Undo (Ctrl Z) the last erase - and move on to the next line.   

Dr PR

I think DT (or perhaps someone else) posted a macro to clean up overlapping lines several years ago - but I may be wrong about that. Who knows what all those macros with cryptic names really do?

Personally, I don't trust macros or the "Save As" hidden line cleanup functions. They always seem to remove lines I want and leave those I don't want.

The program can't read your mind so the only sure way to get what you want is to trace over the existing objects on a separate layer and then delete the originals. I always do this after saving a 2D projection of a 3D drawing.

Phil
DesignCAD user since 1987

Bob P

'DeleteDuplicateLines.d3m

' This simple macro removes duplicate lines 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
' Loop through all the objects in the drawing
   for a = 1 to Sys(9)

input "Enter the tolerance for matching points: ", tol

F$ = a/Sys(9)*100

print "Working, Please Wait . . .", f$ , " %"


' 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

      'next b
      ' Loop through the rest of the objects

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

         ' Select the next object in the drawing
            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 Location of the 2 Items

if abs(OneX1-TwoX1)>tol then goto skip
if abs(OneY1-TwoY1)>tol then goto skip
if abs(OneZ1-TwoZ1)>tol then goto skip
if abs(OneX2-TwoX2)<tol then goto skip
if abs(OneY2-TwoY2)>tol then goto skip
if abs(OneZ2-TwoZ2)>tol then goto skip
if abs(OneX1-TwoX2)>tol then goto skip
if abs(OneY1-TwoY2)>tol then goto skip
if abs(OneZ1-TwoZ2)>tol then goto skip
if abs(OneX2-TwoX1)>tol then goto skip
if abs(OneY2-TwoY1)>tol then goto skip
if abs(OneZ2-TwoZ1)>tol then goto skip
                     ' Select the duplicate object
                        getattr d, type, select
                        if select = 0 then
                        select = 1
                        putattr d, type, select
                        f = f + 1
                        endif
skip:
   
                  endif

      next c
'end if
   next a


>Regenerate
{
}

prompt$ = "Press 1 to delete = ", sys(80),  "lines,  any other key to keep"

print "Number of entities to be deleted = ", sys(80)
input , [prompt$], ts

if ts <> 1 then end

  ' Delete it
   >SelectDelete
   {
   }

>Regenerate
{
}
WClose
Precision 0
f$ = f
Message "Finished !! " + f$ + " duplicate objects removed."
End

samdavo

#28
Thanks Bob,
will look into that one later.  For this project, I assume you would need to break all vectors into units first (?)  since many are elbow shaped multi-segment - and worse (2 cents)
...............

Summary - if you look at the final jpeg, hopefully you will prefer the linestyle in Option C to Option A.   Each intersection of lines unambiguously involves 5 lines in C (whereas in A there is some confusion when a line ends in the middle of a gap). 
Also there are 2.5 modules of phantom2 linestyle in most lines ( which are roughly 10 long, and the linestyle scale is 4, and 10/4 = 2.5);
also there are 1.5 modules of phantom2 linestyle in the short lines ( which are roughly 3.8 long, and the linestyle scale is 2.53, and 3.8/2.53 = 1.5).   Details follow (intended to show progressive improvements):-

...............
Example A.
Meanwhile I have traced this one,  (see A, final jpeg) - Lines are not yet broken, but there are no duplications.  They are all default Phantom linestyle.
  Result :-  big gaps and confusing at some ends of some lines imo.   
Typical length of hexagon I have made 10,  and the linescale = 4 (the significance of this is lost when many lines are multi-segment , discussed in B below) 



...............
Example B.
I broke all lines at changes of direction.
Then I worked on Linestyle Editor to try to improve it.   You access this through Options\Custom Linestyle Editor\Phantom,  then add a 2 to make it Phantom2,  then go to the bottom of the page and change 14 to 72.  (can only be changed at bottom of window) - then "OK".

Basically the default Phantom =  three dashes, 14 + 6 gap, 3 + 6 gap, and 3 + 6 gap =   38 total , so that the long dash is 14/38 = 37% of the module 

And the new Pantom2 = three dashes, 72 +6 gap, 3 + 6 gap, and 3 + 6 gap = 96 total, so that the long dash is 72/96 = 75% of the module,  i.e.   much greater chance of each end of a line being a long dash instead of the short ones.  ESPECIALLY if a line is 2.5 modules long, or 1.5, or 3.5, etc etc 

Next I made all lines of the hexagon linestyle Phantom2.    Ok - herewith the significance of length of line 10, and linescale 4.  This means that there are 10/4 = 2.5 (approx) modules, and this in turn means that each end of each line has a great chance of being the long dash.     

The thing that could be improved are the 6 short lines (cyan).   Because they are only 3.82 long, then the scale of 4 means that one end of each (cyan) line ends in short dashes (instead of long dashes).



...........
Example C
Ok, the way to get around the last-mentioned problem is to select those 6 lines (each 3,82 long), and change the scale from 4 to 3.82/1.5 = 2.53,   i.e. that would mean there are 1.5 modules in each of those lines, and that in turn would mean that there is a long dash at each end. (which I think is better, i.e. every line is unquestionably Phantom2,  and also the end of each (magenta) line is part of a long dash.

samdavo

#29
Bob
Actually that challenge for a macro to eliminate duplicates appears to be harder than first impression.
I moved your input "set tolerance" up the list a bit, otherwise it crops up with each loop lol.   But the big problems are when line AB overlays line CD, and whether you delete one or other depends on where A B C and D are along the line in question.  (that would be a real challenge for any macro).   You may even need some of AB followed by some of CD etc (!) -  Maybe Jack's next paper, lol.

Also it doesn't seem to delete as expected - probably a trivial twig required there.  (2 cents).

Summary, on this occasion Phil may be right lol.  Tracing may be easier than a macro. 

If anyone wants to try, I have pushed-apart the lines (Jack's P1 drawing), firstly before breaking them, then after.  You will see that there must be duplicates if you look at the top right.

Trouble is, even after a) breaking lines, (>dark blue); and b) running the macro (lower right),  (>magenta) ...
there are still duplicates hiding amongst the magenta lines (I have dragged a couple out and changed them to green as examples).  And you will also see what I mean by some overlain lines being longer or shorter and hence not registering as duplicates (2 cents). 

It's a tough macro, and as I say, I'm thinking Phil could be right on this occasion.   
Cheers 
sam

PS If anyone wants to try the macro on that drawing, - look for any effect on the dark blue shape.  Also use this version (below) of Bob's macro which has "input tolerance" higher up the sequence. cheers -  PS Call this one an academic exercise I suspect.

'DeleteDuplicateLines.d3m
'TWIGGED to lift input tolerance in the sequence.

' This simple macro removes duplicate lines 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 "Enter the tolerance for matching points: ", tol
' Loop through all the objects in the drawing
   for a = 1 to Sys(9)


F$ = a/Sys(9)*100

print "Working, Please Wait . . .", f$ , " %"


' 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

      'next b
      ' Loop through the rest of the objects

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

         ' Select the next object in the drawing
            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 Location of the 2 Items

if abs(OneX1-TwoX1)>tol then goto skip
if abs(OneY1-TwoY1)>tol then goto skip
if abs(OneZ1-TwoZ1)>tol then goto skip
if abs(OneX2-TwoX2)<tol then goto skip
if abs(OneY2-TwoY2)>tol then goto skip
if abs(OneZ2-TwoZ2)>tol then goto skip
if abs(OneX1-TwoX2)>tol then goto skip
if abs(OneY1-TwoY2)>tol then goto skip
if abs(OneZ1-TwoZ2)>tol then goto skip
if abs(OneX2-TwoX1)>tol then goto skip
if abs(OneY2-TwoY1)>tol then goto skip
if abs(OneZ2-TwoZ1)>tol then goto skip
                     ' Select the duplicate object
                        getattr d, type, select
                        if select = 0 then
                        select = 1
                        putattr d, type, select
                        f = f + 1
                        endif
skip:
   
                  endif

      next c
'end if
   next a


>Regenerate
{
}

prompt$ = "Press 1 to delete = ", sys(80),  "lines,  any other key to keep"

print "Number of entities to be deleted = ", sys(80)
input , [prompt$], ts

if ts <> 1 then end

  ' Delete it
   >SelectDelete
   {
   }

>Regenerate
{
}
WClose
Precision 0
f$ = f
Message "Finished !! " + f$ + " duplicate objects removed."
End