Message 1 of 4

Not applicable
03-06-2015
05:38 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have to update a large amount of drawings to new styles. I already have code that updates the title block, but when updating the parts list I have not found any working way of inserting a "part number" column.
I have successfully inserted other columns, but my attempts at part number will either throw an exception or show nothing:
' access the old, obsolete parts list style for assemblies Dim AssemblyStyle = Doc.StylesManager.PartsListStyles("Lista de piezas(Plano Conjuntos)") ' re-create all its columns AssemblyStyle.RemoveAllColumns() AssemblyStyle.AddColumn(Inventor.PropertyTypeEnum.kItemPartsListProperty, , "Item", "ID", 6.4 / 10, Inventor.HorizontalTextAlignmentEnum.kAlignTextCenter, Inventor.HorizontalTextAlignmentEnum.kAlignTextCenter) AssemblyStyle.AddColumn(Inventor.PropertyTypeEnum.kQuantityPartsListProperty, , "Quantity", "Uds", 6.8 / 10, Inventor.HorizontalTextAlignmentEnum.kAlignTextCenter, Inventor.HorizontalTextAlignmentEnum.kAlignTextCenter) ' ... (MISSING: PART NUMBER) AssemblyStyle.AddColumn(Inventor.PropertyTypeEnum.kCustomProperty, , PropNames.Codigo, "Código", 29.9 / 10, Inventor.HorizontalTextAlignmentEnum.kAlignTextCenter, Inventor.HorizontalTextAlignmentEnum.kAlignTextCenter) AssemblyStyle.AddColumn(Inventor.PropertyTypeEnum.kCustomProperty, , PropNames.TipoMat, "Material", 64.7 / 10, Inventor.HorizontalTextAlignmentEnum.kAlignTextCenter, Inventor.HorizontalTextAlignmentEnum.kAlignTextLeft) AssemblyStyle.AddColumn(Inventor.PropertyTypeEnum.kCustomProperty, , PropNames.Peso, "Kg/Ud", 12.2 / 10, Inventor.HorizontalTextAlignmentEnum.kAlignTextCenter, Inventor.HorizontalTextAlignmentEnum.kAlignTextRight) ' re-create the parts list in first sheet, to make it update its style Dim PartsListPosition = Doc.Sheets(1).PartsLists(1).Position Dim PartsListView = Doc.Sheets(1).PartsLists(1).ReferencedDocumentDescriptor.ReferencedDocument Doc.Sheets(1).PartsLists(1).Delete() Doc.Sheets(1).PartsLists.Add(PartsListView, PartsListPosition, Inventor.PartsListLevelEnum.kStructuredAllLevels, Inventor.NumberingSchemeEnum.kNumericNumbering, 1)
It is easy to insert part number manually, but for the API I cannot find the proper use of PartsList.AddColumn method documented anywhere.
Solved! Go to Solution.