<?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: Create derived part of assembly | Exclude all assembly parts Sketches Parameters WorkFeatures in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10929579#M40703</link>
    <description>&lt;P&gt;Thank you for taking the time to help me with this case. I'm new to this iLogic world, so the help is highly appreciated.&lt;/P&gt;&lt;P&gt;I've tried to do a little bit more research. I've added a assembly and a part file to this post. Inside the assembly file there is a iLogic rule "Shrink wrap substitute". If you change which one of line 22 / 23 that is commented out, the derived substitute part will either be without or with the sketch with the text "Top Level Assembly Sketch".&lt;/P&gt;&lt;P&gt;If one remove the comment on line 28, the derived substitute part will include both the visible sketch "Sketch1" and the invisible shared sketch "Sketch4".&lt;/P&gt;&lt;P&gt;So for top level sketches I'm able to code if I want sketches to be included or not in the derived part. For sketches inside assembly parts I'm able to code how to include them. What I do not understand is how I can create a code that excludes all sketches inside assembly parts, regardless of the sketch being visible or shared?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="iLogic Shrink wrap substitute" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1020949i0D1171E7321643C9/image-size/large?v=v2&amp;amp;px=999" role="button" title="iLogic Shrink wrap substitute.PNG" alt="iLogic Shrink wrap substitute" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;iLogic Shrink wrap substitute&lt;/span&gt;&lt;/span&gt;&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="Assembly_Derived_Source" style="width: 826px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1020942i1A3FBBC074DFB268/image-size/large?v=v2&amp;amp;px=999" role="button" title="Assembly_Derived_Source.PNG" alt="Assembly_Derived_Source" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Assembly_Derived_Source&lt;/span&gt;&lt;/span&gt;&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="Assembly_Derived_Part Include All Top Level Sketches" style="width: 857px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1020943i20024D034AE94F8D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Assembly_Derived_Part Include All Top Level Sketches.PNG" alt="Assembly_Derived_Part Include All Top Level Sketches" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Assembly_Derived_Part Include All Top Level Sketches&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Assembly_Derived_Part Include All Sketches" style="width: 803px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1020944iE68FAEBAB2AE68E8/image-size/large?v=v2&amp;amp;px=999" role="button" title="Assembly_Derived_Part Include All Sketches.PNG" alt="Assembly_Derived_Part Include All Sketches" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Assembly_Derived_Part Include All Sketches&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;/Rolf Even&lt;/P&gt;</description>
    <pubDate>Fri, 04 Feb 2022 20:40:13 GMT</pubDate>
    <dc:creator>RolfEven</dc:creator>
    <dc:date>2022-02-04T20:40:13Z</dc:date>
    <item>
      <title>Create derived part of assembly | Exclude all assembly parts Sketches Parameters WorkFeatures</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10927193#M40699</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've found an iLogic rule from the site in the link below that creates a derived part of an assembly.&lt;/P&gt;&lt;P&gt;&lt;A title="iLogic Rule to create a Single Derived Part From an Assembly" href="https://microconcepts.typepad.com/design_automation/2015/07/ilogic-rule-to-create-a-single-derived-part-from-an-assembly.html" target="_blank" rel="noopener"&gt;https://microconcepts.typepad.com/design_automation/2015/07/ilogic-rule-to-create-a-single-derived-part-from-an-assembly.html&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The reason for this post is that I can not figure out how I can exclude all assembly parts sketches, parameters and workfeatures in the derived part. I hope this can be accomplished in other ways than turning sketch visibility off inn all parts. What would be ideal is to control this in a similar way as done in the GUI shown in the picture below.&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="Excludes the selected objects.PNG" style="width: 430px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1020475i507CA3354125DA6B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Excludes the selected objects.PNG" alt="Excludes the selected objects.PNG" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Excludes the selected objects.PNG&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I have tried is ask Google to see if anybody have solved this task already, but either I'm asking Google the wrong questions (most likely) or Google simply doesn't know. I've also looked in the API help in Inventor and here I found a Method to do the opposite to what I want to do, IncludeAllSketches. I want to ExcludeAllSketches. For top-level sketches in the assembly there is a similar API document, but this is not a Method but a Properties. I lack the programming skills to know the difference, but I see there is a difference in the two.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="API Sketch Method.PNG" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1020478iAE38CD047034B228/image-size/medium?v=v2&amp;amp;px=400" role="button" title="API Sketch Method.PNG" alt="API Sketch Method.PNG" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;API Sketch Method.PNG&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code below is what I have tried so far, but I'm not doing this correctly. The include all (not commented out) is doing what it is supposed to do, but I struggle to create the code to do the opposite.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;'--- Work in progress, this section is not okay
'Method that includes all sketches from the source assembly.
'This includes top level sketches In the source assembly As well As sketches In Sub-assemblies And parts.
oDerivedAssemblyDef.IncludeAllSketches()
'oDerivedAssemblyDef.ExcludeAllSketches()
'oDerivedAssemblyDef.IncludeAllSketches() = DerivedComponentOptionEnum.kDerivedExcludeAll
'oDerivedAssemblyDef.IncludeAllSketches = False
'---End Work in progress&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If anybody can point me the right direction to help me understand what I have to do I would highly appreciate that.&lt;/P&gt;&lt;P&gt;/Rolf Even&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 21:10:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10927193#M40699</guid>
      <dc:creator>RolfEven</dc:creator>
      <dc:date>2022-02-03T21:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: Create derived part of assembly | Exclude all assembly parts Sketches Parameters WorkFeatures</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10927362#M40700</link>
      <description>&lt;P&gt;Maybe try below. This is how the sample is layed out.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;oDerivedAssemblyDef.IncludeAllSketches() = kDerivedExcludeAll&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AAcheson_0-1643928568967.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1020504i787D6D91E93D7067/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AAcheson_0-1643928568967.png" alt="AAcheson_0-1643928568967.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;AAcheson_0-1643928568967.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 22:54:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10927362#M40700</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2022-02-03T22:54:05Z</dc:date>
    </item>
    <item>
      <title>Re: Create derived part of assembly | Exclude all assembly parts Sketches Parameters WorkFeatures</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10927993#M40701</link>
      <description>&lt;P&gt;Thanks Alan,&lt;/P&gt;&lt;P&gt;I've tried adding the suggested code but it creates an error when I run the iLogic rule.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Error line 24.PNG" style="width: 300px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1020609i9C3027770BF92BDA/image-size/small?v=v2&amp;amp;px=200" role="button" title="Error line 24.PNG" alt="Error line 24.PNG" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Error line 24.PNG&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The only way I can make the Method "oDerivedAssemblyDef.IncludeAllSketches()" to work is shown below. And this code includes all sketches in all assembly parts. Do I need to create a loop function that turns off all sketches after the derived part is created, or is it possible to use the Method to exclude instead of include?&lt;/P&gt;&lt;LI-CODE lang="general"&gt;'---End Work in progress
