Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi I have just started to see that ilogics can make things easier.
Currently when I create a final .idw I need to manually create a PDF and DXF under a folder called PDFDXF that is found under same file location. All files are kept under Vault project.
Using naming example DD-01 revA - Part Number and current revision of part.
I have used this code to ask if PDF and DXF are needed and it creates the files under correct PDFDXF folder (using as external rule .txt and trigger when closed)
oPath = ThisDoc.Path oFileName = ThisDoc.FileName(False) 'without extension oRevNum = iProperties.Value("Project", "Revision Number") oPDFAddIn = ThisApplication.ApplicationAddIns.ItemById _ ("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}") oDXFAddIn = ThisApplication.ApplicationAddIns.ItemById("{C24E3AC4-122E-11D5-8E91-0010B541CD80}") oDocument = ThisApplication.ActiveDocument oContext = ThisApplication.TransientObjects.CreateTranslationContext oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism oOptions = ThisApplication.TransientObjects.CreateNameValueMap oDataMedium = ThisApplication.TransientObjects.CreateDataMedium 'query user question = MessageBox.Show("Create PDF?", "Create PDF?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) 'set condition based on answer If question = vbYes Then '------start of iLogic------- If oPDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then oOptions.Value("All_Color_AS_Black") = 1 oOptions.Value("Remove_Line_Weights") = 1 oOptions.Value("Vector_Resolution") = 400 oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets 'oOptions.Value("Custom_Begin_Sheet") = 2 'oOptions.Value("Custom_End_Sheet") = 4 End If 'get PDF target folder path oFolder = oPath & "\" & "PDFDXF" 'Check for the PDF folder and create it if it does not exist If Not System.IO.Directory.Exists(oFolder) Then System.IO.Directory.CreateDirectory(oFolder) End If 'Set the PDF target file name oDataMedium.FileName = oFolder & "\" & oFileName & _ " rev" & oRevNum & ".pdf" MessageBox.Show("PDF SAVED TO: " & oDataMedium.FileName, "PDF Saved", MessageBoxButtons.OK) 'Publish document oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium) '------end of iLogic------- Else If question = vbNo Then End If 'query user question = MessageBox.Show("Create DXF?", "Create DXF?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) 'set condition based on answer If question = vbYes Then 'get DXF target folder path oFolder = oPath & "\" & "PDFDXF" 'Check for the DXF folder and create it if it does not exist If Not System.IO.Directory.Exists(oFolder) Then System.IO.Directory.CreateDirectory(oFolder) End If 'Set the DXF target file name oDataMedium.FileName = oFolder & "\" & oFileName & _ " rev" & oRevNum & ".dxf" MessageBox.Show("DXF SAVED TO: " & oDataMedium.FileName, "DXF Saved", MessageBoxButtons.OK) 'Publish document oDXFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium) '------end of iLogic------- Else If question = vbNo Then End If
Is it possible to get it to check these PDF & DXF into Vault?
I have added the ilogic to our standard template but what is the best way to add it to existing drawings?
Thanks
Solved! Go to Solution.