Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic - save as stl in mm with high quality

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Anonymous
1703 Views, 3 Replies

iLogic - save as stl in mm with high quality

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

 

3 REPLIES 3
Message 2 of 4
t_hascj
in reply to: Anonymous

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

https://forums.autodesk.com/t5/inventor-forum/ilogic-generating-stl-files-in-millimeters-and-with-a-...

 

Thanks,
Jaroslav

Message 3 of 4
Anonymous
in reply to: t_hascj

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 🙂

Message 4 of 4
Anonymous
in reply to: t_hascj

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.

Post to forums  

Autodesk Design & Make Report