oDerivedAssemblyDef.IncludeAllSketches()
'--- Start Work in progress&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Include all sketches.PNG" style="width: 300px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1020624iDF482F42BA37F123/image-size/small?v=v2&amp;amp;px=200" role="button" title="Include all sketches.PNG" alt="Include all sketches.PNG" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Include all sketches.PNG&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;/Rolf Even&lt;/P&gt;</description>
      <pubDate>Fri, 04 Feb 2022 08:08:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10927993#M40701</guid>
      <dc:creator>RolfEven</dc:creator>
      <dc:date>2022-02-04T08:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: Create derived part of assembly | Exclude all assembly parts Sketches Parameters WorkFeatures</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10929223#M40702</link>
      <description>&lt;P&gt;&lt;SPAN&gt;oDerivedAssemblyDef.IncludeAllTopLevelSketches = kDerivedExcludeAll&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Based on testing this will only effect the top assembly sketches, by default all sub assembly sketches will be removed. Sample taken from 2020 API help&amp;nbsp;&lt;/SPAN&gt;Shrink wrap substitute in assembly API Sample&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;'  a reference to the active assembly document&lt;/SPAN&gt;
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyDocument&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;oDef&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyComponentDefinition&lt;/SPAN&gt;
     &lt;SPAN&gt;oDef&lt;/SPAN&gt; = &lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;

    &lt;SPAN&gt;' Create a new part document that will be the shrinkwrap substitute&lt;/SPAN&gt;
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oPartDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;PartDocument&lt;/SPAN&gt;
     &lt;SPAN&gt;oPartDoc&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;Documents&lt;/SPAN&gt;.&lt;SPAN&gt;Add&lt;/SPAN&gt;(&lt;SPAN&gt;kPartDocumentObject&lt;/SPAN&gt;, , &lt;SPAN&gt;False&lt;/SPAN&gt;)

    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oPartDef&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;PartComponentDefinition&lt;/SPAN&gt;
     &lt;SPAN&gt;oPartDef&lt;/SPAN&gt; = &lt;SPAN&gt;oPartDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;

    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDerivedAssemblyDef&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;DerivedAssemblyDefinition&lt;/SPAN&gt;
     &lt;SPAN&gt;oDerivedAssemblyDef&lt;/SPAN&gt; = &lt;SPAN&gt;oPartDef&lt;/SPAN&gt;.&lt;SPAN&gt;ReferenceComponents&lt;/SPAN&gt;.&lt;SPAN&gt;DerivedAssemblyComponents&lt;/SPAN&gt;.&lt;SPAN&gt;CreateDefinition&lt;/SPAN&gt;(&lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;FullDocumentName&lt;/SPAN&gt;)

    &lt;SPAN&gt;'  various shrinkwrap related options&lt;/SPAN&gt;
    &lt;SPAN&gt;oDerivedAssemblyDef&lt;/SPAN&gt;.&lt;SPAN&gt;DeriveStyle&lt;/SPAN&gt; = &lt;SPAN&gt;kDeriveAsSingleBodyNoSeams&lt;/SPAN&gt;
    &lt;SPAN&gt;oDerivedAssemblyDef&lt;/SPAN&gt;.&lt;SPAN&gt;IncludeAllTopLevelWorkFeatures&lt;/SPAN&gt; = &lt;SPAN&gt;kDerivedIncludeAll&lt;/SPAN&gt;
    &lt;SPAN&gt;oDerivedAssemblyDef&lt;/SPAN&gt;.&lt;SPAN&gt;IncludeAllTopLevelSketches&lt;/SPAN&gt; = &lt;SPAN&gt;kDerivedExcludeAll&lt;/SPAN&gt;&lt;SPAN&gt;' Based on testing this will only effect the top assembly sketches, by defualt all sub assembly sketches will be removed&lt;/SPAN&gt;
	&lt;SPAN&gt;oDerivedAssemblyDef&lt;/SPAN&gt;.&lt;SPAN&gt;IncludeAllTopLeveliMateDefinitions&lt;/SPAN&gt; = &lt;SPAN&gt;kDerivedExcludeAll&lt;/SPAN&gt;
    &lt;SPAN&gt;oDerivedAssemblyDef&lt;/SPAN&gt;.&lt;SPAN&gt;IncludeAllTopLevelParameters&lt;/SPAN&gt; = &lt;SPAN&gt;kDerivedExcludeAll&lt;/SPAN&gt;
    &lt;SPAN&gt;oDerivedAssemblyDef&lt;/SPAN&gt;.&lt;SPAN&gt;ReducedMemoryMode&lt;/SPAN&gt; = &lt;SPAN&gt;True&lt;/SPAN&gt;

