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.

Moving Layers to Layer 0 Macro --- DCAD Version 17.2

Started by Robert Willis, December 30, 2006, 10:57:57 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Robert Willis

I am attempting to Move all layers from some company supplied files to make then DesignCAD symbols. I have tried the File Save as symbol but this requires that I change the name of the file. I looked in the BasicCAD manual and could not find the correct commands to do this. So far I have already received some fantastic assistance from this forum (Macro to remove all layer names). My final macro to automate the complete task would be to the follwing.

1. Convert a group of files from AutoCAD DWG to DesignCAD V17.2 format
2. Change dimensions to mm
3. Remove all layer names
4. Move all layers to layer 0
5. Make layer 0 the default
6. Save converted file to DesignCAD format.


prl

There are some basiccad problems with saving and loading files.  I call it the "fake saves" and "fake loads".  I hope we can get them fixed soon.
 
Try this, note it assumes your original drawings are in inches (which is the new default in version 17 when you import AutoCAD type drawings).  Try it on a copy first because it will overwrite your original, which I think is what you wanted.

' Program: rwms.d3m (rw make symbol routine)

' this code is for DC 17 only

'This routine does the following
' 1. Remove all layer names
' 2. Move all layers to layer 0
' 3. Make layer 0 the default
' 4. Save converted file to DesignCAD format.

include "dcadalias.d3i"

'this part assumes the drawing is in inches to start with.  It converts to mm
sys(1100) = 4 'mm
sys(32) = sys(32)/25.4

'item 1 routine ******
sys(36)=1 'silent mode
count=200 'change this to the number of layers you want to cycle through

for i = 1 to count
    sys(3)=i
    sys$(93) = ""
next i

sys(36)=0

'item 2 routine ******
for i = 1 to sys(9)
  entity i
  Change Ent_Layer, 0
next i

'item 3
sys(3) = 0


'item 4
>Save
{
}

Message "Finished - you will need to close this drawing and reload it to see the changes"
End

Robert Willis

THANKS !!!!! I am testing the macro on some drawings that I received and so far everything looks good except for the "units". When I manually set the Units of Measurement I only change the drawing to mm and do not rescale to new units. The reason for this is that during the conversion process from AutoCAD the units of measurements is set to inches however all of the dimensions are in mm.

I want to thank you again for developing these macros for me. They have made my task of converting approximately 300 drawings into symbols.

Have a Safet and Happy New Year !!!!

prl

Quote from: Robert Willis on December 31, 2006, 01:02:43 PM
When I manually set the Units of Measurement I only change the drawing to mm and do not rescale to new units.

You're welcome.

To get the code not to rescale, delete this line of the code:     sys(32) = sys(32)/25.4