<?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: Ways to show message to user apart from message box in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/ways-to-show-message-to-user-apart-from-message-box/m-p/9972726#M16123</link>
    <description>&lt;P&gt;Better late than never, this will show information to the user as a graphics text that is always facing the view and in a fixed location on the viewport.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;   #Author-RM
#Description-

import adsk.core, adsk.fusion, adsk.cam, traceback

def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui  = app.userInterface
        doc = app.activeDocument
        products = doc.products
        product = products.itemByProductType('CAMProductType')
        cam_var = adsk.cam.CAM.cast(product)
        desproduct = products.itemByProductType('DesignProductType')
        des = adsk.fusion.Design.cast(desproduct)
        root = des.rootComponent


        if not cam_var:
            ui.messageBox('No CAM data exists in the active document.')
            return

        #Checks the number of toolpaths and if they are generated    
        toolpathcount = cam_var.allOperations.count
        toolpathcheck = cam_var.checkToolpath(cam_var.allOperations)
  
        text = 'ToolpathNo = ' + str(toolpathcount) + "\nToolpathcheck Valid:" + str(toolpathcheck)

        #Displays as standard message box
        display = ui.messageBox(text)  

        #Displays as graphics on screen:
        # Check to see if a custom graphics groups already exists and delete it.
        if root.customGraphicsGroups.count &amp;gt; 0:
            root.customGraphicsGroups.item(0).deleteMe()
            app.activeViewport.refresh()
        graphics = root.customGraphicsGroups.add()

        matrix = adsk.core.Matrix3D.create()
        graphicsText = graphics.addText(text, 'Arial', 3, matrix)   
        # Set the text to be front facing and anchored at (0,0,0).
        billBoard = adsk.fusion.CustomGraphicsBillBoard.create(adsk.core.Point3D.create(0,0,0))
        billBoard.billBoardStyle = adsk.fusion.CustomGraphicsBillBoardStyles.ScreenBillBoardStyle 
        graphicsText.billBoarding = billBoard

        # Set the text to use view scaling.
        viewScale = adsk.fusion.CustomGraphicsViewScale.create(4, adsk.core.Point3D.create(0,0,0))
        graphicsText.viewScale = viewScale
        viewPlace = adsk.fusion.CustomGraphicsViewPlacement.create(adsk.core.Point3D.create(0,0,0),
                                                    adsk.fusion.ViewCorners.lowerLeftViewCorner, 
                                                    adsk.core.Point2D.create(10, 120))
        graphicsText.viewPlacement = viewPlace

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

