<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Betreff: sorting bom problem in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/sorting-bom-problem/m-p/8613845#M94792</link>
    <description>&lt;P&gt;Sorted partlist:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Partlist.png" style="width: 303px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/606210i5A65003558B51D09/image-size/large?v=v2&amp;amp;px=999" role="button" title="Partlist.png" alt="Partlist.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But there could also some parts with a or b at the beginning which should be positioned after the S00xxxxxxPxx parts.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 22 Feb 2019 10:35:18 GMT</pubDate>
    <dc:creator>GeorgK</dc:creator>
    <dc:date>2019-02-22T10:35:18Z</dc:date>
    <item>
      <title>sorting bom problem</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/sorting-bom-problem/m-p/8611059#M94722</link>
      <description>&lt;P&gt;Hello together,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a problem to sort my drawing bom. The first step is to sort the "part number" ascending, which is working.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Public Sub PartListEdit()
    ' Set a reference to the drawing document.
    ' This assumes a drawing document is active.
    Dim oDrawDoc As DrawingDocument
    Set oDrawDoc = ThisApplication.ActiveDocument
    
    ' Set a reference to the first parts list on the active sheet.
    ' This assumes that a parts list is on the active sheet.
    Dim oPartList As PartsList
    Set oPartList = oDrawDoc.ActiveSheet.PartsLists.Item(1)
    
    ' Iterate through the contents of the parts list.
    Dim i As Long
    For i = 1 To oPartList.PartsListRows.Count
        ' Get the current row.
        Dim oRow As PartsListRow
        Set oRow = oPartList.PartsListRows.Item(i)
        
        ' Iterate through each column in the row.
        Dim j As Long
        For j = 1 To oPartList.PartsListColumns.Count
            ' Get the current cell.
            Dim oCell As PartsListCell
            Set oCell = oRow.Item(j)
            
            
            If oPartList.PartsListColumns.Item(j).Title  "Part number" Then
                'Do some work
            End If
        Next
    Next
    
   
End Sub&lt;/PRE&gt;
&lt;P&gt;In the next step I would like to sort the parts with the name from 1 to x&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;S000AxxxxxxxxxP001&lt;/LI&gt;
&lt;LI&gt;S000AxxxxxxxxxP002&lt;/LI&gt;
&lt;LI&gt;S000AxxxxxxxxxP003&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;xxxxxxxxx could be numbers or text.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The remaining parts should get a number from 100 to xx&lt;BR /&gt;How could I do this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;P&gt;Georg&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 12:05:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/sorting-bom-problem/m-p/8611059#M94722</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2019-02-21T12:05:36Z</dc:date>
    </item>
    <item>
      <title>Betreff: sorting bom problem</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/sorting-bom-problem/m-p/8611173#M94727</link>
      <description>&lt;P&gt;The bom columns:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;No.; Qty.; Part number; Title&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 12:56:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/sorting-bom-problem/m-p/8611173#M94727</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2019-02-21T12:56:28Z</dc:date>
    </item>
    <item>
      <title>Betreff: sorting bom problem</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/sorting-bom-problem/m-p/8613484#M94769</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/241746"&gt;@GeorgK&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hoping that below iLogic code may be helpful to sort substring of string.&lt;/P&gt;
&lt;PRE&gt;Dim list1() As String = {"abc0002", "aab0001", "abb0005", "aaa0003", "aed0004"}
Dim result = list1.OrderBy(Function(q) q.Substring(5)).ToArray

For Each s As String In result
    MessageBox.Show(s)
Next&lt;/PRE&gt;
&lt;P&gt;Thanks and regards,&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 07:23:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/sorting-bom-problem/m-p/8613484#M94769</guid>
      <dc:creator>chandra.shekar.g</dc:creator>
      <dc:date>2019-02-22T07:23:22Z</dc:date>
    </item>
    <item>
      <title>Betreff: sorting bom problem</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/sorting-bom-problem/m-p/8613527#M94772</link>
      <description>&lt;P&gt;Hello &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4427777"&gt;@chandra.shekar.g&lt;/a&gt; ,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thank you for the sample. It's not the problem to sort the list. The problem is to sort the partlist. Please could you send me an example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;P&gt;Georg&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 07:49:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/sorting-bom-problem/m-p/8613527#M94772</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2019-02-22T07:49:36Z</dc:date>
    </item>
    <item>
      <title>Betreff: sorting bom problem</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/sorting-bom-problem/m-p/8613615#M94774</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/241746"&gt;@GeorgK&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please send me sample partslist with expected result and make sure that files are non confidential.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks and regards,&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 08:37:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/sorting-bom-problem/m-p/8613615#M94774</guid>
      <dc:creator>chandra.shekar.g</dc:creator>
      <dc:date>2019-02-22T08:37:36Z</dc:date>
    </item>
    <item>
      <title>Betreff: sorting bom problem</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/sorting-bom-problem/m-p/8613845#M94792</link>
      <description>&lt;P&gt;Sorted partlist:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Partlist.png" style="width: 303px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/606210i5A65003558B51D09/image-size/large?v=v2&amp;amp;px=999" role="button" title="Partlist.png" alt="Partlist.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But there could also some parts with a or b at the beginning which should be positioned after the S00xxxxxxPxx parts.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 10:35:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/sorting-bom-problem/m-p/8613845#M94792</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2019-02-22T10:35:18Z</dc:date>
    </item>
    <item>
      <title>Betreff: sorting bom problem</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/sorting-bom-problem/m-p/8614121#M94801</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/241746"&gt;@GeorgK&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hoping that below iLogic code may be helpful to sort part numbers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Dim oDoc As DrawingDocument 
oDoc = ThisApplication.ActiveDocument 

Dim oSheet As Sheet 
oSheet = oDoc.ActiveSheet 

Dim oPartslist As PartsList
oPartslist = oSheet.PartsLists.Item(1)

Dim oRow As PartsListRow 
 
Dim myList As New List(Of String)()
Dim i As Integer  
For Each oRow In oPartslist.PartsListRows 
	If oRow.Item(3).Value.Length = 13 Then
		myList.Add(oRow.Item(3).Value)
	End If 
Next
Dim list() As String = myList.ToArray()
Dim result = list.OrderBy(Function(q) q.Substring(11)).ToArray

i = 1
For Each s As String In result
    For Each oRow In oPartslist.PartsListRows 
		If s = oRow.Item(3).Value Then
			Call oRow.Reposition(i)
			i = i + 1
		End If
	Next 
Next&lt;/PRE&gt;
&lt;P&gt;Thanks and regards,&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 12:38:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/sorting-bom-problem/m-p/8614121#M94801</guid>
      <dc:creator>chandra.shekar.g</dc:creator>
      <dc:date>2019-02-22T12:38:29Z</dc:date>
    </item>
    <item>
      <title>Betreff: sorting bom problem</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/sorting-bom-problem/m-p/8614407#M94819</link>
      <description>&lt;P&gt;Hello &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4427777"&gt;@chandra.shekar.g&lt;/a&gt; ,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thank you very much. I didn't thought about Reposition the row.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Georg&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 14:20:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/sorting-bom-problem/m-p/8614407#M94819</guid>
      <dc:creator>GeorgK</dc:creator>
      <dc:date>2019-02-22T14:20:43Z</dc:date>
    </item>
  </channel>
</rss>

