<?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: Control visibility of tool paths from API in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/control-visibility-of-tool-paths-from-api/m-p/11634283#M4795</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13108168"&gt;@marylou.forsyth&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps the API does not provide the functionality.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I found a way to show/hide using a text command.&lt;BR /&gt;This sample here shows/hides the first setup.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;# Fusion360API Python script

import traceback
import adsk.core
import adsk.cam
from urllib.parse import quote

def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui = app.userInterface
        doc = app.activeDocument
        products = doc.products
        cam = adsk.cam.CAM.cast(products.itemByProductType("CAMProductType"))

        # target setup
        setup = cam.setups[0]

        # ObjectPaths.Onk
        onk = u'ONK::CmpInst={}/Cmp={}/{}/{}={}/'.format(
            quote(doc.name),
            quote(doc.name),
            'Setups=1', # Language English
            # '設定=1', # Language Japanese
            setup.name,
            setup.operationId,)
        # app.log(onk)

        # select setup
        app.executeTextCommand(u'Commands.Select {}'.format(onk))

        # Toggle visibility for the selected node.
        app.executeTextCommand(u'NaNeuCAMUI.ToolpathVisibilityToggle')

    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;However, I cannot find a way to check whether it is currently shown or not.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 21 Dec 2022 14:52:50 GMT</pubDate>
    <dc:creator>kandennti</dc:creator>
    <dc:date>2022-12-21T14:52:50Z</dc:date>
    <item>
      <title>Control visibility of tool paths from API</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/control-visibility-of-tool-paths-from-api/m-p/11630574#M4794</link>
      <description>&lt;P&gt;Thank you all for allowing me to post this!&amp;nbsp; We are looking for a solution that allows our python API script to call the Manufacturing Tool Paths setups 'hide all' followed by a setups 'show all'.&amp;nbsp; It would be a python line(s) of code that perform the same function as this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="marylouforsyth_0-1671483967485.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1154287i884B03878B548FCD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="marylouforsyth_0-1671483967485.png" alt="marylouforsyth_0-1671483967485.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If we can call Fusion 360 to hide all tool paths and then show all tool paths, our refreshing of the model will be visually correct again.&amp;nbsp; I have looked seriously, so if anyone has a suggestion, please let us know, and if there are any actual python lines of code that does this, I will be SO happy. Thank you all, stay safe!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We had these four lines of code to do the refreshing of our model after all modifications, but this logic stopped working end of November 2022 (with a Fusion update):&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;designWorkspace&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;ui&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;workspaces&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;itemById&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"FusionSolidEnvironment"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;designWorkspace&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;activate&lt;/SPAN&gt;&lt;SPAN&gt;()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;camWorkspace&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;ui&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;workspaces&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;itemById&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"CAMEnvironment"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;camWorkspace&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;activate&lt;/SPAN&gt;&lt;SPAN&gt;()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;At the time of posting this, manually clicking the eye in front of the TOP ONE "setups" in manufacturing (which turns off visibility of all tool paths) and then manually clicking the eye in front of the ONE same "setups" (not each of the lower tool paths) performs the refresh (or the removal of) the unwanted lines.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Please help if can, thank you!!&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 19 Dec 2022 21:22:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/control-visibility-of-tool-paths-from-api/m-p/11630574#M4794</guid>
      <dc:creator>marylou.forsyth</dc:creator>
      <dc:date>2022-12-19T21:22:24Z</dc:date>
    </item>
    <item>
      <title>Re: Control visibility of tool paths from API</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/control-visibility-of-tool-paths-from-api/m-p/11634283#M4795</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13108168"&gt;@marylou.forsyth&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps the API does not provide the functionality.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I found a way to show/hide using a text command.&lt;BR /&gt;This sample here shows/hides the first setup.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;# Fusion360API Python script

import traceback
import adsk.core
import adsk.cam
from urllib.parse import quote

def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui = app.userInterface
        doc = app.activeDocument
        products = doc.products
        cam = adsk.cam.CAM.cast(products.itemByProductType("CAMProductType"))

        # target setup
        setup = cam.setups[0]

        # ObjectPaths.Onk
        onk = u'ONK::CmpInst={}/Cmp={}/{}/{}={}/'.format(
            quote(doc.name),
            quote(doc.name),
            'Setups=1', # Language English
            # '設定=1', # Language Japanese
            setup.name,
            setup.operationId,)
        # app.log(onk)

        # select setup
        app.executeTextCommand(u'Commands.Select {}'.format(onk))

        # Toggle visibility for the selected node.
        app.executeTextCommand(u'NaNeuCAMUI.ToolpathVisibilityToggle')

    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;However, I cannot find a way to check whether it is currently shown or not.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2022 14:52:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/control-visibility-of-tool-paths-from-api/m-p/11634283#M4795</guid>
      <dc:creator>kandennti</dc:creator>
      <dc:date>2022-12-21T14:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: Control visibility of tool paths from API</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/control-visibility-of-tool-paths-from-api/m-p/11645335#M4796</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3787950" target="_self"&gt;&lt;SPAN class=""&gt;Kandennti&lt;/SPAN&gt;&lt;/A&gt;, how wonderful to have your response !&amp;nbsp; I commend you and honor your method of thinking outside the box for this solution!!&amp;nbsp; I was able to bring in the code, I found some syntax issues that I am working through but what a fantastic idea.&amp;nbsp; I really appreciate the time you took to listen and really address my concern.&amp;nbsp; What a world of new features this concept could address for us here in our business, very excited.&amp;nbsp; I will accept your solution as is, and if I am able I will post what syntax issues I was able to resolve when I get there.&amp;nbsp; Thank you!!&lt;/P&gt;</description>
      <pubDate>Wed, 28 Dec 2022 16:13:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/control-visibility-of-tool-paths-from-api/m-p/11645335#M4796</guid>
      <dc:creator>marylou.forsyth</dc:creator>
      <dc:date>2022-12-28T16:13:42Z</dc:date>
    </item>
  </channel>
</rss>

