Export iPart members as STEP files using iLogic
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
iLogic to direct export the iPart factory members as individual STEP files:
- No need for VBA or to generate individual iPart members and then use Inventor Task Scheduler.
- Tested in Inventor 2024
Customize the iLogic as needed:
- Define output file location for the STEP files
- STEP file names will be assigned as per the iPart member names
Dim PartDoc As PartDocument Dim STEPTranslator As TranslatorAddIn Dim TranslationContext As TranslationContext Dim NameValueMap As NameValueMap Dim DataMedium As DataMedium Dim MemberName As String ' Get the current part document PartDoc = ThisApplication.ActiveDocument ' Ensure the document is an iPart factory If PartDoc.ComponentDefinition.IsiPartFactory Then ' Get the STEP translator Add-In. STEPTranslator = ThisApplication.ApplicationAddIns.ItemById("{90AF7F40-0C01-11D5-8E83-0010B541CD80}") If STEPTranslator Is Nothing Then MsgBox("Could not access STEP translator.") Exit Sub End If ' Create the necessary objects for translation TranslationContext = ThisApplication.TransientObjects.CreateTranslationContext NameValueMap = ThisApplication.TransientObjects.CreateNameValueMap DataMedium = ThisApplication.TransientObjects.CreateDataMedium ' Check if SaveCopyAs options are available If STEPTranslator.HasSaveCopyAsOptions(PartDoc, TranslationContext, NameValueMap) Then ' Set application protocol >> 2 = AP 203 - Configuration Controlled Design | 3 = AP 214 - Automotive Design NameValueMap.Value("ApplicationProtocolType") = 3 ' Set the context type TranslationContext.Type = kFileBrowseIOMechanism ' Loop through each row (iPart member) in the iPart factory For Each iPartTableRow In PartDoc.ComponentDefinition.iPartFactory.TableRows ' Get the iPart member name and Activate it MemberName = iPartTableRow.MemberName iPart.ChangeRow("", MemberName) ' Define the output file path and name (using the member name) DataMedium.FileName = "C:\Users\Public\Desktop\STEP\" & MemberName & ".step" ' Perform the translation (export) Call STEPTranslator.SaveCopyAs(PartDoc, TranslationContext, NameValueMap, DataMedium) Next iPartTableRow MsgBox("STEP file exported successfully.") Else MsgBox("Could not export STEP file.") End If Else MsgBox("The active document is not an iPart factory.") End If