&lt;SPAN&gt;'    Call oDerivedAssemblyDef.HolePatchingOptions(kDerivedPatchAll)&lt;/SPAN&gt;
    &lt;SPAN&gt;'Call oDerivedAssemblyDef.RemoveByVisibilityOptions(kDerivedRemovePartsAndFaces, 25)&lt;/SPAN&gt;

    &lt;SPAN&gt;' Create the shrinkwrap component&lt;/SPAN&gt;
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDerivedAssembly&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;DerivedAssemblyComponent&lt;/SPAN&gt;
     &lt;SPAN&gt;oDerivedAssembly&lt;/SPAN&gt; = &lt;SPAN&gt;oPartDef&lt;/SPAN&gt;.&lt;SPAN&gt;ReferenceComponents&lt;/SPAN&gt;.&lt;SPAN&gt;DerivedAssemblyComponents&lt;/SPAN&gt;.&lt;SPAN&gt;Add&lt;/SPAN&gt;(&lt;SPAN&gt;oDerivedAssemblyDef&lt;/SPAN&gt;)

    &lt;SPAN&gt;' Save the part&lt;/SPAN&gt;
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;strSubstituteFileName&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;
    &lt;SPAN&gt;strSubstituteFileName&lt;/SPAN&gt; = &lt;SPAN&gt;Left$&lt;/SPAN&gt;(&lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;FullFileName&lt;/SPAN&gt;, &lt;SPAN&gt;Len&lt;/SPAN&gt;(&lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;FullFileName&lt;/SPAN&gt;) - 4)
    &lt;SPAN&gt;strSubstituteFileName&lt;/SPAN&gt; = &lt;SPAN&gt;strSubstituteFileName&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"_ShrinkwrapSubstitute.ipt"&lt;/SPAN&gt;

    &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;SilentOperation&lt;/SPAN&gt; = &lt;SPAN&gt;True&lt;/SPAN&gt;
    &lt;SPAN&gt;Call&lt;/SPAN&gt; &lt;SPAN&gt;oPartDoc&lt;/SPAN&gt;.&lt;SPAN&gt;SaveAs&lt;/SPAN&gt;(&lt;SPAN&gt;strSubstituteFileName&lt;/SPAN&gt;, &lt;SPAN&gt;False&lt;/SPAN&gt;)
    &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;SilentOperation&lt;/SPAN&gt; = &lt;SPAN&gt;False&lt;/SPAN&gt;

    &lt;SPAN&gt;' Create a substitute level of detail using the shrinkwrap part.&lt;/SPAN&gt;
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oSubstituteLOD&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;LevelOfDetailRepresentation&lt;/SPAN&gt;
     &lt;SPAN&gt;oSubstituteLOD&lt;/SPAN&gt; = &lt;SPAN&gt;oDef&lt;/SPAN&gt;.&lt;SPAN&gt;RepresentationsManager&lt;/SPAN&gt;.&lt;SPAN&gt;LevelOfDetailRepresentations&lt;/SPAN&gt;.&lt;SPAN&gt;AddSubstitute&lt;/SPAN&gt;(&lt;SPAN&gt;strSubstituteFileName&lt;/SPAN&gt;)

    &lt;SPAN&gt;' Release reference of the invisibly opened part document.&lt;/SPAN&gt;
    &lt;SPAN&gt;oPartDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ReleaseReference&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;</description>
      <pubDate>Fri, 04 Feb 2022 17:18:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10929223#M40702</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2022-02-04T17:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: Create derived part of assembly | Exclude all assembly parts Sketches Parameters WorkFeatures</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10929579#M40703</link>
      <description>&lt;P&gt;Thank you for taking the time to help me with this case. I'm new to this iLogic world, so the help is highly appreciated.&lt;/P&gt;&lt;P&gt;I've tried to do a little bit more research. I've added a assembly and a part file to this post. Inside the assembly file there is a iLogic rule "Shrink wrap substitute". If you change which one of line 22 / 23 that is commented out, the derived substitute part will either be without or with the sketch with the text "Top Level Assembly Sketch".&lt;/P&gt;&lt;P&gt;If one remove the comment on line 28, the derived substitute part will include both the visible sketch "Sketch1" and the invisible shared sketch "Sketch4".&lt;/P&gt;&lt;P&gt;So for top level sketches I'm able to code if I want sketches to be included or not in the derived part. For sketches inside assembly parts I'm able to code how to include them. What I do not understand is how I can create a code that excludes all sketches inside assembly parts, regardless of the sketch being visible or shared?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="iLogic Shrink wrap substitute" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1020949i0D1171E7321643C9/image-size/large?v=v2&amp;amp;px=999" role="button" title="iLogic Shrink wrap substitute.PNG" alt="iLogic Shrink wrap substitute" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;iLogic Shrink wrap substitute&lt;/span&gt;&lt;/span&gt;&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="Assembly_Derived_Source" style="width: 826px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1020942i1A3FBBC074DFB268/image-size/large?v=v2&amp;amp;px=999" role="button" title="Assembly_Derived_Source.PNG" alt="Assembly_Derived_Source" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Assembly_Derived_Source&lt;/span&gt;&lt;/span&gt;&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="Assembly_Derived_Part Include All Top Level Sketches" style="width: 857px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1020943i20024D034AE94F8D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Assembly_Derived_Part Include All Top Level Sketches.PNG" alt="Assembly_Derived_Part Include All Top Level Sketches" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Assembly_Derived_Part Include All Top Level Sketches&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Assembly_Derived_Part Include All Sketches" style="width: 803px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1020944iE68FAEBAB2AE68E8/image-size/large?v=v2&amp;amp;px=999" role="button" title="Assembly_Derived_Part Include All Sketches.PNG" alt="Assembly_Derived_Part Include All Sketches" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Assembly_Derived_Part Include All Sketches&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;/Rolf Even&lt;/P&gt;</description>
      <pubDate>Fri, 04 Feb 2022 20:40:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10929579#M40703</guid>
      <dc:creator>RolfEven</dc:creator>
      <dc:date>2022-02-04T20:40:13Z</dc:date>
    </item>
    <item>
      <title>Re: Create derived part of assembly | Exclude all assembly parts Sketches Parameters WorkFeatures</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10929949#M40704</link>
      <description>&lt;P&gt;If I read your post correctly you want to remove all sketches. In my testing on 2020 this snippet removed sketches from the derived part.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;oDerivedAssemblyDef&lt;/SPAN&gt;.&lt;SPAN&gt;IncludeAllTopLevelSketches&lt;/SPAN&gt; = &lt;SPAN&gt;kDerivedExcludeAll&lt;/SPAN&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;Are you seeing the same thing?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Feb 2022 02:07:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10929949#M40704</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2022-02-05T02:07:29Z</dc:date>
    </item>
    <item>
      <title>Re: Create derived part of assembly | Exclude all assembly parts Sketches Parameters WorkFeatures</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10932173#M40705</link>
      <description>&lt;P&gt;Correct, I'm looking for a way to have no sketches in the derived part, as shown in picture "Derived substitute with no Sketches". With "oDerivedAssemblyDef.IncludeAllTopLevelSketches = kDerivedExcludeAll" all top level sketches in the assembly is excluded. But visible sketches in parts are included.&lt;/P&gt;&lt;P&gt;I've added a R2020 assembly that is used in the below pictures. Assembly.iam has an iLogic rule "Shrink wrap substitute"&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Assembly with some Sketches visible" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1021456iFC87F6EE49EE1A36/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Assembly with some Sketches visible.PNG" alt="Assembly with some Sketches visible" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Assembly with some Sketches visible&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Derived substitute with Sketches" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1021459i0A070A532C5341E8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Derived substitute with Sketches.PNG" alt="Derived substitute with Sketches" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Derived substitute with Sketches&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Derived substitute with no Sketches" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1021461i6D2933DBB21944CA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Derived substitute with no Sketches.PNG" alt="Derived substitute with no Sketches" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Derived substitute with no Sketches&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;/Rolf Even&lt;/P&gt;</description>
      <pubDate>Sun, 06 Feb 2022 20:03:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10932173#M40705</guid>
      <dc:creator>RolfEven</dc:creator>
      <dc:date>2022-02-06T20:03:25Z</dc:date>
    </item>
    <item>
      <title>Re: Create derived part of assembly | Exclude all assembly parts Sketches Parameters WorkFeatures</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10932479#M40706</link>
      <description>&lt;P&gt;I have been helping another user in &lt;A href="https://forums.autodesk.com/t5/inventor-ilogic-api-vba-forum/new-substitute-gt-derive-assembly-gt-bounding-box-ipt-only/m-p/10932467/highlight/true#M134325" target="_blank" rel="noopener"&gt;This Thread&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think the goals are similar, and I just figured out a way to get the part level sketches to not show up in the derived part.&amp;nbsp; You can find the most Up-to-Date full code from my last post on the thread linked above.&amp;nbsp; The subroutine handling the ObjectVisibility code is below:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub ObjectVisibility(AsmDoc As AssemblyDocument, oToggle As Boolean)

	Dim oVis As ObjectVisibility = AsmDoc.ObjectVisibility
	oVis.Sketches = oToggle
	oVis.Sketches3D = oToggle
	oVis.UserWorkPlanes = oToggle
	oVis.UserWorkAxes = oToggle
	oVis.UserWorkPoints = oToggle
	oVis.OriginWorkPlanes =oToggle
	oVis.OriginWorkAxes = oToggle
	oVis.OriginWorkPoints = oToggle

