Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

renumber partlist

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
GeorgK
321 Views, 2 Replies

renumber partlist

Hello together,

 

how could I renumber my partlist at a given position for example 50 to 100?

 

First I renumber it :

Call oBOMView.Renumber(1, 1)

 

1-50

50-100  => 500-1000

 

Thank you very much

 

Georg

2 REPLIES 2
Message 2 of 3
YuhanZhang
in reply to: GeorgK

Can you explain more details about your requirement? I created a VBA sample for your requirement, not sure if this can satisfy you:

 

Sub RenumberPartslistSample()
    Dim oDoc As DrawingDocument
    Set oDoc = ThisApplication.ActiveDocument
    
    Dim oSheet As Sheet
    Set oSheet = oDoc.ActiveSheet
    
    ' In UI select a part list first
    Dim oPL As PartsList
    Set oPL = oDoc.SelectSet(1)
    
    ' Set which rows will be renumbered, like rows from 50 to 100
    Dim iStart As Integer, iEnd As Integer, sInput As String
    sInput = InputBox("Input the start row number for renumbering", "Input data")
    iStart = CInt(sInput)
    sInput = InputBox("Input the end row number for renumbering", "Input data")
    iEnd = CInt(sInput)
    
    ' Set the start value for the renumbered rows and step value
    Dim iRenumStartValue As Integer, iRenumStepValue As Integer
    sInput = InputBox("Input the start value for renumbering", "Input data")
    iRenumStartValue = CInt(sInput)
    sInput = InputBox("Input the step value for renumbering", "Input data")
    iRenumStepValue = CInt(sInput)
    
    Dim oRow As PartsListRow
    Dim i As Integer: i = 1
    For Each oRow In oPL.PartsListRows
        If i > iStart - 1 And i < iEnd + 1 Then
            oRow.Item("ITEM").Value = iRenumStartValue + iRenumStepValue * (i - iStart)
        End If
        Debug.Print oRow.Item("ITEM").Value
        i = i + 1
    Next
    
    oSheet.Update
End Sub

 Please let me if this helps.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

Message 3 of 3
GeorgK
in reply to: YuhanZhang

Hello Rocky,

thats exact what I am looking for.

Thank you very much

Georg

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report