Jump to content

Recommended Posts

Posted

Is there a macro or command line entry that will turn the current layer on?

 

I would like to do this without using the standard AutoCAD dialog box, so I can build it into a toolbutton macro.

I should add that I do not want to specify the layer name, just turn on the current layer whatever the layer name might be.

 

Thanks to anybody who can help.

Posted

This will work, not sure how elegant a solution it is.

 

(setq clyr (getvar "clayer"))(command "-layer" "on" clyr "")

Posted

rkent, that works a treat.

 

Thank you so much, I sincerely appreciate your help.

 

Cheers.

 

:beer:

Posted

I use this to toggle the on/off state of the current layer:

 

(defun c:TG nil
 ;; toggle on/off state of current layer
 ;; Alan J. Thompson
 ((lambda (layer) (vlax-put layer 'LayerOn (~ (vlax-get layer 'LayerOn))))
   (vlax-ename->vla-object (tblobjname "LAYER" (getvar 'CLAYER)))
 )
 (princ)
)

Posted

alanjt, many thanks for taking time to post this alternative.

 

Works very well and can also help me.

 

Cheers

 

:beer:

Posted
alanjt, many thanks for taking time to post this alternative.

 

Works very well and can also help me.

 

Cheers

 

:beer:

Enjoy. :)..........

Posted
Works a treat! Thanks Alan!

:) Glad you like it.

I was amazed how much I actually use it - made it F4 on my keyboard and I can call it transparently.

Posted
:) Glad you like it.

I was amazed how much I actually use it - made it F4 on my keyboard and I can call it transparently.

 

I was going to ask if you used a F# key for that. TG enter works for me, I might set something up later. How did you do the transparent call?

Posted
I was going to ask if you used a F# key for that. TG enter works for me, I might set something up later. How did you do the transparent call?

Here it is directly out of my .MNL file...

 

["F4"]'TG

Posted
That's what i thought, just add the ' .

Easy as pie. :)

Posted

Just out of curiosity. Why would the current layer be off or why would you want it to be turn off? I have always had the current layer (the one I'm working on) turned on and do not see a need to turn it off. Hopefully I will learn something quite new here.

Posted
Just out of curiosity. Why would the current layer be off or why would you want it to be turn off? I have always had the current layer (the one I'm working on) turned on and do not see a need to turn it off. Hopefully I will learn something quite new here.

 

+1, Good question

Posted

In normal design, sometimes I just want to get a quick look at the site w/o whatever it may be that I'm working on.

 

Another way I really use it is when I'm cleaning up a surface (flipping faces, smoothing, etc.) I like to have my triangles as my current layer. From there, I can quickly turn the triangles off; pan around, find a problem area; flip layer on and fix; flip layer off and pan around until I find the next issue; rinse & repeat.

Posted

I had a feeling it was something like this but couldn't think of a practical application. Thanks for sharing alan.

Posted
I had a feeling it was something like this but couldn't think of a practical application. Thanks for sharing alan.

Any time. :)

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...