End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if you need help adapting your code to work with the Sub routine above, or if you need help converting the full code, posted on the linked thread, to function the way you need.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Feb 2022 00:28:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10932479#M40706</guid>
      <dc:creator>J-Camper</dc:creator>
      <dc:date>2022-02-07T00:28:22Z</dc:date>
    </item>
    <item>
      <title>Re: Create derived part of assembly | Exclude all assembly parts Sketches Parameters WorkFeatures</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10932957#M40707</link>
      <description>&lt;P&gt;Thank you for the input and the subrutine code. I've embedded your code inside the code found in the link below. The derived part is now without sketches, and also without the other work features specified in the code you provided.&lt;/P&gt;&lt;P&gt;&lt;A title="iLogic Rule to create a Single Derived Part From an Assembly" href="https://microconcepts.typepad.com/design_automation/2015/07/ilogic-rule-to-create-a-single-derived-part-from-an-assembly.html" target="_blank" rel="noopener"&gt;https://microconcepts.typepad.com/design_automation/2015/07/ilogic-rule-to-create-a-single-derived-part-from-an-assembly.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Since this is still work in progress I've attached an updated Assembly.iam with the modified rule to create derived part without sketches. I will post a working code when it is more complete. A remaining task is to reset sketch visibility in the assembly file. Pressing F10 by hand does this, but I'm not sure on how I should code this. In other words, I only need the sketches to be invisible when the derived part is created. Visible sketches in the assembly should ideally be the same in the two assembly pictures below.&lt;/P&gt;&lt;P&gt;If anyone could download Assembly.iam and the two parts from post #7 and check the code I'll highly appreciate that. Also if it is better to post the work in progress code directly in the thread please let me know.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Assembly with some Sketches visible 2" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1021598i38D52341854BC4B1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Assembly with some Sketches visible 2.PNG" alt="Assembly with some Sketches visible 2" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Assembly with some Sketches visible 2&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Derived part without Sketches" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1021602i8B74681FE4C08970/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Derived part without Sketches.PNG" alt="Derived part without Sketches" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Derived part without Sketches&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Assembly with Sketche visibility turned off" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1021605i608A0D7C65486E2D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Assembly with Sketche visibility turned off.PNG" alt="Assembly with Sketche visibility turned off" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Assembly with Sketche visibility turned off&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;/Rolf Even&lt;/P&gt;</description>
      <pubDate>Mon, 07 Feb 2022 08:28:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10932957#M40707</guid>
      <dc:creator>RolfEven</dc:creator>
      <dc:date>2022-02-07T08:28:41Z</dc:date>
    </item>
    <item>
      <title>Re: Create derived part of assembly | Exclude all assembly parts Sketches Parameters WorkFeatures</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10933520#M40708</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/392122"&gt;@RolfEven&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I was running the Sub routine above with (AssemblyDocument, False) at the beginning of the process then with (AssemblyDocument, True) after the derived part was created.&amp;nbsp; The second call is there to turn ObjectVisibilty back on in the main assembly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I prefer looking at posted code alone in most cases.&amp;nbsp; I only prefer parts/assemblies if the code is meant to be very specific to a particular work flow or if there is a unique issue that I cannot recreate myself.&amp;nbsp; That's just my opinion though.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you still need help implementing this, please let me know.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Feb 2022 13:17:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10933520#M40708</guid>
      <dc:creator>J-Camper</dc:creator>
      <dc:date>2022-02-07T13:17:42Z</dc:date>
    </item>
    <item>
      <title>Re: Create derived part of assembly | Exclude all assembly parts Sketches Parameters WorkFeatures</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10933680#M40709</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4898893"&gt;@J-Camper&lt;/a&gt;,&lt;/BLOCKQUOTE&gt;&lt;P&gt;I'm completely new to the programing world so I'm more than likely to ask the same question over and over again. But with the help of kind souls out there I'm taking step by step away from the start location. Thank you for taking the time to help me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since you are kind enough to give away a finger, why shouldn't I take the whole hand... I think I'll learn more with your explanations instead of my copy/paste until it works method. So, if you have the time to look at the code below and help me understand how I should/could write the sequence to turn visibility on/off in the assembly I'm grateful for that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I have puzzled together so far:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim g_App As Inventor.InventorServer = ThisApplication
