<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Betreff: help export step file to iam in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/10686747#M130020</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As I can see, iLogic's Component.IsActive sets the status of a component to suppressed and also sets the BOM structure to reference for this occurrences. That's why the BOM shows correct parts only view.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your subassemblies seems to have a write protected LoD active. So setting component status by iLogic is not allowed. You have to switch to a writeable LoD in the subassemblies before.&lt;/P&gt;&lt;P&gt;Can't give you more details, cause nothing of this is shown in your code. It's very hard to follow you, but I'll try my best. &lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@B4D44A73814D7FC0D950DEDFACB97081/emoticons/1f642.png" alt=":slightly_smiling_face:" title=":slightly_smiling_face:" /&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 13 Oct 2021 21:33:07 GMT</pubDate>
    <dc:creator>Ralf_Krieg</dc:creator>
    <dc:date>2021-10-13T21:33:07Z</dc:date>
    <item>
      <title>help export step file to iam</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/10675439#M129797</link>
      <description>&lt;PRE&gt;&lt;SPAN class="Y2IQFc"&gt;hello, I need some help ...
i have an assembly file with ilogic rules and part and subassemblies.
according to certain ilogic rules I need to export only the visible elements and not all the parts present in the assembly to file step.
I found a rule already made and it works but not as I would like.

the problem is this rule exports the visible files but also the derivatives which, however, are not visible in the assembly.

how could I do not to make it exhibit a derivative part.

the derived part is used for a mirrored part so in my assembly it is not visually present.

I can't delete the link with the derived part because it's all parametric and I need the parameters

the rule I am using is this:&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;Sub Main()&lt;BR /&gt;Dim oAsmDoc As AssemblyDocument&lt;BR /&gt;oAsmDoc = ThisApplication.ActiveDocument&lt;BR /&gt;oAsmName = Left(oAsmDoc.DisplayName, Len(oAsmDoc.DisplayName) -4)&lt;BR /&gt;&lt;BR /&gt;'check that the active document is an assembly file&lt;BR /&gt;If ThisApplication.ActiveDocument.DocumentType &amp;lt;&amp;gt; kAssemblyDocumentObject Then&lt;BR /&gt;MessageBox.Show("Please run this rule from the assembly file.", "iLogic")&lt;BR /&gt;Exit Sub&lt;BR /&gt;End If&lt;BR /&gt;&lt;BR /&gt;'get user input&lt;BR /&gt;' If MessageBox.Show ( _&lt;BR /&gt;' "This will create a STP file for all of the asembly components that have drawings files." _&lt;BR /&gt;' &amp;amp; vbLf &amp;amp; "This rule expects that the drawing file shares the same name and location as the component." _&lt;BR /&gt;' &amp;amp; vbLf &amp;amp; " " _&lt;BR /&gt;' &amp;amp; vbLf &amp;amp; "Are you sure you want to create STP Drawings for all of the assembly components?" _&lt;BR /&gt;' &amp;amp; vbLf &amp;amp; "This could take a while.", "iLogic - Batch Output STPs ",MessageBoxButtons.YesNo) = vbNo Then&lt;BR /&gt;'&lt;BR /&gt;' Exit Sub&lt;BR /&gt;' End If&lt;BR /&gt;&lt;BR /&gt;Dim STEPTranslator As TranslatorAddIn&lt;BR /&gt;Dim oContext As TranslationContext&lt;BR /&gt;Dim oOptions As NameValueMap&lt;BR /&gt;Dim oDataMedium As DataMedium&lt;BR /&gt;&lt;BR /&gt;Call ConfigureSTEPTranslatorSettings(STEPTranslator, oContext, oOptions, oDataMedium)&lt;BR /&gt;&lt;BR /&gt;'oPath = ThisDoc.Path&lt;BR /&gt;oFolder = "C:\Users\STEFANIA\Desktop\Nuova cartella (3)" &amp;amp; "\" &amp;amp; oAsmName &amp;amp; " STEP Files"&lt;BR /&gt;&lt;BR /&gt;If Not System.IO.Directory.Exists(oFolder) Then&lt;BR /&gt;System.IO.Directory.CreateDirectory(oFolder)&lt;BR /&gt;End If&lt;BR /&gt;&lt;BR /&gt;'- - - - - - - - - - - - -Component Drawings - - - - - - - - - - - -'&lt;BR /&gt;'look at the files referenced by the assembly&lt;BR /&gt;Dim oRefDoc As Document&lt;BR /&gt;&lt;BR /&gt;For Each oRefDoc In oAsmDoc.AllReferencedDocuments&lt;BR /&gt;idwPathName = Left(oRefDoc.FullDocumentName, Len(oRefDoc.FullDocumentName) - 3) &amp;amp; "idw"&lt;/P&gt;&lt;P&gt;' If(System.IO.File.Exists(idwPathName)) Then&lt;BR /&gt;Dim oSTEPDoc As Document&lt;BR /&gt;oSTEPDoc = ThisApplication.Documents.Open(oRefDoc.FullFileName, True)&lt;BR /&gt;oFileName = Left(oRefDoc.DisplayName, Len(oRefDoc.DisplayName) -4)&lt;BR /&gt;' oRevNum = oDrawDoc.PropertySets.Item("Inventor Summary Information").Item("Revision Number").Value&lt;BR /&gt;'oDesc = oRefDoc.iProperties.Value("Project", "Description")&lt;BR /&gt;oDesc = oSTEPDoc.PropertySets.Item("Design Tracking Properties").Item("Description").Value&lt;BR /&gt;'********************For Each oRefDoc In oRefDocs&lt;/P&gt;&lt;P&gt;iptPathName = Left(oRefDoc.FullDocumentName, Len(oRefDoc.FullDocumentName) - 3) &amp;amp; "ipt"&lt;/P&gt;&lt;P&gt;'check that model is saved&lt;BR /&gt;If(System.IO.File.Exists(iptPathName)) Then&lt;/P&gt;&lt;P&gt;Dim oDrawDoc As PartDocument&lt;/P&gt;&lt;P&gt;oDrawDoc = ThisApplication.Documents.Open(iptPathName, True)&lt;/P&gt;&lt;P&gt;oFileName = Left(oRefDoc.DisplayName, Len(oRefDoc.DisplayName))&lt;BR /&gt;End If&lt;/P&gt;&lt;P&gt;'**********************&lt;BR /&gt;'&lt;BR /&gt;On Error Resume Next&lt;BR /&gt;' 'Set the STP target file name&lt;BR /&gt;' If oRevNum = Nothing Then&lt;BR /&gt;' oDataMedium.FileName = oFolder &amp;amp; "\" &amp;amp; oFileName &amp;amp; ".STP"&lt;BR /&gt;oSTEPDoc.SaveAs(oFolder &amp;amp; "\" &amp;amp; oFileName &amp;amp;"_"&amp;amp; Parameter ("sospensione") &amp;amp; oDesc &amp;amp; (".stp") , True)&lt;BR /&gt;'&lt;BR /&gt;' Else&lt;BR /&gt;' oDataMedium.FileName = oFolder &amp;amp; "\" &amp;amp; oFileName &amp;amp; ".STP"&lt;BR /&gt;' End If&lt;BR /&gt;&lt;BR /&gt;Call STEPTranslator.SaveCopyAs(oSTEPDoc, oContext, oOptions, oDataMedium)&lt;BR /&gt;oRefDoc.Close&lt;BR /&gt;On Error Goto 0&lt;BR /&gt;' End If&lt;BR /&gt;Next&lt;BR /&gt;'- - - - - - - - - - - - -&lt;BR /&gt;&lt;BR /&gt;'- - - - - - - - - - - - -Top Level Drawing - - - - - - - - - - - -&lt;BR /&gt;' Dim oAsmDrawingDoc As DrawingDocument&lt;BR /&gt;' oAsmDrawingDoc = ThisApplication.Documents.Open(ThisDoc.ChangeExtension(".idw"), True)&lt;BR /&gt;' oAsmDrawingName = Left(oAsmDrawingDoc.DisplayName, Len(oAsmDrawingDoc.DisplayName) -4)&lt;BR /&gt;' oAsmDrawingRev = oAsmDrawingDoc.PropertySets.Item("Inventor Summary Information").Item("Revision Number").Value&lt;BR /&gt;'&lt;BR /&gt;' On Error Resume Next&lt;BR /&gt;' 'Set the PDF target file name&lt;BR /&gt;' If oAsmDrawingRev = Nothing Then&lt;BR /&gt;' oDataMedium.FileName = oFolder &amp;amp; "\" &amp;amp; oAsmDrawingName &amp;amp; ".pdf"&lt;BR /&gt;'&lt;BR /&gt;' Else&lt;BR /&gt;' oDataMedium.FileName = oFolder &amp;amp; "\" &amp;amp; oAsmDrawingName &amp;amp; " Rev." &amp;amp; oRevNum &amp;amp; ".pdf"&lt;BR /&gt;'&lt;BR /&gt;' End If&lt;BR /&gt;'&lt;BR /&gt;' Call PDFAddIn.SaveCopyAs(oAsmDrawingDoc, oContext, oOptions, oDataMedium)&lt;BR /&gt;' oAsmDrawingDoc.Close&lt;BR /&gt;&lt;BR /&gt;MessageBox.Show("New Files Created in: " &amp;amp; vbLf &amp;amp; oFolder, "iLogic")&lt;BR /&gt;Shell("explorer.exe " &amp;amp; oFolder,vbNormalFocus)&lt;BR /&gt;End Sub&lt;/P&gt;&lt;P&gt;Sub ConfigureSTEPTranslatorSettings(ByRef STEPTranslator As TranslatorAddIn, ByRef oContext As TranslationContext, ByRef oOptions As NameValueMap, ByRef oDataMedium As DataMedium)&lt;/P&gt;&lt;P&gt;oPath = ThisDoc.Path&lt;BR /&gt;oSTEPTranslator = ThisApplication.ApplicationAddIns.ItemById("{90AF7F40-0C01-11D5-8E83-0010B541CD80}")&lt;BR /&gt;oContext = ThisApplication.TransientObjects.CreateTranslationContext&lt;BR /&gt;oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism&lt;BR /&gt;oOptions = ThisApplication.TransientObjects.CreateNameValueMap&lt;BR /&gt;&lt;BR /&gt;If oSTEPTranslator.HasSaveCopyAsOptions(ThisApplication.ActiveDocument, oContext, oOptions) Then&lt;BR /&gt;' Set application protocol.&lt;BR /&gt;' 2 = AP 203 - Configuration Controlled Design&lt;BR /&gt;' 3 = AP 214 - Automotive Design&lt;BR /&gt;oOptions.Value("ApplicationProtocolType") = 3&lt;BR /&gt;' Other options...&lt;BR /&gt;'oOptions.Value("Author") = ""&lt;BR /&gt;'oOptions.Value("Authorization") = ""&lt;BR /&gt;'oOptions.Value("Description") = ""&lt;BR /&gt;'oOptions.Value("Organization") = ""&lt;BR /&gt;oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism&lt;BR /&gt;' Dim oData As DataMedium&lt;BR /&gt;oDataMedium = ThisApplication.TransientObjects.CreateDataMedium&lt;BR /&gt;oDataMedium.FileName = ThisDoc.PathAndFileName(False) &amp;amp; ".stp"&lt;BR /&gt;oSTEPTranslator.SaveCopyAs(ThisApplication.ActiveDocument, oContext, oOptions, oDataMedium)&lt;BR /&gt;End If&lt;/P&gt;&lt;P&gt;oDataMedium = ThisApplication.TransientObjects.CreateDataMedium&lt;BR /&gt;End Sub&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="Y2IQFc"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2021 11:33:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/10675439#M129797</guid>
      <dc:creator>leoa.87</dc:creator>
      <dc:date>2021-10-08T11:33:31Z</dc:date>
    </item>
    <item>
      <title>Betreff: help export step file to iam</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/10677329#M129823</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've cleaned your code a bit. As I understand, you want to export every visible part in your assembly to an single STEP file. No export of the entire assembly or any subassemblies. Is this correct?&lt;/P&gt;&lt;P&gt;Try this one:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Option Explicit On
