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"
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.
Thanks,
I know the PropertyTypeEnum.kDescriptionProperty doesn't exist. Im trying to fid out what is should be instead?
Any advice anyone? 😞