Dim AssDoc As Inventor.AssemblyDocument = ThisDoc.Document

Dim ObjectVisibility As AssemblyDocument
Dim oToggle As Boolean
Dim oVis As ObjectVisibility = AssDoc.ObjectVisibility
oVis.Sketches = oToggle
oVis.Sketches3D = oToggle
oVis.UserWorkPlanes = oToggle
oVis.UserWorkAxes = oToggle
oVis.UserWorkPoints = oToggle
oVis.OriginWorkPlanes =oToggle
oVis.OriginWorkAxes = oToggle
oVis.OriginWorkPoints = oToggle

' Create a new part document that will be the shrinkwrap substitute
Dim oPartDoc As PartDocument
oPartDoc = g_App.Documents.Add(DocumentTypeEnum.kPartDocumentObject, , True)

Dim oPartDef As PartComponentDefinition
oPartDef = oPartDoc.ComponentDefinition

Dim oDerivedAssemblyDef As DerivedAssemblyDefinition
oDerivedAssemblyDef = oPartDef.ReferenceComponents.DerivedAssemblyComponents.CreateDefinition(AssDoc.FullDocumentName)
' Set various shrinkwrap related options
oDerivedAssemblyDef.DeriveStyle = DerivedComponentStyleEnum.kDeriveAsMultipleBodies
oDerivedAssemblyDef.IncludeAllTopLevelWorkFeatures = DerivedComponentOptionEnum.kDerivedExcludeAll
oDerivedAssemblyDef.IncludeAllTopLevelSketches = DerivedComponentOptionEnum.kDerivedExcludeAll
oDerivedAssemblyDef.IncludeAllTopLeveliMateDefinitions = DerivedComponentOptionEnum.kDerivedExcludeAll
oDerivedAssemblyDef.IncludeAllTopLevelParameters = DerivedComponentOptionEnum.kDerivedExcludeAll
Call oDerivedAssemblyDef.SetHolePatchingOptions(DerivedHolePatchEnum.kDerivedPatchNone)
Call oDerivedAssemblyDef.SetRemoveByVisibilityOptions(DerivedGeometryRemovalEnum.kDerivedRemoveNone)
Dim oDerivedAss As DerivedAssemblyComponent
oDerivedAss = oPartDoc.ComponentDefinition.ReferenceComponents.DerivedAssemblyComponents.Add(oDerivedAssemblyDef)
Call oDerivedAss.BreakLinkToFile()

' Save the part
Dim partname As String=ThisDoc.PathAndFileName(False)&amp;amp; ".ipt"
ThisApplication.ActiveView.Fit
ThisApplication.CommandManager.ControlDefinitions.Item("AppIsometricViewCmd").Execute
Call oPartDoc.SaveAs(partname ,  False)&lt;/LI-CODE&gt;&lt;P&gt;/Rolf Even&lt;/P&gt;</description>
      <pubDate>Mon, 07 Feb 2022 14:09:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10933680#M40709</guid>
      <dc:creator>RolfEven</dc:creator>
      <dc:date>2022-02-07T14:09:50Z</dc:date>
    </item>
    <item>
      <title>Re: Create derived part of assembly | Exclude all assembly parts Sketches Parameters WorkFeatures</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10933823#M40710</link>
      <description>&lt;P&gt;I believe this should work for you:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub Main
	Dim g_App As Inventor.InventorServer = ThisApplication
	Dim AssDoc As Inventor.AssemblyDocument = TryCast(ThisDoc.Document, AssemblyDocument)
	If IsNothing(AssDoc) Then Logger.Debug("Not run in assembly") : Exit Sub
	Dim partname As String = AssDoc.FullFileName : partname = Left(partname, partname.Length-4) &amp;amp; ".ipt"
	
	Dim visRep As DesignViewRepresentation = AssDoc.ComponentDefinition.RepresentationsManager.ActiveDesignViewRepresentation
	
	Dim ReturnState As Boolean = visRep.Locked
	
	If visRep.DesignViewType = DesignViewTypeEnum.kMasterDesignViewType
		ReturnState = False
		MessageBox.Show("ObjectVisibility Toggles don't affect Derived Parts using the ""Master"" View Representation", "Limited Functionality")
	End If
	
	If ReturnState Then visRep.Locked = Not(ReturnState)
	
	Call ObjectVisibility(AssDoc, False)
	
	' Create a new part document that will be the shrinkwrap substitute
	Dim oPartDoc As PartDocument
	oPartDoc = g_App.Documents.Add(DocumentTypeEnum.kPartDocumentObject, , True)

	Dim oPartDef As PartComponentDefinition
	oPartDef = oPartDoc.ComponentDefinition

	Dim oDerivedAssemblyDef As DerivedAssemblyDefinition
	oDerivedAssemblyDef = oPartDef.ReferenceComponents.DerivedAssemblyComponents.CreateDefinition(AssDoc.FullDocumentName)
	' Set various shrinkwrap related options
	oDerivedAssemblyDef.DeriveStyle = DerivedComponentStyleEnum.kDeriveAsMultipleBodies
	oDerivedAssemblyDef.IncludeAllTopLevelWorkFeatures = DerivedComponentOptionEnum.kDerivedExcludeAll
	oDerivedAssemblyDef.IncludeAllTopLevelSketches = DerivedComponentOptionEnum.kDerivedExcludeAll
	oDerivedAssemblyDef.IncludeAllTopLeveliMateDefinitions = DerivedComponentOptionEnum.kDerivedExcludeAll
	oDerivedAssemblyDef.IncludeAllTopLevelParameters = DerivedComponentOptionEnum.kDerivedExcludeAll
	Call oDerivedAssemblyDef.SetHolePatchingOptions(DerivedHolePatchEnum.kDerivedPatchNone)
	Call oDerivedAssemblyDef.SetRemoveByVisibilityOptions(DerivedGeometryRemovalEnum.kDerivedRemoveNone)
	
	Dim oDerivedAss As DerivedAssemblyComponent
	oDerivedAss = oPartDoc.ComponentDefinition.ReferenceComponents.DerivedAssemblyComponents.Add(oDerivedAssemblyDef)
	Call oDerivedAss.BreakLinkToFile()

	'Save New Document
	Call SaveFile(oPartDoc, partname)
		
	AssDoc.Activate
	
	Call ObjectVisibility(AssDoc, True)
	
	If ReturnState Then visRep.Locked = ReturnState
	
