<?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 Re: iPart or iAssembly member save as other automation in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ipart-or-iassembly-member-save-as-other-automation/m-p/9699687#M114796</link>
    <description>&lt;P&gt;Dear colleagues,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please help us with such question: we are using oFactory.CreateMember method&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;oMember = oFactory.CreateMember&lt;/PRE&gt;&lt;P&gt;for processing and saving&amp;nbsp;&lt;SPAN&gt;Assemblymembers (we are using Inventor API to create our own add-in for Inventor), but we use C#. And we get an error, cause it doesn't work. Could you please tell us if this method (oFactory.CreateMember) also could be used for C# or maybe there are some other methods for C#?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 19 Aug 2020 13:13:55 GMT</pubDate>
    <dc:creator>Andrey.Subbotin</dc:creator>
    <dc:date>2020-08-19T13:13:55Z</dc:date>
    <item>
      <title>iPart or iAssembly member save as other automation</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ipart-or-iassembly-member-save-as-other-automation/m-p/8638363#M95244</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not all that up to speed with iLogic but I've cobbled together a rule to generate all members of an iPart/iAssembly factory. This is good but I really want it to also save as another format too like a .sat file or .step and I cant seem to get it to, it will only save the current member.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;' Set reference to active document.
oDoc = ThisApplication.ActiveDocument

' Check the Document type is an assembly or part
If (oDoc.DocumentType &amp;lt;&amp;gt; kAssemblyDocumentObject And _
   oDoc.DocumentType &amp;lt;&amp;gt; kPartDocumentObject) Then
   MsgBox("Error:Document type is not assembly/part")
   Exit Sub
End If

Dim oDef As AssemblyComponentDefinition = oDoc.ComponentDefinition 
Dim initRowIndex As Integer
Dim oFactory As iAssemblyFactory = oDef.iAssemblyFactory


Dim oRow As iAssemblyTableRow
For Each oRow In oFactory.TableRows
	' Generate the member and file, (overwrites member file or creates new file)
	oFactory.CreateMember(oRow)
	' Get document's full file name
    sFname = iProperties.Value("Project", "Part Number") &amp;amp; ".sat"

    ' Do a 'Save Copy As' to SAT format
    oDoc.SaveAs(sFname, True)
Next

&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyone able to help get the save as for each member working?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 20:12:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ipart-or-iassembly-member-save-as-other-automation/m-p/8638363#M95244</guid>
      <dc:creator>j.peterszetapdm</dc:creator>
      <dc:date>2019-03-05T20:12:02Z</dc:date>
    </item>
    <item>
      <title>Re: iPart or iAssembly member save as other automation</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ipart-or-iassembly-member-save-as-other-automation/m-p/8644975#M95374</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/512053"&gt;@j.peterszetapdm&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hoping that below iLogic code may be helpful to save iAssemblymembers. Similarly, code can be modified for iPart.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;' Set reference to active document.
oDoc = ThisApplication.ActiveDocument

' Check the Document type is an assembly or part
If (oDoc.DocumentType &amp;lt;&amp;gt; kAssemblyDocumentObject And _
   oDoc.DocumentType &amp;lt;&amp;gt; kPartDocumentObject) Then
   MsgBox("Error:Document type is not assembly/part")
   Exit Sub
End If

Dim oDef As AssemblyComponentDefinition = oDoc.ComponentDefinition 
Dim initRowIndex As Integer
Dim oFactory As iAssemblyFactory = oDef.iAssemblyFactory

