Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
YuhanZhang
in reply to: Maxim-CADman77

Does the error happen to the line:

oNode = oPane.GetBrowserNodeFromObject(oSketch)

 

If so seems the browser node for the hidden sketch is not available, so you can try below code:

 

Dim oCompdef As PartComponentDefinition
oCompdef = ThisDoc.Document.ComponentDefinition

Dim oPane As BrowserPane
oPane = ThisDoc.Document.BrowserPanes("PmDefault")
    
Dim MsgBody As String
Dim AboveEoP_SkCount As Integer=0
For Each oSketch As Sketch In oCompdef.Sketches
	On Error Resume Next
    Dim oNode As BrowserNode
    oNode = oPane.GetBrowserNodeFromObject(oSketch)
    
	If Err.Number=0 Then
	    If oSketch.HealthStatus <> HealthStatusEnum.kBeyondStopNodeHealth Then
	        SkCount = AboveEoP_SkCount + 1
	        MsgBody = MsgBody & "                     " & oSketch.Name & " - " & oSketch.IsOwnedByFeature & vbCrLf
	    Else
	        Exit For
	    End If
	Else
		Err.Clear 
		On Error GoTo 0
	End If
Next
MsgBox (MsgBody,,"Out of " & oCompdef.Sketches.Count & " sketches " & AboveEoP_SkCount & " are placed above EoP:     ")

If you want to get the deeper level browser nodes, you can iterate the BrowserNode.BrowserNodes. But if the browser node for the sketch is not available you may not find it via API.

 



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.