End Sub

Sub SaveFile(oDoc As Document, NewFileName As String)
	
	Try
		oDoc.SaveAs(NewFileName, False)
		ThisApplication.ActiveView.Fit
		ThisApplication.CommandManager.ControlDefinitions.Item("AppIsometricViewCmd").Execute()
	Catch
		MessageBox.Show(oDoc.DisplayName &amp;amp; " cannot be overwritten.", "Terminating")
		oDoc.Close(True)
		Exit Sub
	End Try

End Sub

Sub ObjectVisibility(AsmDoc As AssemblyDocument, oToggle As Boolean)

	Dim oVis As ObjectVisibility = AsmDoc.ObjectVisibility
	oVis.Sketches = oToggle
	oVis.Sketches3D = oToggle
	oVis.UserWorkPlanes = oToggle
	oVis.UserWorkAxes = oToggle
	oVis.UserWorkPoints = oToggle
	oVis.OriginWorkPlanes =oToggle
	oVis.OriginWorkAxes = oToggle
	oVis.OriginWorkPoints = oToggle

End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I moved a few things to separate sub routines as it makes overall code easier to read/edit later.&amp;nbsp; I also added some logic to help avoid errors.&amp;nbsp; Let me know if you have any questions, or if this is not working as intended.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Feb 2022 15:16:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10933823#M40710</guid>
      <dc:creator>J-Camper</dc:creator>
      <dc:date>2022-02-07T15:16:38Z</dc:date>
    </item>
    <item>
      <title>Re: Create derived part of assembly | Exclude all assembly parts Sketches Parameters WorkFeatures</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10934732#M40711</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4898893"&gt;@J-Camper&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Thank you for the solution, and even more for taking the time to help me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do I read the code correctly that "If visRep.DesignViewType = DesignViewTypeEnum.kMasterDesignViewType" is a check to see if the assembly has Master selected as View Representation? If yes, the code, to my knowledge, does not show the message box in the if sentence when assembly view representation is set to "Master".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My original idea was to use Master View Representation as a method to make sure that all parts within the assembly was visible and hence included in the derived part, but I think this is possible to achieve in different ways. I need to tinker a little bit more with the code to have all parts in the derived make this work. Maybe I can include part visibility in the same sub as object visibility?&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="Assembly Master View" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1021954iF8122AADA1EC5B4A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Assembly Master View.PNG" alt="Assembly Master View" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Assembly Master View&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;/Rolf Even&lt;/P&gt;</description>
      <pubDate>Mon, 07 Feb 2022 21:39:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10934732#M40711</guid>
      <dc:creator>RolfEven</dc:creator>
      <dc:date>2022-02-07T21:39:40Z</dc:date>
    </item>
    <item>
      <title>Re: Create derived part of assembly | Exclude all assembly parts Sketches Parameters WorkFeatures</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10934874#M40712</link>
      <description>&lt;P&gt;So in the first forum post I was helping with, we were working to a user created View rep and I had Master Selectable.&amp;nbsp; When selected, the visRep Object did get recognized as a MasterDesignViewRep....&amp;nbsp; That situation did trigger my If statement to brief the user that These ObjectVisibility changes didn't seem to function in the MasterViewRepresentation.&amp;nbsp; I didn't notice when I brought that check over to your code, the ActiveDesignViewRepresentation [master being active] was reading as a TransientViewRepresentation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Long story short, I thought I was catching the MasterView rep full, but It appears the ActiveView Rep is a Transient View rep even in the "Master" Is Active.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All it was meant to do is stop the View.Locked property from getting changed if the view was a "Master" View, which can't be unlocked.&amp;nbsp; If you want to base the derived part on Master View Rep, we can make a temporary one then delete it when done.&amp;nbsp; won't need the If Check you mentioned.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a modified code:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub Main
	Dim g_App As Inventor.InventorServer = ThisApplication
	Dim AssDoc As Inventor.AssemblyDocument = TryCast(ThisDoc.Document, AssemblyDocument)
	If IsNothing(AssDoc) Then Logger.Debug("Not run in assembly") : Exit Sub
	Dim partname As String = AssDoc.FullFileName : partname = Left(partname, partname.Length-4) &amp;amp; ".ipt"
	
	Dim visRep As DesignViewRepresentation = AssDoc.ComponentDefinition.RepresentationsManager.ActiveDesignViewRepresentation
	Dim masterRep As DesignViewRepresentation = AssDoc.ComponentDefinition.RepresentationsManager.DesignViewRepresentations.Item("Master")
	
	If visRep.Name &amp;lt;&amp;gt; masterRep.Name Then masterRep.Activate ' Make sure master is active first
	
	Dim tempRep As DesignViewRepresentation = AssDoc.ComponentDefinition.RepresentationsManager.DesignViewRepresentations.Add() 'Make temp view based on Master
	tempRep.Activate

	Call ObjectVisibility(AssDoc, False)
	
	' Create a new part document that will be the shrinkwrap substitute
	Dim oPartDoc As PartDocument
	oPartDoc = g_App.Documents.Add(DocumentTypeEnum.kPartDocumentObject, , True)

	Dim oPartDef As PartComponentDefinition
	oPartDef = oPartDoc.ComponentDefinition

	Dim oDerivedAssemblyDef As DerivedAssemblyDefinition
	oDerivedAssemblyDef = oPartDef.ReferenceComponents.DerivedAssemblyComponents.CreateDefinition(AssDoc.FullDocumentName)
	' Set various shrinkwrap related options
	oDerivedAssemblyDef.DeriveStyle = DerivedComponentStyleEnum.kDeriveAsMultipleBodies
	oDerivedAssemblyDef.IncludeAllTopLevelWorkFeatures = DerivedComponentOptionEnum.kDerivedExcludeAll
	oDerivedAssemblyDef.IncludeAllTopLevelSketches = DerivedComponentOptionEnum.kDerivedExcludeAll
	oDerivedAssemblyDef.IncludeAllTopLeveliMateDefinitions = DerivedComponentOptionEnum.kDerivedExcludeAll
	oDerivedAssemblyDef.IncludeAllTopLevelParameters = DerivedComponentOptionEnum.kDerivedExcludeAll
	Call oDerivedAssemblyDef.SetHolePatchingOptions(DerivedHolePatchEnum.kDerivedPatchNone)
	Call oDerivedAssemblyDef.SetRemoveByVisibilityOptions(DerivedGeometryRemovalEnum.kDerivedRemoveNone)
	
	Dim oDerivedAss As DerivedAssemblyComponent
	oDerivedAss = oPartDoc.ComponentDefinition.ReferenceComponents.DerivedAssemblyComponents.Add(oDerivedAssemblyDef)
	Call oDerivedAss.BreakLinkToFile()

	'Save New Document
	Call SaveFile(oPartDoc, partname)
		
	AssDoc.Activate
	
	Call ObjectVisibility(AssDoc, True)
	
	tempRep.Delete
	