Sub Main()

'check that the active document is an assembly file
If ThisDoc.Document.DocumentType &amp;lt;&amp;gt; DocumentTypeEnum.kAssemblyDocumentObject Then
	MessageBox.Show("Please run this rule from the assembly file.", "iLogic")
	Exit Sub
End If

Dim oAsmDoc As AssemblyDocument = ThisDoc.Document
Dim sAsmName As String = System.IO.Path.GetFileNameWithoutExtension(oAsmDoc.FullDocumentName )
Dim sFolder As String = "C:\Users\STEFANIA\Desktop\Nuova cartella (3)" &amp;amp; "\" &amp;amp; sAsmName &amp;amp; " STEP Files"

Dim STEPTranslator As TranslatorAddIn
Dim oContext As TranslationContext = ThisApplication.TransientObjects.CreateTranslationContext
Dim oOptions As NameValueMap = ThisApplication.TransientObjects.CreateNameValueMap
Dim oDataMedium As DataMedium  = ThisApplication.TransientObjects.CreateDataMedium
Call ConfigureSTEPTranslatorSettings(STEPTranslator, oContext, oOptions, oDataMedium)

If Not System.IO.Directory.Exists(sFolder) Then
	System.IO.Directory.CreateDirectory(sFolder)
End If

'look at the files referenced by the assembly
Dim oRefDoc As Document
For Each oRefDoc In oAsmDoc.AllReferencedDocuments
	If Not oRefDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then Continue For
	'get all occurrences of the referenced file, if one on them is visible - export that file to STEP, otherwise skip
	Dim oOccs As ComponentOccurrencesEnumerator = oAsmDoc.ComponentDefinition.Occurrences.AllReferencedOccurrences(oRefDoc)
	Dim oOcc As ComponentOccurrence
	Dim bVis As Boolean = False
	For Each oOcc In oOccs
		If oOcc.Visible 
			bVis = True
			Exit For
		End If
	Next
	
	If bVis = False Then
		Continue For 'Next For
	End If
	
	'check that model is saved
	If(System.IO.File.Exists(oRefDoc.FullDocumentName)) Then
		Dim sFilename As String = System.IO.Path.GetFileNameWithoutExtension(oRefDoc.FullDocumentName)
		Dim sDesc As String = oRefDoc.PropertySets.Item("Design Tracking Properties").Item("Description").Value
		Parameter.Quiet = True
		Dim sSospensione As String = Parameter("sospensione")
		oDataMedium.FileName = sFolder &amp;amp; "\" &amp;amp; sFilename &amp;amp; "_" &amp;amp; sSospensione &amp;amp; sDesc &amp;amp; ".stp"
		
		Try
			Call STEPTranslator.SaveCopyAs(oRefDoc, oContext, oOptions, oDataMedium)
		Catch
			MsgBox("Export of " &amp;amp; oRefDoc.DisplayName &amp;amp; " failed. Continue next one", MsgBoxStyle.Critical)
		End Try
	End If
Next

MessageBox.Show("New Files Created in: " &amp;amp; vbLf &amp;amp; sFolder, "iLogic")
Shell("explorer.exe " &amp;amp; sFolder,vbNormalFocus)
End Sub


Sub ConfigureSTEPTranslatorSettings(ByRef oSTEPTranslator As TranslatorAddIn, ByRef oContext As TranslationContext, ByRef oOptions As NameValueMap, ByRef oDataMedium As DataMedium)
	oSTEPTranslator = ThisApplication.ApplicationAddIns.ItemById("{90AF7F40-0C01-11D5-8E83-0010B541CD80}")

	If oSTEPTranslator.HasSaveCopyAsOptions(ThisApplication.ActiveDocument, oContext, oOptions) Then
		' Set application protocol.
		' 2 = AP 203 - Configuration Controlled Design
		' 3 = AP 214 - Automotive Design
		oOptions.Value("ApplicationProtocolType") = 3
		' Other options...
		'oOptions.Value("Author") = ""
		'oOptions.Value("Authorization") = ""
		'oOptions.Value("Description") = ""
		'oOptions.Value("Organization") = ""
		oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
		oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
		'oDataMedium.FileName = ThisDoc.PathAndFileName(False) &amp;amp; ".stp"
	End If
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Oct 2021 08:29:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/10677329#M129823</guid>
      <dc:creator>Ralf_Krieg</dc:creator>
      <dc:date>2021-10-09T08:29:35Z</dc:date>
    </item>
    <item>
      <title>Betreff: help export step file to iam</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/10678130#M129843</link>
      <description>&lt;P&gt;&lt;SPAN&gt;hello, yes you understand what I would like ... I tried the code but on launch it gives me an error "invalid characters in the path" how could i solve?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;System.ArgumentException: Caratteri non validi nel percorso.
   in System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
   in System.IO.Path.GetFileName(String path)
   in System.IO.Path.GetFileNameWithoutExtension(String path)
   in LmiRuleScript.Main()
   in Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
   in iLogic.RuleEvalContainer.ExecRuleEval(String execRule)&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 09 Oct 2021 23:04:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/10678130#M129843</guid>
      <dc:creator>leoa.87</dc:creator>
      <dc:date>2021-10-09T23:04:13Z</dc:date>
    </item>
    <item>
      <title>Betreff: help export step file to iam</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/10678158#M129844</link>
      <description>ok i solved ... i hacked the code and i replaced&lt;BR /&gt;&lt;BR /&gt;Dim sAsmName As String = System.IO.Path.GetFileNameWithoutExtension (oAsmDoc.FullDocumentName)&lt;BR /&gt;&lt;BR /&gt;with&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Dim sAsmName As String = System.IO.Path.GetFileNameWithoutExtension (oAsmDoc.FullFileName)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;it works now&lt;BR /&gt;&lt;BR /&gt;Thank you&lt;BR /&gt;&lt;BR /&gt;p.S: I don't want to profit but do you think you could integrate the BOM only parts with excel exports in the same folder?</description>
      <pubDate>Sat, 09 Oct 2021 23:25:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/10678158#M129844</guid>
      <dc:creator>leoa.87</dc:creator>
      <dc:date>2021-10-09T23:25:30Z</dc:date>
    </item>
    <item>
      <title>Betreff: help export step file to iam</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/10679100#M129851</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Exporting the BOM is not much work to do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Option Explicit On
