<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: DisplayName of BrowserNode parent to the Face (DerrivedAssy with SuppressedL in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/displayname-of-browsernode-parent-to-the-face-derrivedassy-with/m-p/9389005#M107120</link>
    <description>&lt;P&gt;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:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;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 &amp;lt;&amp;gt; "" Then
				GoTo findLabel
			End If
		Next
'		For Each oRefComp In oDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents 
'			PrFtrNm = getLabel(oNBND.NativeObject,oRefComp)
'			If PrFtrNm &amp;lt;&amp;gt; "" 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&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 20 Mar 2020 08:24:33 GMT</pubDate>
    <dc:creator>YuhanZhang</dc:creator>
    <dc:date>2020-03-20T08:24:33Z</dc:date>
    <item>
      <title>DisplayName of BrowserNode parent to the Face (DerrivedAssy with SuppressedLink)</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/displayname-of-browsernode-parent-to-the-face-derrivedassy-with/m-p/9385750#M107091</link>
      <description>&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;As a test sample I'm using&amp;nbsp;&lt;STRONG&gt;Switch Mold_Combined CR1.ipt &lt;/STRONG&gt;(one of &lt;A href="https://knowledge.autodesk.com/support/inventor/downloads/caas/downloads/content/inventor-sample-files.html" target="_blank" rel="noopener"&gt;generic sample files&lt;/A&gt; see folder \Models\Mold Design\Switch\Switch Mold\).&lt;/P&gt;&lt;P&gt;I'm using this iLogic code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;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")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I pick one of that faces (for example the one highlighted red on the screenshot):&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Face-of-Interest_InDerASSY-Sample.png" style="width: 721px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/742766iB8B83611D35D0793/image-size/large?v=v2&amp;amp;px=999" role="button" title="Face-of-Interest_InDerASSY-Sample.png" alt="Face-of-Interest_InDerASSY-Sample.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get exactly what i need:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Get_DerAssyBrNd_DisplayName_OK.png" style="width: 226px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/742783iDC74B76F064712D3/image-size/large?v=v2&amp;amp;px=999" role="button" title="Get_DerAssyBrNd_DisplayName_OK.png" alt="Get_DerAssyBrNd_DisplayName_OK.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But if I try to repeat this after suppress link with Base (Derrived Assembly) component I get error "&lt;STRONG&gt;Object Variable or With block Variable Not Set"&amp;nbsp;&lt;/STRONG&gt;&lt;SPAN style="font-family: inherit;"&gt;instead.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope to get some workaround for this case...&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PS:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Sorry I dont know how to choose oFace using one of its identifiers&lt;/P&gt;&lt;P&gt;TransientKey:&lt;/P&gt;&lt;P&gt;43852&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;or&lt;/P&gt;&lt;P&gt;GUID:&lt;/P&gt;&lt;P&gt;{19A3A58F-597A-1506-FD16-70F14FA4D916}&lt;/P&gt;</description>
      <pubDate>Wed, 18 Mar 2020 20:50:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/displayname-of-browsernode-parent-to-the-face-derrivedassy-with/m-p/9385750#M107091</guid>
      <dc:creator>Maxim-CADman77</dc:creator>
      <dc:date>2020-03-18T20:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: DisplayName of BrowserNode parent to the Face (DerrivedAssy with SuppressedL</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/displayname-of-browsernode-parent-to-the-face-derrivedassy-with/m-p/9389005#M107120</link>
      <description>&lt;P&gt;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:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;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 &amp;lt;&amp;gt; "" Then
				GoTo findLabel
			End If
		Next
'		For Each oRefComp In oDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents 
'			PrFtrNm = getLabel(oNBND.NativeObject,oRefComp)
'			If PrFtrNm &amp;lt;&amp;gt; "" 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&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2020 08:24:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/displayname-of-browsernode-parent-to-the-face-derrivedassy-with/m-p/9389005#M107120</guid>
      <dc:creator>YuhanZhang</dc:creator>
      <dc:date>2020-03-20T08:24:33Z</dc:date>
    </item>
    <item>
      <title>Re: DisplayName of BrowserNode parent to the Face (DerrivedAssy with SuppressedL</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/displayname-of-browsernode-parent-to-the-face-derrivedassy-with/m-p/9389359#M107123</link>
      <description>&lt;P&gt;I can accept - this does the trick for the suppressed link.&lt;/P&gt;&lt;P&gt;But what if the link is broken?&lt;/P&gt;&lt;P&gt;Could top-most node still be found in that case somehow?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2020 12:07:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/displayname-of-browsernode-parent-to-the-face-derrivedassy-with/m-p/9389359#M107123</guid>
      <dc:creator>Maxim-CADman77</dc:creator>
      <dc:date>2020-03-20T12:07:52Z</dc:date>
    </item>
    <item>
      <title>Re: DisplayName of BrowserNode parent to the Face (DerrivedAssy with SuppressedL</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/displayname-of-browsernode-parent-to-the-face-derrivedassy-with/m-p/9397047#M107240</link>
      <description>&lt;P&gt;As far as Inventor understands relationship (I meant browser tree) it should be possible to track feature to the browser-node of TopNode, right?&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2020 16:07:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/displayname-of-browsernode-parent-to-the-face-derrivedassy-with/m-p/9397047#M107240</guid>
      <dc:creator>Maxim-CADman77</dc:creator>
      <dc:date>2020-03-24T16:07:36Z</dc:date>
    </item>
    <item>
      <title>Re: DisplayName of BrowserNode parent to the Face (DerrivedAssy with SuppressedL</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/displayname-of-browsernode-parent-to-the-face-derrivedassy-with/m-p/9411339#M107486</link>
      <description>&lt;P&gt;You can also update the code a bit to handle the broken link scenario:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;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 &amp;lt;&amp;gt; "" Then
				GoTo findLabel
			End If
		Next
'		For Each oRefComp In oDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents 
'			PrFtrNm = getLabel(oNBND.NativeObject,oRefComp)
'			If PrFtrNm &amp;lt;&amp;gt; "" 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&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 31 Mar 2020 06:44:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/displayname-of-browsernode-parent-to-the-face-derrivedassy-with/m-p/9411339#M107486</guid>
      <dc:creator>YuhanZhang</dc:creator>
      <dc:date>2020-03-31T06:44:54Z</dc:date>
    </item>
  </channel>
</rss>

