<?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: How to add isNewComponent from a Ptr&amp;lt;CombineFeatureInput&amp;gt; to selected in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-add-isnewcomponent-from-a-ptr-lt-combinefeatureinput-gt/m-p/8031027#M16041</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I checked the behavior of combine feature in Fusion 360 UI. It looks be same with one in Fusion API. Please refer to the following screencast. I am not sure if it is bug or not. I will check it with our modeling experts.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://autode.sk/2smsIz8" target="_blank"&gt;https://autode.sk/2smsIz8&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Marshal&lt;/P&gt;</description>
    <pubDate>Tue, 29 May 2018 02:28:36 GMT</pubDate>
    <dc:creator>marshaltu</dc:creator>
    <dc:date>2018-05-29T02:28:36Z</dc:date>
    <item>
      <title>How to add isNewComponent from a Ptr&lt;CombineFeatureInput&gt; to selected component</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-add-isnewcomponent-from-a-ptr-lt-combinefeatureinput-gt/m-p/8028922#M16032</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If a new component is added using the Ptr&amp;lt;CombineFeatureInput&amp;gt;-&amp;gt;add method, with isNewComponent set&lt;/P&gt;&lt;P&gt;to true, the new component is added to the active component. How can the parent component&lt;/P&gt;&lt;P&gt;be changed?&lt;/P&gt;</description>
      <pubDate>Sun, 27 May 2018 16:35:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-add-isnewcomponent-from-a-ptr-lt-combinefeatureinput-gt/m-p/8028922#M16032</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-05-27T16:35:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to add isNewComponent from a Ptr&lt;CombineFeatureInput&gt; to selected</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-add-isnewcomponent-from-a-ptr-lt-combinefeatureinput-gt/m-p/8028987#M16033</link>
      <description>&lt;P&gt;You have to get a reference to the occurrence of the component you want to activate.&lt;/P&gt;&lt;P&gt;With this reference you can use the code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;#include &amp;lt;Fusion/Components/Occurrence.h&amp;gt;

returnValue = occurrence_var-&amp;gt;activate();&lt;/PRE&gt;&lt;P&gt;Above code is taken from the documentation of the method &lt;A href="https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-ab109cba-286b-44d2-984a-e17823515706" target="_blank"&gt;Occurrence.activate&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To get a reference to an occurrence call the method &lt;A href="https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-0bdbbf88-57c2-46b5-84e0-ffed8b0f328b" target="_blank"&gt;component.occurrences.itemByName&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;#include &amp;lt;Fusion/Components/Occurrences.h&amp;gt;

