In our company we have a drop down menu on our CAD systems which allow us to select layers to include in a drawing.
The following is a sample of the script used:
ID_DISC [->Building]
ID_Bldg1 [Buildings]^C^C_MENUECHO;3;-insert T-Buildings-buildings= 0,0 1 1 0;-purge;b;T-Buildings-buildings;n;^C^C_MENUECHO;0
ID_Bldg2 [Ceilings and Floors]^C^C_MENUECHO;3;-insert T-Buildings-ceilings-floors= 0,0 1 1 0;-purge;b;T-Buildings-ceilings-floors;n;^C^C_MENUECHO;0
ID_Bldg3 [Columns and Walls]^C^C_MENUECHO;3;-insert T-Buildings-columns-walls= 0,0 1 1 0;-purge;b;T-Buildings-columns-walls;n;^C^C_MENUECHO;0
ID_Bldg4 [Drainage and Pipework]^C^C_MENUECHO;3;-insert T-Buildings-drainage-pipework= 0,0 1 1 0;-purge;b;T-Buildings-drainage-pipework;n;^C^C_MENUECHO;0
ID_Bldg5 [Doors and Windows]^C^C_MENUECHO;3;-insert T-Buildings-doors-windows= 0,0 1 1 0;-purge;b;T-Buildings-doors-windows;n;^C^C_MENUECHO;0
ID_Bldg6 [Fire Safety Certs]^C^C_MENUECHO;3;-insert T-Buildings-fire-safety= 0,0 1 1 0;-purge;b;T-Buildings-fire-safety;n;^C^C_MENUECHO;0
ID_Bldg7 [Levels]^C^C_MENUECHO;3;-insert T-Buildings-levels= 0,0 1 1 0;-purge;b;T-Buildings-levels;n;^C^C_MENUECHO;0
ID_Bldg8 [Sanitary]^C^C_MENUECHO;3;-insert T-Buildings-sanitary= 0,0 1 1 0;-purge;b;T-Buildings-sanitary;n;^C^C_MENUECHO;0
ID_Bldg9 [Structural]^C^C_MENUECHO;3;-insert T-Buildings-structural= 0,0 1 1 0;-purge;b;T-Buildings-structural;n;^C^C_MENUECHO;0
ID_Bldg10 [Hatching]^C^C_MENUECHO;3;-insert T-Buildings-hatching= 0,0 1 1 0;-purge;b;T-Buildings-hatching;n;^C^C_MENUECHO;0
ID_Bldg11 [Dimensions and Text]^C^C_MENUECHO;3;-insert T-Buildings-dimensions-text= 0,0 1 1 0;-purge;b;T-Buildings-dimensions-text;n;^C^C_MENUECHO;0
ID_Bldg12 [<-General]^C^C_MENUECHO;3;-insert T-Buildings-general= 0,0 1 1 0;-purge;b;T-Buildings-general;n;^C^C_MENUECHO;0
We have received a Guidance Document which states that all As-Built records need to be to a prescribed layering convention and we are looking to update of layering menu. However, the people who created the files have left the company.
Can anyone explain the script used? I am new to script in CAD and do not know where to begin.
I assume that I need to create drawing with the layers defined in it and then complete the script to refer back to this file?
Any help woould be greatly appreciated.
@tobin2008 wrote:In our company we have a drop down menu on our CAD systems which allow us to select layers to include in a drawing.
The following is a sample of the script used:
ID_DISC [->Building]
ID_Bldg1 [Buildings]^C^C_MENUECHO;3;-insert T-Buildings-buildings= 0,0 1 1 0;-purge;b;T-Buildings-buildings;n;^C^C_MENUECHO;0
....
Can anyone explain the script used? I am new to script in CAD and do not know where to begin.
I assume that I need to create drawing with the layers defined in it and then complete the script to refer back to this file?
....
Each of those menu items [which are actually macros, not Scripts] is inserting a drawing, which will surely be a file with no drawn content but containing the desired Layers, loaded linetypes, and so on. That will make it a Block in the drawing, and the macros then Purge that Block definition, but the Layers and so on remain.
The ^C^C is a double cancel, which should get you out of any command that might be running when you pick on the menu macro item, and is a very common way to start macros. The MENUECHO settings are just so it doesn't put everything it's doing out there in the Command: line, but does it "quietly." [I don't think the = sign nor the second ^C^C are necessary, but they don't hurt anything.]
You should be able to open the drawings that are inserted [in the line left in above, T-Buildings-buildings is a drawing file somewhere in a Support File Search Path -- you can find where it is with (findfile "T-Buildings-buildings.dwg")], and change the Layer names and properties as appropriate, or you can make different macros using different drawing names if you have them already.
Personally, I would suggest using drawing Templates for this if you can, rather than insert-a-drawing macros. One reason is that if the drawing you're in already has a Layer in it with the name of one of the Layers in an inserted drawing, but it has different characteristics [of color, linetype, plot-or-not, etc.], it will keep the characteristics it already has, and will not take on those of the Layer by that name in the inserted drawing. However, if you are imposing a different Layering convention on an existing drawing, and not starting a new drawing, Templates are not an option. One way to get around the existing-Layer possibility is to use Layer commands to Make the desired Layers and assign them colors and linetypes and so on, which will "fix" those characteristics of any Layer(s) that may already exist.
FWIW -
Importing from CSV was common for us, but now I just STEAL what I want from another drawing, when I need it, thanks to Lee.
Cheers
"How we think determines what we do, and what we do determines what we get."
@BlackBox_ wrote:
...but now I just STEAL what I want from another drawing, when I need it, thanks to Lee.
Cheers dude
@BlackBox_ wrote:...
now I just STEAL what I want from another drawing, when I need it, thanks to Lee.
....
Since your original question is about primarily Layering standards, you can also just use the native AutoCAD Design Center [ADC command], through which you can steal a lot of things -- Layers, Blocks & Xrefs, Text & Dimension Styles, Linetypes, Layouts -- not as many kinds of things as the STEAL routine can get you, but possibly enough for your purposes, much of the time.
When wondering what a menu/command macro does, just key in the values using the semi-colon as a return and using the ^C^C as a double-tap ESC. For example, the first item:
ESC
ESC
_MENUECHO
3
-insert
T-Buildings-buildings=
0,0
1
1
0
-purge
b
T-Buildings-buildings
n
ESC
ESC
_MENUECHO
0
To keep the macro resonably short the letter-shortcuts for commands are commonly used, although it makes later interpretation somewhat difficult.
@dgorsman wrote:When wondering what a menu/command macro does, just key in the values using the semi-colon as a return ....
Semi-colons and spaces [such as are used between the file names and insertion points and scale/rotation entries in these macros] are both equivalent to return [Enter] in any situation where the space-bar and Enter are equivalent when typing on the keyboard. I usually use spaces where there's only one, because I find it easier to read, but when there's more than one needed, such as to finish a Layer command, it's harder to see how many there are if they're spaces, so I will use semicolons for multiples, or sometimes a space for the first and semicolons for any more that are needed. If I remember correctly, if you need more than one at the end of a macro, it's required [even apart from the how-many-are-there legibility issue] to use a semicolon for at least the last one, because the system doesn't work right with trailing spaces.
@Lee_Mac wrote:
@BlackBox_ wrote:...but now I just STEAL what I want from another drawing, when I need it, thanks to Lee.Cheers dude
... Anytime; Cheers :beer:
"How we think determines what we do, and what we do determines what we get."