i don't know an equivalent command in the API.
So seems you have to iterate on your own through each sheet's Layers collection and search/set the desired layer's Show property to true/false.
Thanks for the suggestion. I have already tried this one. But if in views I have used "Draw In View"command to insert geometries/annotatations then this is not working. Then use of Hide/Show Everywhere is also different for views with use of "Draw in View" command.
If you have any suggestion on this ;Please let me know.
the DrawingView object owns the methods named HideLayer("layerName") and ShowLayer("layerName") with which you can hide/show the layers inside of a DrawingView object.
So you have to iterate over each sheet's DrawingViews collection and call for each DrawingView object one of the above mentioned methods to hide/show a specific layer.
By the way, the behaviour of Hide/Show Everywhere for the sheet layers can be accomplished too by
as noted in an older thread here.
Thanks for the reply.
Here this API are working correctly but here there is also issue with GUI. The Layers are not getting disabled on using Hide Layer.
Also this functionlaity is different than the Hide/Show Everywhere on Layer.
I am working with'Draw in view'command in Drawing views.
as I've written above, the GUI Hide/Show Everywhere works for sheet layers only. As you observed, the hidden/shown status of layers in drawing views doesn't get changed by this GUI command.
To achieve the functionality you want, you have to do the following in abstract:
Iterate over all foreground and background sheets of your dft document
Iterate over each sheet's Layers collection
Set the Show property for the Layer object as you need it to be
Iterate over each sheet's DrawingViews collection
Execute the DrawingView object method HideLayer/ShowLayer as you need it to be
with your sample I don't see a problem at all to hide a specific layer really everywhere. Even by GUI the command Hide Everywhere works properly on layers in views too.
Here a short VB.NET example how to achieve the same results per API:
Sub Main() Const layerNameToHide As String = "DrawInLayer" Dim seApp As SolidEdgeFramework.Application = GetObject(, "SolidEdge.Application") Dim dftDoc = CType(seApp.ActiveDocument, SolidEdgeDraft.DraftDocument) For Each layer As SolidEdgeFramework.Layer In dftDoc.ActiveSheet.Layers Select Case layer.Name Case layerNameToHide layer.Show = False Exit For End Select Next For Each dv As SolidEdgeDraft.DrawingView In dftDoc.ActiveSheet.DrawingViews Try dv.HideLayer(layerNameToHide) Catch ex As Exception End Try Next If dftDoc IsNot Nothing Then Marshal.FinalReleaseComObject(dftDoc) dftDoc = Nothing End If If seApp IsNot Nothing Then Marshal.FinalReleaseComObject(seApp) seApp = Nothing End If End Sub
Result after execution with your above dft file opened in Solid Edge:
The layer named DrawInLayer is hidden everywhere
This is giving correct result to me.But still in my case the GUI issue after using command
View.HideLayer("LayerName") is still there.
I have tried with vb as well C# .net codes.That is still minor issue.
Earlier I have used either of them combination thats why getting different results.
can you please explain your open issue more in detail. I don't understand what's not working in your case.
If you don't have any issues, you could mark this thread as solved