Exporting Files After Project Completion

Exporting Files After Project Completion

phlyx
Collaborator Collaborator
667 Views
3 Replies
Message 1 of 4

Exporting Files After Project Completion

phlyx
Collaborator
Collaborator

We design and build custom machinery and since these are one shot machines each machine has it's own project folders with its own ipj project file.  When we're done with the design and it moves into production, we are required to provide a variety of files for manufacturing and production.  We currently use Task Scheduler for these tasks:

 

- Create DWF files from all assemblies

- Create DXF files from all drawings

- Create PDF printouts for all drawings

- Create STEP files from parts

 

There are a lot of "challenges" when using Task Scheduler for this:

 

- DWF files end up named <FILENAME>.iam.dwf rather than just <FILENAME>.dwf

- DXF files end up being zipped and named <FILENAME>.idw.zip and the files they contain are named <FILENAME>.idw.dxf

- PDF files are difficult to create as most PDF printing programs require some user input during the printing process

 

And we have to create a new task for each type of export we're doing and for each project we complete.  Very laborious and time consuming.

 

Was wondering if there was a better way to accomplish the exporting of a complete project and keep in mind some of our projects consist of dozens of assemblies and hundreds of parts.

 

Thanks.

 

 

0 Likes
668 Views
3 Replies
Replies (3)
Message 2 of 4

mcgyvr
Consultant
Consultant

Off the top of my head I would just create a few ilogic rules as needed for each of the different requirements to create the needed files each time you save (ilogic trigger...before save event)

Then your process happens automatically and there is no needing to use task scheduler at all..

 

If you are familiar with ilogic it all you can easily get the needed code by simply googling "ilogic save as pdf" or whatever and go from there..

 

 

 



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
0 Likes
Message 3 of 4

philip1009
Advisor
Advisor

Exporting to different file formats during a Save event is easy with iLogic, you wouldn't have to worry about it at the end of a project.

 

The only slightly tricky part is what kind of folder structure you have and whether you want the exported files in different folders for each project.

 

I haven't used Task Scheduler, so I'm not familiar how it gathers filenames for exporting, but this isn't a problem with iLogic when written correctly.

 

For PDF Printing, the easiest solution is to use Microsoft Print to PDF, but that's only available in Windows 10.  The only other solution to PDFs is to use the PDF Export function built in to Inventor, unfortunately a side effect that hasn't been removed yet is the line layers can be individually selected and turned off in the PDF, which some companies don't like due to some copyright issues on top of just being annoying.

 

For quick export rules, each of these rules will export matching filenames and will go in the same folder as the file it was exported from.

 

Here's the rule for exporting a DWF file from an assembly:

I haven't work with DWF files, so I don't know all of the options for exporting, but they probably aren't too hard to find.

SyntaxEditor Code Snippet

'Get DWF Add In by ID Number.
DWFAddIn = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD95-2F4D-42CE-8BE0-8AEA580399E4}")

oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = kFileBrowseIOMechanism

'Set Options for Export.
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
If DWFAddIn.HasSaveCopyAsOptions(ThisDoc.Document, oContext, oOptions) Then
    oOptions.Value("Launch_Viewer") = 0
'Other Options. 'oOptions.Value("Publish_All_Component_Props") = 1 'oOptions.Value("Publish_All_Physical_Props") = 1 'oOptions.Value("Password") = 0 End If 'Set filename and folder for export. oDataMedium = ThisApplication.TransientObjects.CreateDataMedium oDataMedium.FileName = ThisDoc.PathAndFileName(False) + ".dwf" 'Export DWF File. Call DWFAddIn.SaveCopyAs(ThisDoc.Document, oContext, oOptions, oDataMedium) 

 

Here's the rule to export a STEP file from a part:

 

SyntaxEditor Code Snippet

'Get STEP Translator by Add In ID Number.
oSTEPTranslator = ThisApplication.ApplicationAddIns.ItemById("{90AF7F40-0C01-11D5-8E83-0010B541CD80}")

oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = kFileBrowseIOMechanism

oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
oDataMedium.FileName = ThisDoc.PathAndFileName(False) + ".stp"

'Set Options for Export, then Export.
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
If oSTEPTranslator.HasSaveCopyAsOptions(ThisDoc.Document, oContext, oOptions) Then
    ' Set application protocol.
    ' 2 = AP 203 - Configuration Controlled Design
    ' 3 = AP 214 - Automotive Design
    oOptions.Value("ApplicationProtocolType") = 2

    ' Other options...
    'oOptions.Value("Author") = ""
    'oOptions.Value("Authorization") = ""
    'oOptions.Value("Description") = ""
    'oOptions.Value("Organization") = ""

    Call oSTEPTranslator.SaveCopyAs(ThisDoc.Document, oContext, oOptions, oDataMedium)
End If

 

Here's the rule for exporting DXF from a Drawing:

 

SyntaxEditor Code Snippet

'Get DXF Add In by ID Number.
DXFAddIn = ThisApplication.ApplicationAddIns.ItemById("{C24E3AC4-122E-11D5-8E91-0010B541CD80}")

oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = kFileBrowseIOMechanism

'Set path and file name for export.
oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
oDataMedium.FileName = ThisDoc.PathAndFileName(False) + ".dxf"

' Get INI file for DXF Options.
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
oOptions.Value("Export_Acad_IniFile") = "C:\tempDXFOut.ini" '''Enter your folder location and name of .ini file here.

Call DXFAddIn.SaveCopyAs(ThisDoc.Document, oContext, oOptions, oDataMedium)

 

Here's the PDF Export via Microsoft Print to PDF:

 

 SyntaxEditor Code Snippet

'Set PDF Print Options.
prntMgr
= ThisApplication.ActiveDocument.PrintManager
prntMgr.Printer = "Microsoft Print to PDF"
prntMgr.ColorMode = kPrintDefaultColorMode
prntMgr.Orientation = kLandscapeOrientation
prntMgr.Scale = kPrintBestFitScale
prntMgr.PaperSize = kPaperSizeDefault
prntMgr.PrintRange = kPrintAllSheets

'Export PDF.
prntMgr.PrintToFile(ThisDoc.PathAndFileName(False) + ".pdf"

 

Here's the PDF Export via Inventor PDF Export:

 

SyntaxEditor Code Snippet

'Get PDF Add In by ID Number.
oPDFAddIn
= ThisApplication.ApplicationAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
oContext = ThisApplication.TransientObjects.CreateTranslationContext oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism

'Set folder path and file name for Export.
oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
oDataMedium.FileName = ThisDoc.PathAndFileName(False) + ".pdf"

'Set Options for Export. oOptions = ThisApplication.TransientObjects.CreateNameValueMap oOptions.Value("All_Color_AS_Black") = 0 oOptions.Value("Remove_Line_Weights") = 1 oOptions.Value("Vector_Resolution") = 4800 oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets

Call oPDFAddIn.SaveCopyAs(ThisDoc.Document, oContext, oOptions, oDataMedium)

Let me know if you have any issues or any questions for setting up each rule.

 

Philip Martick
Inventor 2018 Pro, AutoCAD 2018, Autodesk Vault Basic 2018
Windows 10 Pro
2X Intel Xeon E5-2630 v4 @ 2.20GHz
16.00 GB of RAM
NVIDIA Quadro M2000

0 Likes
Message 4 of 4

phlyx
Collaborator
Collaborator

Hi Philip,

 

Amazing stuff there and sorry for not replying sooner.   We're busy with new projects and moving into a new facility so we're juggling a lot right now.  I'll grab those snippets and looks to be exactly what we were looking for.

 

Thanks!

0 Likes