Jump to content

layer conversion lisp not working


Recommended Posts

Posted

I am trying to create a lisp routine that will set the layer to "1", freeze all (I have a working command for freeze all called "fa") chprop of all to layer "am_0" and then thaw all (once again I have a working command for thaw all called "ta"). Can any of you tell me why this lisp routine is not working? Please see the code below...

 

(defun c:am0	 ()
 (command "-layer" "set" "1" " " "fa" "chprop" "all" " " "la" "am_0" " " "ta")
 )

Posted
I am trying to create a lisp routine that will set the layer to "1", freeze all (I have a working command for freeze all called "fa") chprop of all to layer "am_0" and then thaw all (once again I have a working command for thaw all called "ta"). Can any of you tell me why this lisp routine is not working? Please see the code below...

 

(defun c:am0     ()
 (command "-layer" "set" "1" " " "fa" "chprop" "all" " " "la" "am_0" " " "ta")
 )

You can't call another routine like that. Either include the appropriate coding, or use (c:FA) when you need to call it. You'll have to start a new command string; can't include (c:FA) or (c:TA) in them.

Posted

OK. Thank you alanjt. I put all of the commands in there but I am still getting an error. This time the error reads:

 

"Command: am0

 

Cannot freeze layer "1". It is the CURRENT layer.

 

Invalid option keyword.

; error: Function cancelled

 

Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness]:"

 

Below is my revised code:

 

(defun c:am0	 ()
 (command "-layer" "set" "1" "freeze" "*" "" "chprop" "all" "" "la" "am_0" "thaw" "*" "")
 )

Posted
OK. Thank you alanjt. I put all of the commands in there but I am still getting an error. This time the error reads:

 

"Command: am0

 

Cannot freeze layer "1". It is the CURRENT layer.

 

Invalid option keyword.

; error: Function cancelled

 

Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness]:"

 

Below is my revised code:

 

(defun c:am0     ()
 (command "-layer" "set" "1" "freeze" "*" "" "chprop" "all" "" "la" "am_0" "thaw" "*" "")
 )

 

 

 

Add one more "" to the end and try it. It will work, if you have objects on layer "1" and layers "1" and "am_0" exist.

 

 

Command: am0
-layer
Current layer:  "1"
Enter an option 
[?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/MATerial/Plot/Freeze/Thaw/LOck
/Unlock/stAte/Description/rEconcile]: set
Enter layer name to make current or <select object>: 1 Enter an option 
[?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/MATerial/Plot/Freeze/Thaw/LOck
/Unlock/stAte/Description/rEconcile]: freeze
Enter name list of layer(s) to freeze or <select objects>: *
Cannot freeze layer "1".  It is the CURRENT layer.
Enter an option 
[?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/MATerial/Plot/Freeze/Thaw/LOck
/Unlock/stAte/Description/rEconcile]:
Command: chprop
Select objects: all 1 found

Select objects:
Enter property to change 
[Color/LAyer/LType/ltScale/LWeight/Thickness/Material/Annotative]: la
Enter new layer name <1>: am_0
Enter property to change 
[Color/LAyer/LType/ltScale/LWeight/Thickness/Material/Annotative]: thaw
Invalid option keyword.

Enter property to change 
[Color/LAyer/LType/ltScale/LWeight/Thickness/Material/Annotative]:

Posted

Thank you alanjt, I got it to work now. :)

Posted
Thank you alanjt, I got it to work now. :)

 

Good deal. No problem. :)

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

×
×
  • Create New...