<?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 reference a feature by its name? in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-reference-a-feature-by-its-name/m-p/9545608#M11706</link>
    <description>&lt;P&gt;I've run the script with a more complex design. The differences are as follows:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;nested components (on multiple levels)&lt;/LI&gt;&lt;LI&gt;shared designs&lt;/LI&gt;&lt;LI&gt;sheet metal bended components.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;While iterating trough components, I get this error:&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="Screenshot 2020-05-28 at 13.22.01.png" style="width: 423px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/776734i37DCA98156B761BE/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2020-05-28 at 13.22.01.png" alt="Screenshot 2020-05-28 at 13.22.01.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I cannot understand the meaning. Some advice? Thanks.&lt;/P&gt;</description>
    <pubDate>Thu, 28 May 2020 11:37:29 GMT</pubDate>
    <dc:creator>luca.giorcelli9CG7C</dc:creator>
    <dc:date>2020-05-28T11:37:29Z</dc:date>
    <item>
      <title>How to reference a feature by its name?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-reference-a-feature-by-its-name/m-p/9521868#M11699</link>
      <description>&lt;P&gt;I'm sure it's incredibly simple, but I've been searching for hours and haven't figured it out yet.&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="Screenshot 2020-05-17 at 13.52.30.png" style="width: 194px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/771713i15B1BFE9FC04C229/image-dimensions/194x156?v=v2" width="194" height="156" role="button" title="Screenshot 2020-05-17 at 13.52.30.png" alt="Screenshot 2020-05-17 at 13.52.30.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I just want to suppress a feature named "myFeature" in timeline using the&amp;nbsp;&lt;STRONG&gt;Feature.isSuppressed&lt;/STRONG&gt; Property&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In&amp;nbsp;&lt;A href="https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-79e18b6c-7847-4ae2-97a0-a174671f3289" target="_blank" rel="noopener"&gt;API reference&lt;/A&gt; I find the following&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;feature_var.isSuppressed = True&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where&amp;nbsp;"feature_var" is a variable referencing a Feature object.&lt;BR /&gt;&lt;BR /&gt;QUESTION&lt;BR /&gt;What the right way to reference a Feature by its name? I suppose something like this...&lt;/P&gt;&lt;PRE&gt;getFeatureByName("myFeature").isSuppressed = True&lt;/PRE&gt;&lt;P&gt;Please can you tell me the right syntax?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 17 May 2020 12:01:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-reference-a-feature-by-its-name/m-p/9521868#M11699</guid>
      <dc:creator>luca.giorcelli</dc:creator>
      <dc:date>2020-05-17T12:01:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to reference a feature by its name?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-reference-a-feature-by-its-name/m-p/9522035#M11700</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try something like this :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;features= rootComp.features

myFeature = features.itemByName('myFeature')

myFeature.deleteMe()&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 17 May 2020 14:48:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-reference-a-feature-by-its-name/m-p/9522035#M11700</guid>
      <dc:creator>JeromeBriot</dc:creator>
      <dc:date>2020-05-17T14:48:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to reference a feature by its name?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-reference-a-feature-by-its-name/m-p/9522266#M11701</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2020-05-17 at 20.03.52.png" style="width: 629px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/771797i8553D555F92A9AAB/image-dimensions/629x240?v=v2" width="629" height="240" role="button" title="Screenshot 2020-05-17 at 20.03.52.png" alt="Screenshot 2020-05-17 at 20.03.52.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3865419"&gt;@JeromeBriot&lt;/a&gt;&amp;nbsp;thanks, it works!&lt;/P&gt;</description>
      <pubDate>Sun, 17 May 2020 18:11:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-reference-a-feature-by-its-name/m-p/9522266#M11701</guid>
      <dc:creator>luca.giorcelli</dc:creator>
      <dc:date>2020-05-17T18:11:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to reference a feature by its name?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-reference-a-feature-by-its-name/m-p/9522383#M11702</link>
      <description>&lt;P&gt;Sorry, I should have posted a complete code:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;import adsk.core, adsk.fusion, traceback

