TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: One Shot on September 23, 2004, 01:14:08 PM
-
Do anyone have a Lisp routine or script that can do the following? It should be able to set to layer ‘0’ and set objects to layer ‘0’ and linetype to by block. It should also use the layer filter delete and layer translate. With the layer translate option; you can pick what layer to translate to.
-
Here is a start:
(defun c:set2zero (/ clay ss)
(setq clay (getvar 'clayer))
(command "_.layer" "set" "0" "")
(if (setq ss (ssget))
(command "_.change" ss "" "Properties" "LAyer" "0" "")
)
(setvar 'clayer clay)
(princ)
)
-
For the layer filter delete do a search on here for the word delete. You should find a function that will delete them. The thread where I know you'll find it was started by me, though I didn't post it. So if you get a long list, look for threads started by Daron.
-
Speaking of clayer, anyone know why I get this error sometimes, but not others?
With "clayer"
Command: (setvar "clayer" 0)
; error: AutoCAD variable setting rejected: "clayer" 0
OR
With 'clayer
Command: (setvar 'clayer 0)
; error: AutoCAD variable setting rejected: "clayer" 0
-
AutoCAD no like it when you try to set the current layer to one that's frozen. Also, clayer expects a string, so "0" would work but 0 would bomb.
-
I don't know D2H .. I have the same exact problem in some of my routines on occasion. It can even be the current layer that I am setting to "clayer" and it will bomb ... I have stopped using the "clayer" variable for now until I can find out why it is happening.
-
... I have stopped using the "clayer" variable for now until I can find out why it is happening.
Is there another method you're using now to set the current layer instead?
On another note...I'm really hijacking this thread...sorry...I should start a new one and delete my posts in here....anywho...
there is NOTHING on that line...used to be a SHELL to textpad, but not anymore...can't get this error to go away when I REINIT my pgp....
Syntax error in acad.pgp file on line 73 in field 3
(memory size specification missing)
-
probably an errant space or tab ...remove blank spaces