returnValue = occurrences_var-&amp;gt;itemByName(name);&lt;/PRE&gt;&lt;P&gt;If this didn't answer you question or you have anymore questions please reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Erik&lt;/P&gt;</description>
      <pubDate>Sun, 27 May 2018 18:02:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-add-isnewcomponent-from-a-ptr-lt-combinefeatureinput-gt/m-p/8028987#M16033</guid>
      <dc:creator>erik</dc:creator>
      <dc:date>2018-05-27T18:02:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to add isNewComponent from a Ptr&lt;CombineFeatureInput&gt; to selected</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-add-isnewcomponent-from-a-ptr-lt-combinefeatureinput-gt/m-p/8029741#M16034</link>
      <description>&lt;P&gt;Thanks, that code activates the correct component I want the newly created component to belong to,&lt;/P&gt;&lt;P&gt;but the new component still appears at the top level of the design.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I'm back to square one - how do I choose where the new component created by a&lt;/P&gt;&lt;P&gt;Ptr&amp;lt;CombineFeatures&amp;gt;&amp;nbsp; add, with isNewComponent = true, is placed in the hierachy&lt;/P&gt;&lt;P&gt;of components?&lt;/P&gt;</description>
      <pubDate>Mon, 28 May 2018 08:46:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-add-isnewcomponent-from-a-ptr-lt-combinefeatureinput-gt/m-p/8029741#M16034</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-05-28T08:46:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to add isNewComponent from a Ptr&lt;CombineFeatureInput&gt; to selected</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-add-isnewcomponent-from-a-ptr-lt-combinefeatureinput-gt/m-p/8029754#M16035</link>
      <description>&lt;P&gt;When you create you feature isn't it done with something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Ptr&amp;lt;Features&amp;gt; propertyValue = component_var-&amp;gt;features();&lt;/PRE&gt;&lt;P&gt;Most features (if not all) are connected to a component eg. rootComponent.&lt;/P&gt;&lt;P&gt;If you instead use a reference to&amp;nbsp;the destination component you should see the new component under that component.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this makes sense and work for you, otherwise please reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Erik&lt;/P&gt;</description>
      <pubDate>Mon, 28 May 2018 08:52:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-add-isnewcomponent-from-a-ptr-lt-combinefeatureinput-gt/m-p/8029754#M16035</guid>
      <dc:creator>erik</dc:creator>
      <dc:date>2018-05-28T08:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to add isNewComponent from a Ptr&lt;CombineFeatureInput&gt; to selected</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-add-isnewcomponent-from-a-ptr-lt-combinefeatureinput-gt/m-p/8029807#M16036</link>
      <description>&lt;P&gt;My code is:-&lt;/P&gt;&lt;PRE&gt;      static Ptr&amp;lt;BRepBody&amp;gt; FuseComponents
//    ===================================
      (
        Ptr&amp;lt;Component&amp;gt; &amp;amp;         Parent, //!&amp;lt;
        Ptr&amp;lt;BRepBody&amp;gt; &amp;amp;          Head,   //!&amp;lt;
        Ptr&amp;lt;ObjectCollection&amp;gt; &amp;amp;  Tail    //!&amp;lt;       ObjectCollection of BRepBody
      )
      { 
        Ptr&amp;lt;Features&amp;gt;            features             = Parent-&amp;gt;features();
        Ptr&amp;lt;CombineFeatures&amp;gt;     combineFeatures      = features-&amp;gt;combineFeatures();

        Ptr&amp;lt;CombineFeatureInput&amp;gt; combineFeaturesInput = combineFeatures-&amp;gt;createInput ( Head, Tail );
 
        bool Flag = combineFeaturesInput-&amp;gt;isKeepToolBodies(false);
             Flag = combineFeaturesInput-&amp;gt;isNewComponent(true);
             Flag = combineFeaturesInput-&amp;gt;operation(JoinFeatureOperation);

        Ptr&amp;lt;CombineFeature&amp;gt;      combineFeature       = combineFeatures-&amp;gt;add ( combineFeaturesInput );

//      Now return the newly created body

        Ptr&amp;lt;BRepBodies&amp;gt;          Bodies               = combineFeature-&amp;gt;bodies();
        Ptr&amp;lt;BRepBody&amp;gt;            Body                 = Bodies-&amp;gt;item(0);

             Flag = Body-&amp;gt;name ( "The new one!" );

        return Body;
      }&lt;/PRE&gt;&lt;P&gt;The body appears in the grandparent, not the parent as I would like. The grandparent happens to be the&lt;/P&gt;&lt;P&gt;rootComponent. And when I started with this quest was active (by default), which is what lead my down the&lt;/P&gt;&lt;P&gt;"activate the parent" rabbit hole. As you can see, the combineFeature is part of the features of the parent,&lt;/P&gt;&lt;P&gt;but the new component (with its solitary "The new one!" body) is created in the grandparent.&lt;/P&gt;</description>
      <pubDate>Mon, 28 May 2018 09:23:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-add-isnewcomponent-from-a-ptr-lt-combinefeatureinput-gt/m-p/8029807#M16036</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-05-28T09:23:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to add isNewComponent from a Ptr&lt;CombineFeatureInput&gt; to selected</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-add-isnewcomponent-from-a-ptr-lt-combinefeatureinput-gt/m-p/8029841#M16037</link>
      <description>&lt;P&gt;I am a Python programmer and I am not sure I read you code correctly, but from what I can see in your code you are creating a variable of type Component named Parent.&lt;/P&gt;&lt;P&gt;But where is the reference to the actual component in you design?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That is the only thing I can find looking through your code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Erik&lt;/P&gt;</description>
      <pubDate>Mon, 28 May 2018 09:50:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-add-isnewcomponent-from-a-ptr-lt-combinefeatureinput-gt/m-p/8029841#M16037</guid>
      <dc:creator>erik</dc:creator>
      <dc:date>2018-05-28T09:50:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to add isNewComponent from a Ptr&lt;CombineFeatureInput&gt; to selected</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-add-isnewcomponent-from-a-ptr-lt-combinefeatureinput-gt/m-p/8030152#M16038</link>
      <description>&lt;P&gt;I have a 3 level tree of valid components created by extrude, revolve etc. It all works, except my combine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tree branches (children) are created by:-&lt;/P&gt;&lt;PRE&gt;      static Ptr&amp;lt;Component&amp;gt; CreateSubComponent
