<?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: Is there access to the Display Settings / Environment options? in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/is-there-access-to-the-display-settings-environment-options/m-p/11678365#M4681</link>
    <description>Thanks!</description>
    <pubDate>Fri, 13 Jan 2023 21:36:26 GMT</pubDate>
    <dc:creator>Joshua.mursic</dc:creator>
    <dc:date>2023-01-13T21:36:26Z</dc:date>
    <item>
      <title>Is there access to the Display Settings / Environment options?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/is-there-access-to-the-display-settings-environment-options/m-p/11675615#M4676</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to have my addon change the background color of the environment, depending on what mode that addon is in. Is there a way to activate the different environment options (Dark Sky, Grey Room etc...)? And is it possible to create new environment color options?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Josh&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2023 20:56:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/is-there-access-to-the-display-settings-environment-options/m-p/11675615#M4676</guid>
      <dc:creator>Joshua.mursic</dc:creator>
      <dc:date>2023-01-12T20:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: Is there access to the Display Settings / Environment options?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/is-there-access-to-the-display-settings-environment-options/m-p/11675944#M4677</link>
      <description>&lt;P&gt;The environments aren't directly exposed through the API. However, you can access the environment command through the API and interact with it to get and set the current environment.&amp;nbsp; Below is some example code that contains a test function and two helper functions that let you get and set the environment. When getting and setting which item in the list is active, I chose to use the index instead of the name so it will work when Fusion is set to any language.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def run(context):
    app: adsk.core.Application = adsk.core.Application.get()
    ui = app.userInterface
    try:
        SetEnvironment(ui, 'Dark Sky')
        envName = GetEnvironment(ui)
        app.log(envName)

        SetEnvironment(ui, 'Tranquility Blue')
        envName = GetEnvironment(ui)
        app.log(envName)
    except:
        ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))


def GetEnvironment(ui: adsk.core.UserInterface) -&amp;gt; str:
    viewCmd = ui.commandDefinitions.itemById('ViewEnvCommand')
    listCntrl: adsk.core.ListControlDefinition = viewCmd.controlDefinition

    if listCntrl.listItems[0].isSelected:
        return 'Dark Sky'
    elif listCntrl.listItems[1].isSelected:
        return 'Grey Room'
    elif listCntrl.listItems[2].isSelected:
        return 'Photo Booth'
    elif listCntrl.listItems[3].isSelected:
        return 'Tranquility Blue'
    elif listCntrl.listItems[4].isSelected:
        return 'Infinity Pool'
    elif listCntrl.listItems[5].isSelected:
        return 'River Rubicon'
    else:
        return 'Unknown'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2023 00:16:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/is-there-access-to-the-display-settings-environment-options/m-p/11675944#M4677</guid>
      <dc:creator>BrianEkins</dc:creator>
      <dc:date>2023-01-13T00:16:24Z</dc:date>
    </item>
    <item>
      <title>Re: Is there access to the Display Settings / Environment options?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/is-there-access-to-the-display-settings-environment-options/m-p/11675979#M4678</link>
      <description>&lt;P&gt;Thanks so much Brian! Really appreciate the help!&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2023 00:51:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/is-there-access-to-the-display-settings-environment-options/m-p/11675979#M4678</guid>
      <dc:creator>Joshua.mursic</dc:creator>
      <dc:date>2023-01-13T00:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: Is there access to the Display Settings / Environment options?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/is-there-access-to-the-display-settings-environment-options/m-p/11677258#M4679</link>
      <description>&lt;P&gt;Hey Brian,&lt;/P&gt;&lt;P&gt;I do not see the SetEnviroment() function in your example code that you provided&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2023 13:37:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/is-there-access-to-the-display-settings-environment-options/m-p/11677258#M4679</guid>
      <dc:creator>Joshua.mursic</dc:creator>
      <dc:date>2023-01-13T13:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: Is there access to the Display Settings / Environment options?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/is-there-access-to-the-display-settings-environment-options/m-p/11677603#M4680</link>
      <description>&lt;P&gt;Oops. Sorry about that. Here it is.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def SetEnvironment(ui: adsk.core.UserInterface, envName: str) -&amp;gt; bool:
    viewCmd = ui.commandDefinitions.itemById('ViewEnvCommand')
    listCntrl: adsk.core.ListControlDefinition = viewCmd.controlDefinition

    if envName == 'Dark Sky':
        listCntrl.listItems[0].isSelected = True
    elif envName == 'Grey Room':
        listCntrl.listItems[1].isSelected = True
    elif envName == 'Photo Booth':
        listCntrl.listItems[2].isSelected = True
    elif envName == 'Tranquility Blue':
        listCntrl.listItems[3].isSelected = True
    elif envName == 'Infinity Pool':
        listCntrl.listItems[4].isSelected = True
    elif envName == 'River Rubicon':
        listCntrl.listItems[5].isSelected = True
    else:
        return False

    return True&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 13 Jan 2023 15:43:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/is-there-access-to-the-display-settings-environment-options/m-p/11677603#M4680</guid>
      <dc:creator>BrianEkins</dc:creator>
      <dc:date>2023-01-13T15:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: Is there access to the Display Settings / Environment options?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/is-there-access-to-the-display-settings-environment-options/m-p/11678365#M4681</link>
      <description>Thanks!</description>
      <pubDate>Fri, 13 Jan 2023 21:36:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/is-there-access-to-the-display-settings-environment-options/m-p/11678365#M4681</guid>
      <dc:creator>Joshua.mursic</dc:creator>
      <dc:date>2023-01-13T21:36:26Z</dc:date>
    </item>
  </channel>
</rss>

