Strange behaviour with layer visibility

Pioneer
Pioneer

Hi all,

 

I'm a bit confused with how Solid Edge manages layers in the drawing. My scenario is as follows:

 

- the drawing has 2 sheets

- I switch to the second sheet and add a new layer to the second sheet and set sheet2.layer.Show = false for the new layer.

 

Now the confusing part:

When I stay on the second sheet and check the sheet2.layer.Show property, it shows false

When I switch to the first sheet and check the sheet2.layer.Show property, it shows true, even though it's still hidden.

 

Is this a bug or am I missing something?

 

6 REPLIES

Re: Strange behaviour with layer visibility

Pioneer
Pioneer

Hi,

You can give a try and use

"Layer.ShowInContext(seSheet)" or "Layer.HideInContext(seSheet)" for hiding and showing the layer.

 

Thanks,

Onkar

 

 

 

Re: Strange behaviour with layer visibility

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

Hi freijon,

I think this is normal behavior. 

When you create a new layer, then  layer elements are created on each sheet,  view  and block. All are visible by default. So the program has to hide them at the different places.

 

Regards JB

regards

JB
VS2015, SE ST10

Re: Strange behaviour with layer visibility

Pioneer
Pioneer

I wound understand if it showed "false" when reading from the ActiveSheet, but I'm using the sheet object which represents the second sheet and access the property through that object. This is not normal behavior IMO.

Re: Strange behaviour with layer visibility

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

I aggree with you.

Digging a bit more in the Layer object, I found the methods HideInContext() and ShowInCOntext() the could solve the problem. It seems the setting the property to false will hide the Layer in all contexts but is not shown by the UI.

I did not try it, but I assume that the context parameter can be the target Sheet object.

pls reply if you had success.

 

regards JB

 

PS: I used "Spy for Solid Edge" to change the property

regards

JB
VS2015, SE ST10

Re: Strange behaviour with layer visibility

Pioneer
Pioneer

I finally found the time to test this.

I can confirm that the method layer.ShowInContext(sheet) is what I was looking for. It also works when an other layer is active.

 

Thanks for your help!

Re: Strange behaviour with layer visibility

Pioneer
Pioneer

Good to know..it worked for you. Smiley Happy

 

Regards,

Onkar