Create Browser Folder Messes Up Model Tree Order

Create Browser Folder Messes Up Model Tree Order

Curtis_Waguespack
Consultant Consultant
993 Views
3 Replies
Message 1 of 4

Create Browser Folder Messes Up Model Tree Order

Curtis_Waguespack
Consultant
Consultant

Attached is an Inventor 2020 file for testing and replicating this issue. Within it are a couple of iLogic rules that demonstrate the problem.

 

If I run the rule to create a browser folder first, and then run the rule to create the hole feature, the hole feature is placed at the top of the browser model tree as shown, which is not correct.

 

I suspect the issue is, that the the rule to create the folder browser is leaving the tree in a disordered state. But I'm not sure if that is truly the case or what the fix would be.

 

Would anyone happen to know how to resolve this?

 

Thanks!

Curtis

 

Curtis_W_0-1634313122731.png

 

EESignature

Accepted solutions (2)
994 Views
3 Replies
Replies (3)
Message 2 of 4

Ralf_Krieg
Advisor
Advisor
Accepted solution

Hello

 

I think it is cause browser folders are not for parts. Try to create a browser folder per GUI. The context menu options are only aviable in assemblys.


R. Krieg
RKW Solutions
www.rkw-solutions.com
Message 3 of 4

J-Camper
Advisor
Advisor
Accepted solution

Yes I believe the issue is the fact that custom Browser Folders are not meant to be possible in parts.  Even when you don't add the hole feature, moving EOP to End, with the folder at the bottom of the list, puts the EOP marker Above SolidBodies.

 

I did get a workaround working... But I don't really like it.  Anyways, I made edits to the Create Folder Rule:

Sub Main

	Dim oDoc As PartDocument
	oDoc = ThisApplication.ActiveDocument	

	sFolder = "Test Folder"
	Call MakeFolder(oDoc, sFolder)
	
End Sub

Sub MakeFolder(oDoc As Document,sFolder As String)

		
	Dim oDef As PartComponentDefinition
	oDef = oDoc.ComponentDefinition

	Dim oPane As BrowserPane
	oPane = oDoc.BrowserPanes.Item("Model")

	Dim oTopNode As BrowserNode
	oTopNode = oPane.TopNode

	Logger.Info("oPane.TopNode: " & oPane.TopNode.FullPath)

	Dim oTargetNode As BrowserNode
	If oDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
		oTargetNode = oPane.TopNode.BrowserNodes.Item("Folded Model")
	Else
		oTargetNode = oTopNode
	End If

	For Each xFolder In oTargetNode.BrowserFolders
		Logger.Info(xFolder.name)
		If xFolder.name = sFolder
			Exit Sub
		End If
	Next


	Dim oCollection As ObjectCollection
	oCollection = ThisApplication.TransientObjects.CreateObjectCollection

	Dim oNode As BrowserNode


	For Each oItem In oDef.Workplanes		
		If oItem.isCoordinateSystemElement = False Then
			oNode = oPane.GetBrowserNodeFromObject(oItem)
			oCollection.Add(oNode)
			oItem.Visible = False
		End If
	Next

	For Each oItem In oDef.WorkAxes
		If oItem.isCoordinateSystemElement = False Then
			oNode = oPane.GetBrowserNodeFromObject(oItem)
			oCollection.Add(oNode)
			oItem.Visible = False
		End If
	Next

	For Each oItem In oDef.Workpoints
		If oItem.isCoordinateSystemElement = False Then
			oNode = oPane.GetBrowserNodeFromObject(oItem)
			oCollection.Add(oNode)
			oItem.Visible = False
		End If
	Next
	'Logger.Info(oCollection.Count)
	
	Dim TempFeat As NonParametricBaseFeature = oDef.Features.NonParametricBaseFeatures.Add(oDef.SurfaceBodies.Item(1))
	Try : TempFeat.Name = "Block" : Catch : End Try
	TempFeat.SurfaceBodies.Item(1).Visible = False
	Dim TempNode As BrowserNode = oPane.GetBrowserNodeFromObject(TempFeat)
	'TempNode.Visible = False
	
	Dim oFolder As BrowserFolder
	Try
		oFolder = oPane.TopNode.BrowserFolders.Item(sFolder)
		'Logger.Info("oFolder: " & oFolder.Name)
	Catch

		oFolder = oPane.AddBrowserFolder(sFolder, oCollection)
	End Try

	'oFolder.SetEndOfPart(False)
	oFolder.AllowReorder = True
	oFolder.AllowDelete = True
	
	'Logger.Info("oFolder.AllowReorder: " & oFolder.AllowReorder)
	'Logger.Info("oFolder.AllowDelete: " & oFolder.AllowDelete)

End Sub

 

So I'm putting a dummy feature after the folder, which makes the Browser kind of happy again.  What I mean by that is the new hole features go where they are supposed to and Setting EOP to Top/End works as intended.  You cannot move EOP to either side of the folder, you must move around adjacent features [ie below the chamfer, or above the dummy feature].

 

I have an option commented out where I made the dummy feature's browser node invisible.  EOP still functions properly, but the dummy feature doesn't show up in the Browser and can only be deleted through the SurfaceBody it created.

 

Also the Folder options at the bottom won't allow you to move/delete the folder since custom folders aren't meant to exist in Parts...

 

Let me know if you have any questions.

Message 4 of 4

Curtis_Waguespack
Consultant
Consultant

Thank you both, I was indeed looking right past the fact that I was using browser folders  in unsupported parts.

EESignature

0 Likes