Is there a command for Show Everywhere and Hide Everywhere for layers in VBA?

PLM World Member Legend PLM World Member Legend
PLM World Member Legend

Just stumbling around learning VBA for Solid Edge...

 

Is there a command for showing and hiding layers throughout a draft document?  In one hit?

 

The Visual Basic line syntax "layer.show = true" (or false) works to show or hide a layer but only on the active sheet.

 

I can loop through all the background sheets and it will work but only if each background sheet is activated first.  But that is a bit ugly as I don't want them activated.

 

There is the Solid Edge command "Show Everywhere" and "Hide Everywhere" which Shows or Hides all instances of a layer throughout a draft document.  Is there an equivalent command in Visual Basic?

 

Cheers!

4 REPLIES

Re: Is there a command for Show Everywhere and Hide Everywhere for layers in VBA?

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

You can use Spy for Solid Edge to see what CommandID is being used when you use the command via the GUI. Once you know the CommandID, you can use Application.StartCommand() at any time to execute the command manually. Most CommandIDs have a corresponding constant (enum) associated with them but not all. In this particular case, it doesn't so you'll just have to use the number. You might also look at my Spy for Solid Edge Introduction blog post.

Jason Newell
Applications Architect
www.jasonnewell.net
Highlighted

Re: Is there a command for Show Everywhere and Hide Everywhere for layers in VBA?

PLM World Member Legend PLM World Member Legend
PLM World Member Legend

Jason,

 

You are a scholar and a gentleman!  Spy found the ID of those commands I was after, so I can implement that.  I had in the meantime completed the little macro using some alternative coding and it works -- but this will streamline it quite a bit.

 

 

Cheers,

 

Chris

Re: Is there a command for Show Everywhere and Hide Everywhere for layers in VBA?

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

I love how Spy for Solid Edge makes me look smart ;-)

 

Glad to help. Code on!

Jason Newell
Applications Architect
www.jasonnewell.net

Re: Is there a command for Show Everywhere and Hide Everywhere for layers in VBA?

im trying to do the same and have not had success.

 

I found the command ID but can t seem to invoke it...

 

here is what I'm trying,... whats wrong?

 

'turn on UOS Dimensions Layer

objUOSLayers = objActiveSheet.Layers

If rbImperial.Checked = True Then

For Each objUOSLayer In objUOSLayers

If objUOSLayer.Name = "ImperialUOS" Then

objUOSLayer.Show = True

objApp.StartCommand(35007) 'Show Everywhere

End If

Next objUOSLayer

End If