Layer visibility toggle

mmaenpaa
Posts: 8
Joined: Fri Nov 01, 2024 5:31 pm
Answers: 0
x 2

Layer visibility toggle

Unread post 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,
User avatar
jcapriotti
Posts: 1854
Joined: Wed Mar 10, 2021 6:39 pm
Answers: 29
Location: The south
x 1196
x 1988

Re: Layer visibility toggle

Unread post 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.
Jason
mmaenpaa
Posts: 8
Joined: Fri Nov 01, 2024 5:31 pm
Answers: 0
x 2

Re: Layer visibility toggle

Unread post 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
mmaenpaa
Posts: 8
Joined: Fri Nov 01, 2024 5:31 pm
Answers: 0
x 2

Re: Layer visibility toggle

Unread post 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
User avatar
jcapriotti
Posts: 1854
Joined: Wed Mar 10, 2021 6:39 pm
Answers: 29
Location: The south
x 1196
x 1988

Re: Layer visibility toggle

Unread post 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
Jason
mmaenpaa
Posts: 8
Joined: Fri Nov 01, 2024 5:31 pm
Answers: 0
x 2

Re: Layer visibility toggle

Unread post 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
Post Reply