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?
Solved! Go to Solution.
You can give a try and use
"Layer.ShowInContext(seSheet)" or "Layer.HideInContext(seSheet)" for hiding and showing the layer.
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.
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.
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.
PS: I used "Spy for Solid Edge" to change the property
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!