<?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: Add or Remove Solid Bodies from Derived Part. in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/add-or-remove-solid-bodies-from-derived-part/m-p/12312184#M18136</link>
    <description>&lt;P&gt;For anyone who comes by this in the future, this code will extract all solid bodies from your part file, allowing you to select the model state.&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 doc As PartDocument = ThisApplication.ActiveDocument

For Each sb In doc.ComponentDefinition.SurfaceBodies
				
    'Create Part With A Derived Part Component
    Dim prt As PartDocument
    prt = ThisApplication.Documents.Add(kPartDocumentObject, "PART TEMPLATE DIRECTORY")
    
    Dim oDPComps As DerivedPartComponents = prt.ComponentDefinition.ReferenceComponents.DerivedPartComponents
    Dim oDPDef As DerivedPartUniformScaleDef = oDPComps.CreateUniformScaleDef(doc.FullDocumentName)
	
	'Select Model States
	oDPDef.ActiveModelState = "MODEL STATE NAME"	
	
    'Hide All Other Solid Bodies
    Dim oDPEnt As DerivedPartEntity
   	For Each oDPEnt In oDPDef.Solids
	
        oDPEnt.IncludeEntity = oDPEnt.ReferencedEntity Is sb
		
    Next
	
	oDPComps.Add(oDPDef)
	
	        prt.SaveAs("DRIVE PATH" &amp;amp; sb.Name &amp;amp; ".ipt", False)
		
		prt.Close
		
Next&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 25 Oct 2023 20:15:33 GMT</pubDate>
    <dc:creator>C_Haines_ENG</dc:creator>
    <dc:date>2023-10-25T20:15:33Z</dc:date>
    <item>
      <title>Add or Remove Solid Bodies from Derived Part.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/add-or-remove-solid-bodies-from-derived-part/m-p/12284863#M18131</link>
      <description>&lt;P&gt;Good afternoon,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need some help figuring out how to add or remove solidparts from an extracted "Derived Part".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can use the "make components" tool to extract my solid bodies but I need to be able to add / remove parts from the derived part and I need to be able to switch model states of the derived part aswell.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could anyone help with this?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2023 17:05:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/add-or-remove-solid-bodies-from-derived-part/m-p/12284863#M18131</guid>
      <dc:creator>C_Haines_ENG</dc:creator>
      <dc:date>2023-10-04T17:05:19Z</dc:date>
    </item>
    <item>
      <title>Re: Add or Remove Solid Bodies from Derived Part.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/add-or-remove-solid-bodies-from-derived-part/m-p/12286242#M18132</link>
      <description>&lt;P&gt;Could you explain a bit more in detail?&lt;/P&gt;
&lt;P&gt;Maybe you can make some screenshots to explain what you try to do.&lt;/P&gt;
&lt;P&gt;Your question is based on i-logic or via VBA or via an add-in?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2023 08:57:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/add-or-remove-solid-bodies-from-derived-part/m-p/12286242#M18132</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2023-10-05T08:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: Add or Remove Solid Bodies from Derived Part.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/add-or-remove-solid-bodies-from-derived-part/m-p/12286806#M18133</link>
      <description>&lt;P&gt;My question is a iLogic questions, here is what I mean by derived part:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="chainesL5H3G_0-1696511243615.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1275622i525E5AF062EA2940/image-size/medium?v=v2&amp;amp;px=400" role="button" title="chainesL5H3G_0-1696511243615.png" alt="chainesL5H3G_0-1696511243615.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Its a single solid body extracted from a larger part file containing all the solid bodies, and im trying to select whatever solid body I want within this menu:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="chainesL5H3G_1-1696511314759.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1275623i6B7C9D58F9F97A58/image-size/medium?v=v2&amp;amp;px=400" role="button" title="chainesL5H3G_1-1696511314759.png" alt="chainesL5H3G_1-1696511314759.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In iLogic, however I cant seem to figure out how exactly this works, and on top of that id like to be able to select what model state it wants as shown below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="chainesL5H3G_2-1696511383584.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1275624i1F282BFB3AFB744C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="chainesL5H3G_2-1696511383584.png" alt="chainesL5H3G_2-1696511383584.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2023 13:09:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/add-or-remove-solid-bodies-from-derived-part/m-p/12286806#M18133</guid>
      <dc:creator>C_Haines_ENG</dc:creator>
      <dc:date>2023-10-05T13:09:50Z</dc:date>
    </item>
    <item>
      <title>Re: Add or Remove Solid Bodies from Derived Part.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/add-or-remove-solid-bodies-from-derived-part/m-p/12287053#M18134</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12191678"&gt;@C_Haines_ENG&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is&lt;A href="https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-rule-to-include-exclude-derived-parameter-in-all-parts/m-p/8691196#M96089" target="_blank" rel="noopener"&gt; a post on this forum for adjusting the solidy body shown here&lt;/A&gt; There is also a &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=GUID-DerivedPartDefinition" target="_blank" rel="noopener"&gt;DerivedPartDefinition help page here&lt;/A&gt; where you can start adjusting the outcome of the derive. Attach your attempted sample if you get stuck implementing.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2023 14:39:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/add-or-remove-solid-bodies-from-derived-part/m-p/12287053#M18134</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2023-10-05T14:39:35Z</dc:date>
    </item>
    <item>
      <title>Re: Add or Remove Solid Bodies from Derived Part.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/add-or-remove-solid-bodies-from-derived-part/m-p/12287918#M18135</link>
      <description>&lt;P&gt;Is there anyway to simplify this? Seems like I have a couple things here that do not need to be there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit: This code can only be run on an already extracted derived part.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;ODDoc&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;oDPComp&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;DerivedPartComponent&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDPComps&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;DerivedPartComponents&lt;/SPAN&gt;
