<?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: Get parent of a selected component/design in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/get-parent-of-a-selected-component-design/m-p/13879372#M22335</link>
    <description>&lt;P&gt;You mentioned that you're starting with a selection. There are many different things that can be selected, but in the end, they're either in the root component or in another component (either external or local). If it's in another component, that means there is an occurrence of that component in the current assembly. Here's some untested code that determines whether the selection is in the root component or an occurrence. If it's in an occurrence it displays the occurrence, component, and document names.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;ent = ui.activeSelections[0].entity

if ent.assemblyContext:
    occ = end.assemblyContext
    result = f'Occurrence: {occ.name}\n'
    comp = occ.component
    result += f'Component: {comp.name}\n'
    doc = comp.parentDesign.parentDocument
    result += f'Document: {doc.name}'
    ui.messageBox(result)
else:
    ui.messageBox('The selected entity is in the root Component.')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 03 Nov 2025 23:24:51 GMT</pubDate>
    <dc:creator>BrianEkins</dc:creator>
    <dc:date>2025-11-03T23:24:51Z</dc:date>
    <item>
      <title>Get parent of a selected component/design</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/get-parent-of-a-selected-component-design/m-p/13870598#M22314</link>
      <description>&lt;P&gt;If I have a referenced design in an assembly, is there a way to(with API) get the parent component/design/occurrence of a selection which is nested below the referenced design?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I guess what I’m asking is how to get the whole design three from the component I select up to the first referenced design over this selection?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5741855"&gt;@BrianEkins&lt;/a&gt;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3787950"&gt;@kandennti&lt;/a&gt;&amp;nbsp;?&lt;/P&gt;</description>
      <pubDate>Tue, 28 Oct 2025 20:05:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/get-parent-of-a-selected-component-design/m-p/13870598#M22314</guid>
      <dc:creator>oyvindTMNSU</dc:creator>
      <dc:date>2025-10-28T20:05:25Z</dc:date>
    </item>
    <item>
      <title>Re: Get parent of a selected component/design</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/get-parent-of-a-selected-component-design/m-p/13877117#M22329</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6776022"&gt;@oyvindTMNSU&lt;/a&gt;&amp;nbsp;-San.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;I overlooked that. My apologies.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The add-in published here only has Japanese documentation, but this command might be useful.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/kantoku-code/Fusion360_GOKOTAI/tree/main" target="_blank" rel="noopener"&gt;https://github.com/kantoku-code/Fusion360_GOKOTAI/tree/main&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="kandennti_0-1762093226167.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1584212i23ADE54E49297E21/image-size/medium?v=v2&amp;amp;px=400" role="button" title="kandennti_0-1762093226167.png" alt="kandennti_0-1762093226167.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Clicking here will take a moment, but it displays a tree view of the files related to the active document.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;For example, “caster” is the active document here, but it will trace all the way up to the top-level “RollStand_Assy”.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="kandennti_1-1762093294067.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1584213iE0B000F3E3D925C9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="kandennti_1-1762093294067.png" alt="kandennti_1-1762093294067.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 02 Nov 2025 14:21:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/get-parent-of-a-selected-component-design/m-p/13877117#M22329</guid>
      <dc:creator>kandennti</dc:creator>
      <dc:date>2025-11-02T14:21:47Z</dc:date>
    </item>
    <item>
      <title>Re: Get parent of a selected component/design</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/get-parent-of-a-selected-component-design/m-p/13879372#M22335</link>
      <description>&lt;P&gt;You mentioned that you're starting with a selection. There are many different things that can be selected, but in the end, they're either in the root component or in another component (either external or local). If it's in another component, that means there is an occurrence of that component in the current assembly. Here's some untested code that determines whether the selection is in the root component or an occurrence. If it's in an occurrence it displays the occurrence, component, and document names.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;ent = ui.activeSelections[0].entity

if ent.assemblyContext:
    occ = end.assemblyContext
    result = f'Occurrence: {occ.name}\n'
    comp = occ.component
    result += f'Component: {comp.name}\n'
    doc = comp.parentDesign.parentDocument
    result += f'Document: {doc.name}'
    ui.messageBox(result)
else:
    ui.messageBox('The selected entity is in the root Component.')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Nov 2025 23:24:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/get-parent-of-a-selected-component-design/m-p/13879372#M22335</guid>
      <dc:creator>BrianEkins</dc:creator>
      <dc:date>2025-11-03T23:24:51Z</dc:date>
    </item>
  </channel>
</rss>

