<?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: Update a Simplify Substitute in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/update-a-simplify-substitute/m-p/11885534#M151158</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3382408"&gt;@gaetan.lucas&lt;/a&gt;.&amp;nbsp; I haven't really used Simplified/Shrinkwrap Assemblies as ModelStates before, but after reading down through your code, and looking at the online documentation for the associated API objects/methods/properties involved, I am making a relatively educated guess that in order for you to 'update' that &lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=ShrinkwrapComponent" target="_blank" rel="noopener"&gt;ShrinkwrapComopnent&lt;/A&gt;, you may need to access its &lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=ShrinkwrapComponent_Definition" target="_blank" rel="noopener"&gt;ShrinkwrapComponent.Definition&lt;/A&gt; (a &lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=ShrinkwrapDefinition" target="_blank" rel="noopener"&gt;ShrinkwrapDefinition&lt;/A&gt;), then try changing one or more of its Propertys, and maybe change them back if no changes are were actually needed, then see if that causes the 'update' to happen.&amp;nbsp; If some of those properties actually need to change, do so.&amp;nbsp; That is similar to 'editing' it through the dialog, but by code.&lt;/P&gt;</description>
    <pubDate>Mon, 10 Apr 2023 16:34:05 GMT</pubDate>
    <dc:creator>WCrihfield</dc:creator>
    <dc:date>2023-04-10T16:34:05Z</dc:date>
    <item>
      <title>Update a Simplify Substitute</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/update-a-simplify-substitute/m-p/11879598#M151101</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would creat a code to&amp;nbsp;update a simplify Substitute as &lt;A href="https://help.autodesk.com/view/INVNTOR/2023/ENU/?guid=GUID-A106F1D6-2B7C-4BAB-9356-1DB87CA4767A" target="_blank" rel="noopener"&gt;here&amp;nbsp;&lt;/A&gt;(chapter "To Edit a Simplify Substitute")&lt;/P&gt;&lt;P&gt;but&amp;nbsp;I can't code the action "Edit Simplified Assembly":&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub ActualiseSubstitute()
    ' Set a reference to the active assembly document
Dim oDoc As AssemblyDocument
Dim oDef As AssemblyComponentDefinition
Dim oModelStates As ModelStates
Dim oModelState As ModelState
Dim oSubstitute() As String
Dim i As Long
Dim MyModelState As ModelState
Dim AssName As String

    Set oDoc = ThisApplication.ActiveDocument
    Set oDef = oDoc.ComponentDefinition
    Set oModelStates = oDef.ModelStates
    
    'Active Master state
    If oModelStates.ActiveModelState.Name &amp;lt;&amp;gt; oModelStates.Item(1).Name Then
        Set MyModelState = oModelStates.Item(1)
        MyModelState.Activate
    End If
    AssName = oDoc.DisplayName
    
    
    'for future if i want have the choice
    i = 1
    For Each oModelState In oModelStates
        If oModelState.ModelStateType = kSubstituteModelStateType Then
            ReDim Preserve oSubstitute(1 To i)
            oSubstitute(i) = oModelState.Name
            i = i + 1
        End If
    Next
    
Dim MyOccName As String

Dim oCompOccSympl As ComponentOccurrence
Dim oCompOccAssSympl As ComponentOccurrence
    
    Set oDoc = ThisApplication.ActiveDocument
    Set oDef = oDoc.ComponentDefinition
    Set oModelStates = oDef.ModelStates
    
    'Active the first Substitute
    If oModelStates.ActiveModelState.Name &amp;lt;&amp;gt; oModelStates.Item(oSubstitute(1)).Name Then
        Set MyModelState = oModelStates.Item(oSubstitute(1))
        MyModelState.Activate
    End If
    MyOccName = MyModelState.Name
    
    'Edit the first Substitute
    Set oDoc = ThisApplication.ActiveDocument
    Set oDef = oDoc.ComponentDefinition
    Set oCompOccSympl = oDef.Occurrences.ItemByName(MyOccName &amp;amp; ":1")
    oCompOccSympl.Edit
    
    'Edit Simplified Assembly
Dim oSimplDoc As PartDocument
Dim oSimplDef As PartComponentDefinition
Dim oShrinkComp As ShrinkwrapComponent
    Set oSimplDoc = ThisApplication.ActiveEditDocument
    Set oSimplDef = oSimplDoc.ComponentDefinition
    Set oShrinkComp = oSimplDef.ReferenceComponents.ShrinkwrapComponents.Item(1)
   
End Sub&lt;/LI-CODE&gt;&lt;P&gt;Could you help me ?&lt;/P&gt;</description>
      <pubDate>Fri, 07 Apr 2023 08:43:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/update-a-simplify-substitute/m-p/11879598#M151101</guid>
      <dc:creator>gaetan.lucas</dc:creator>
      <dc:date>2023-04-07T08:43:40Z</dc:date>
    </item>
    <item>
      <title>Re: Update a Simplify Substitute</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/update-a-simplify-substitute/m-p/11885534#M151158</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3382408"&gt;@gaetan.lucas&lt;/a&gt;.&amp;nbsp; I haven't really used Simplified/Shrinkwrap Assemblies as ModelStates before, but after reading down through your code, and looking at the online documentation for the associated API objects/methods/properties involved, I am making a relatively educated guess that in order for you to 'update' that &lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=ShrinkwrapComponent" target="_blank" rel="noopener"&gt;ShrinkwrapComopnent&lt;/A&gt;, you may need to access its &lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=ShrinkwrapComponent_Definition" target="_blank" rel="noopener"&gt;ShrinkwrapComponent.Definition&lt;/A&gt; (a &lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=ShrinkwrapDefinition" target="_blank" rel="noopener"&gt;ShrinkwrapDefinition&lt;/A&gt;), then try changing one or more of its Propertys, and maybe change them back if no changes are were actually needed, then see if that causes the 'update' to happen.&amp;nbsp; If some of those properties actually need to change, do so.&amp;nbsp; That is similar to 'editing' it through the dialog, but by code.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2023 16:34:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/update-a-simplify-substitute/m-p/11885534#M151158</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2023-04-10T16:34:05Z</dc:date>
    </item>
  </channel>
</rss>

