Author Topic: Need Lisp or Script help  (Read 3178 times)

0 Members and 1 Guest are viewing this topic.

One Shot

  • Guest
Need Lisp or Script help
« 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.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Need Lisp or Script help
« Reply #1 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)
  )
TheSwamp.org  (serving the CAD community since 2003)

daron

  • Guest
Need Lisp or Script help
« Reply #2 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.

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Need Lisp or Script help
« Reply #3 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

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Need Lisp or Script help
« Reply #4 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.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Need Lisp or Script help
« Reply #5 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.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Need Lisp or Script help
« Reply #6 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)

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Need Lisp or Script help
« Reply #7 on: September 24, 2004, 01:11:23 PM »
probably an errant space or tab ...remove blank spaces
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie