Page 1 of 1

Layer visibility toggle

Posted: Mon Nov 04, 2024 12:36 pm
by mmaenpaa
Hi All,
I have a drawing with text controlled with Custom Properties/Data Card selection.
I have arrows shown on the drawing, pointing left or right, each on separate layers. Based on data card selection, I have to open up the Layer properties and toggle visibility. Ideally, I I'd like to cut down on the number of mouse clicks and hit a button.
Left_To_Right.jpg
Right_To_Left.jpg
Has anyone done anything like this?

Thanks,

Re: Layer visibility toggle

Posted: Mon Nov 04, 2024 3:10 pm
by jcapriotti
If by "Data Card" you mean the PDM Data Card, I can't think of an automatic way to do this on opening the drawing. You can write a macro that will toggle the two layers which would save a few steps of opening the layer manager and closing it.

Re: Layer visibility toggle

Posted: Mon Nov 04, 2024 3:53 pm
by mmaenpaa
Jason,
Yes, I meant with the PDM data card. I have the text change working fine via the data card/custom properties. It doesn't need to happen automatically when opening the drawing.
Yes, the layer manager is what I'm trying to avoid. I've not written a macro in a long time. I tried to record a macro, but it didn't seem to capture the layer toggle in the layer manager. Guess I'll have to dig a little more into it. Can the macro be embedded in the drawing template, so it's always there?

Thanks,
Mike

Re: Layer visibility toggle

Posted: Mon Nov 04, 2024 5:59 pm
by mmaenpaa
I found some example code on the forum and was able to put something together that works.
https://www.cadforum.net/viewtopic.php? ... yer#p32178

Thanks,
Mike

Re: Layer visibility toggle

Posted: Tue Nov 05, 2024 9:47 am
by jcapriotti
mmaenpaa wrote: Mon Nov 04, 2024 3:53 pm Can the macro be embedded in the drawing template, so it's always there?
You can create your own tab on the Command Manager and put a button there for it. Then you would need to share your toolbar settings with your company if needed.
image.png

Re: Layer visibility toggle

Posted: Tue Nov 05, 2024 4:44 pm
by mmaenpaa
jcapriotti wrote: Tue Nov 05, 2024 9:47 am You can create your own tab on the Command Manager and put a button there for it. Then you would need to share your toolbar settings with your company if needed.

image.png
Thanks Jason, I figured that out yesterday, as well.
The last time I used macros was back in 2012 when using Inventor, where the macros could be stored in the default.ivb. Wasn't used how SW does it, by storing in it's own file. I'll be exploring macros more, as time permits. I need to re-learn the basics, but getting this simple one done, will be extremely helpful.

Thanks,
Mike