@YuhanZhang,
I was curious about accessing the geometry labels too, so I tried the code you provided, modified to toggle all on/off and use as iLogic rule:
Sub Main
Dim oDoc As PartDocument = ThisApplication.ActiveDocument
Dim oGraphicsColl As ClientGraphicsCollection = oDoc.ComponentDefinition.ClientGraphicsCollection
Dim oClientGraphics As ClientGraphics
Dim oNode As GraphicsNode
MessageBox.Show(oGraphicsColl.Count, "Title")
For Each oClientGraphics In oGraphicsColl
If oClientGraphics.ClientId = "NamedEntityGraphicsID"
oClientGraphics.Visible = True
For Each oNode In oClientGraphics
'MessageBox.Show(oNode.DisplayName, "Title")
oNode.Visible = Not oNode.Visible
oDoc.Update
Next
oClientGraphics.Visible = False
End If
Next
End SubIt is not working the way I had hoped:
1. if the label visibility starts as not visible, it can't find the named geometry [oGraphicsColl.Count=0]
2. if the label visibility starts as visible, it can toggle off but not toggle on
3. if the label visibility starts as visible and gets toggled off, it all gets toggled back on when the document is saved/updated
Is there a more direct way to access label visibility without relying on the client graphics? I was able to get the names of the labels and the face/vertex/... that are named using: "iLogicVb.Automation.GetNamedEntities", but I can't get to the actual label object to toggle visibility.
I also tried going through the iLogic DockableWindow but quickly hit a road block because I can't find documentation on navigating the Tabs/folders in the iLogic DockableWindow:
'iLogic Browser "dockable window" information:
oInternalName = "ilogic.treeeditor"
oClientID = "{3bdd8d79-2179-4b11-8a5a-257b1c0263ac}"
oTitle = "iLogic"
For Each oDockableWindow As Inventor.DockableWindow In ThisApplication.UserInterfaceManager.DockableWindows
If oDockableWindow.InternalName = oInternalName
If oDockableWindow.Visible <> True Then oDockableWindow.Visible = True
'Start using it
'oDockableWindow
End If
Next