&lt;SPAN&gt;oDPComps&lt;/SPAN&gt; = &lt;SPAN&gt;ODDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;ReferenceComponents&lt;/SPAN&gt;.&lt;SPAN&gt;DerivedPartComponents&lt;/SPAN&gt;

	&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;x&lt;/SPAN&gt; = 1 &lt;SPAN&gt;To&lt;/SPAN&gt; &lt;SPAN&gt;oDPComps&lt;/SPAN&gt;.&lt;SPAN&gt;Count&lt;/SPAN&gt;
		&lt;SPAN&gt;oDPComp&lt;/SPAN&gt; = &lt;SPAN&gt;oDPComps&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;x&lt;/SPAN&gt;)
		&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDPDef&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;DerivedPartUniformScaleDef&lt;/SPAN&gt; = &lt;SPAN&gt;oDPComp&lt;/SPAN&gt;.&lt;SPAN&gt;Definition&lt;/SPAN&gt;
		&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDPEnts&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;DerivedPartEntities&lt;/SPAN&gt; = &lt;SPAN&gt;oDPDef&lt;/SPAN&gt;.&lt;SPAN&gt;Solids&lt;/SPAN&gt;
		&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDPEnt&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;DerivedPartEntity&lt;/SPAN&gt;
		
			&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oDPEnt&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;oDPEnts&lt;/SPAN&gt;
				
				&lt;SPAN&gt;'CHANGE MODEL STATE&lt;/SPAN&gt;
				&lt;SPAN&gt;oDPDef&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveModelState&lt;/SPAN&gt; = &lt;SPAN&gt;"MODEL STATE NAME"&lt;/SPAN&gt;
			&lt;BR /&gt;                                'ADD PART YOU WANT BY SOLID NAME
				&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oDPEnt&lt;/SPAN&gt;.&lt;SPAN&gt;ReferencedEntity&lt;/SPAN&gt;.&lt;SPAN&gt;Name&lt;/SPAN&gt; = &lt;SPAN&gt;"YOUR SOLID BODY NAME"&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
					&lt;SPAN&gt;oDPEnt&lt;/SPAN&gt;.&lt;SPAN&gt;IncludeEntity&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;oDPComp&lt;/SPAN&gt;.&lt;SPAN&gt;Definition&lt;/SPAN&gt; = &lt;SPAN&gt;oDPDef&lt;/SPAN&gt;
	
	&lt;SPAN&gt;Next&lt;/SPAN&gt;

&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2023 19:09:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/add-or-remove-solid-bodies-from-derived-part/m-p/12287918#M18135</guid>
      <dc:creator>C_Haines_ENG</dc:creator>
      <dc:date>2023-10-17T19:09:11Z</dc:date>
    </item>
    <item>
      <title>Re: Add or Remove Solid Bodies from Derived Part.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/add-or-remove-solid-bodies-from-derived-part/m-p/12312184#M18136</link>
      <description>&lt;P&gt;For anyone who comes by this in the future, this code will extract all solid bodies from your part file, allowing you to select the model state.&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 doc As PartDocument = ThisApplication.ActiveDocument

For Each sb In doc.ComponentDefinition.SurfaceBodies
				
    'Create Part With A Derived Part Component
    Dim prt As PartDocument
    prt = ThisApplication.Documents.Add(kPartDocumentObject, "PART TEMPLATE DIRECTORY")
    
    Dim oDPComps As DerivedPartComponents = prt.ComponentDefinition.ReferenceComponents.DerivedPartComponents
    Dim oDPDef As DerivedPartUniformScaleDef = oDPComps.CreateUniformScaleDef(doc.FullDocumentName)
	
	'Select Model States
	oDPDef.ActiveModelState = "MODEL STATE NAME"	
	
    'Hide All Other Solid Bodies
    Dim oDPEnt As DerivedPartEntity
   	For Each oDPEnt In oDPDef.Solids
	
        oDPEnt.IncludeEntity = oDPEnt.ReferencedEntity Is sb
		
    Next
	
	oDPComps.Add(oDPDef)
	
	        prt.SaveAs("DRIVE PATH" &amp;amp; sb.Name &amp;amp; ".ipt", False)
		
		prt.Close
		
Next&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2023 20:15:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/add-or-remove-solid-bodies-from-derived-part/m-p/12312184#M18136</guid>
      <dc:creator>C_Haines_ENG</dc:creator>
      <dc:date>2023-10-25T20:15:33Z</dc:date>
    </item>
  </channel>
</rss>