def run():
        
    app = adsk.core.Application.get()
    ui = app.userInterface

    try:

        design = app.activeProduct

        rootComponent = design.rootComponent

        features= rootComponent.features

        myFeature = features.itemByName('myFeature')

        if myFeature:
            myFeature.deleteMe()

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 17 May 2020 19:44:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-reference-a-feature-by-its-name/m-p/9522383#M11702</guid>
      <dc:creator>JeromeBriot</dc:creator>
      <dc:date>2020-05-17T19:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to reference a feature by its name?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-reference-a-feature-by-its-name/m-p/9526310#M11703</link>
      <description>&lt;P&gt;itemByName seems to works only if the feature belongs to root component. But I'm not able to reference a feature inside a child component.&lt;BR /&gt;&lt;BR /&gt;In the example below I unsuccessfully try to suppress &lt;STRONG&gt;featureB&lt;/STRONG&gt; inside &lt;STRONG&gt;childComponent:1&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2020-05-19 at 14.07.43.png" style="width: 436px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/772637i8F52CB2DF5A1FD45/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2020-05-19 at 14.07.43.png" alt="Screenshot 2020-05-19 at 14.07.43.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code used is the following&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;import adsk.core, adsk.fusion, traceback

def run(context):
    ui = None
    try:
        app :adsk.core.Application = adsk.core.Application.get()
        ui  :adsk.core.UserInterface = app.userInterface
        design :adsk.fusion.Design = app.activeProduct
        rootComp = design.rootComponent
        features = rootComp.features

        features.itemByName("featureB").isSuppressed = True


    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))&lt;/LI-CODE&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;&lt;P&gt;&lt;STRONG&gt;The error I get is the following one&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2020-05-19 at 14.10.07.png" style="width: 405px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/772639iD659524775646D95/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2020-05-19 at 14.10.07.png" alt="Screenshot 2020-05-19 at 14.10.07.png" /&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Instead, everything works well if I try tu suppress featureA (belonging to root component) using the same code above.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2020-05-19 at 14.12.18.png" style="width: 414px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/772640i71327454D85C3237/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2020-05-19 at 14.12.18.png" alt="Screenshot 2020-05-19 at 14.12.18.png" /&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Is there some syntax to reference features inside subcomponents? E.g. something like "childComponent1:/featureB".&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2020 12:14:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-reference-a-feature-by-its-name/m-p/9526310#M11703</guid>
      <dc:creator>luca.giorcelli</dc:creator>
      <dc:date>2020-05-19T12:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to reference a feature by its name?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-reference-a-feature-by-its-name/m-p/9527333#M11704</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can iterate through all the components in the current design:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;import adsk.core, adsk.fusion, traceback

def run(context):
        
    app = adsk.core.Application.get()
    ui = app.userInterface

    try:

        design = adsk.fusion.Design.cast(app.activeProduct)

        allComponents = design.allComponents

        for component in allComponents:

            features = component.features

            feature = features.itemByName('featureA')

            if feature:
                ui.messageBox('{} - {}'.format(component.name, feature.name))
                feature.deleteMe()

            feature = features.itemByName('featureB')

            if feature:
                ui.messageBox('{} - {}'.format(component.name, feature.name))
                feature.deleteMe()

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 May 2020 18:11:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-reference-a-feature-by-its-name/m-p/9527333#M11704</guid>
      <dc:creator>JeromeBriot</dc:creator>
      <dc:date>2020-05-19T18:11:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to reference a feature by its name?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-reference-a-feature-by-its-name/m-p/9536050#M11705</link>
      <description>&lt;P&gt;Thanks! It works&lt;/P&gt;</description>
      <pubDate>Sat, 23 May 2020 19:40:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-reference-a-feature-by-its-name/m-p/9536050#M11705</guid>
      <dc:creator>luca.giorcelli</dc:creator>
      <dc:date>2020-05-23T19:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to reference a feature by its name?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-reference-a-feature-by-its-name/m-p/9545608#M11706</link>
      <description>&lt;P&gt;I've run the script with a more complex design. The differences are as follows:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;nested components (on multiple levels)&lt;/LI&gt;&lt;LI&gt;shared designs&lt;/LI&gt;&lt;LI&gt;sheet metal bended components.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;While iterating trough components, I get this error:&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="Screenshot 2020-05-28 at 13.22.01.png" style="width: 423px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/776734i37DCA98156B761BE/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2020-05-28 at 13.22.01.png" alt="Screenshot 2020-05-28 at 13.22.01.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I cannot understand the meaning. Some advice? Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 28 May 2020 11:37:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-to-reference-a-feature-by-its-name/m-p/9545608#M11706</guid>
      <dc:creator>luca.giorcelli9CG7C</dc:creator>
      <dc:date>2020-05-28T11:37:29Z</dc:date>
    </item>
  </channel>
</rss>