Dim oRow As iAssemblyTableRow
Dim oMember As iAssemblyMember 
For Each oRow In oFactory.TableRows
	
	' Generate the member and file, (overwrites member file or creates new file)
	oMember = oFactory.CreateMember(oRow)&lt;BR /&gt;
	Dim oPath As String &lt;BR /&gt;	oPath = oMember.ParentFactory.MemberCacheDir&lt;BR /&gt;
	Dim oReferDoc As AssemblyDocument 
    oReferDoc = ThisApplication.Documents.Open(oPath &amp;amp; "\" &amp;amp; oRow.MemberName &amp;amp; ".iam", True)
    
    Dim oName As String
    oName = oReferDoc.PropertySets.Item("Design Tracking Properties").Item("Part Number").Value
     
    	
    Call oReferDoc.SaveAs(oPath &amp;amp; "\" &amp;amp; oName &amp;amp; ".iam", True) &lt;BR /&gt;    &lt;BR /&gt;    Call oReferDoc.Close
	  
Next&lt;/PRE&gt;
&lt;P&gt;Thanks and regards,&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2019 09:38:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ipart-or-iassembly-member-save-as-other-automation/m-p/8644975#M95374</guid>
      <dc:creator>chandra.shekar.g</dc:creator>
      <dc:date>2019-03-08T09:38:42Z</dc:date>
    </item>
    <item>
      <title>Re: iPart or iAssembly member save as other automation</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ipart-or-iassembly-member-save-as-other-automation/m-p/8655109#M95550</link>
      <description>&lt;P&gt;Hi there, thank you for your help. I've had a go with the code but I am getting an error with line 20&lt;/P&gt;
&lt;P&gt;"Error on Line 20 : Expression does not produce a value."&lt;/P&gt;
&lt;P&gt;Is there something i could be missing?&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 10:38:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ipart-or-iassembly-member-save-as-other-automation/m-p/8655109#M95550</guid>
      <dc:creator>j.peterszetapdm</dc:creator>
      <dc:date>2019-03-13T10:38:51Z</dc:date>
    </item>
    <item>
      <title>Re: iPart or iAssembly member save as other automation</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ipart-or-iassembly-member-save-as-other-automation/m-p/8655200#M95554</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/512053"&gt;@j.peterszetapdm&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Actually, previous code is for iAssmeblyFactory. Is code is used for iAssembly or iPart?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you provide non confidential iAssmebly file, I can simulate error and correct the same.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks and regards,&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 11:17:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ipart-or-iassembly-member-save-as-other-automation/m-p/8655200#M95554</guid>
      <dc:creator>chandra.shekar.g</dc:creator>
      <dc:date>2019-03-13T11:17:56Z</dc:date>
    </item>
    <item>
      <title>Re: iPart or iAssembly member save as other automation</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ipart-or-iassembly-member-save-as-other-automation/m-p/8655483#M95564</link>
      <description>&lt;P&gt;Thank you, attached is the assembly i am trying to export each memeber out as an obj in this case. I could generate all the members with my code but I couldnt figure out how to export each one as well, it just exported the current member.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 12:50:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ipart-or-iassembly-member-save-as-other-automation/m-p/8655483#M95564</guid>
      <dc:creator>j.peterszetapdm</dc:creator>
      <dc:date>2019-03-13T12:50:08Z</dc:date>
    </item>
    <item>
      <title>Re: iPart or iAssembly member save as other automation</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ipart-or-iassembly-member-save-as-other-automation/m-p/8657583#M95586</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/512053"&gt;@j.peterszetapdm&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this iLogic code for iAssembly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;' Set reference to active document.
oDoc = ThisApplication.ActiveDocument

' Check the Document type is an assembly or part
If (oDoc.DocumentType &amp;lt;&amp;gt; kAssemblyDocumentObject And _
   oDoc.DocumentType &amp;lt;&amp;gt; kPartDocumentObject) Then
   MsgBox("Error:Document type is not assembly/part")
   Exit Sub
End If

Dim oDef As AssemblyComponentDefinition = oDoc.ComponentDefinition 
Dim initRowIndex As Integer
Dim oFactory As iAssemblyFactory = oDef.iAssemblyFactory

Dim oRow As iAssemblyTableRow
Dim oMember As iAssemblyMember 
For Each oRow In oFactory.TableRows
	
	' Generate the member and file, (overwrites member file or creates new file)
	Call oFactory.CreateMember(oRow)

	Dim oPath As String 
	oPath = oFactory.MemberCacheDir

	Dim oReferDoc As AssemblyDocument 
    oReferDoc = ThisApplication.Documents.Open(oPath &amp;amp; "\" &amp;amp; oRow.MemberName &amp;amp; ".iam", True)
    
    Dim oName As String
    oName = oReferDoc.PropertySets.Item("Design Tracking Properties").Item("Part Number").Value
     
    ThisApplication.SilentOperation = True 
	
    Call oReferDoc.SaveAs(oPath &amp;amp; "\" &amp;amp; oName &amp;amp; ".iam", True) 
    
    Call oReferDoc.Close
	
	ThisApplication.SilentOperation = False 
	  
Next&lt;/PRE&gt;
&lt;P&gt;Thanks and regards,&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2019 05:27:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ipart-or-iassembly-member-save-as-other-automation/m-p/8657583#M95586</guid>
      <dc:creator>chandra.shekar.g</dc:creator>
      <dc:date>2019-03-14T05:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: iPart or iAssembly member save as other automation</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ipart-or-iassembly-member-save-as-other-automation/m-p/8658008#M95589</link>
      <description>&lt;P&gt;Thats got it thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2019 09:33:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ipart-or-iassembly-member-save-as-other-automation/m-p/8658008#M95589</guid>
      <dc:creator>j.peterszetapdm</dc:creator>
      <dc:date>2019-03-14T09:33:11Z</dc:date>
    </item>
    <item>
      <title>Re: iPart or iAssembly member save as other automation</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/ipart-or-iassembly-member-save-as-other-automation/m-p/9699687#M114796</link>
      <description>&lt;P&gt;Dear colleagues,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please help us with such question: we are using oFactory.CreateMember method&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;oMember = oFactory.CreateMember&lt;/PRE&gt;&lt;P&gt;for processing and saving&amp;nbsp;&lt;SPAN&gt;Assemblymembers (we are using Inventor API to create our own add-in for Inventor), but we use C#. And we get an error, cause it doesn't work. Could you please tell us if this method (oFactory.CreateMember) also could be used for C# or maybe there are some other methods for C#?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 13:13:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/ipart-or-iassembly-member-save-as-other-automation/m-p/9699687#M114796</guid>
      <dc:creator>Andrey.Subbotin</dc:creator>
      <dc:date>2020-08-19T13:13:55Z</dc:date>
    </item>
  </channel>
</rss>

