<?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: problem with activate() method of nested occurrences in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/problem-with-activate-method-of-nested-occurrences/m-p/8322179#M15382</link>
    <description>&lt;P&gt;Hi Mr. Tomsia,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;thank you very much&lt;/STRONG&gt; for your time and your hints!&lt;/P&gt;&lt;P&gt;It helped me to find a way to achieve what I wanted - problem solved!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-&amp;gt;createForAssemblyContext() did the job.&lt;/P&gt;&lt;PRE&gt;Ptr&amp;lt;Occurrence&amp;gt; newOcc = activeComp-&amp;gt;occurrences()-&amp;gt;addNewComponent(Matrix3D::create())-&amp;gt;createForAssemblyContext(activeOccurrence);	// new occurrence&lt;/PRE&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Oct 2018 12:48:31 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-10-09T12:48:31Z</dc:date>
    <item>
      <title>problem with activate() method of nested occurrences</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/problem-with-activate-method-of-nested-occurrences/m-p/8318132#M15378</link>
      <description>&lt;P&gt;Simple C++ script to demonstrate problem (-&amp;gt; attached file):&lt;/P&gt;&lt;P&gt;1) create new occurrence/component in active component&lt;/P&gt;&lt;P&gt;2) create sketch in new component&lt;/P&gt;&lt;P&gt;3) activate new component&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Works as expected if root-component is active when user starts script:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-&amp;gt; component is activated, user can select sketch in timeline, right-click "edit sketch", create circle, stop sketch, create extrusion.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-&amp;gt; component activated&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="new component in root.PNG" style="width: 564px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/554763i628BBE6C35DF3490/image-size/large?v=v2&amp;amp;px=999" role="button" title="new component in root.PNG" alt="new component in root.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;circle clearly visible after "stop sketch"&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="new component in root sketch geometry.PNG" style="width: 588px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/554764iB598FB5580207DA6/image-size/large?v=v2&amp;amp;px=999" role="button" title="new component in root sketch geometry.PNG" alt="new component in root sketch geometry.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Works not as expected if "subassy" is active when user starts script:&lt;/P&gt;&lt;P&gt;-&amp;gt; new component is added, but in an "half-active" state. Timeline looks as if the component is activated, but no active-component radio button in the browser is visible. No component item in the browser is activated at all.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Question: known limitation?&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the user ignores this weird state, it can cause problems:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- user selects sketch in timeline, right-click "edit sketch", creates geometry, then "stop sketch" -&amp;gt; see image, faint display of circle, no component selected in browser&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="display after stop sketch in sketch palette.PNG" style="width: 591px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/554769i431C2A2E63354E3B/image-size/large?v=v2&amp;amp;px=999" role="button" title="display after stop sketch in sketch palette.PNG" alt="display after stop sketch in sketch palette.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then the user creates an extrusion with the circle.&lt;/P&gt;&lt;P&gt;-&amp;gt; see image&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="result of extrusion.PNG" style="width: 998px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/554771i41AA6171C402580B/image-size/large?v=v2&amp;amp;px=999" role="button" title="result of extrusion.PNG" alt="result of extrusion.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;oops!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Addendum: if the user leaves the sketch directly by entering "create extrusion" (instead of "stop sketch" and then "create extrusion") then the extrusion is created without any warnings (and the new component is selected in the browser).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;=&amp;gt; ??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Oct 2018 14:12:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/problem-with-activate-method-of-nested-occurrences/m-p/8318132#M15378</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-10-07T14:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: problem with activate() method of nested occurrences</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/problem-with-activate-method-of-nested-occurrences/m-p/8321195#M15379</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Hi Mr. Steinbach,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;... it is difficult and time-consuming&amp;nbsp;to give the definitive strict diagnosis but,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;when creating extrusion make sure that the following are addressed:&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV class="ui-tabs ui-widget ui-widget-content ui-corner-all"&gt;&lt;DIV class="api-code ui-tabs-panel ui-widget-content ui-corner-bottom"&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;BR /&gt;&lt;PRE&gt;&lt;SPAN&gt;# Get the value of the property.&lt;/SPAN&gt;&lt;BR /&gt;propertyValue = extrudeFeatureInput_var.&lt;STRONG&gt;creationOccurrence&lt;/STRONG&gt;&lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;DIV class="ui-tabs ui-widget ui-widget-content ui-corner-all"&gt;&lt;DIV class="api-code ui-tabs-panel ui-widget-content ui-corner-bottom"&gt;&lt;BR /&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;PRE&gt;&lt;SPAN&gt;# Get the value of the property.&lt;/SPAN&gt;&lt;BR /&gt;propertyValue = profile_var.&lt;STRONG&gt;assemblyContext&lt;/STRONG&gt;&lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;MichaelT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Oct 2018 01:32:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/problem-with-activate-method-of-nested-occurrences/m-p/8321195#M15379</guid>
      <dc:creator>MichaelT_123</dc:creator>
      <dc:date>2018-10-09T01:32:44Z</dc:date>
    </item>
    <item>
      <title>Re: problem with activate() method of nested occurrences</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/problem-with-activate-method-of-nested-occurrences/m-p/8321298#M15380</link>
      <description>&lt;P&gt;Just for clarification to avoid misunderstandings:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the example/demonstration C++ script just creates an occurrence in the active object, adds a sketch and activates the occurrence.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The rest of the operations (open/edit sketch, add circle, add extrusion) are done by the user interactively. Just to show what problems might arise when a user runs that script (which is actually only a part of a larger program).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My problem/question is: why does the API return a semi-activated occurrence, when the occurrence is created in a subassembly (in a non-root component/occurrence).&lt;/P&gt;</description>
      <pubDate>Tue, 09 Oct 2018 04:35:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/problem-with-activate-method-of-nested-occurrences/m-p/8321298#M15380</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-10-09T04:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: problem with activate() method of nested occurrences</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/problem-with-activate-method-of-nested-occurrences/m-p/8321896#M15381</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Hi Mr. Steinbach&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are many strange behaviors in F360 and depends upon a point of view (from below, from above, from ground level) they could be attributed to devilish work, miracle, someone's fatty fingers or ... misunderstandings of things by me, you and others.&lt;/P&gt;&lt;P&gt;Thank you for the clarification. Regardless of WHO created the strings of commands, they are at the end processed by the same(?) F360 core.&lt;/P&gt;&lt;P&gt;In your case, you are the co-author, sharing responsibility for the final outcome ( or failure).&lt;/P&gt;&lt;P&gt;I do not have time to C-compile and run your script but consider looking into the following:&lt;/P&gt;&lt;P&gt;- &lt;EM&gt;&amp;lt;&amp;lt;newOcc = activeComp-&amp;gt;occurrences()-&amp;gt;addNewComponent(matrix);&amp;gt;&amp;gt;&lt;/EM&gt; does not create full contextual path to the occurence if it is not at root level&lt;BR /&gt;As a fact, if the active component has many occurrences representations, the command will 'create' respective number of occurences.&lt;BR /&gt;- &lt;EM&gt;&amp;lt;&amp;lt;Ptr&amp;lt;Sketch&amp;gt; sketch = newComp-&amp;gt;sketches()-&amp;gt;add(xy);&amp;gt;&amp;gt;&lt;/EM&gt; Based on documentation when &lt;EM&gt;planarEntity&lt;/EM&gt; is deep in the assembly, the different command's construct should be used.&lt;BR /&gt;&lt;EM&gt;&amp;lt;&amp;lt;returnValue = sketches_var-&amp;gt;add(planarEntity, occurrenceForCreation);&amp;gt;&amp;gt;&lt;/EM&gt;&lt;BR /&gt;- it seems that in your code, you did not cupture &lt;EM&gt;occurrenceForCreation&lt;/EM&gt; and as such you can not build assembly context for entities you create.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully, this will help...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Regards&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;MichaelT&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Oct 2018 10:12:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/problem-with-activate-method-of-nested-occurrences/m-p/8321896#M15381</guid>
      <dc:creator>MichaelT_123</dc:creator>
      <dc:date>2018-10-09T10:12:37Z</dc:date>
    </item>
    <item>
      <title>Re: problem with activate() method of nested occurrences</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/problem-with-activate-method-of-nested-occurrences/m-p/8322179#M15382</link>
      <description>&lt;P&gt;Hi Mr. Tomsia,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;thank you very much&lt;/STRONG&gt; for your time and your hints!&lt;/P&gt;&lt;P&gt;It helped me to find a way to achieve what I wanted - problem solved!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-&amp;gt;createForAssemblyContext() did the job.&lt;/P&gt;&lt;PRE&gt;Ptr&amp;lt;Occurrence&amp;gt; newOcc = activeComp-&amp;gt;occurrences()-&amp;gt;addNewComponent(Matrix3D::create())-&amp;gt;createForAssemblyContext(activeOccurrence);	// new occurrence&lt;/PRE&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Oct 2018 12:48:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/problem-with-activate-method-of-nested-occurrences/m-p/8322179#M15382</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-10-09T12:48:31Z</dc:date>
    </item>
  </channel>
</rss>

