Not applicable
09-11-2013
09:39 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I created a iLogic routine to generate a STL file if the iProperty "Printed Part" is set to YES.
I am getting an error when Ln33 oTranslator.SaveCopyAs(oDocument, oContext, oOptions, oData) is executed.
Any help would be appriciated
If iProperties.Value("Custom", "Printed Part") = False Then 'False = "NO" Return Else MsgBox ("Selected to output STL for printing" & vbCrLf & "Disable by setting the custom iProperty:Printed Part to NO") End If 'Create _OUTPUTS directory oPath = ThisDoc.Path oFolder = oPath & "\" & iProperties.Value("Custom", "Output Directory") 'Check for the custom iProperty directory and create it if it does not exist If Not System.IO.Directory.Exists(oFolder) Then System.IO.Directory.CreateDirectory(oFolder) End If ' Get the STL translator Add-In. 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 'Configure options and write out If oTranslator.HasSaveCopyAsOptions (ThisApplication.ActiveDocument, oContext, oOptions) Then oOptions.Value("ExportUnits") = 1 'Inch 'Based off of index in combo box in STL Export Dialog oOptions.Value("Resolution") = 1 'High 'Based off of index of radio buttons in STL Export Dialog oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism Dim oData As DataMedium oData = ThisApplication.TransientObjects.CreateDataMedium Dim oFileName As String oFileName = ThisDoc.PathAndFileName(False) oData.FileName = oFolder & "\" & oFileName & " Rev " & oRevNum & ".stl" ' 'Write out file oTranslator.SaveCopyAs(oDocument, oContext, oOptions, oData) Else MsgBox("!!!ERROR: STL File was not created!!!") End If
Solved! Go to Solution.
Link copied