Sub Main()

'check that the active document is an assembly file
If ThisDoc.Document.DocumentType &amp;lt;&amp;gt; DocumentTypeEnum.kAssemblyDocumentObject Then
	MessageBox.Show("Please run this rule from the assembly file.", "iLogic")
	Exit Sub
End If

Dim oAsmDoc As AssemblyDocument = ThisDoc.Document
Dim sAsmName As String = System.IO.Path.GetFileNameWithoutExtension(oAsmDoc.FullFileName )
Dim sFolder As String = "C:\Users\STEFANIA\Desktop\Nuova cartella (3)" &amp;amp; "\" &amp;amp; sAsmName &amp;amp; " STEP Files"

Dim STEPTranslator As TranslatorAddIn
Dim oContext As TranslationContext = ThisApplication.TransientObjects.CreateTranslationContext
Dim oOptions As NameValueMap = ThisApplication.TransientObjects.CreateNameValueMap
Dim oDataMedium As DataMedium  = ThisApplication.TransientObjects.CreateDataMedium
Call ConfigureSTEPTranslatorSettings(STEPTranslator, oContext, oOptions, oDataMedium)

If Not System.IO.Directory.Exists(sFolder) Then
	System.IO.Directory.CreateDirectory(sFolder)
End If

'look at the files referenced by the assembly
Dim oRefDoc As Document
For Each oRefDoc In oAsmDoc.AllReferencedDocuments
	If Not oRefDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then Continue For
	'get all occurrences of the referenced file, if one on them is visible - export that file to STEP, otherwise skip
	Dim oOccs As ComponentOccurrencesEnumerator = oAsmDoc.ComponentDefinition.Occurrences.AllReferencedOccurrences(oRefDoc)
	Dim oOcc As ComponentOccurrence
	Dim bVis As Boolean = False
	For Each oOcc In oOccs
		If oOcc.Visible 
			bVis = True
			Exit For
		End If
	Next
	
	If bVis = False Then
		Continue For 'Next For
	End If
	
	'check that model is saved
	If(System.IO.File.Exists(oRefDoc.FullDocumentName)) Then
		Dim sFilename As String = System.IO.Path.GetFileNameWithoutExtension(oRefDoc.FullDocumentName)
		Dim sDesc As String = oRefDoc.PropertySets.Item("Design Tracking Properties").Item("Description").Value
		Parameter.Quiet = True
		Dim sSospensione As String = Parameter("sospensione")
		oDataMedium.FileName = sFolder &amp;amp; "\" &amp;amp; sFilename &amp;amp; "_" &amp;amp; sSospensione &amp;amp; sDesc &amp;amp; ".stp"
		
		Try
			Call STEPTranslator.SaveCopyAs(oRefDoc, oContext, oOptions, oDataMedium)
		Catch
			MsgBox("Export of " &amp;amp; oRefDoc.DisplayName &amp;amp; " failed. Continue next one", MsgBoxStyle.Critical)
		End Try
	End If
Next

ExportBOM(oAsmDoc, sFolder)

MessageBox.Show("New Files Created in: " &amp;amp; vbLf &amp;amp; sFolder, "iLogic")
Shell("explorer.exe " &amp;amp; sFolder,vbNormalFocus)
End Sub


Sub ConfigureSTEPTranslatorSettings(ByRef oSTEPTranslator As TranslatorAddIn, ByRef oContext As TranslationContext, ByRef oOptions As NameValueMap, ByRef oDataMedium As DataMedium)
	oSTEPTranslator = ThisApplication.ApplicationAddIns.ItemById("{90AF7F40-0C01-11D5-8E83-0010B541CD80}")

	If oSTEPTranslator.HasSaveCopyAsOptions(ThisApplication.ActiveDocument, oContext, oOptions) Then
		' Set application protocol.
		' 2 = AP 203 - Configuration Controlled Design
		' 3 = AP 214 - Automotive Design
		oOptions.Value("ApplicationProtocolType") = 3
		' Other options...
		'oOptions.Value("Author") = ""
		'oOptions.Value("Authorization") = ""
		'oOptions.Value("Description") = ""
		'oOptions.Value("Organization") = ""
		oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
		oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
		'oDataMedium.FileName = ThisDoc.PathAndFileName(False) &amp;amp; ".stp"
	End If
End Sub

