Jump to content
Jamesjh1171

LISP for create new layer on open dwg

Recommended Posts

Jamesjh1171

Hi I've been looking for a LISP that will create a new layer with a given name ("DATA EXTRACTION") every time I open up a dwg (unless that layer already exists) and make that layer current. I have found a couple of similar LISP routines but they don't do just that.

Any help much appreciated.

Share this post


Link to post
Share on other sites
tzframpton

You can create this layer in your Template instead.

Share this post


Link to post
Share on other sites
ReMark

Could the OP be referring to already existing drawings?

Share this post


Link to post
Share on other sites
tzframpton

Good point ReMark.

Share this post


Link to post
Share on other sites
Jamesjh1171

Yes it is with existing drawings.

Share this post


Link to post
Share on other sites
Dadgad

Welcome to CADTutor James. :)

 

A lisp could certainly do this, but you would do well to look at the following lisp from Lee Mac's wonderful website.

 

http://www.lee-mac.com/layerdirector.html

 

Thanks Lee! :beer:

 

I have this placed in my start up lisp folder, so that it is always running in the background.

Anybody who doesn't follow suit is doing themselves and their company a huge disservice.

They are wasting time, energy and by extension money.

 

As with most things in life, and especially in technical drawings, there is much to be said for consistency.

Everything getting placed on the appropriate layers automagically, even if the layers don't exist, without the need to create or even monitor the current layer?

What's not to like?

Being accurate?

 

Take it around the block, you'll be glad you did!

Share this post


Link to post
Share on other sites
paulmcz

Put this into your acaddoc.lsp file

(if (tblsearch "layer" "DATA EXTRACTION")
   (command "-layer" "s" "DATA EXTRACTION" "")
   (command "-layer" "m" "DATA EXTRACTION" "")
 )

Share this post


Link to post
Share on other sites
Jamesjh1171

Thanks I will try that lisp tomorrow and let you know how it goes.

I have used Lee Mac's lisps including the layer director. It is a great timesaver if you are designing stuff but for me I'm mainly manipulating architect or structural dwgs and extracting data for setting out. I'm very impressed by anyone who can produce a lisp routine because I haven't got a scooby how they work.....:D

Share this post


Link to post
Share on other sites
Jamesjh1171

errrrrrr where is my acaddoc lisp file????

Share this post


Link to post
Share on other sites
paulmcz

If you don't have one, take this one (attached) and place it in the support folder of your autocad installation

acaddoc.lsp

Share this post


Link to post
Share on other sites
Jamesjh1171

Hi I put the lisp in Support but it hasn't made any difference........

Share this post


Link to post
Share on other sites
SLW210

What is the result of entering (findfile "acaddoc.lsp") on the command line?

Share this post


Link to post
Share on other sites
Jamesjh1171

'findfile' is not recognised as an internal or external command, operable program or batch file

Share this post


Link to post
Share on other sites
paulmcz
Hi I put the lisp in Support but it hasn't made any difference........

 

What happens when you copy the code from my previous post, paste it to the command line and hit Enter?

Share this post


Link to post
Share on other sites
Jamesjh1171

Yeah if i paste that in and press enter it creates the layer

Share this post


Link to post
Share on other sites
paulmcz
'findfile' is not recognised as an internal or external command, operable program or batch file

 

Did you include the parentheses with the findfile function call on command line?

Share this post


Link to post
Share on other sites
paulmcz

Copy following line and paste it to command line and press Enter:

 

(findfile "acaddoc.lsp")

 

What happens when you do that?

Share this post


Link to post
Share on other sites
Jamesjh1171

no i didn't, here is a copy:

 

Command: findfile Unknown command "FINDFILE". Press F1 for help.

Command: "acaddoc.lsp"

Unknown command "LSP"". Press F1 for help.

Share this post


Link to post
Share on other sites
Jamesjh1171

Command: (findfile "acaddoc.lsp")

nil

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×