Export to PDF and DXF on close

Export to PDF and DXF on close

Anonymous
Not applicable
543 Views
2 Replies
Message 1 of 3

Export to PDF and DXF on close

Anonymous
Not applicable

Hi ,

 

Who can help me. I'm looking for a script that makes automatically PDF AND DXF when i close a IDW drawing.

 

So on close export to PDF and DXF

 

Thanks in advance. 

0 Likes
544 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

Hi dodrain!

 

First add rule in ilogic panel with the code inside and set the event triggers in the ilogic panel to at close document

this is my code, save in same folder

 

oPath = ThisDoc.Path oFileName = ThisDoc.FileName(False) 'without extension oPDFAddIn = ThisApplication.ApplicationAddIns.ItemById _ ("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}") oDocument = ThisApplication.ActiveDocument oContext = ThisApplication.TransientObjects.CreateTranslationContext oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism oOptions = ThisApplication.TransientObjects.CreateNameValueMap oDataMedium = ThisApplication.TransientObjects.CreateDataMedium

If oPDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then oOptions.Value("All_Color_AS_Black") = 0 oOptions.Value("Remove_Line_Weights") = 0 oOptions.Value("Vector_Resolution") = 1200 oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets 'oOptions.Value("Custom_Begin_Sheet") = 2 'oOptions.Value("Custom_End_Sheet") = 4 End If

 'Set the PDF target file name oDataMedium.FileName = oFileName & ".pdf"

'Publish document oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)

0 Likes
Message 3 of 3

Anonymous
Not applicable

oops end this one is for dxf lol sorry set the triggers same to pdf 🙂

 

' Get the DXF translator Add-In. Dim DXFAddIn As TranslatorAddIn DXFAddIn = ThisApplication.ApplicationAddIns.ItemById("{C24E3AC4-122E-11D5-8E91-0010B541CD80}") 'Set a reference to the active document (the document to be published). Dim oDocument As Document oDocument = ThisApplication.ActiveDocument Dim oContext As TranslationContext oContext = ThisApplication.TransientObjects.CreateTranslationContext oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism ' Create a NameValueMap object Dim oOptions As NameValueMap oOptions = ThisApplication.TransientObjects.CreateNameValueMap ' Create a DataMedium object Dim oDataMedium As DataMedium oDataMedium = ThisApplication.TransientObjects.CreateDataMedium ' Check whether the translator has 'SaveCopyAs' options If DXFAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then Dim strIniFile As String strIniFile = "C:\temp\dxfout.ini" ' Create the name-value that specifies the ini file to use. oOptions.Value("Export_Acad_IniFile") = strIniFile End If 'Set the destination file name oDataMedium.FileName = ThisDoc.PathAndFileName(False) & ".dxf" 'Publish document. DXFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium) 'Launch the dxf file in whatever application Windows is set to open this document type with

 

 

0 Likes