Hello,
I have a parametric model of a product. By changing the custom parameter values I can easily modify that product to actual needs.
I do not use vault but have a 'track and trace' procedure to always export that parametric model to a step file.
The name of the stepfile ought to be based on different custom parameters and their values. E.g. 'CS40,0 CWT2,0 CWST0,25.step' where CS CWT and CWST are custom parameter names each sequenced by its value in the parametric ipt model. In real there are some more parameters and values to the name.
Is there a way to automatically generate the name of this step file each time I export it from the parametric model. Now I have to take a piece of paper to note down the parameter (short memory failure) values to give it the correct name. Nevertheless the risk of making errors remains.
Looking very hard forward to a solution for this inconvenience.
Thanks & best regards
Wouter
Solved! Go to Solution.
Yes you can do this with iLogic.
You can create a rule that translates your file to a step and give it a custom name.
You can use something like this
dim oDestPath as string = 'folder path location
dim oStepFileName as string = 'your parameters
SaveFile = oDestPath & oStepFileName & ".stp"
ThisDoc.Document.SaveAs(SaveFile, True)
There's alot of people with extensive knowledge about iLogic here. If you can give more details i'm sure there will be a fitting solution.
Here's the code you need.
I put in 2 lines for the file path, as it is, it will save the STEP file to the same location as the current file (with the naming convention you asked for). If you want the file to save to a specific location change the values in "oPath" (currently "C:\CAD\STEP Files\") and uncomment the 2nd oPath (remove the ' before oPath)
oParamnames = "CST" & CST & " CWT" & CWT & " CWST"& CWST & ".stp" oPath = ThisDoc.Path ' use this line to save to current file location 'oPath = "C:\CAD\STEP Files\" 'make sure you include a "\" at the end eg "C:\CAD\STEP Files\" ' 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 ' Set application protocol. ' 2 = AP 203 - Configuration Controlled Design ' 3 = AP 214 - Automotive Design oOptions.Value("ApplicationProtocolType") = 3 oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism Dim oData As DataMedium oData = ThisApplication.TransientObjects.CreateDataMedium oData.FileName = oPath & oParamnames oSTEPTranslator.SaveCopyAs(ThisApplication.ActiveDocument, oContext, oOptions, oData) End If
@Anonymous That worked fine, thanks alot!
I only had to 'comment' the oPath = ThisDoc.path for it to save to actual location. Don't know why.
Anyhow, this saves some work.
Best regards
Wouter
Can't find what you're looking for? Ask the community or share your knowledge.