Ilogic: Sort the items on the browser with index value

Ilogic: Sort the items on the browser with index value

204Е10
Enthusiast Enthusiast
861 Views
2 Replies
Message 1 of 3

Ilogic: Sort the items on the browser with index value

204Е10
Enthusiast
Enthusiast

Hi everyone,

 

There are any way using iLogic to sort and rename the index numbers on the browser starting for "1, 2,..." when the same component are several time in the assembly (as is show in the image attached)

 

Cheers.

 

0 Likes
Accepted solutions (1)
862 Views
2 Replies
Replies (2)
Message 2 of 3

Sergio.D.Suárez
Mentor
Mentor
Accepted solution

Hi, try to execute the following ilogic rule from the assembly. I think I could do what you need. Be sure to put the name you want to appear on each component. I have attenuated a few examples as comments in the code.

Dim oDoc As AssemblyDocument = ThisDoc.Document
Dim i As Integer
Dim oPropertyA As String

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

For Each oOcc As ComponentOccurrence In oDoc.ComponentDefinition.Occurrences
	Try
		Dim oOccDoc As Document = oOcc.Definition.Document
		oPropertyA = oOccDoc.PropertySets.Item("Design Tracking Properties").Item("Part Number").Value
		'oPropertyA = oOccDoc.DisplayName
		'oPropertyA = oOccDoc.PropertySets.Item("Inventor User Defined Properties").Item("P").Value
		'oPropertyA = oOccDoc.PropertySets.Item("Design Tracking Properties").Item("Part Number").Value
		'oPropertyA = oOccDoc.PropertySets.Item("Design Tracking Properties").Item("Description").Value
		Dim oNode As BrowserNode = oPane.GetBrowserNodeFromObject(oOcc)

		i = 0
		Line1 : 
		i=i+1

		Try
	    	oNode.NativeObject.Name = oPropertyA & ": " & i
		Catch
			GoTo Line1
		End Try
	Catch
	End Try
Next

 I hope it is useful for you. Regards


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

Message 3 of 3

204Е10
Enthusiast
Enthusiast

Many thanks 

0 Likes