Message 1 of 9
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I want to pick a layer using multiple options within a command before inserting a block.
Run Lisp > Choose from 3 options [Option1 Option2 Option3] > 3 > Insert block with Option3 Layer.
Where can I insert that option in this lisp below. Thanks!
(defun c:test (); ;Error Handling Start (setq temperr *error* *error* errortrap varlst '("CMDECHO" "DRAGMODE" "CLAYER");edit variables as necessary oldvar (mapcar 'getvar varlst) ) (setq a (getvar 'cmdecho)) ;gets current cmdecho value and stores it for future use (setvar "cmdecho" 1) ;sets cmdecho value to 1 (setq b (getvar 'dragmode)) ;gets current dragmode value and stores it for future use (setvar "dragmode" 2) ;sets dragmode value to 2 (setq c (getvar 'clayer)) ;gets the current layer and stores it for future use (Command "-layer" "m" "TestLayer1" "C" "green" "" "") ;creates new layer if not already existing (Command "-layer" "m" "TestLayer2" "C" "green" "" "") ;creates new layer if not already existing (Command "-layer" "m" "TestLayer3" "C" "green" "" "") ;creates new layer if not already existing ;inserting blocks ;;inserting first block (setq pt (getpoint "\n::Pick Location")) ;prompt for insert point A (Command "-insert" "../test.dwg" pt "" "") ;restoring previous values (setvar "cmdecho" a) ;gets stored cmdecho value and sets it as current (setvar "dragmode" b) ;gets stored dragmode value and sets it as current (setvar "clayer" c) ;gets stored dragmode value and sets it as current (Command "Zoom" "o" "l" "") ;zooms in last inserted object (Command "Regen" "");regenerates drawing ;Error Handling End (defun errortrap (msg) (if oldvar (mapcar 'setvar varlst oldvar)) (setq *error* temperr) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n<< Error: " msg " >>")) ) (princ) ) ;End of Command (Princ); );defun;
Solved! Go to Solution.