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.