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: 

ilogic drawing parts list add column

2 REPLIES 2
Reply
Message 1 of 3
craig.clayton
1360 Views, 2 Replies

ilogic drawing parts list add column

Hello,

        In an IDW drawing, using ilogic code I wish to place a parts list on a drawing, delete all the column present in th eparts list, and add my own columns... Im stuck at the stage of adding the 'Description' column into the parts list. Any advice anyone?

 

Thanks in advance  -see my code so far below:

 

 

Dim oDrawDoc As Inventor.Document = InvApp.ActiveDocument
Dim oSheet = oDrawDoc.Sheets.Item(1)
'Dim oView As Inventor.DrawingView

'oView = oSheet.

Dim oPartsList As Inventor.PartsList
oPartsList = oSheet.PartsLists(1)

 

For i As Integer = 1 To oPartsList.PartsListColumns.Count ' delete all existing columns
oPartsList.PartsListColumns.Item(1).Remove()
Next

 

Dim oPropSet As PropertySet
Dim CreatedPropSet As Boolean = False
Dim oPropInc As Integer = 1
Do While CreatedPropSet = False
Try
oPropSet = oDrawDoc.PropertySets.Add("plist_columns" & oPropInc)
CreatedPropSet = True
Catch ex As Exception
oPropInc = oPropInc + 1
End Try
Loop

Dim oProp1 As Inventor.Property
Dim oProp2 As Inventor.Property
Dim oProp3 As Inventor.Property
Dim oProp4 As Inventor.Property

 

oProp1 = oPropSet.Add("", "Item") 'PropertyTypeEnum.kItemPartsListProperty
oProp2 = oPropSet.Add("", "Length1")
oProp3 = oPropSet.Add("", "Material")
oProp4 = oDrawDoc.PropertySets.Item("Design Tracking Properties").Item("Description")


' Create the custom column
Dim oPLCol As PartsListColumn
oPLCol = oPartsList.PartsListColumns.Add(PropertyTypeEnum.kItemPartsListProperty, , oProp1.PropId)
oPLCol.Title = "ITEM"
oPLCol = oPartsList.PartsListColumns.Add(PropertyTypeEnum.kCustomProperty, , oProp2.PropId)
oPLCol.Title = "Length1"
oPLCol = oPartsList.PartsListColumns.Add(PropertyTypeEnum.kMaterialPartsListProperty, , oProp3.PropId)
oPLCol.Title = "MATERIAL"
oPLCol = oPartsList.PartsListColumns.Add(PropertyTypeEnum.kDescriptionProperty, , oProp4.PropId)
oPLCol.Title = "DESCRIPTION"

2 REPLIES 2
Message 2 of 3
dkatz
in reply to: craig.clayton

I think the problem is that PropertyTypeEnum.kDescriptionProperty doesn't seem to exist (I checked using a vb.net program that I had). Does that need to be a custom property enumtype as well?

 

Sorry, I'm not an expert and I could very well be wrong, but I'm just replying in the hopes that it helps you out.

Message 3 of 3
craig.clayton
in reply to: dkatz

Thanks, 

            I know the PropertyTypeEnum.kDescriptionProperty doesn't exist. Im trying to fid out what is should be instead? 

 

Any advice anyone? 😞

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

Post to forums  

Autodesk Design & Make Report