Hide nodes Browserfolder

Anonymous

Hide nodes Browserfolder

Anonymous
Not applicable

Hi All ,

 

I have a question about browserfolders in inventor.

 

I have a code that hide the content (parts / component patterns) of a browserfolder and set bomstructure to reference in this folder .

 

But i want to specify it also for a Sub_Folder in this folder by giving the foldername as a argument.

 

1. when its a first level folder        : hide everything and set bomstructure in this folder (include the child subfolders)

2. When its a second  level folder : hide everything and set bomstructure ONLY in this folder

 

Below the code for case 1 (maby can be better) , cause a subfolder didn't hide

	
Private Sub SetFolderVisibility(ByVal FolderName As String, ByVal Visibility As Boolean)
On Error Resume Next

Dim oAssyDoc As Inventor.AssemblyDocument = ThisDoc.Document 
       
oPane = ThisDoc.Document.BrowserPanes("Model")

'Get the browser folder object
oFolder = oPane.TopNode.BrowserFolders.Item(FolderName) 

'Get the set of nodes in the folder
oFolderNodes = oFolder.BrowserNode.BrowserNodes 

'Cycle through each browser node in the folder
	For Each oNode As BrowserNode In oFolderNodes 
	
		oComp = oNode.NativeObject
			
		'set Visibility folder contents		
	If Visibility = True Then
                oComp.BOMStructure = Inventor.BOMStructureEnum.kDefaultBOMStructure
                oComp.Visible = True	
        Else
                oComp.BOMStructure = Inventor.BOMStructureEnum.kReferenceBOMStructure
                oComp.Visible = False		
        End If			   
	Next
	
	
	Dim oOccurrencePattern As Inventor.OccurrencePattern = Nothing
	Dim OccurrencePatternName As String  
	
		
	For Each oOccurrencePattern In oAssyDoc.ComponentDefinition.OccurrencePatterns
		Dim oOccurrencePatternElement As Inventor.OccurrencePatternElement
		For Each oOccurrencePatternElement In oOccurrencePattern.OccurrencePatternElements
			Dim oOcc As Inventor.ComponentOccurrence
			oOcc.Name = OccurrencePatternName
			For Each oOcc In oOccurrencePatternElement.Occurrences
				If oOcc.Visible = True Then
					oOcc.BOMStructure = Inventor.BOMStructureEnum.kDefaultBOMStructure
				Else If oOcc.Visible = False
					oOcc.BOMStructure = Inventor.BOMStructureEnum.kReferenceBOMStructure   
				End If
			Next
		Next
	Next



End Sub	




.

 

Thx for helping me

0 Likes
Reply
312 Views
0 Replies
Replies (0)