TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: One Shot on September 23, 2004, 01:14:08 PM

Title: Need Lisp or Script help
Post 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.
Title: Need Lisp or Script help
Post by: Mark on September 23, 2004, 01:24:30 PM
Here is a start:
Code: [Select]

(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)
  )
Title: Need Lisp or Script help
Post by: daron on September 24, 2004, 11:45:22 AM
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.
Title: Need Lisp or Script help
Post by: Dommy2Hotty on September 24, 2004, 11:57:35 AM
Speaking of clayer, anyone know why I get this error sometimes, but not others?

Code: [Select]
With "clayer"
Command: (setvar "clayer" 0)
; error: AutoCAD variable setting rejected: "clayer" 0


OR

Code: [Select]
With 'clayer
Command: (setvar 'clayer 0)
; error: AutoCAD variable setting rejected: "clayer" 0
Title: Need Lisp or Script help
Post by: MP on September 24, 2004, 12:04:11 PM
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.
Title: Need Lisp or Script help
Post by: Keith™ on September 24, 2004, 12:36:51 PM
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.
Title: Need Lisp or Script help
Post by: Dommy2Hotty on September 24, 2004, 12:50:58 PM
Quote from: Keith
... 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....
Code: [Select]
Syntax error in acad.pgp file on line 73 in field 3
  (memory size specification missing)
Title: Need Lisp or Script help
Post by: Keith™ on September 24, 2004, 01:11:23 PM
probably an errant space or tab ...remove blank spaces