//    ========================================
      (
        Ptr&amp;lt;Component&amp;gt; &amp;amp;       Parent,
        Ptr&amp;lt;Matrix3D&amp;gt; const &amp;amp;  Transform,
        std::string const &amp;amp;    Name = ""
      )
      {
        Ptr&amp;lt;Occurrences&amp;gt; occurrences  = Parent-&amp;gt;occurrences();       
        Ptr&amp;lt;Occurrence&amp;gt;  occurrence   = occurrences-&amp;gt;addNewComponent ( Transform );
        Ptr&amp;lt;Component&amp;gt;   subComponent = occurrence-&amp;gt;component();
        subComponent-&amp;gt;name ( Name );  
        return subComponent;      
      }&lt;/PRE&gt;&lt;P&gt;How would you solve in Python?&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;</description>
      <pubDate>Mon, 28 May 2018 13:10:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-add-isnewcomponent-from-a-ptr-lt-combinefeatureinput-gt/m-p/8030152#M16038</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-05-28T13:10:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to add isNewComponent from a Ptr&lt;CombineFeatureInput&gt; to selected</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-add-isnewcomponent-from-a-ptr-lt-combinefeatureinput-gt/m-p/8030367#M16039</link>
      <description>&lt;P&gt;After testing this thorougly in Fusion with python code I can't the new combined body to end up anywhere but in the RootComponent. This has to be a bug or some functionality hidden to us.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5741855"&gt;@BrianEkins&lt;/a&gt;&amp;nbsp;or&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/561768"&gt;@marshaltu&lt;/a&gt;&amp;nbsp;knows the answer?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code in my run method would be&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;app = adsk.core.Application.get()
        ui  = app.userInterface
        
        componentSel = ui.selectEntity('Select a body', 'Occurrences')
        occ = componentSel.entity
        
        design = adsk.fusion.Design.cast(app.activeProduct)
        if not design:
            ui.messageBox('No active Fusion 360 design', 'No Design')
            return
        
        comp = design.rootComponent
        
        targetBody = comp.bRepBodies.itemByName("Body1")
        toolBody =  comp.bRepBodies.itemByName("Body2")
        toolBodies = adsk.core.ObjectCollection.create()
        toolBodies.add(toolBody)
        
        combinedBody = fuseComponents(occ.component, targetBody, toolBodies)&lt;/PRE&gt;&lt;P&gt;And in my fuseComponents method&lt;/P&gt;&lt;PRE&gt;def fuseComponents (component, targetBody, toolBodies):
    newBody = adsk.fusion.BRepBody.cast(None)
    
    features = adsk.fusion.Features.cast(None)
    features = component.features
    combineFeatures = features.combineFeatures
    combineFeatureInput = combineFeatures.createInput(targetBody, toolBodies)
    
    combineFeatureInput.isKeepToolBodies = False
    combineFeatureInput.isNewComponent = True
    combineFeatureInput.operation = adsk.fusion.FeatureOperations.JoinFeatureOperation
    
    combineFeature = combineFeatures.add(combineFeatureInput)
    
    bodies = combineFeature.bodies
    newBody = bodies.item(0)
    newBody.name = "The new One!"
    
    return newBody&lt;/PRE&gt;&lt;P&gt;I am sorry I can't help you any further.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Erik&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 May 2018 15:35:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-add-isnewcomponent-from-a-ptr-lt-combinefeatureinput-gt/m-p/8030367#M16039</guid>
      <dc:creator>erik</dc:creator>
      <dc:date>2018-05-28T15:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to add isNewComponent from a Ptr&lt;CombineFeatureInput&gt; to selected</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-add-isnewcomponent-from-a-ptr-lt-combinefeatureinput-gt/m-p/8030506#M16040</link>
      <description>&lt;P&gt;Thank you very much for trying this in Python. At least now I know its not a complete "stupid" on&lt;/P&gt;&lt;P&gt;my part. Its either a bug, a feature, or there is some obscure work around hidden deep in the documentation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It will have to wait until the Autodesk people are back.&lt;/P&gt;</description>
      <pubDate>Mon, 28 May 2018 16:55:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-add-isnewcomponent-from-a-ptr-lt-combinefeatureinput-gt/m-p/8030506#M16040</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-05-28T16:55:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to add isNewComponent from a Ptr&lt;CombineFeatureInput&gt; to selected</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-add-isnewcomponent-from-a-ptr-lt-combinefeatureinput-gt/m-p/8031027#M16041</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I checked the behavior of combine feature in Fusion 360 UI. It looks be same with one in Fusion API. Please refer to the following screencast. I am not sure if it is bug or not. I will check it with our modeling experts.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://autode.sk/2smsIz8" target="_blank"&gt;https://autode.sk/2smsIz8&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Marshal&lt;/P&gt;</description>
      <pubDate>Tue, 29 May 2018 02:28:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-add-isnewcomponent-from-a-ptr-lt-combinefeatureinput-gt/m-p/8031027#M16041</guid>
      <dc:creator>marshaltu</dc:creator>
      <dc:date>2018-05-29T02:28:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to add isNewComponent from a Ptr&lt;CombineFeatureInput&gt; to selected</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-add-isnewcomponent-from-a-ptr-lt-combinefeatureinput-gt/m-p/8031816#M16042</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/561768"&gt;@marshaltu&lt;/a&gt;!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The screencast shows the same result, but it is not the desired result.&lt;/P&gt;&lt;P&gt;Even though the other component is active, the new component ends up under the root component.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Erik&lt;/P&gt;</description>
      <pubDate>Tue, 29 May 2018 10:29:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-add-isnewcomponent-from-a-ptr-lt-combinefeatureinput-gt/m-p/8031816#M16042</guid>
      <dc:creator>erik</dc:creator>
      <dc:date>2018-05-29T10:29:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to add isNewComponent from a Ptr&lt;CombineFeatureInput&gt; to selected</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-add-isnewcomponent-from-a-ptr-lt-combinefeatureinput-gt/m-p/8034066#M16043</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, I have confirmed with our modeling team. It did not be a desired behaviour.&amp;nbsp;FUS-40520 has been logged to track the issue in our internal system.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Marshal&lt;/P&gt;</description>
      <pubDate>Wed, 30 May 2018 02:26:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-add-isnewcomponent-from-a-ptr-lt-combinefeatureinput-gt/m-p/8034066#M16043</guid>
      <dc:creator>marshaltu</dc:creator>
      <dc:date>2018-05-30T02:26:03Z</dc:date>
    </item>
  </channel>
</rss>