Sub ExportBOM(ByVal oAsmDoc As AssemblyDocument, ByVal sFolder As String)
	Dim oBOM As Inventor.BOM = oAsmDoc.ComponentDefinition.BOM
	oBOM.PartsOnlyViewEnabled = True
	Dim oBOMView As Inventor.BOMView
	For Each oBOMView In oBOM.BOMViews
		If oBOMView.ViewType=BOMViewTypeEnum.kPartsOnlyBOMViewType Then Exit For	
	Next
	
	If oBOMView IsNot Nothing Then
		oBOMView.Export(sFolder &amp;amp; "\" &amp;amp; "BOM.xls",FileFormatEnum.kMicrosoftExcelFormat)
	End If
	
End Sub

	&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Oct 2021 20:16:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/10679100#M129851</guid>
      <dc:creator>Ralf_Krieg</dc:creator>
      <dc:date>2021-10-10T20:16:04Z</dc:date>
    </item>
    <item>
      <title>Betreff: help export step file to iam</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/10679706#M129865</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Hello I the new code gives me an error&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;System.NotImplementedException: Non implementato (Eccezione da HRESULT: 0x80004001 (E_NOTIMPL))&lt;BR /&gt;in System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData&amp;amp; msgData)&lt;BR /&gt;in Inventor.BOMView.Export(String FileName, FileFormatEnum FileFormat, Object Options)&lt;BR /&gt;in LmiRuleScript.ExportBOM(AssemblyDocument oAsmDoc, String sFolder)&lt;BR /&gt;in LmiRuleScript.Main()&lt;BR /&gt;in Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)&lt;BR /&gt;in iLogic.RuleEvalContainer.ExecRuleEval(String execRule)&lt;/P&gt;</description>
      <pubDate>Mon, 11 Oct 2021 06:58:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/10679706#M129865</guid>
      <dc:creator>leoa.87</dc:creator>
      <dc:date>2021-10-11T06:58:27Z</dc:date>
    </item>
    <item>
      <title>Betreff: help export step file to iam</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/10679962#M129870</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry, can't reproduce the error. Wich version of Inventor are you using?&lt;/P&gt;&lt;P&gt;Is the Thumbnail column visible in the parts only view and can you try disable it before export? Does tihs work? If not, is it possible to post a anonymized sample assembly?&lt;/P&gt;</description>
      <pubDate>Mon, 11 Oct 2021 09:13:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/10679962#M129870</guid>
      <dc:creator>Ralf_Krieg</dc:creator>
      <dc:date>2021-10-11T09:13:54Z</dc:date>
    </item>
    <item>
      <title>Betreff: help export step file to iam</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/10679997#M129874</link>
      <description>&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the version is inventor 2018 and the thumbnails do not export them normally.&lt;/P&gt;&lt;P&gt;your code works if before running the rule I set the detail level on Master if instead it is set on LOD custom it goes in error.&lt;/P&gt;&lt;P&gt;Obviously I only need a parts list for a custom level of detail&lt;/P&gt;&lt;P&gt;Could you force the export of the CUSTOM level of detail BOM only parts for both the assempbly main document and the sub assemblies?&lt;/P&gt;</description>
      <pubDate>Mon, 11 Oct 2021 09:38:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/10679997#M129874</guid>
      <dc:creator>leoa.87</dc:creator>
      <dc:date>2021-10-11T09:38:36Z</dc:date>
    </item>
    <item>
      <title>Betreff: help export step file to iam</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/10681126#M129910</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ok, now I can reproduce the error, but have no solution for this.The BOM should export, independent of the active LoD.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No, the BOM is not affected by Level of Detail (LoD). LoD is only for reducing used RAM on 32bit systems. So you can't export the BOM of a LoD, cause it doesn't exist. If you want to affect the BOM, you have to set the part/assembly occurrence as "Reference" to "kick it out" the BOM. It would be possible to set this occurrences to reference by an iLogic rule if they are suppressed. The problem is, if they are unsuppressed later, the BOM structure had to change to normal, purchased or inseparable? There's more than one possible choice. In short, not a stable way.&lt;/P&gt;&lt;P&gt;The right way would be to convert the assembly into an iAssembly. There you can define which part to exclude in which version. The change of iAssembly version affects the BOM in the correct way. And you can then define which version to export.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Oct 2021 18:25:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/10681126#M129910</guid>
      <dc:creator>Ralf_Krieg</dc:creator>
      <dc:date>2021-10-11T18:25:22Z</dc:date>
    </item>
    <item>
      <title>Betreff: help export step file to iam</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/10681321#M129919</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ok, what you say is right, but I have a general assembly with sub-assemblies and related parts all under ilogic rules.&lt;BR /&gt;this in relation to the levels of detail have changes on the bill of materials.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if I set custom level of detail on the basis of ilogic rules I only see what interests me because all the components are inactive by ilogic rules and in the bill of materials (parts only) I only see what interests me.&lt;BR /&gt;if instead I enable the master level of detail it is as if the ilogic rules for inactivating sub-assemblies and parts no longer have an effect and in fact I see everything in the bill of materials.&lt;/P&gt;&lt;P&gt;I therefore tampered with your code with to make sure that the lod master is forced to get the bill of materials that I am interested in (parts only) export to excel and then retoten in customized level of detail.&lt;/P&gt;&lt;P&gt;the problem that in this way I receive an error message indicating that some subassemblies are set are not set to a custom level of detail but this is false and furthermore ignoring these errors it exports the parts list correctly only.&lt;/P&gt;&lt;P&gt;do you think I can do something?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Option Explicit On
Sub Main()

'check that the active document is an assembly file
If ThisDoc.Document.DocumentType &amp;lt;&amp;gt; DocumentTypeEnum.kAssemblyDocumentObject Then
	MessageBox.Show("Please run this rule from the assembly file.", "iLogic")
	Exit Sub
End If
Dim oDoc = ThisApplication.ActiveDocument
Dim oAsmDoc As AssemblyDocument = ThisDoc.Document
Dim sAsmName As String = System.IO.Path.GetFileNameWithoutExtension(oAsmDoc.FullFileName )
Dim sFolder As String = "C:\Users\STEFANIA\Desktop\Nuova cartella (3)" &amp;amp; "\" &amp;amp; sAsmName &amp;amp; Parameter("d109") &amp;amp; "Step Files"


Dim STEPTranslator As TranslatorAddIn
Dim oContext As TranslationContext = ThisApplication.TransientObjects.CreateTranslationContext
Dim oOptions As NameValueMap = ThisApplication.TransientObjects.CreateNameValueMap
Dim oDataMedium As DataMedium  = ThisApplication.TransientObjects.CreateDataMedium
Call ConfigureSTEPTranslatorSettings(STEPTranslator, oContext, oOptions, oDataMedium)

If Not System.IO.Directory.Exists(sFolder) Then
	System.IO.Directory.CreateDirectory(sFolder)
End If

	'sFolder = "C:\Users\STEFANIA\Desktop\Nuova cartella (3)"&amp;amp; Parameter"d118" 
		

'look at the files referenced by the assembly
Dim oRefDoc As Document
For Each oRefDoc In oAsmDoc.AllReferencedDocuments
	If Not oRefDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then Continue For
	'get all occurrences of the referenced file, if one on them is visible - export that file to STEP, otherwise skip
	Dim oOccs As ComponentOccurrencesEnumerator = oAsmDoc.ComponentDefinition.Occurrences.AllReferencedOccurrences(oRefDoc)
	Dim oOcc As ComponentOccurrence
	Dim bVis As Boolean = False
	For Each oOcc In oOccs
		If oOcc.Visible 
			bVis = True
			Exit For
		End If
	Next
	
	If bVis = False Then
		Continue For 'Next For
	End If
	
	'check that model is saved
	If(System.IO.File.Exists(oRefDoc.FullDocumentName)) Then
		Dim sFilename As String = System.IO.Path.GetFileNameWithoutExtension(oRefDoc.FullDocumentName)
		Dim sDesc As String = oRefDoc.PropertySets.Item("Design Tracking Properties").Item("Description").Value
		Parameter.Quiet = True
		Dim sSospensione As String = Parameter("sospensione")
		Dim srif As String = Parameter("d109")
		oDataMedium.FileName = sFolder &amp;amp; "\" &amp;amp; sFilename &amp;amp; "_" &amp;amp; sSospensione &amp;amp; srif &amp;amp; sDesc &amp;amp; ".stp"
		
		Try
			Call STEPTranslator.SaveCopyAs(oRefDoc, oContext, oOptions, oDataMedium)
		Catch
			MsgBox("Export of " &amp;amp; oRefDoc.DisplayName &amp;amp; " failed. Continue next one", MsgBoxStyle.Critical)
		End Try
	End If
Next

MessageBox.Show("New Files Created in: " &amp;amp; vbLf &amp;amp; sFolder, "iLogic")
Shell("explorer.exe " &amp;amp; sFolder,vbNormalFocus)


		Dim oDock As Document = ThisDoc.Document
Dim oAsmCompDef As AssemblyComponentDefinition = oDock.ComponentDefinition
oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Item("Principale").activate
oDock.ComponentDefinition.RepresentationsManager.LevelofDetailRepresentations("Principale").activate



Dim ExportSheet = sFolder  &amp;amp; "\"  &amp;amp; "Parts Only " &amp;amp; Parameter("d109") &amp;amp; ".xls"

'oAsmDoc = ThisApplication.ActiveDocument
Dim oBOM As BOM
oBOM = oDoc.ComponentDefinition.BOM


'' Export the BOM view 
Dim oPartsOnlyBOMView As BOMView
oPartsOnlyBOMView = oBOM.BOMViews.Item("Solo parti")
oPartsOnlyBOMView.Export(ExportSheet, kMicrosoftExcelFormat)


Try
oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Item("View1").activate 
Catch
oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Add("View1")
End Try
Try
oDock.ComponentDefinition.RepresentationsManager.LevelofDetailRepresentations("Livello di dettaglio1").activate
Catch
oDock.ComponentDefinition.RepresentationsManager.LevelofDetailRepresentations.Add("Livello di dettaglio1")
End Try
		




End Sub


Sub ConfigureSTEPTranslatorSettings(ByRef oSTEPTranslator As TranslatorAddIn, ByRef oContext As TranslationContext, ByRef oOptions As NameValueMap, ByRef oDataMedium As DataMedium)
	oSTEPTranslator = ThisApplication.ApplicationAddIns.ItemById("{90AF7F40-0C01-11D5-8E83-0010B541CD80}")

	If oSTEPTranslator.HasSaveCopyAsOptions(ThisApplication.ActiveDocument, oContext, oOptions) Then
		' Set application protocol.
		' 2 = AP 203 - Configuration Controlled Design
		' 3 = AP 214 - Automotive Design
		oOptions.Value("ApplicationProtocolType") = 3
		' Other options...
		'oOptions.Value("Author") = ""
		'oOptions.Value("Authorization") = ""
		'oOptions.Value("Description") = ""
		'oOptions.Value("Organization") = ""
		oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
		oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
		'oDataMedium.FileName = ThisDoc.PathAndFileName(False) &amp;amp; ".stp"
		
		
		
	End If
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Oct 2021 20:15:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/10681321#M129919</guid>
      <dc:creator>leoa.87</dc:creator>
      <dc:date>2021-10-11T20:15:31Z</dc:date>
    </item>
    <item>
      <title>Betreff: help export step file to iam</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/10683520#M129969</link>
      <description>&lt;P&gt;&lt;BR /&gt;if I put this code inside yours, I can get the basic list with the components I need (managed by other ilogic rules)&lt;BR /&gt;but this rule reports me an error for each subassembly that is inside.&lt;/P&gt;&lt;P&gt;(Rule error: Parameters xxx.iam, document: xxx.iam&lt;/P&gt;&lt;P&gt;Component.IsActive: Could not change the suppression status of the lining component xxx: 1.&lt;BR /&gt;The active level of detail in xxx is not a custom level of detail.&lt;/P&gt;&lt;P&gt;giving ok. it goes on and carries out the export of the list but it is very annoying.&lt;/P&gt;&lt;P&gt;how could i solve?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim oDock As Document = ThisDoc.Document
Dim oAsmCompDef As AssemblyComponentDefinition = oDock.ComponentDefinition
oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Item("Principale").activate
oDock.ComponentDefinition.RepresentationsManager.LevelofDetailRepresentations("Principale").activate



Dim ExportSheet = sFolder  &amp;amp; "\"  &amp;amp; "Parts Only " &amp;amp; Parameter("d109") &amp;amp; ".xls"

'oAsmDoc = ThisApplication.ActiveDocument
Dim oBOM As BOM
oBOM = oDoc.ComponentDefinition.BOM


'' Export the BOM view 
Dim oPartsOnlyBOMView As BOMView
oPartsOnlyBOMView = oBOM.BOMViews.Item("Solo parti")
oPartsOnlyBOMView.Export(ExportSheet, kMicrosoftExcelFormat)


Try
oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Item("View1").activate 
Catch
oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Add("View1")
End Try
Try
oDock.ComponentDefinition.RepresentationsManager.LevelofDetailRepresentations("Livello di dettaglio1").activate
Catch
oDock.ComponentDefinition.RepresentationsManager.LevelofDetailRepresentations.Add("Livello di dettaglio1")
End Try&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 12 Oct 2021 16:19:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/10683520#M129969</guid>
      <dc:creator>leoa.87</dc:creator>
      <dc:date>2021-10-12T16:19:12Z</dc:date>
    </item>
    <item>
      <title>Betreff: help export step file to iam</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/10686747#M130020</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As I can see, iLogic's Component.IsActive sets the status of a component to suppressed and also sets the BOM structure to reference for this occurrences. That's why the BOM shows correct parts only view.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your subassemblies seems to have a write protected LoD active. So setting component status by iLogic is not allowed. You have to switch to a writeable LoD in the subassemblies before.&lt;/P&gt;&lt;P&gt;Can't give you more details, cause nothing of this is shown in your code. It's very hard to follow you, but I'll try my best. &lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@B4D44A73814D7FC0D950DEDFACB97081/emoticons/1f642.png" alt=":slightly_smiling_face:" title=":slightly_smiling_face:" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Oct 2021 21:33:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/10686747#M130020</guid>
      <dc:creator>Ralf_Krieg</dc:creator>
      <dc:date>2021-10-13T21:33:07Z</dc:date>
    </item>
    <item>
      <title>Betreff: help export step file to iam</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/10688534#M130053</link>
      <description>&lt;P&gt;hi, thanks for your support.&lt;/P&gt;&lt;P&gt;as regards the LODs, in the sub-assemblies I simply set a custom LOD "Level of detail1" this same level is set on all the .iams present.&lt;/P&gt;&lt;P&gt;So I do not understand why he creates that error for me.&lt;/P&gt;&lt;P&gt;Are there any ways to set up an LOD without write protection?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Oct 2021 15:10:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/10688534#M130053</guid>
      <dc:creator>leoa.87</dc:creator>
      <dc:date>2021-10-14T15:10:30Z</dc:date>
    </item>
    <item>
      <title>Betreff: help export step file to iam</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/10689485#M130087</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe this script can help you. It checks in the main assembly and recursive in all subassemblies if a Level of Detail named "LoD" exists and activate it. If there's not a Level of Detail "LoD" it creates one and then activate it.&lt;/P&gt;&lt;P&gt;The name of the LoD can be changed in second line.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub Main
	Dim sLoDName As String = "LoD" 
	
	Dim oAsmDoc As AssemblyDocument = ThisDoc.Document
	Dim oOccs As Inventor.ComponentOccurrences=oAsmDoc.ComponentDefinition.Occurrences 

	LoD(oAsmDoc, sLoDName)
	LoD(oOccs, sLoDName)

	MsgBox("done")

End Sub

Private Sub LoD(ByVal oOccs As ComponentOccurrences, ByVal sLoDName As String)
	
	Dim oCompDef As AssemblyComponentDefinition
	Dim oOcc As Inventor.ComponentOccurrence

	For Each oOcc In oOccs
		If oOcc.DefinitionDocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
			oCompDef= oOcc.Definition			
			Dim oLoD As LevelOfDetailRepresentation
			For Each oLod In oCompDef.RepresentationsManager.LevelOfDetailRepresentations
				If oLoD.Name = sLoDName Then 
					Exit For
				End If
				oLoD=Nothing
			Next
	
			If oLoD Is Nothing Then
				oLoD = oCompDef.RepresentationsManager.LevelOfDetailRepresentations.Add(sLoDName)
			End If
			oOcc.SetLevelOfDetailRepresentation(sLoDName, True)
			
			LoD(oOcc.Definition.Occurrences,sLoDName )
		End If
	Next
End Sub

Private Sub LoD(ByVal oAsmDoc As AssemblyDocument, ByVal sLoDName As String)
	Dim oCompDef As AssemblyComponentDefinition = oAsmDoc.ComponentDefinition 
	Dim oLod As LevelOfDetailRepresentation
	For Each oLod In oCompDef.RepresentationsManager.LevelOfDetailRepresentations
		If oLod.Name = sLoDName Then 
			oLod.Activate
			Exit For
		End If
		oLod=Nothing
	Next
	
	If oLod Is Nothing Then
		oLod = oCompDef.RepresentationsManager.LevelOfDetailRepresentations.Add(sLoDName)
	End If
	If Not oCompDef.RepresentationsManager.ActiveLevelOfDetailRepresentation.Name=sLoDName Then
		oCompDef.RepresentationsManager.LevelOfDetailRepresentations.Item(sLoDName).Activate
	End If
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Oct 2021 22:23:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/10689485#M130087</guid>
      <dc:creator>Ralf_Krieg</dc:creator>
      <dc:date>2021-10-14T22:23:37Z</dc:date>
    </item>
    <item>
      <title>Betreff: help export step file to iam</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/11005908#M135446</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hello, I need your kind help once again ...&lt;BR /&gt;could you also include the dwg export of the active files in the assembly?&lt;/P&gt;</description>
      <pubDate>Tue, 15 Mar 2022 11:28:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/11005908#M135446</guid>
      <dc:creator>leoa.87</dc:creator>
      <dc:date>2022-03-15T11:28:41Z</dc:date>
    </item>
    <item>
      <title>Betreff: help export step file to iam</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/11005947#M135448</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This snippet can do the export&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub PublishDWG(ByVal oDoc As Document,ByVal sFolder As String, ByVal sFileName As String, sSospensione As String,ByVal srif As String, ByVal sDesc As String)
    ' Get the DWG translator Add-In.
    Dim DWGAddIn As TranslatorAddIn = ThisApplication.ApplicationAddIns.ItemById("{C24E3AC2-122E-11D5-8E91-0010B541CD80}")
   'Create translation context
    Dim oContext As TranslationContext = ThisApplication.TransientObjects.CreateTranslationContext
    oContext.Type = kFileBrowseIOMechanism
    ' Create a NameValueMap object
    Dim oOptions As NameValueMap = ThisApplication.TransientObjects.CreateNameValueMap
    ' Create a DataMedium object
    Dim oDataMedium As DataMedium = ThisApplication.TransientObjects.CreateDataMedium
    'Set the destination file name
    oDataMedium.FileName = oDataMedium.FileName = sFolder &amp;amp; "\" &amp;amp; sFilename &amp;amp; "_" &amp;amp; sSospensione &amp;amp; srif &amp;amp; sDesc &amp;amp; ".dwg"
    'Publish document.
    Call DWGAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You have to call it from your main sub&lt;/P&gt;&lt;LI-CODE lang="general"&gt;PublishDWG(oRefDoc,sFolder,sFileName,sSospensione,srif,sDesc)&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 15 Mar 2022 12:05:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/11005947#M135448</guid>
      <dc:creator>Ralf_Krieg</dc:creator>
      <dc:date>2022-03-15T12:05:07Z</dc:date>
    </item>
    <item>
      <title>Betreff: help export step file to iam</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/11006799#M135464</link>
      <description>&lt;P&gt;&lt;BR /&gt;Hello,&lt;BR /&gt;i can't get it to work&lt;/P&gt;&lt;P&gt;this is currently my rule.&lt;BR /&gt;I would also like to export the individual dwg files.&lt;/P&gt;&lt;P&gt;would you kindly help me to integrate it into this rule?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Sub&lt;/SPAN&gt; &lt;SPAN&gt;Main&lt;/SPAN&gt;()

&lt;SPAN&gt;'check that the active document is an assembly file&lt;/SPAN&gt;
&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;.&lt;SPAN&gt;DocumentType&lt;/SPAN&gt; &amp;lt;&amp;gt; &lt;SPAN&gt;DocumentTypeEnum&lt;/SPAN&gt;.&lt;SPAN&gt;kAssemblyDocumentObject&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
	&lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"Please run this rule from the assembly file."&lt;/SPAN&gt;, &lt;SPAN&gt;"iLogic"&lt;/SPAN&gt;)
	&lt;SPAN&gt;Exit&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oAsmDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyDocument&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;sAsmName&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;Path&lt;/SPAN&gt;.&lt;SPAN&gt;GetFileNameWithoutExtension&lt;/SPAN&gt;(&lt;SPAN&gt;oAsmDoc&lt;/SPAN&gt;.&lt;SPAN&gt;FullFileName&lt;/SPAN&gt; )
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;sFolder&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;"C:\Users\l.azzariti\Desktop\Output"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;sAsmName&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"_"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Parameter&lt;/SPAN&gt;(&lt;SPAN&gt;"RIF_CMA"&lt;/SPAN&gt;) &amp;amp; &lt;SPAN&gt;Parameter&lt;/SPAN&gt;(&lt;SPAN&gt;"RIF_ID"&lt;/SPAN&gt;) &amp;amp; &lt;SPAN&gt;"Step"&lt;/SPAN&gt;


&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;STEPTranslator&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;TranslatorAddIn&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oContext&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;TranslationContext&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;TransientObjects&lt;/SPAN&gt;.&lt;SPAN&gt;CreateTranslationContext&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oOptions&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;NameValueMap&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;TransientObjects&lt;/SPAN&gt;.&lt;SPAN&gt;CreateNameValueMap&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDataMedium&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;DataMedium&lt;/SPAN&gt;  = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;TransientObjects&lt;/SPAN&gt;.&lt;SPAN&gt;CreateDataMedium&lt;/SPAN&gt;
&lt;SPAN&gt;Call&lt;/SPAN&gt; &lt;SPAN&gt;ConfigureSTEPTranslatorSettings&lt;/SPAN&gt;(&lt;SPAN&gt;STEPTranslator&lt;/SPAN&gt;, &lt;SPAN&gt;oContext&lt;/SPAN&gt;, &lt;SPAN&gt;oOptions&lt;/SPAN&gt;, &lt;SPAN&gt;oDataMedium&lt;/SPAN&gt;)

&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;Not&lt;/SPAN&gt; &lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;Directory&lt;/SPAN&gt;.&lt;SPAN&gt;Exists&lt;/SPAN&gt;(&lt;SPAN&gt;sFolder&lt;/SPAN&gt;) &lt;SPAN&gt;Then&lt;/SPAN&gt;
	&lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;Directory&lt;/SPAN&gt;.&lt;SPAN&gt;CreateDirectory&lt;/SPAN&gt;(&lt;SPAN&gt;sFolder&lt;/SPAN&gt;)
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;

	
		

&lt;SPAN&gt;'look at the files referenced by the assembly&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oRefDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Document&lt;/SPAN&gt;
&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oRefDoc&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;oAsmDoc&lt;/SPAN&gt;.&lt;SPAN&gt;AllReferencedDocuments&lt;/SPAN&gt;
	&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;Not&lt;/SPAN&gt; &lt;SPAN&gt;oRefDoc&lt;/SPAN&gt;.&lt;SPAN&gt;DocumentType&lt;/SPAN&gt; = &lt;SPAN&gt;DocumentTypeEnum&lt;/SPAN&gt;.&lt;SPAN&gt;kPartDocumentObject&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt; &lt;SPAN&gt;Continue&lt;/SPAN&gt; &lt;SPAN&gt;For&lt;/SPAN&gt;
	&lt;SPAN&gt;'get all occurrences of the referenced file, if one on them is visible - export that file to STEP, otherwise skip&lt;/SPAN&gt;
	&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oOccs&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ComponentOccurrencesEnumerator&lt;/SPAN&gt; = &lt;SPAN&gt;oAsmDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;Occurrences&lt;/SPAN&gt;.&lt;SPAN&gt;AllReferencedOccurrences&lt;/SPAN&gt;(&lt;SPAN&gt;oRefDoc&lt;/SPAN&gt;)
	&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oOcc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ComponentOccurrence&lt;/SPAN&gt;
	&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;bVis&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Boolean&lt;/SPAN&gt; = &lt;SPAN&gt;False&lt;/SPAN&gt;
	&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oOcc&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;oOccs&lt;/SPAN&gt;
		&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oOcc&lt;/SPAN&gt;.&lt;SPAN&gt;Visible&lt;/SPAN&gt; 
			&lt;SPAN&gt;bVis&lt;/SPAN&gt; = &lt;SPAN&gt;True&lt;/SPAN&gt;
			&lt;SPAN&gt;Exit&lt;/SPAN&gt; &lt;SPAN&gt;For&lt;/SPAN&gt;
		&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
	&lt;SPAN&gt;Next&lt;/SPAN&gt;
	
	&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;bVis&lt;/SPAN&gt; = &lt;SPAN&gt;False&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
		&lt;SPAN&gt;Continue&lt;/SPAN&gt; &lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;'Next For&lt;/SPAN&gt;
	&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
	
	&lt;SPAN&gt;'check that model is saved&lt;/SPAN&gt;
	&lt;SPAN&gt;If&lt;/SPAN&gt;(&lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;File&lt;/SPAN&gt;.&lt;SPAN&gt;Exists&lt;/SPAN&gt;(&lt;SPAN&gt;oRefDoc&lt;/SPAN&gt;.&lt;SPAN&gt;FullDocumentName&lt;/SPAN&gt;)) &lt;SPAN&gt;Then&lt;/SPAN&gt;
		&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;sFilename&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;Path&lt;/SPAN&gt;.&lt;SPAN&gt;GetFileNameWithoutExtension&lt;/SPAN&gt;(&lt;SPAN&gt;oRefDoc&lt;/SPAN&gt;.&lt;SPAN&gt;FullDocumentName&lt;/SPAN&gt;)
		&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;sDesc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;oRefDoc&lt;/SPAN&gt;.&lt;SPAN&gt;PropertySets&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"Design Tracking Properties"&lt;/SPAN&gt;).&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"Description"&lt;/SPAN&gt;).&lt;SPAN&gt;Value&lt;/SPAN&gt;
		&lt;SPAN&gt;Parameter&lt;/SPAN&gt;.&lt;SPAN&gt;Quiet&lt;/SPAN&gt; = &lt;SPAN&gt;True&lt;/SPAN&gt;
		&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;sRIF_CMA&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;Parameter&lt;/SPAN&gt;(&lt;SPAN&gt;"RIF_CMA"&lt;/SPAN&gt;)
		&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;sRIF_ID&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;Parameter&lt;/SPAN&gt;(&lt;SPAN&gt;"RIF_ID"&lt;/SPAN&gt;)
		&lt;SPAN&gt;oDataMedium&lt;/SPAN&gt;.&lt;SPAN&gt;FileName&lt;/SPAN&gt; = &lt;SPAN&gt;sFolder&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;sFilename&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"_"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;sRIF_CMA&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"_"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;sRIF_ID&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;sDesc&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;".stp"&lt;/SPAN&gt;
		
		&lt;SPAN&gt;Try&lt;/SPAN&gt;
			&lt;SPAN&gt;Call&lt;/SPAN&gt; &lt;SPAN&gt;STEPTranslator&lt;/SPAN&gt;.&lt;SPAN&gt;SaveCopyAs&lt;/SPAN&gt;(&lt;SPAN&gt;oRefDoc&lt;/SPAN&gt;, &lt;SPAN&gt;oContext&lt;/SPAN&gt;, &lt;SPAN&gt;oOptions&lt;/SPAN&gt;, &lt;SPAN&gt;oDataMedium&lt;/SPAN&gt;)
		&lt;SPAN&gt;Catch&lt;/SPAN&gt;
			&lt;SPAN&gt;MsgBox&lt;/SPAN&gt;(&lt;SPAN&gt;"Export of "&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;oRefDoc&lt;/SPAN&gt;.&lt;SPAN&gt;DisplayName&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;" failed. Continue next one"&lt;/SPAN&gt;, &lt;SPAN&gt;MsgBoxStyle&lt;/SPAN&gt;.&lt;SPAN&gt;Critical&lt;/SPAN&gt;)
		&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Try&lt;/SPAN&gt;
	&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
