Jump to content

create layer lisp


MikeP

Recommended Posts

Im sure this already exist. Does anyone have a lisp to quickly create layers. All I need it to do its create the layer and ask what color I want it on.

Link to comment
Share on other sites

Quick + dirty:

 

(defun c:test ( / name color )
 (while
   (or
     (not (snvalid (setq name (getstring t "\nSpecify Layer Name: "))))
     (tblsearch "LAYER" name)
   )
   (princ "\nLayer Name Invalid or Already Exists.")
 )
 (if (setq color (acad_colordlg 7 nil))
   (entmake
     (list
       (cons 0 "LAYER")
       (cons 100 "AcDbSymbolTableRecord")
       (cons 100 "AcDbLayerTableRecord")
       (cons 2 name)
       (cons 70 0)
       (cons 62 color)
     )
   )
 )
 (princ)
)

Link to comment
Share on other sites

Im sure this already exist. Does anyone have a lisp to quickly create layers. All I need it to do its create the layer and ask what color I want it on.

 

Why should a lisp exist to do such a simple task? There probably is one out there and you no doubt have searched for it.

 

If you type la at the keyboard, you will get the Layer Properties Manager dialogue box.

 

If you want to do it all at the command line, then you can type -la, then choose Option M for make a new layer (which will be the current layer), and Option C to choose the colour, as well as a lot more options. :D

 

Why look for a lisp :shock:

Edited by eldon
beaten by the flying fingers of a Lisp-phile
Link to comment
Share on other sites

why does this keep happening? I cant load a lisp. I use APPLOAD to load the new lisp i renamed to "Make Layer". but after I load it it says

 

"Make Layer.lsp successfully loaded.

Command:

Program ERROR

Resetting environment ; error: An error has occurred inside the *error*

functionbad argument type: consp nil"

 

and when I type in the key command. it tells me Unknown command "NL". Press F1 for help."

Link to comment
Share on other sites

so how do i troubleshoot?

 

Open VLIDE, Go to Debug > Break on Error (checked)

 

Perform the actions that lead to your error.

 

After error occurs:

 

Debug > Last Break Source

 

Then reset your environment by going to:

 

Debug > Reset to Top Level

Debug > Break on Error (uncheck)

Link to comment
Share on other sites

Open VLIDE, Go to Debug > Break on Error (checked)

 

Perform the actions that lead to your error.

 

After error occurs:

 

Debug > Last Break Source

 

Then reset your environment by going to:

 

Debug > Reset to Top Level

Debug > Break on Error (uncheck)

 

Um yeah, I have no idea how this debug things works. how do I "perform the actions" my action is loading a lisp in appload

Link to comment
Share on other sites

right.... and I have but it does nothing. I open the vlide. I check the break on error. then go back to the cad window. load the lisp. but it does nothing in the vlide menu. what am I missing?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...