In my seemingly never-ending battle with standardizing, I have created a template with all the layers I expect to use in the future. The template will be used by both surveyors and engineers so I have layers that won't ever be used by surveyors. What I don't want is the surveyor to purge the drawing and delete all the layers that the engineers will need. I found the link below explaining and .lisp to replace deleted layers.
http://forums.autodesk.com/t5/AutoCAD-2011/Keeping-template-layers-when-purging/td-p/2720847
Now, I am completely new at .lisp and I have no idea how to use them. Is there any advice or how to's to help me with .lisp?
Also, this template is used in a program called BricsCad (some of the older generation still uses it instead of Autocad) and using .dws and checking isn't an option for them.
Thanks
Caryn
One method without the need for lisp.
If the layers are referenced in a style they are not purged (unless you delete the style first), even by bricscad.
Create a dummy style, under which ever area you like, then on the display tab set the layer for each component to a layer you want to keep in the drawing. Make sure the style has a suitable nameand description to let users know what it is there for and not to remove it, etc.
A surface style will allow you to lock 25 layers in one style (on the display tab change the view direction to get to layers for Plan/Model/Section), save having a lot of extra styles.
The number of layers you wish to maintain and the object style you choose will govern the number of styles you need.
I typically use DesignCenter for this type of issue. I don't particularly worry about layers deleted by other users because I can use the DC to re-import all of the layers from my template. It won't overwrite layers already in the drawing, so any edits to layer colors, linetypes etc can be an issue but there are standards tools available to reset them if necessary.
If you have survey layers that will never be used by civil and civil layers that would never be used by survey, I would consider two templates. Civil3D templates can get fairly large even before there is any linework done in them. The larger your files are the more time it takes to open and the more space they will take up on your network. My own comapny struggles with network hard drive space as not much thought is given to IT resources and management. Just something to think about.
We had the same issue but I did not want to try to keep 2 templates up to date with each other. I went the route of creating a layer properties filter in the template that the surveyors could switch to and not have to look through the ungodly number of engineering layers. Depending on your layer names standard this could be a chore to initially set up but your survey CAD people will have a lot less layers to scroll through every day. You will have to show them how to use it once you've figured it out yourself. In the Layer Properties Manager we now have the standard "All" in the filter area, "All used layers" and the one I created "Survey Layers".
I will be creating layer filters for the surveyors. If we have 2 templates, it will cause problems when the surveyors pass on the survey to the engineers and they only have survey layers.
What I am doing is creating layer filters, saved layer states and I also created a custom command button that will automatically insert the template to an existing drawing, remove any linework in the template, then zoom to the previous extent. That way they can just push one button to insert the template and all the layer, dimensions, text, filters, etc will magically be there.
I'm sure I will have more issues once this whole system gets into the pilot stage.
Since your OP asked about how to do this with AutoLISP:
If you place the following code in your ACADDOC.LSP file, it will be run each time a drawing is opened:
(vl-load-com)
(vl-cmdf "layer" "N" "BASE" "C" 2 "BASE" "L" "Dashed" "BASE" "")
Just replicate the second line as many times as you have layers you need to protect., replace the layer name I used, Base, with your layer names and replace the color and linetype to your specifications. If you use the name of a color, Red, for instance, it must be in quotes. If you specify by number as I have done, no quotes required.
If you aren't familiar with the command line version of the layer command, the line above reads like this:
vl-cmdf is the function that calls an AutoCAD command.
"Layer" is the command we are invoking.
"N" for New
The name of the layer
"C" for Color
the color number or name (in quotes)
The name of the layer we are applying the color to
"L" for Linetype
The linetype name
The layer to which to assign that linetype.
"" This is like hitting Enter. It closes the Layer command.
Best regards,
Tim
Not having messed with lisp in quite a while, why use "vl-cmdf" and not simply "command"?
@tcorey wrote:Since your OP asked about how to do this with AutoLISP:
If you place the following code in your ACADDOC.LSP file, it will be run each time a drawing is opened:
(vl-load-com)
(vl-cmdf "layer" "N" "BASE" "C" 2 "BASE" "L" "Dashed" "BASE" "")
Best regards,
Tim
VL-CMDF evaluates the entire line before passing to AutoCAD for execution. Command passes each entry as it reads it, so if you said (Command "Layer" garbage blah blah blah), AutoCAD will start the Layer command, but throw an error during the command. If you use VL-CMDF, line layer command won't ever get passed to AutoCAD with the error in it.
Tim
@mnyrac wrote:In my seemingly never-ending battle with standardizing, I have created a template with all the layers I expect to use in the future. The template will be used by both surveyors and engineers so I have layers that won't ever be used by surveyors. What I don't want is the surveyor to purge the drawing and delete all the layers that the engineers will need. I found the link below explaining and .lisp to replace deleted layers.
http://forums.autodesk.com/t5/AutoCAD-2011/Keeping-template-layers-when-purging/td-p/2720847
Now, I am completely new at .lisp and I have no idea how to use them. Is there any advice or how to's to help me with .lisp?
Also, this template is used in a program called BricsCad (some of the older generation still uses it instead of Autocad) and using .dws and checking isn't an option for them.
Thanks
Caryn
As Ian said, I'd use two different templates. We have five main templates that we use. Survey.dwt, surface.dwt, proposed.dwt, corridor.dwt, and x-sections.dwt. When the designers need the survey, they just XREF in the survey drawing into the proposed drawing. If they need anything else, they just bring in the figures from the survey database. We haven't run into any problems with layer names using this method, at least for those that are using C3D. We still have a stubburn surveyor who wants to do use LDD 2009 on his 7 year old computer instead of the nice new $1.5k one I got him with C3D 2012 on it, but that's another issue. 🙂
I used to try and keep just a single template for everything, but it became too large and unwieldly to use. It became much easier to just split it up. This also helps reinforce the idea that the design drawings need to be broken up and DREFs & XREFs used in order to keep C3D working fast.
Thanks to all for your input. I will give the .lisp a try and look at using multiple templates. Please feel free to shoot additional ideas on standardizing if you have any. I want to make sure the way we do it is going to be the most efficient way to do it.
Caryn
Can't find what you're looking for? Ask the community or share your knowledge.