&lt;SPAN&gt;Next&lt;/SPAN&gt;

&lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"New Files Created in: "&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;vbLf&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;sFolder&lt;/SPAN&gt;, &lt;SPAN&gt;"iLogic"&lt;/SPAN&gt;)
&lt;SPAN&gt;Shell&lt;/SPAN&gt;(&lt;SPAN&gt;"explorer.exe "&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;sFolder&lt;/SPAN&gt;,&lt;SPAN&gt;vbNormalFocus&lt;/SPAN&gt;)


		&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDock&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Document&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oAsmCompDef&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyComponentDefinition&lt;/SPAN&gt; = &lt;SPAN&gt;oDock&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;
&lt;SPAN&gt;oAsmCompDef&lt;/SPAN&gt;.&lt;SPAN&gt;RepresentationsManager&lt;/SPAN&gt;.&lt;SPAN&gt;DesignViewRepresentations&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"Principale"&lt;/SPAN&gt;).&lt;SPAN&gt;activate&lt;/SPAN&gt;
&lt;SPAN&gt;oDock&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;RepresentationsManager&lt;/SPAN&gt;.&lt;SPAN&gt;LevelofDetailRepresentations&lt;/SPAN&gt;(&lt;SPAN&gt;"Principale"&lt;/SPAN&gt;).&lt;SPAN&gt;activate&lt;/SPAN&gt;



