Getting component from Browsernode

Getting component from Browsernode

NachoShaw
Advisor Advisor
505 Views
2 Replies
Message 1 of 3

Getting component from Browsernode

NachoShaw
Advisor
Advisor

Hey

 

I have a method that finds the browsernode from the component by using NativeObject. What is the method of doing it the other way round? i.e. finding the object from the Browsernode? I am trying to turn off the components in the assembly but i only have the browser nodes in my method as i am looping them by folder.

 

The RepNode.NativeObject is the Browsernode and i need to check if its an assembly. If it is, i need to run all child components visiblity off

 

Dim RepNodes As BrowserNodesEnumerator = oFolder.BrowserNode.BrowserNodes
                        For Each RepNode As BrowserNode In RepNodes
                            If oFolder.Name = oViewRep.Name Then
                                RepNode.NativeObject.Visible = True
                                If oFolder.Name = "NOZZLE" Then
                                  'LOOP THE TOP LEVEL COMPONENTS
                                   'IF COMPONENT IS ASSEMBLY,
                                   'LOOP CHILD COMPONENTS AND TURN OFF
                                End If
                            End If
                        Next

 

Thanks

 

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes
506 Views
2 Replies
Replies (2)
Message 2 of 3

marcin_otręba
Advisor
Advisor

heck this:

 

Dim oPane As BrowserPane
oPane = ThisDoc.Document.BrowserPanes.Item("Model")
On Error Resume Next

    ' Get the last visible child node under the sub-assembly occurrence
    Dim oTargetNode As BrowserFolder
    Dim i As Long
    For i = oPane.TopNode.BrowserFolders.Count To 1 Step -1
                 oTargetNode = oPane.TopNode.BrowserFolders.Item(i)
			 If oTargetNode.Name = "NOZZLE" Then
				Dim onode As BrowserNode
				For Each onode In oTargetNode.BrowserNode.BrowserNodes
					Dim occ As ComponentOccurrence = onode.NativeObject
					MessageBox.Show(occ.name, "Title")
				Next
                         End If
    Next

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

0 Likes
Message 3 of 3

NachoShaw
Advisor
Advisor

Thanks for the reply

 

i figure it out last night, i needed to make an occurrence and assign the browsernode to it

If oFolder.Name = "NOZZLE" Then
   Dim oComp As ComponentOccurrence = RepNode.NativeObject
   If oComp.DefinitionDocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
      For Each SubComp As ComponentOccurrence In oComp.SubOccurrences
         SubComp.Visible = False
      Next
   End If
End If

 

Thanks 

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes