Hi All,
I would like to save stl files in mm and high quality. This is easily done manually, by changing the settings in the options bar, but when iLogic saves as an stl it reverts back to saving in cm with standard quality.
I'm using this to autosave:
ThisDoc.Document.SaveAs(ThisDoc.ChangeExtension(".stl"), True)
Any help, greatly appreciated.
Thanks
Solved! Go to Solution.
Solved by t_hascj. Go to Solution.
Hi c.pikket,
Please, try this code:
sTLname = ( "D:\LOD\PART001.STL" ) Dim oTranslator As TranslatorAddIn oTranslator = ThisApplication.ApplicationAddIns.ItemById("{533E9A98-FC3B-11D4-8E7E-0010B541CD80}") Dim oContext As TranslationContext oContext = ThisApplication.TransientObjects.CreateTranslationContext Dim oOptions As NameValueMap oOptions = ThisApplication.TransientObjects.CreateNameValueMap If oTranslator.HasSaveCopyAsOptions (ThisApplication.ActiveDocument, oContext, oOptions) Then oOptions.Value("ExportUnits") = 5 'Millimeter oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism Dim oData As DataMedium oData = ThisApplication.TransientObjects.CreateDataMedium oData.FileName = sTLname oTranslator.SaveCopyAs(ThisApplication.ActiveDocument, oContext, oOptions, oData) End If
Thanks,
Jaroslav
Hello Jaroslav,
Thank you for your help.
I'm just wondering if this will save the stl file with the name of the part or will it always save it with the same file name?
I'm looking for it to be saved with the same file name as the part.
Thanks 🙂
Hi Jaroslav,
Thanks,
With a bit of editing it works beautifully:
Format:HTML Format Version:1.0 StartHTML: 165 EndHTML: 8679 StartFragment: 314 EndFragment: 8647 StartSelection: 314 EndSelection: 314SyntaxEditor Code Snippet
sTLname = ThisDoc.ChangeExtension(".stl") Dim oTranslator As TranslatorAddIn oTranslator = ThisApplication.ApplicationAddIns.ItemById("{533E9A98-FC3B-11D4-8E7E-0010B541CD80}") Dim oContext As TranslationContext oContext = ThisApplication.TransientObjects.CreateTranslationContext Dim oOptions As NameValueMap oOptions = ThisApplication.TransientObjects.CreateNameValueMap If oTranslator.HasSaveCopyAsOptions (ThisApplication.ActiveDocument, oContext, oOptions) Then oOptions.Value("ExportUnits") = 5 'Millimeter oOptions.Value("Resolution") = 0 'High oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism Dim oData As DataMedium oData = ThisApplication.TransientObjects.CreateDataMedium oData.FileName = sTLname oTranslator.SaveCopyAs(ThisApplication.ActiveDocument, oContext, oOptions, oData) End If
Thanks 🙂
Can't find what you're looking for? Ask the community or share your knowledge.