&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;ExportSheet&lt;/SPAN&gt; = &lt;SPAN&gt;sFolder&lt;/SPAN&gt;  &amp;amp; &lt;SPAN&gt;"\"&lt;/SPAN&gt;  &amp;amp; &lt;SPAN&gt;"Distinta"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"_"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Parameter&lt;/SPAN&gt;(&lt;SPAN&gt;"RIF_CMA"&lt;/SPAN&gt;) &amp;amp; &lt;SPAN&gt;"_"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Parameter&lt;/SPAN&gt; (&lt;SPAN&gt;"RIF_ID"&lt;/SPAN&gt;) &amp;amp; &lt;SPAN&gt;".xls"&lt;/SPAN&gt;

&lt;SPAN&gt;'oAsmDoc = ThisApplication.ActiveDocument''''&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oBOM&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;BOM&lt;/SPAN&gt;
&lt;SPAN&gt;oBOM&lt;/SPAN&gt; = &lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;BOM&lt;/SPAN&gt;


&lt;SPAN&gt;'' Export the BOM view &lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oPartsOnlyBOMView&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;BOMView&lt;/SPAN&gt;
&lt;SPAN&gt;oPartsOnlyBOMView&lt;/SPAN&gt; = &lt;SPAN&gt;oBOM&lt;/SPAN&gt;.&lt;SPAN&gt;BOMViews&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"Solo parti"&lt;/SPAN&gt;)
&lt;SPAN&gt;oPartsOnlyBOMView&lt;/SPAN&gt;.&lt;SPAN&gt;Export&lt;/SPAN&gt;(&lt;SPAN&gt;ExportSheet&lt;/SPAN&gt;, &lt;SPAN&gt;kMicrosoftExcelFormat&lt;/SPAN&gt;)


&lt;SPAN&gt;Try&lt;/SPAN&gt;
&lt;SPAN&gt;oAsmCompDef&lt;/SPAN&gt;.&lt;SPAN&gt;RepresentationsManager&lt;/SPAN&gt;.&lt;SPAN&gt;DesignViewRepresentations&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"Vista1"&lt;/SPAN&gt;).&lt;SPAN&gt;activate&lt;/SPAN&gt; 
&lt;SPAN&gt;Catch&lt;/SPAN&gt;
&lt;SPAN&gt;oAsmCompDef&lt;/SPAN&gt;.&lt;SPAN&gt;RepresentationsManager&lt;/SPAN&gt;.&lt;SPAN&gt;DesignViewRepresentations&lt;/SPAN&gt;.&lt;SPAN&gt;Add&lt;/SPAN&gt;(&lt;SPAN&gt;"Vista1"&lt;/SPAN&gt;)
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Try&lt;/SPAN&gt;
&lt;SPAN&gt;Try&lt;/SPAN&gt;
&lt;SPAN&gt;oDock&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;RepresentationsManager&lt;/SPAN&gt;.&lt;SPAN&gt;LevelofDetailRepresentations&lt;/SPAN&gt;(&lt;SPAN&gt;"Livello di dettaglio1"&lt;/SPAN&gt;).&lt;SPAN&gt;activate&lt;/SPAN&gt;
&lt;SPAN&gt;Catch&lt;/SPAN&gt;
&lt;SPAN&gt;oDock&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;RepresentationsManager&lt;/SPAN&gt;.&lt;SPAN&gt;LevelofDetailRepresentations&lt;/SPAN&gt;.&lt;SPAN&gt;Add&lt;/SPAN&gt;(&lt;SPAN&gt;"Livello di dettaglio1"&lt;/SPAN&gt;)
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Try&lt;/SPAN&gt;
		




&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;


&lt;SPAN&gt;Sub&lt;/SPAN&gt; &lt;SPAN&gt;ConfigureSTEPTranslatorSettings&lt;/SPAN&gt;(&lt;SPAN&gt;ByRef&lt;/SPAN&gt; &lt;SPAN&gt;oSTEPTranslator&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;TranslatorAddIn&lt;/SPAN&gt;, &lt;SPAN&gt;ByRef&lt;/SPAN&gt; &lt;SPAN&gt;oContext&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;TranslationContext&lt;/SPAN&gt;, &lt;SPAN&gt;ByRef&lt;/SPAN&gt; &lt;SPAN&gt;oOptions&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;NameValueMap&lt;/SPAN&gt;, &lt;SPAN&gt;ByRef&lt;/SPAN&gt; &lt;SPAN&gt;oDataMedium&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;DataMedium&lt;/SPAN&gt;)
	&lt;SPAN&gt;oSTEPTranslator&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ApplicationAddIns&lt;/SPAN&gt;.&lt;SPAN&gt;ItemById&lt;/SPAN&gt;(&lt;SPAN&gt;"{90AF7F40-0C01-11D5-8E83-0010B541CD80}"&lt;/SPAN&gt;)

	&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oSTEPTranslator&lt;/SPAN&gt;.&lt;SPAN&gt;HasSaveCopyAsOptions&lt;/SPAN&gt;(&lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;, &lt;SPAN&gt;oContext&lt;/SPAN&gt;, &lt;SPAN&gt;oOptions&lt;/SPAN&gt;) &lt;SPAN&gt;Then&lt;/SPAN&gt;
		&lt;SPAN&gt;' Set application protocol.&lt;/SPAN&gt;
		&lt;SPAN&gt;' 2 = AP 203 - Configuration Controlled Design&lt;/SPAN&gt;
		&lt;SPAN&gt;' 3 = AP 214 - Automotive Design&lt;/SPAN&gt;
		&lt;SPAN&gt;oOptions&lt;/SPAN&gt;.&lt;SPAN&gt;Value&lt;/SPAN&gt;(&lt;SPAN&gt;"ApplicationProtocolType"&lt;/SPAN&gt;) = 3
		&lt;SPAN&gt;' Other options...&lt;/SPAN&gt;
		&lt;SPAN&gt;'oOptions.Value("Author") = ""&lt;/SPAN&gt;
		&lt;SPAN&gt;'oOptions.Value("Authorization") = ""&lt;/SPAN&gt;
		&lt;SPAN&gt;'oOptions.Value("Description") = ""&lt;/SPAN&gt;
		&lt;SPAN&gt;'oOptions.Value("Organization") = ""&lt;/SPAN&gt;
		&lt;SPAN&gt;oContext&lt;/SPAN&gt;.&lt;SPAN&gt;Type&lt;/SPAN&gt; = &lt;SPAN&gt;IOMechanismEnum&lt;/SPAN&gt;.&lt;SPAN&gt;kFileBrowseIOMechanism&lt;/SPAN&gt;
		&lt;SPAN&gt;oDataMedium&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;TransientObjects&lt;/SPAN&gt;.&lt;SPAN&gt;CreateDataMedium&lt;/SPAN&gt;
		&lt;SPAN&gt;'oDataMedium.FileName = ThisDoc.PathAndFileName(False) &amp;amp; ".stp"&lt;/SPAN&gt;
		
		
		
	&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Mar 2022 17:52:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/11006799#M135464</guid>
      <dc:creator>leoa.87</dc:creator>
      <dc:date>2022-03-15T17:52:37Z</dc:date>
    </item>
    <item>
      <title>Betreff: help export step file to iam</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/11008197#M135482</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have sorted your code a little bit and added the DWG export. I'm not able to test it right now.&lt;/P&gt;&lt;P&gt;Please try this and post if errors occur.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub Main()

'check that the active document is an assembly file
If ThisDoc.Document.DocumentType &amp;lt;&amp;gt; DocumentTypeEnum.kAssemblyDocumentObject Then
	MessageBox.Show("Please run this rule from the assembly file.", "iLogic")
	Exit Sub
End If
'Dim oDoc = ThisApplication.ActiveDocument
Dim oAsmDoc As AssemblyDocument = ThisDoc.Document
Dim sAsmName As String = System.IO.Path.GetFileNameWithoutExtension(oAsmDoc.FullFileName )
Dim sFolder As String = "C:\Users\l.azzariti\Desktop\Output" &amp;amp; "\" &amp;amp; sAsmName &amp;amp; "_" &amp;amp; Parameter("RIF_CMA") &amp;amp; Parameter("RIF_ID") &amp;amp; "Step"


Dim STEPTranslator As TranslatorAddIn
Dim oSTPContext As TranslationContext = ThisApplication.TransientObjects.CreateTranslationContext
Dim oSTPOptions As NameValueMap = ThisApplication.TransientObjects.CreateNameValueMap
Dim oSTPDataMedium As DataMedium  = ThisApplication.TransientObjects.CreateDataMedium
Call ConfigureSTEPTranslatorSettings(STEPTranslator, oSTPContext, oSTPOptions)

Dim DWGTranslator As TranslatorAddIn
Dim oDWGContext As TranslationContext = ThisApplication.TransientObjects.CreateTranslationContext
Dim oDWGOptions As NameValueMap = ThisApplication.TransientObjects.CreateNameValueMap
Dim oDWGDataMedium As DataMedium  = ThisApplication.TransientObjects.CreateDataMedium
Call ConfigureDWGTranslatorSettings(DWGTranslator, oDWGContext)

If Not System.IO.Directory.Exists(sFolder) Then
	System.IO.Directory.CreateDirectory(sFolder)
End If
	

'look at the files referenced by the assembly
Dim oRefDoc As Document
For Each oRefDoc In oAsmDoc.AllReferencedDocuments
	If Not oRefDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then Continue For
	'get all occurrences of the referenced file, if one on them is visible - export that file to STEP, otherwise skip
	Dim oOccs As ComponentOccurrencesEnumerator = oAsmDoc.ComponentDefinition.Occurrences.AllReferencedOccurrences(oRefDoc)
	Dim oOcc As ComponentOccurrence
	Dim bVis As Boolean = False
	For Each oOcc In oOccs
		If oOcc.Visible 
			bVis = True
			Exit For
		End If
	Next
	
	If bVis = False Then
		Continue For 'Next For
	End If
	
	'check that model is saved
	If(System.IO.File.Exists(oRefDoc.FullDocumentName)) Then
		Dim sFilename As String = System.IO.Path.GetFileNameWithoutExtension(oRefDoc.FullDocumentName)
		Dim sDesc As String = oRefDoc.PropertySets.Item("Design Tracking Properties").Item("Description").Value
		Parameter.Quiet = True
		Dim sRIF_CMA As String = Parameter("RIF_CMA")
		Dim sRIF_ID As String = Parameter("RIF_ID")
		oSTPDataMedium.FileName = sFolder &amp;amp; "\" &amp;amp; sFilename &amp;amp; "_" &amp;amp; sRIF_CMA &amp;amp; "_" &amp;amp; sRIF_ID &amp;amp; sDesc &amp;amp; ".stp"
		oDWGDataMedium.FileName = sFolder &amp;amp; "\" &amp;amp; sFilename &amp;amp; "_" &amp;amp; sRIF_CMA &amp;amp; "_" &amp;amp; sRIF_ID &amp;amp; sDesc &amp;amp; ".dwg"
		
		Try
			Call STEPTranslator.SaveCopyAs(oRefDoc, oSTPContext, oSTPOptions, oSTPDataMedium)
		Catch
			MsgBox("Export of " &amp;amp; oRefDoc.DisplayName &amp;amp; " to STP failed. Continue next one", MsgBoxStyle.Critical)
		End Try
		Try
			Call DWGTranslator.SaveCopyAs(oRefDoc, oDWGContext, oDWGOptions, oDWGDataMedium)
		Catch
			MsgBox("Export of " &amp;amp; oRefDoc.DisplayName &amp;amp; " to DWG failed. Continue next one", MsgBoxStyle.Critical)
		End Try
	End If
Next

MessageBox.Show("New Files Created in: " &amp;amp; vbLf &amp;amp; sFolder, "iLogic")
Shell("explorer.exe " &amp;amp; sFolder,vbNormalFocus)

Dim oAsmCompDef As AssemblyComponentDefinition = oAsmDoc.ComponentDefinition
Dim oRepMgr As RepresentationsManager =oAsmCompDef.RepresentationsManager 
oRepMgr.DesignViewRepresentations.Item("Principale").activate
oRepMgr.LevelofDetailRepresentations("Principale").activate

Dim ExportSheet = sFolder  &amp;amp; "\"  &amp;amp; "Distinta" &amp;amp; "_" &amp;amp; Parameter("RIF_CMA") &amp;amp; "_" &amp;amp; Parameter ("RIF_ID") &amp;amp; ".xls"

Dim oBOM As BOM
oBOM = oAsmDoc.ComponentDefinition.BOM

'' Export the BOM view 
Dim oPartsOnlyBOMView As BOMView
oPartsOnlyBOMView = oBOM.BOMViews.Item("Solo parti")
oPartsOnlyBOMView.Export(ExportSheet, kMicrosoftExcelFormat)

Try
	oRepMgr.DesignViewRepresentations.Item("Vista1").Activate 
Catch
	oRepMgr.DesignViewRepresentations.Add("Vista1")
End Try
Try
	oRepMgr.LevelofDetailRepresentations("Livello di dettaglio1").activate
Catch
	oRepMgr.LevelofDetailRepresentations.Add("Livello di dettaglio1")
End Try
		
End Sub


Sub ConfigureSTEPTranslatorSettings(ByRef oSTEPTranslator As TranslatorAddIn, ByRef oContext As TranslationContext, ByRef oOptions As NameValueMap)
	oSTEPTranslator = ThisApplication.ApplicationAddIns.ItemById("{90AF7F40-0C01-11D5-8E83-0010B541CD80}")

	If oSTEPTranslator.HasSaveCopyAsOptions(ThisApplication.ActiveDocument, oContext, oOptions) Then
		' Set application protocol.
		' 2 = AP 203 - Configuration Controlled Design
		' 3 = AP 214 - Automotive Design
		oOptions.Value("ApplicationProtocolType") = 3
		' Other options...
		'oOptions.Value("Author") = ""
		'oOptions.Value("Authorization") = ""
		'oOptions.Value("Description") = ""
		'oOptions.Value("Organization") = ""
		oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
	End If
End Sub

Sub ConfigureDWGTranslatorSettings(ByRef oDWGTranslator As TranslatorAddIn, ByRef oContext As TranslationContext)
	oDWGTranslator = ThisApplication.ApplicationAddIns.ItemById("{C24E3AC2-122E-11D5-8E91-0010B541CD80}")
	oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2022 09:08:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/11008197#M135482</guid>
      <dc:creator>Ralf_Krieg</dc:creator>
      <dc:date>2022-03-16T09:08:42Z</dc:date>
    </item>
    <item>
      <title>Betreff: help export step file to iam</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/11008286#M135483</link>
      <description>&lt;P&gt;&lt;BR /&gt;thanks it works ...&lt;BR /&gt;but the dwg serves me as a flat model, can you add it as a dwg?&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2022 10:08:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/11008286#M135483</guid>
      <dc:creator>leoa.87</dc:creator>
      <dc:date>2022-03-16T10:08:20Z</dc:date>
    </item>
    <item>
      <title>Betreff: help export step file to iam</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/11008503#M135490</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry, don't understand what you mean. If you export a part file to a DWG, it will save the 3D model in model space of the dwg. It will not create a Inventor drawing document, place views, add all needed dimensions, fill titleblock or anything else and export it to a DWG file. Or do you mean something different?&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2022 12:04:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/help-export-step-file-to-iam/m-p/11008503#M135490</guid>
      <dc:creator>Ralf_Krieg</dc:creator>
      <dc:date>2022-03-16T12:04:16Z</dc:date>
    </item>
  </channel>
</rss>

