Code help for turning on layers

Code help for turning on layers

Anonymous
Not applicable
435 Views
3 Replies
Message 1 of 4

Code help for turning on layers

Anonymous
Not applicable

Hello All,

 

I'm new to writing code and can't seem to get this one figured out. I want to activate the command, be prompted for a word, then have every layer with that word turn on. (such as "contour" then all of my countour layers turn on.)

 

Here's the code and thanks again in advance for any help you can give me.

 

Jason

 

(DEFUN C:RF ()

  (setq wild(getstring "\nEnter part of layer name: ")) ;Gets the layer name

 

  (command "-layer" "_on" (concatenate 'string "*" wild "*"))
  (command "-layer" "_thaw" (concatenate 'string "*" wild "*"))
  (command "regen")

(princ)

)

0 Likes
Accepted solutions (1)
436 Views
3 Replies
Replies (3)
Message 2 of 4

paullimapa
Mentor
Mentor
Accepted solution

AutoLISP does not have a  concatenate  function but does have a  strcat  function.  So change the code to this and it should work:

 

(DEFUN C:RF ()

  (setq wild(getstring "\nEnter part of layer name: ")) ;Gets the layer name

  (command "_.Layer" "_On" (strcat "*" wild "*") "_Thaw" (strcat "*" wild "*") "")
  (command "_.Regen")

  (setq wild nil)

  (princ)

)

 

 

Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator
Layer Apps | List on Steroids | VP Zoom Scales |Exchange App Store


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 3 of 4

Anonymous
Not applicable

Works perfect. I knew that was the problem, but didn't know the right command.  Thanks!

0 Likes
Message 4 of 4

paullimapa
Mentor
Mentor
0 Likes