iLogic to change parts list style

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi!
I have been successful recently in creating a series of rules thanks to the posts of many helpful people, thank you all!
Below are 2 rules that run in succession to create and save a parts list from a base view in a drawing.
I am now trying to set the parts list style to a custom style, ideally while creating the list.
Also, I have to manually go into the list to turn off visibility of certain items (based on material), does anyone know if I can do this with Ilogic? I ask because these steps precede a rule that automates placing base views of all parts in the parts list. If I could get the style and visibility right, I could automate the entire process.
Can anyone help changing such a style with ilogic?
Thanks to all in advance!
Inventor & Vault Pro 2012
Windows 7, 64bit
Core i7 920@2.67
8GB
CREATE PARTS LIST____
' Set a reference to the drawing document.
' This assumes a drawing document is active.
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument
'Set a reference to the active sheet.
Dim oSheet As Sheet
oSheet = oDrawDoc.ActiveSheet
' Set a reference to the first drawing view on the sheet. This assumes the first drawing view on the sheet is not a draft view.
Dim oDrawingView As DrawingView
oDrawingView = oSheet.DrawingViews(1)
Dim oPlacementPoint As Point2d
oPlacementPoint = ThisApplication.TransientGeometry.CreatePoint2d(-15#, 20#)
' Create the parts list.
Dim oPartsList As PartsList
'Dim oPartsListStyle As oDrawDoc.StylesManager.PartsListStyle.Name
'oDrawDoc.StylesManager.PartsListStyle.Name = ("CNC Parts List")
oPartsList = oSheet.PartsLists.Add(oDrawingView, oPlacementPoint)
iLogicVb.RunRule(export cnc parts list)
EXPORT CNC PARTS LIST____
path_and_name = ThisDoc.PathAndFileName(False) ' without extension
Dim oDoc As Inventor.DrawingDocument
oDoc = ThisDoc.Document
'specify the drawing sheet
oSheet = oDoc.Sheets(1) ' first sheet
' say there is a Partslist on the sheet.
'Dim oPartslist As PartsList
oPartslist = oSheet.PartsLists(1)
' create a new NameValueMap object
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
'specify an existing template file
'to use For formatting colors, fonts, etc
oOptions.Value("Template") = ""'"E:\_VAULT WORKING FOLDER\Templates\PARTSLISTEXPORT.xls"
'specify the columns to export
'oOptions.Value("ExportedColumns") = "SYTELINE#;QTY"
'specify the start cell
oOptions.Value("StartingCell") = "A1"
'specify the XLS tab name
'here the file name is used
oOptions.Value("TableName") = "Parts List"
'choose to include the parts list title row
'in this example "Ye Old List of Parts" is written to the StartingCell
oOptions.Value("IncludeTitle") =True
'choose not to autofit the column width in the xls file
oOptions.Value("AutoFitColumnWidth") = False
'choose to apply cell formatting in the xls file
oOptions.Value("ApplyCellFormatting") = True
' export the Partslist to Excel with options
oPartslist.Export (path_and_name & ".xls", PartsListFileFormatEnum.kMicrosoftExcel, oOptions)