End Sub

Sub SaveFile(oDoc As Document, NewFileName As String)
	
	Try
		oDoc.SaveAs(NewFileName, False)
		ThisApplication.ActiveView.Fit
		ThisApplication.CommandManager.ControlDefinitions.Item("AppIsometricViewCmd").Execute()
	Catch
		MessageBox.Show(oDoc.DisplayName &amp;amp; " cannot be overwritten.", "Terminating")
		oDoc.Close(True)
		Exit Sub
	End Try

End Sub

Sub ObjectVisibility(AsmDoc As AssemblyDocument, oToggle As Boolean)

	Dim oVis As ObjectVisibility = AsmDoc.ObjectVisibility
	oVis.Sketches = oToggle
	oVis.Sketches3D = oToggle
	oVis.UserWorkPlanes = oToggle
	oVis.UserWorkAxes = oToggle
	oVis.UserWorkPoints = oToggle
	oVis.OriginWorkPlanes =oToggle
	oVis.OriginWorkAxes = oToggle
	oVis.OriginWorkPoints = oToggle

End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if you are still having issues/questions&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Feb 2022 23:03:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10934874#M40712</guid>
      <dc:creator>J-Camper</dc:creator>
      <dc:date>2022-02-07T23:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: Create derived part of assembly | Exclude all assembly parts Sketches Parameters WorkFeatures</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10935627#M40713</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4898893"&gt;@J-Camper&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Beautiful, thank you so much for taking the time to help me with this project.&lt;/P&gt;&lt;P&gt;I added a couple of lines to the code so that View Representation in the assembly file is set back to "Default" after the derived part is created. Modified code is posted below if anybody else is interested.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub Main
	Dim g_App As Inventor.InventorServer = ThisApplication
	Dim AssDoc As Inventor.AssemblyDocument = TryCast(ThisDoc.Document, AssemblyDocument)
	If IsNothing(AssDoc) Then Logger.Debug("Not run in assembly") : Exit Sub
	Dim partname As String = AssDoc.FullFileName : partname = Left(partname, partname.Length-4) &amp;amp; ".ipt"
	
	Dim visRep As DesignViewRepresentation = AssDoc.ComponentDefinition.RepresentationsManager.ActiveDesignViewRepresentation
	Dim masterRep As DesignViewRepresentation = AssDoc.ComponentDefinition.RepresentationsManager.DesignViewRepresentations.Item("Master")
	
	If visRep.Name &amp;lt;&amp;gt; masterRep.Name Then masterRep.Activate ' Make sure master is active first
	
	Dim tempRep As DesignViewRepresentation = AssDoc.ComponentDefinition.RepresentationsManager.DesignViewRepresentations.Add() 'Make temp view based on Master
	tempRep.Activate

	Call ObjectVisibility(AssDoc, False)
	
	' Create a new part document that will be the shrinkwrap substitute
	Dim oPartDoc As PartDocument
	oPartDoc = g_App.Documents.Add(DocumentTypeEnum.kPartDocumentObject, , True)

	Dim oPartDef As PartComponentDefinition
	oPartDef = oPartDoc.ComponentDefinition

	Dim oDerivedAssemblyDef As DerivedAssemblyDefinition
	oDerivedAssemblyDef = oPartDef.ReferenceComponents.DerivedAssemblyComponents.CreateDefinition(AssDoc.FullDocumentName)
	' Set various shrinkwrap related options
	oDerivedAssemblyDef.DeriveStyle = DerivedComponentStyleEnum.kDeriveAsMultipleBodies
	oDerivedAssemblyDef.IncludeAllTopLevelWorkFeatures = DerivedComponentOptionEnum.kDerivedExcludeAll
	oDerivedAssemblyDef.IncludeAllTopLevelSketches = DerivedComponentOptionEnum.kDerivedExcludeAll
	oDerivedAssemblyDef.IncludeAllTopLeveliMateDefinitions = DerivedComponentOptionEnum.kDerivedExcludeAll
	oDerivedAssemblyDef.IncludeAllTopLevelParameters = DerivedComponentOptionEnum.kDerivedExcludeAll
	Call oDerivedAssemblyDef.SetHolePatchingOptions(DerivedHolePatchEnum.kDerivedPatchNone)
	Call oDerivedAssemblyDef.SetRemoveByVisibilityOptions(DerivedGeometryRemovalEnum.kDerivedRemoveNone)
	
	Dim oDerivedAss As DerivedAssemblyComponent
	oDerivedAss = oPartDoc.ComponentDefinition.ReferenceComponents.DerivedAssemblyComponents.Add(oDerivedAssemblyDef)
	Call oDerivedAss.BreakLinkToFile()

	'Save New Document
	Call SaveFile(oPartDoc, partname)
		
	AssDoc.Activate
	Dim DefaultRep As DesignViewRepresentation = AssDoc.ComponentDefinition.RepresentationsManager.DesignViewRepresentations.Item("Default")
	DefaultRep.Activate
	tempRep.Delete
	
