Jump to content

Create layers with LISP


Loque
 Share

Recommended Posts

thanks lee mac i got it i created a new template with my linetypes loaded :)

 

No problem :)

Though, if you are using a template you may as well have the layers already created in the template ;)

Link to comment
Share on other sites

no they aren't!its a new drawing only load Bylayer,Byblock and continuous....

isn't possible to load then automatic?i will try to search for that!

 

(defun c:loadltypes ( / fn f rl ltname ltypes )
 (setq fn (open (setq f (findfile "acadiso.lin")) "r"))
 (while (setq rl (read-line fn))
   (if (eq "*" (substr rl 1 1)) (setq ltname (substr rl 1 (vl-string-position (ascii ",") rl))))
   (if ltname
     (progn
       (setq ltname (vl-string-left-trim "*" ltname))
       (setq ltypes (cons ltname ltypes))
     )
   )
 )
 (foreach ln ltypes
   (command "_.linetype" "l" f "" "s" ln "")
 )
 (command "_.linetype" "s" "ByLayer" "")
 (princ)
)

Link to comment
Share on other sites

  • 5 years later...
On 12/20/2011 at 3:31 AM, pBe said:

 


(defun c:UA ()
 (entmake
   (list
     (cons 0 "LAYER")
     (cons 100 "AcDbSymbolTableRecord")
     (cons 100 "AcDbLayerTableRecord")
     '(2 . "001_Urban_Areas")
     '(70 . 0)
     '(62 . 25)
     '(6 . "Continuous")
     )
   )
 (princ)
 )
 

 

 

 

 


(defun c:UA ()
 (command "_.Layer" "_Make" "001_Urban_Areas" "_Color" "25" "" "LType" "Continuous" "" "")
 (princ)
 )
Hi,
im new here, can someone help me on this routine, it works by it says unknown command. basicly i got this from someone and i just added for layer description.
Richard
 

(DEFUN C:ANNO (/ CME LYR RGM)     
    (SETQ CME (GETVAR "CMDECHO"))   
    (SETQ LYR (GETVAR "CLAYER"))
    (SETQ RGM (GETVAR "REGENMODE"))   
    (SETVAR "CMDECHO" 0)
    (SETVAR "REGENMODE" 0)   
;;;; ANNOTATION********************************************************************************************************************
    (COMMAND "LAYER" "MAKE" "A-ANNO-DIMS" "COLOR" "1" "" "L" "CONTINUOUS" "" "LW" "0.13" "" "D" "ANNOTATION: DIMENSIONS" "A-ANNO-DIMS" "" "")
    (COMMAND "LAYER" "MAKE" "A-ANNO-REFR" "COLOR" "2" "" "L" "CONTINUOUS" "" "LW" "0.25" "" "D" "ANNOTATION: REFERENCE TAGS" "A-ANNO-REFR" "" "")
    (COMMAND "LAYER" "MAKE" "A-ANNO-NOTE" "COLOR" "2" "" "L" "CONTINUOUS" "" "LW" "0.25" "" "D" "ANNOTATION: NOTES" "A-ANNO-NOTE" "" "")
    (COMMAND "LAYER" "MAKE" "A-ANNO-ARRW" "COLOR" "1" "" "L" "CONTINUOUS" "" "LW" "0.13" "" "D" "ANNOTATION: ARROWS" "A-ANNO-ARRW" "" "")
;;;;;

(SETVAR "CMDECHO" CME)   
(SETVAR "CLAYER" LYR)
(SETVAR "REGENMODE" RGM)   
(PRINC))     
(PRINC "\nCOMMAND: ANNO")

 

 

Link to comment
Share on other sites

I tried removing the last double quote quote seemed to work then the extra was calling the layer command again.

 

You can keep going with the layer command so it could all be one command line.

 

A neater way is to use a list so can have as many layers as you like ("A-ANNO-DIMS" "1" "CONTINUOUS" "0.13" "ANNOTATION: DIMENSIONS"...........) Then just make each layer in the list.

Link to comment
Share on other sites

  • 3 years later...

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

 Share

×
×
  • Create New...