AutoCAD Civil 3D General Discussion

AutoCAD Civil 3D General Discussion

Reply
Active Contributor
mnyrac
Posts: 49
Registered: ‎10-16-2012
Message 1 of 11 (915 Views)

Lock Template Layers to they can't be purged & .lisp

915 Views, 10 Replies
10-30-2012 02:59 PM

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

Distinguished Mentor
andrewpuller3811
Posts: 770
Registered: ‎07-30-2008
Message 2 of 11 (905 Views)

Re: Lock Template Layers to they can't be purged & .lisp

10-30-2012 06:50 PM in reply to: mnyrac

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.

If this fixed your issue, click on "Accept as Solution"

Andrew Puller
Maitland, NSW, Australia
Windows 7 Enterprise 64bit
Intel core i7 2600 @ 3.40 GHz with 16GB Ram
Civil 3d 2013 64bit
*Expert Elite*
sboon
Posts: 2,095
Registered: ‎11-08-2005
Message 3 of 11 (894 Views)

Re: Lock Template Layers to they can't be purged & .lisp

10-31-2012 12:11 AM in reply to: andrewpuller3811

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.

Valued Mentor
IanMcClain
Posts: 442
Registered: ‎09-29-2008
Message 4 of 11 (882 Views)

Re: Lock Template Layers to they can't be purged & .lisp

10-31-2012 07:52 AM in reply to: mnyrac

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.

-Ian McClain
(running C3D 2012 sp4, Win7 64bit, 8GB)
Valued Contributor
Maine-iac
Posts: 73
Registered: ‎10-15-2009
Message 5 of 11 (856 Views)

Re: Lock Template Layers to they can't be purged & .lisp

11-02-2012 01:21 PM in reply to: mnyrac

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".

Civil 3D 2011
Windows 7 Prof. x64
HP Z400 Workstation
Intel(R) Xenon(R) CPU
W3550 @ 3.07GHz
6.00 GB RAM
Active Contributor
mnyrac
Posts: 49
Registered: ‎10-16-2012
Message 6 of 11 (849 Views)

Re: Lock Template Layers to they can't be purged & .lisp

11-02-2012 01:25 PM in reply to: Maine-iac

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.

*Expert Elite*
tcorey
Posts: 2,549
Registered: ‎12-18-2002
Message 7 of 11 (836 Views)

Re: Lock Template Layers to they can't be purged & .lisp

11-02-2012 02:46 PM in reply to: mnyrac

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

 

Tim Corey, Owner
Delta Engineering Systems
Redding, CA
Autodesk Authorized Value-Added Reseller
*Expert Elite*
BrianHailey
Posts: 2,770
Registered: ‎04-27-2005
Message 8 of 11 (809 Views)

Re: Lock Template Layers to they can't be purged & .lisp

11-04-2012 06:06 PM in reply to: tcorey

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

 


 

Brian Hailey
CAD-1.com
My Blog
*Expert Elite*
tcorey
Posts: 2,549
Registered: ‎12-18-2002
Message 9 of 11 (790 Views)

Re: Lock Template Layers to they can't be purged & .lisp

11-05-2012 12:31 PM in reply to: mnyrac

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

Tim Corey, Owner
Delta Engineering Systems
Redding, CA
Autodesk Authorized Value-Added Reseller
Valued Mentor
engrtech
Posts: 730
Registered: ‎05-05-2008
Message 10 of 11 (788 Views)

Re: Lock Template Layers to they can't be purged & .lisp

11-05-2012 12:49 PM in reply to: mnyrac

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. :smileyhappy:

 

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.

Infrastructure Design Suite Premium 2014
Civil 3D 2014 x64
Testing IDSP 2015
Windows 7 64-bit
6GB RAM
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.