Community
Public Sub SendIGES() ' Get the IGES translator Add-In. Dim oIGESTranslator As TranslatorAddIn Set oIGESTranslator = ThisApplication.ApplicationAddIns.ItemById("{90AF7F44-0C01-11D5-8E83-0010B541CD80}") Dim oContext As TranslationContext Set oContext = ThisApplication.TransientObjects.CreateTranslationContext Dim oOptions As NameValueMap Set oOptions = ThisApplication.TransientObjects.CreateNameValueMap Dim oData As DataMedium Set oData = ThisApplication.TransientObjects.CreateDataMedium Dim i As Long 'Counter for For loop Dim oAssyDoc As AssemblyDocument Set oAssyDoc = ThisApplication.ActiveDocument Dim oAssyCompDef As AssemblyComponentDefinition Set oAssyCompDef = oAssyDoc.ComponentDefinition Dim oPartDoc As PartDocument Dim oPartCompDef As PartComponentDefinition oContext.Type = kFileBrowseIOMechanism Dim oOcc As ComponentOccurrence i = 1 For Each oOcc In oAssyCompDef Set oPartDoc = oAssyCompDef.Occurrences.Item(i) Set oPartCompDef = oPartDoc.ComponentDefinition oData.FileName = "C:\Users\JBL09\Desktop\iges test\Temptest_" & i & ".igs" Call oIGESTranslator.SaveCopyAs(oPartCompDef, oContext, oOptions, oData) i = i + 1 Next End Sub
I have this code to try to export an iges file for each part in an assy. However, I get an error when the code tries to run the For loop. What gives?
Solved! Go to Solution.
I figured it out. For anyone wanting to know here's the new For loop that works.
For Each oOcc In oAssyCompDef.Occurrences oData.FileName = "C:\iges test\Temptest_" & i & ".igs" Call oIGESTranslator.SaveCopyAs(oOcc.Definition.Document, oContext, oOptions, oData) i = i + 1 Next
Can't find what you're looking for? Ask the community or share your knowledge.