End Sub

Sub SaveFile(oDoc As Document, NewFileName As String)
	
	Try
		oDoc.SaveAs(NewFileName, False)
		ThisApplication.ActiveView.Fit
		ThisApplication.CommandManager.ControlDefinitions.Item("AppIsometricViewCmd").Execute()
	Catch
		MessageBox.Show(oDoc.DisplayName &amp;amp; " cannot be overwritten.", "Terminating")
		oDoc.Close(True)
		Exit Sub
	End Try

End Sub

Sub ObjectVisibility(AsmDoc As AssemblyDocument, oToggle As Boolean)

	Dim oVis As ObjectVisibility = AsmDoc.ObjectVisibility
	oVis.Sketches = oToggle
	oVis.Sketches3D = oToggle
	oVis.UserWorkPlanes = oToggle
	oVis.UserWorkAxes = oToggle
	oVis.UserWorkPoints = oToggle
	oVis.OriginWorkPlanes =oToggle
	oVis.OriginWorkAxes = oToggle
	oVis.OriginWorkPoints = oToggle

End Sub&lt;/LI-CODE&gt;&lt;P&gt;/Rolf Even&lt;/P&gt;</description>
      <pubDate>Tue, 08 Feb 2022 08:27:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10935627#M40713</guid>
      <dc:creator>RolfEven</dc:creator>
      <dc:date>2022-02-08T08:27:55Z</dc:date>
    </item>
    <item>
      <title>Re: Create derived part of assembly | Exclude all assembly parts Sketches Parameters WorkFeatures</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10945679#M40714</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I need to revisit this thread because I have overlooked that I need to delete/unlink parameters. The parameter "Thickness" is exported in sheet metal parts and used in drawing title block. In the derived part this parameter is included, but I want to exclude it, and all other parameters for that sake. The code in this thread's post 14 excludes all top-level parameters, but parameters from assembly parts gets included.&lt;/P&gt;&lt;P&gt;The picture below from GUI is to illustrate what I want to accomplish. I've spent some time trying to search for a solution, and the closest thing I've found is the two links below. The code below is from the second link, post 3 by &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1171223"&gt;@DRoam&lt;/a&gt;. This code is working for a derived part. But it is not working for a derived assembly. If anybody can point me in the right direction to solve this, I would highly appreciate it.&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-ilogic-api-vba-forum/i-logic-with-derived-parts/td-p/10244759" target="_blank" rel="noopener"&gt;https://forums.autodesk.com/t5/inventor-ilogic-api-vba-forum/i-logic-with-derived-parts/td-p/10244759&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-ilogic-api-vba-forum/deleting-derived-parameters-that-are-not-used/td-p/8206226" target="_blank" rel="noopener"&gt;https://forums.autodesk.com/t5/inventor-ilogic-api-vba-forum/deleting-derived-parameters-that-are-not-used/td-p/8206226&lt;/A&gt;&amp;nbsp;&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="Derived part exclude parameters" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1024199iFE569EE75B38CA66/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Derived part exclude parameters.png" alt="Derived part exclude parameters" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Derived part exclude parameters&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim oDoc As PartDocument = ThisDoc.Document

For Each oDerivedPartComponent As Inventor.DerivedPartComponent In oDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents
	Dim oDerivedPartDefinition As Inventor.DerivedPartDefinition = oDerivedPartComponent.Definition
	
	For Each oParameterEntity As Inventor.DerivedPartEntity In oDerivedPartDefinition.Parameters
		oParameterEntity.IncludeEntity = False
	Next 'Derived parameter
	oDerivedPartComponent.Definition = oDerivedPartDefinition
Next 'Derived part component&lt;/LI-CODE&gt;&lt;P&gt;/Rolf Even&lt;/P&gt;</description>
      <pubDate>Fri, 11 Feb 2022 20:47:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10945679#M40714</guid>
      <dc:creator>RolfEven</dc:creator>
      <dc:date>2022-02-11T20:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: Create derived part of assembly | Exclude all assembly parts Sketches Parameters WorkFeatures</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10945715#M40715</link>
      <description>&lt;P&gt;I don't see an easy access to DerivedOccurrence Parameters, but once you break the link all the linked parameters become normal User Parameters.&amp;nbsp; You should be able to delete them after you break the link.&amp;nbsp; Like this:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;'.... more code above

Call oDerivedAss.BreakLinkToFile()
	
'New lines start:
	For Each p As Inventor.Parameter In oPartDoc.ComponentDefinition.Parameters
		Try
			p.Delete()
		Catch : End Try
	Next
'New lines end

	'Save New Document
	Call SaveFile(oPartDoc, partname)

'.... more code below&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if this does not work in your testing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Feb 2022 21:03:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10945715#M40715</guid>
      <dc:creator>J-Camper</dc:creator>
      <dc:date>2022-02-11T21:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: Create derived part of assembly | Exclude all assembly parts Sketches Parameters WorkFeatures</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10945791#M40716</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4898893"&gt;@J-Camper&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Thank you for the quick reply. The code you created is working when the link to the source assembly is broken. I guess this would be the perfect moment to share this bit of info; After a little bit of thought since post #14, I'm trying to keep the derived part linked to the source assembly...&lt;/P&gt;&lt;P&gt;So, if it is impractical to get rid of these parameters I see three options. A; do some work by hand (GUI) to unlink parameters. B; leave the parameters there, as I don't think they do anything wrong or causes to much harm. C; Do it the Inception way with a derived in a derived. Idea with C is to first derive the assembly to an IPT, and then derive the IPT into another IPT and there have no parameters. Right now I'm thinking option B.&lt;/P&gt;&lt;P&gt;/Rolf Even&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Feb 2022 21:52:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/create-derived-part-of-assembly-exclude-all-assembly-parts/m-p/10945791#M40716</guid>
      <dc:creator>RolfEven</dc:creator>
      <dc:date>2022-02-11T21:52:31Z</dc:date>
    </item>
  </channel>
</rss>

