- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
So, I used the custom iLogic snippet called "Save As STEP File". It works fine, just the way it is to save the STEP file with the same name as the source file and in the same folder as the source file. But, what I really want to do is save a STEP file to the same folder as the source, but use the iProperty "Part Number" and then an underscore "_" and then the iProperty "Revision Number" for the new file name.
I added one line to define the Step File Name and also added a line below the oData.Filename line, to try and pull the current document path and then the new file name. It works except it always saves the file one folder higher than the source file folder location and it adds that folder name to the beginning of the new file name.
Example:
The source file is in C:\Work\Designs\Testing. I want the file name to be Eric-123456_A.stp
It saves the file in C:\Work\Designs and names the file TestingEric-123456_A.stp
Any idea what I'm doing wrong?
SyntaxEditor Code Snippet
' 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 oStepFileName = iProperties.Value("Project", "Part Number") & "_" & iProperties.Value("Project", "Revision Number") If oSTEPTranslator.HasSaveCopyAsOptions(ThisApplication.ActiveDocument, oContext, oOptions) Then ' Set application protocol. ' 2 = AP 203 - Configuration Controlled Design ' 3 = AP 214 - Automotive Design oOptions.Value("ApplicationProtocolType") = 3 ' Other options... 'oOptions.Value("Author") = "" 'oOptions.Value("Authorization") = "" 'oOptions.Value("Description") = "" 'oOptions.Value("Organization") = "" oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism Dim oData As DataMedium oData = ThisApplication.TransientObjects.CreateDataMedium 'oData.FileName = ThisDoc.PathAndFileName(False) & ".stp" oData.FileName = ThisDoc.Path & oStepFileName & ".stp" oSTEPTranslator.SaveCopyAs(ThisApplication.ActiveDocument, oContext, oOptions, oData) End If
Solved! Go to Solution.