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: 

Add custom part in idw Partslist

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
k14348
348 Views, 2 Replies

Add custom part in idw Partslist

Public Sub InsertCustomPartinPartlist()

Dim oDoc As Document
Dim oSheet As Sheet
Dim oPartslist As PartsList

Set oDoc = ThisApplication.ActiveDocument
If oDoc.DocumentType = kDrawingDocumentObject Then
    Set oSheet = oDoc.ActiveSheet
    oSheet.Activate
Set oPartslist = oSheet.PartsLists(1)

Dim oPartslistRows As PartsListRows
Set oPartslistRows = oPartslist.PartsListRows.Add

Dim oPartslistCell As PartsListCell
Set oPartslistCell = oPartslistRows.Item



Else
    MsgBox "The Selected document is not a drawing document please select a drawing document and continue", vbOKOnly, "Edit Column Name"
    Exit Sub
End If
End Sub

Hi,

  Im planning to add custom part in my idw partslist. Also want to add values for the added custom part. I tried but unable to select the last added item. Can anybody help?

-karthikeyan

2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: k14348

Hi Karthik,

 

I've modified your Code slightly which might help you

 

Public Sub InsertCustomPartinPartlist()

Dim oDoc As Document
Dim oSheet As Sheet
Dim oPartslist As PartsList

Set oDoc = ThisApplication.ActiveDocument
If oDoc.DocumentType = kDrawingDocumentObject Then
    Set oSheet = oDoc.ActiveSheet
    oSheet.Activate
Set oPartslist = oSheet.PartsLists(1)

Dim oPartslistRows As PartsListRows
Dim oCount As Long
oCount = oPartslist.PartsListRows.Count+1
oPartslist.PartsListRows.Add
oPartslist.PartsListRows.Item(oCount).Item(2).Value = 2 'Qty
oPartslist.PartsListRows.Item(oCount).Item(3).Value = "Part Number"
oPartslist.PartsListRows.Item(oCount).Item(4).Value = "Description"

'You Can Add N number of columns you have


Else
    MsgBox "The Selected document is not a drawing document please select a drawing document and continue", vbOKOnly, "Edit Column Name"
    Exit Sub
End If
End Sub
Message 3 of 3
k14348
in reply to: Anonymous

Hi Srinivas,

             Thanks for your timely helpSmiley Happy

 

-karthikeyan M

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

Post to forums  

Autodesk Design & Make Report