ilogic sequence

ilogic sequence

Anonymous
Not applicable
576 Views
2 Replies
Message 1 of 3

ilogic sequence

Anonymous
Not applicable

I have a bunch of idw's in the workpath of my project directory

 

I am looking to get ilogic to do the following

 

  1. open drawing
  2. in styles editor, import a new part list style called "SPIDERPARTSLIST" file name = SPIDERPARTSLIST.styxm locations = desktop
  3. change the current parts list to the newly imported one
  4. export part list as xls
  5. delete parts list
  6. export idw as pdf (all sheets)
  7. close idw without saving

 

I hope someone out there can help me.

 

Thanks

 

 

577 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

There are no methods currently available in API to interact with the Styles Editor (as of Inventor 2014). In this case, you won't be able to fully automate your sequence. The likely best alternative would be to use the command manager and launch the styles editor and manually import you .styxml file.

0 Likes
Message 3 of 3

Ktomberlin
Advocate
Advocate
'UPDATE TITLE BLOCK SHEET 1
ThisDrawing.ResourceFileName = "C:\Vault Explorer\Templates\PartsListDrawing.idw"
ThisDrawing.KeepExtraResources = False
Dim oDrawingDoc As Document = ThisApplication.ActiveDocument
'Update Styles
Dim i As Integer
For i = 1 To oDrawingDoc.StylesManager.Styles.Count
If oDrawingDoc.StylesManager.Styles.Item(i).UpToDate = False Then
 oDrawingDoc.StylesManager.Styles.Item(i).UpdateFromGlobal
End If
Next

You could create a new drawing template with the parts list you want renamed as the default one. Since your not saving these changes it won't do any harm.  Or you could update the styles like above, but then change the parts list using the code. 

 

 

Dim oDrawDoc As DrawingDocument
    oDrawDoc = ThisApplication.ActiveDocument
        
    'Set a reference to the active sheet.
    Dim oSheet As Sheet
    oSheet = oDrawDoc.ActiveSheet

    'Look for partlist within drawing. End rule, if it doesn't exist.
    'say there is a Partslist on the sheet.
    Dim oPartslist As PartsList
    oPartslist = oSheet.PartsLists(1)

    If oSheet.PartsLists(1) IsNot Nothing Then

        'set parts list to a specific style
        oPartsList.Style = oDrawDoc.StylesManager.PartsListStyles.Item("SPIDERPARTSLIST")

     End If

To export the bom there is a snippet for it that looks something like. Look at the snippet of you want another format. 

 

'Get the Filename of the file without the extension
FileName = ThisDoc.FileName(False) 'without extension

'Sets the path and filename of where the Exported BOM should be saved
BOMFile = "C:\BOMs\" & FileName & ".xls"

'Exports the BOM to the desired location
ThisBOM.Export("Structured", BOMFile, kMicrosoftExcelFormat)

 

Hope this helps. 

0 Likes