- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'd like to know if it possible to get DisplayName of the top-most BrowserNode parent to the given Face when it is about DerivedAssembly with link suppressed.
As a test sample I'm using Switch Mold_Combined CR1.ipt (one of generic sample files see folder \Models\Mold Design\Switch\Switch Mold\).
I'm using this iLogic code:
oFace = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "")
Dim PrFtrNm As String=""
Dim oNBND As NativeBrowserNodeDefinition=ThisDoc.Document.BrowserPanes.GetNativeBrowserNodeDefinition(oFace.SurfaceBody.CreatedByFeature)
If oNBND.NativeObject.Type=ObjectTypeEnum.kReferenceFeatureObject Then
PrFtrNm=oNBND.NativeObject.ReferenceComponent.ReferencedDocumentDescriptor.DisplayName ' "With" exception failure if link to derived (reference) component is suppressed or broken.
Else
PrFtrNm=oNBND.Label
End If
MsgBox(PrFtrNm,,"PrFtrNm")
When I pick one of that faces (for example the one highlighted red on the screenshot):
I get exactly what i need:
But if I try to repeat this after suppress link with Base (Derrived Assembly) component I get error "Object Variable or With block Variable Not Set" instead.
Hope to get some workaround for this case...
PS:
Sorry I dont know how to choose oFace using one of its identifiers
TransientKey:
43852
or
GUID:
{19A3A58F-597A-1506-FD16-70F14FA4D916}
Please vote for Inventor-Idea Text Search within Option Names
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Seems there is a problem that when the derived assembly is suppressed the ReferenceFeature.ReferenceComponent returns Nothing here. I updated the iLogic code to workaround it, you can try if it works well there:
Sub Main()
oFace = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "")
Dim PrFtrNm As String=""
Dim oNBND As NativeBrowserNodeDefinition=ThisDoc.Document.BrowserPanes.GetNativeBrowserNodeDefinition(oFace.SurfaceBody.CreatedByFeature)
If oNBND.NativeObject.Type=ObjectTypeEnum.kReferenceFeatureObject Then
If oNBND.NativeObject.ReferenceComponent Is Nothing Then
Dim oRefComp As ReferenceComponent
Dim oRefFeature As ReferenceFeature
Dim oDoc As PartDocument
oDoc = ThisDoc.Document
For Each oRefComp In oDoc.ComponentDefinition.ReferenceComponents.DerivedAssemblyComponents
PrFtrNm = getLabel(oNBND.NativeObject,oRefComp)
If PrFtrNm <> "" Then
GoTo findLabel
End If
Next
' For Each oRefComp In oDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents
' PrFtrNm = getLabel(oNBND.NativeObject,oRefComp)
' If PrFtrNm <> "" Then
' GoTo findLabel
' End If
' Next
Else
PrFtrNm = oNBND.NativeObject.ReferenceComponent.ReferencedDocumentDescriptor.DisplayName ' "With" exception failure if link to derived (reference) component is suppressed or broken.
End If
findLabel :
Else
PrFtrNm=oNBND.Label
End If
MsgBox(PrFtrNm, , "PrFtrNm")
End Sub
Function getLabel(oParentRefFeature As ReferenceFeature,oRefComp As ReferenceComponent) As String
For Each oRefFeature In oRefComp.ReferenceFeatures
If oParentRefFeature Is oRefFeature Then
getLabel = oRefComp.ReferencedDocumentDescriptor.DisplayName
Exit For
End If
Next
End Function
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I can accept - this does the trick for the suppressed link.
But what if the link is broken?
Could top-most node still be found in that case somehow?
Please vote for Inventor-Idea Text Search within Option Names
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
As far as Inventor understands relationship (I meant browser tree) it should be possible to track feature to the browser-node of TopNode, right?
Please vote for Inventor-Idea Text Search within Option Names
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
You can also update the code a bit to handle the broken link scenario:
Sub Main()
oFace = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "")
Dim PrFtrNm As String=""
Dim oNBND As NativeBrowserNodeDefinition=ThisDoc.Document.BrowserPanes.GetNativeBrowserNodeDefinition(oFace.SurfaceBody.CreatedByFeature)
If oNBND.NativeObject.Type=ObjectTypeEnum.kReferenceFeatureObject Then
If oNBND.NativeObject.ReferenceComponent Is Nothing Then
Dim oRefComp As ReferenceComponent
Dim oRefFeature As ReferenceFeature
Dim oDoc As PartDocument
oDoc = ThisDoc.Document
For Each oRefComp In oDoc.ComponentDefinition.ReferenceComponents.DerivedAssemblyComponents
PrFtrNm = getLabel(oNBND.NativeObject,oRefComp)
If PrFtrNm <> "" Then
GoTo findLabel
End If
Next
' For Each oRefComp In oDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents
' PrFtrNm = getLabel(oNBND.NativeObject,oRefComp)
' If PrFtrNm <> "" Then
' GoTo findLabel
' End If
' Next
Else
PrFtrNm = oNBND.NativeObject.ReferenceComponent.ReferencedDocumentDescriptor.DisplayName ' "With" exception failure if link to derived (reference) component is suppressed or broken.
End If
findLabel :
Else
PrFtrNm=oNBND.Label
End If
MsgBox(PrFtrNm, , "PrFtrNm")
End Sub
Function getLabel(oParentRefFeature As ReferenceFeature, oRefComp As ReferenceComponent) As String
For Each oRefFeature In oRefComp.ReferenceFeatures
If oParentRefFeature Is oRefFeature Then
If oRefComp.ReferencedDocumentDescriptor Is Nothing Then
getLabel = oRefComp.Name
Exit For
Else
getLabel = oRefComp.ReferencedDocumentDescriptor.DisplayName
Exit For
End If
End If
Next
End Function
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.