- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Guys,
We've got a few Ilogic external rules we use regularly to export PDF/DXF's of our sheet metal parts for laser cutting and folding. They go into a specific directory on another drive for our purchasing staff to use.
Our suppliers have a new software which can work more efficiently using .step files. I found a code which exports the step file to the same directory the parts our saved, but I'm not great with ilogic and I'm struggling to figure out how to direct the exported part to the specific directory we want them to go to.
This is the step file code, I've seen it posted in a few different threads.
' Start of iLogic code ******************************************* Stepfilename = ThisDoc.PathAndFileName(False) FileExists = True 'check to see if the file to be exported already exists Do While FileExists ' Define name of exported file - note a .stp file extension ' Is currently being used. In this example I am exporting a Step file Rev = iProperties.Value("Project", "Revision Number") CurrentFile = Stepfilename & Rev & ".stp" 'If Dir(CurrentFile) <> "" Then ' The file does exist ' Counter += 1 ' FileExists = True 'Else SaveAs = MessageBox.Show("Export file as '" & CurrentFile & _ "'?", "Cadline iLogic", _ MessageBoxButtons.YesNo, MessageBoxIcon.Question, _ MessageBoxDefaultButton.Button1) If SaveAs = vbNo Then Return Else ' User says continue FileExists = False End If ' End If Loop ' Put your export or 'save as' code in here *********************** ' Get the STEP translator Add-In. Dim oSTEPTranslator As TranslatorAddIn oSTEPTranslator = ThisApplication.ApplicationAddIns.ItemById _ ("{90AF7F40-0C01-11D5-8E83-0010B541CD80}") Dim oContext As TranslationContext oContext = ThisApplication.TransientObjects.CreateTranslationContext Dim oOptions As NameValueMap oOptions = ThisApplication.TransientObjects.CreateNameValueMap If oSTEPTranslator.HasSaveCopyAsOptions(ThisApplication.ActiveDocument _ , oContext, oOptions) Then oOptions.Value("ApplicationProtocolType") = 3 oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism Dim oData As DataMedium oData = ThisApplication.TransientObjects.CreateDataMedium ' Set export name of STEP file oData.FileName = CurrentFile oSTEPTranslator.SaveCopyAs(ThisApplication.ActiveDocument, oContext _ , oOptions, oData) End If ' End of export code *********************************************** ' Ask user if they want to open the export folder 'OpenFolder = MessageBox.Show("Export successful! " & _ '"- open containing folder now?", "Cadline iLogic", _ 'MessageBoxButtons.YesNo, _ 'MessageBoxIcon.Question,MessageBoxDefaultButton.Button1) 'If OpenFolder = vbYes Then ' Process.Start("explorer.exe", ThisDoc.Path) 'Else ' User says continue 'Return 'End If ' End of iLogic code **************************************************
I've looked at these snippets of our dxf export code to try and get the parts directing the file to the correct directory
Dim sPATH As String sPATH = "P:\Procurement\Drawing" sOut = "FLAT PATTERN DXF?AcadVersion=2000&OuterProfileLayer=IV_INTERIOR_PROFILES" Dim sFname As String sFname = sPATH & "\" & ThisDoc.FileName(False) & iProperties.Value("Project", "Revision Number") & ".dxf" MessageBox.Show("DXF SAVED TO: " & sFname ,"DXF Saved", MessageBoxButtons.OK)
Any help would be greatly appreciated
Thanks
Matt
Solved! Go to Solution.