def stop(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui  = app.userInterface
        #ui.messageBox('Stop addin')

    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;Cheers,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;RM&lt;/P&gt;</description>
    <pubDate>Fri, 01 Jan 2021 21:37:24 GMT</pubDate>
    <dc:creator>rmerlo_Gamma</dc:creator>
    <dc:date>2021-01-01T21:37:24Z</dc:date>
    <item>
      <title>Ways to show message to user apart from message box</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/ways-to-show-message-to-user-apart-from-message-box/m-p/7984113#M16119</link>
      <description>&lt;P&gt;I was wondering if it's possible to show message to user in these ways through api?&lt;/P&gt;</description>
      <pubDate>Mon, 07 May 2018 09:09:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/ways-to-show-message-to-user-apart-from-message-box/m-p/7984113#M16119</guid>
      <dc:creator>rolandas_vegis</dc:creator>
      <dc:date>2018-05-07T09:09:10Z</dc:date>
    </item>
    <item>
      <title>Re: Ways to show message to user apart from message box</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/ways-to-show-message-to-user-apart-from-message-box/m-p/7989430#M16120</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unfortunately no. Please log your request in our idea station.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/fusion-360-ideastation/idb-p/125" target="_blank"&gt;https://forums.autodesk.com/t5/fusion-360-ideastation/idb-p/125&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>Wed, 09 May 2018 09:03:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/ways-to-show-message-to-user-apart-from-message-box/m-p/7989430#M16120</guid>
      <dc:creator>marshaltu</dc:creator>
      <dc:date>2018-05-09T09:03:57Z</dc:date>
    </item>
    <item>
      <title>Re: Ways to show message to user apart from message box</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/ways-to-show-message-to-user-apart-from-message-box/m-p/7991937#M16121</link>
      <description>&lt;P&gt;Actually, it is possible to show a message like the second example.&amp;nbsp; You do this by setting the executeFailed&amp;nbsp;property of the CommandEventArgs object that passed into the command execute event to True.&amp;nbsp; And setting the executeFailedMessage property to whatever message you want to show up in the error dialog.&lt;/P&gt;</description>
      <pubDate>Thu, 10 May 2018 04:58:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/ways-to-show-message-to-user-apart-from-message-box/m-p/7991937#M16121</guid>
      <dc:creator>BrianEkins</dc:creator>
      <dc:date>2018-05-10T04:58:50Z</dc:date>
    </item>
    <item>
      <title>Re: Ways to show message to user apart from message box</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/ways-to-show-message-to-user-apart-from-message-box/m-p/9972726#M16123</link>
      <description>&lt;P&gt;Better late than never, this will show information to the user as a graphics text that is always facing the view and in a fixed location on the viewport.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;   #Author-RM
#Description-

import adsk.core, adsk.fusion, adsk.cam, traceback

def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui  = app.userInterface
        doc = app.activeDocument
        products = doc.products
        product = products.itemByProductType('CAMProductType')
        cam_var = adsk.cam.CAM.cast(product)
        desproduct = products.itemByProductType('DesignProductType')
        des = adsk.fusion.Design.cast(desproduct)
        root = des.rootComponent


        if not cam_var:
            ui.messageBox('No CAM data exists in the active document.')
            return

        #Checks the number of toolpaths and if they are generated    
        toolpathcount = cam_var.allOperations.count
        toolpathcheck = cam_var.checkToolpath(cam_var.allOperations)
  
        text = 'ToolpathNo = ' + str(toolpathcount) + "\nToolpathcheck Valid:" + str(toolpathcheck)

        #Displays as standard message box
        display = ui.messageBox(text)  

        #Displays as graphics on screen:
        # Check to see if a custom graphics groups already exists and delete it.
        if root.customGraphicsGroups.count &amp;gt; 0:
            root.customGraphicsGroups.item(0).deleteMe()
            app.activeViewport.refresh()
        graphics = root.customGraphicsGroups.add()

        matrix = adsk.core.Matrix3D.create()
        graphicsText = graphics.addText(text, 'Arial', 3, matrix)   
        # Set the text to be front facing and anchored at (0,0,0).
        billBoard = adsk.fusion.CustomGraphicsBillBoard.create(adsk.core.Point3D.create(0,0,0))
        billBoard.billBoardStyle = adsk.fusion.CustomGraphicsBillBoardStyles.ScreenBillBoardStyle 
        graphicsText.billBoarding = billBoard

        # Set the text to use view scaling.
        viewScale = adsk.fusion.CustomGraphicsViewScale.create(4, adsk.core.Point3D.create(0,0,0))
        graphicsText.viewScale = viewScale
        viewPlace = adsk.fusion.CustomGraphicsViewPlacement.create(adsk.core.Point3D.create(0,0,0),
                                                    adsk.fusion.ViewCorners.lowerLeftViewCorner, 
                                                    adsk.core.Point2D.create(10, 120))
        graphicsText.viewPlacement = viewPlace

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

def stop(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui  = app.userInterface
        #ui.messageBox('Stop addin')

    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;Cheers,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;RM&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jan 2021 21:37:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/ways-to-show-message-to-user-apart-from-message-box/m-p/9972726#M16123</guid>
      <dc:creator>rmerlo_Gamma</dc:creator>
      <dc:date>2021-01-01T21:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: Ways to show message to user apart from message box</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/ways-to-show-message-to-user-apart-from-message-box/m-p/11511980#M16124</link>
      <description>&lt;P&gt;Could you give an example on how that would look like? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2022 07:59:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/ways-to-show-message-to-user-apart-from-message-box/m-p/11511980#M16124</guid>
      <dc:creator>Simon__H</dc:creator>
      <dc:date>2022-10-27T07:59:17Z</dc:date>
    </item>
  </channel>
</rss>

