<?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: addFloatSliderCommandInput Slider Increment in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/addfloatslidercommandinput-slider-increment/m-p/11112976#M6149</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/11211802"&gt;@ebunn3&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried it too.&lt;BR /&gt;It changed the properties but did not change the behavior.&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;# Fusion360API Python script

import traceback
import adsk.fusion
import adsk.core

_app: adsk.core.Application = None
_ui: adsk.core.UserInterface = None
_handlers = []

_sliderIpt: adsk.core.FloatSliderCommandInput = None
_dropDownIpt: adsk.core.DropDownCommandInput = None

class MyCommandCreatedHandler(adsk.core.CommandCreatedEventHandler):
    def __init__(self):
        super().__init__()

    def notify(self, args: adsk.core.CommandCreatedEventArgs):
        # adsk.core.Application.get().log(args.firingEvent.name)
        try:
            global _handlers
            cmd: adsk.core.Command = adsk.core.Command.cast(args.command)

            # inputs
            inputs: adsk.core.CommandInputs = cmd.commandInputs

            global _sliderIpt
            _sliderIpt = inputs.addFloatSliderCommandInput(
                'sliderIptId',
                'Slider',
                'mm',
                0.0,
                100.0,
                False
            )
            unitMgr: adsk.core.UnitsManager = _app.activeProduct.unitsManager
            _sliderIpt.spinStep = unitMgr.convert(1, unitMgr.defaultLengthUnits, unitMgr.internalUnits)

            global _dropDownIpt
            _dropDownIpt = inputs.addDropDownCommandInput(
                'dropDownIptId',
                'Slider Step',
                adsk.core.DropDownStyles.TextListDropDownStyle
            )
            ddItems = _dropDownIpt.listItems
            ddItems.add('1', True, '')
            ddItems.add('5', False, '')
            ddItems.add('10', False, '')
            ddItems.add('20', False, '')

            # event
            onDestroy = MyCommandDestroyHandler()
            cmd.destroy.add(onDestroy)
            _handlers.append(onDestroy)

            onStepChanged = StepChangedHandler(_dropDownIpt)
            cmd.inputChanged.add(onStepChanged)
            _handlers.append(onStepChanged)


        except:
            _ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))


class StepChangedHandler(adsk.core.InputChangedEventHandler):
    def __init__(self, ddIpt: adsk.core.DropDownCommandInput):
        super().__init__()
        self.input = ddIpt

    def notify(self, args: adsk.core.InputChangedEventArgs):
        # adsk.core.Application.get().log(args.firingEvent.name)

        if self.input != args.input:
            return

        global _dropDownIpt, _sliderIpt
        step = float(_dropDownIpt.selectedItem.name)

        _sliderIpt.spinStep = step

        global _app
        _app.log(f'Slider SpinStep:{_sliderIpt.spinStep}')


class MyCommandDestroyHandler(adsk.core.CommandEventHandler):
    def __init__(self):
        super().__init__()

    def notify(self, args: adsk.core.CommandEventArgs):
        # adsk.core.Application.get().log(args.firingEvent.name)
        adsk.terminate()


def run(context):
    try:
        global _app, _ui
        _app = adsk.core.Application.get()
        _ui = _app.userInterface

        cmdDef: adsk.core.CommandDefinition = _ui.commandDefinitions.itemById(
            'test_cmd'
        )

        if not cmdDef:
            cmdDef = _ui.commandDefinitions.addButtonDefinition(
                'test_cmd',
                'Test',
                'Test'
            )

        global _handlers
        onCommandCreated = MyCommandCreatedHandler()
        cmdDef.commandCreated.add(onCommandCreated)
        _handlers.append(onCommandCreated)

        cmdDef.execute()

        adsk.autoTerminate(False)

    except:
        if _ui:
            _ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 19 Apr 2022 01:40:03 GMT</pubDate>
    <dc:creator>kandennti</dc:creator>
    <dc:date>2022-04-19T01:40:03Z</dc:date>
    <item>
      <title>addFloatSliderCommandInput Slider Increment</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/addfloatslidercommandinput-slider-increment/m-p/11112216#M6148</link>
      <description>&lt;P&gt;I see that there is a way to set the spinStep for a slider but there does not appear to be a way to set something similar for the slider itself.&amp;nbsp; Is there a way to set the sensitivity of the slider so it increments a lessor amount when using the slider.&amp;nbsp; SpinStep does not appear to affect this slider behavior at all.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Eric&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="ebunn3_0-1650299972284.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1055977i966288826AC0B235/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ebunn3_0-1650299972284.png" alt="ebunn3_0-1650299972284.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2022 16:40:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/addfloatslidercommandinput-slider-increment/m-p/11112216#M6148</guid>
      <dc:creator>ebunn3</dc:creator>
      <dc:date>2022-04-18T16:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: addFloatSliderCommandInput Slider Increment</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/addfloatslidercommandinput-slider-increment/m-p/11112976#M6149</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/11211802"&gt;@ebunn3&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried it too.&lt;BR /&gt;It changed the properties but did not change the behavior.&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;# Fusion360API Python script

import traceback
import adsk.fusion
import adsk.core

_app: adsk.core.Application = None
_ui: adsk.core.UserInterface = None
_handlers = []

_sliderIpt: adsk.core.FloatSliderCommandInput = None
_dropDownIpt: adsk.core.DropDownCommandInput = None

class MyCommandCreatedHandler(adsk.core.CommandCreatedEventHandler):
    def __init__(self):
        super().__init__()

    def notify(self, args: adsk.core.CommandCreatedEventArgs):
        # adsk.core.Application.get().log(args.firingEvent.name)
        try:
            global _handlers
            cmd: adsk.core.Command = adsk.core.Command.cast(args.command)

            # inputs
            inputs: adsk.core.CommandInputs = cmd.commandInputs

            global _sliderIpt
            _sliderIpt = inputs.addFloatSliderCommandInput(
                'sliderIptId',
                'Slider',
                'mm',
                0.0,
                100.0,
                False
            )
            unitMgr: adsk.core.UnitsManager = _app.activeProduct.unitsManager
            _sliderIpt.spinStep = unitMgr.convert(1, unitMgr.defaultLengthUnits, unitMgr.internalUnits)

            global _dropDownIpt
            _dropDownIpt = inputs.addDropDownCommandInput(
                'dropDownIptId',
                'Slider Step',
                adsk.core.DropDownStyles.TextListDropDownStyle
            )
            ddItems = _dropDownIpt.listItems
            ddItems.add('1', True, '')
            ddItems.add('5', False, '')
            ddItems.add('10', False, '')
            ddItems.add('20', False, '')

            # event
            onDestroy = MyCommandDestroyHandler()
            cmd.destroy.add(onDestroy)
            _handlers.append(onDestroy)

            onStepChanged = StepChangedHandler(_dropDownIpt)
            cmd.inputChanged.add(onStepChanged)
            _handlers.append(onStepChanged)


        except:
            _ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))


class StepChangedHandler(adsk.core.InputChangedEventHandler):
    def __init__(self, ddIpt: adsk.core.DropDownCommandInput):
        super().__init__()
        self.input = ddIpt

    def notify(self, args: adsk.core.InputChangedEventArgs):
        # adsk.core.Application.get().log(args.firingEvent.name)

        if self.input != args.input:
            return

        global _dropDownIpt, _sliderIpt
        step = float(_dropDownIpt.selectedItem.name)

        _sliderIpt.spinStep = step

        global _app
        _app.log(f'Slider SpinStep:{_sliderIpt.spinStep}')


class MyCommandDestroyHandler(adsk.core.CommandEventHandler):
    def __init__(self):
        super().__init__()

    def notify(self, args: adsk.core.CommandEventArgs):
        # adsk.core.Application.get().log(args.firingEvent.name)
        adsk.terminate()


def run(context):
    try:
        global _app, _ui
        _app = adsk.core.Application.get()
        _ui = _app.userInterface

        cmdDef: adsk.core.CommandDefinition = _ui.commandDefinitions.itemById(
            'test_cmd'
        )

        if not cmdDef:
            cmdDef = _ui.commandDefinitions.addButtonDefinition(
                'test_cmd',
                'Test',
                'Test'
            )

        global _handlers
        onCommandCreated = MyCommandCreatedHandler()
        cmdDef.commandCreated.add(onCommandCreated)
        _handlers.append(onCommandCreated)

        cmdDef.execute()

        adsk.autoTerminate(False)

    except:
        if _ui:
            _ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 19 Apr 2022 01:40:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/addfloatslidercommandinput-slider-increment/m-p/11112976#M6149</guid>
      <dc:creator>kandennti</dc:creator>
      <dc:date>2022-04-19T01:40:03Z</dc:date>
    </item>
    <item>
      <title>Re: addFloatSliderCommandInput Slider Increment</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/addfloatslidercommandinput-slider-increment/m-p/11115213#M6150</link>
      <description>&lt;P&gt;I suspect this isn't supported internally by the float slider. When I use some Fusion commands that have float sliders their values aren't nice even values. I'm guessing that Fusion determines the increment based on the number of pixels the slider currently spans and that's what you get.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 21:54:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/addfloatslidercommandinput-slider-increment/m-p/11115213#M6150</guid>
      <dc:creator>BrianEkins</dc:creator>
      <dc:date>2022-04-19T21:54:49Z</dc:date>
    </item>
    <item>
      <title>Re: addFloatSliderCommandInput Slider Increment</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/addfloatslidercommandinput-slider-increment/m-p/11116492#M6151</link>
      <description>&lt;P&gt;Thanks all for the support. &amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Eric&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 11:49:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/addfloatslidercommandinput-slider-increment/m-p/11116492#M6151</guid>
      <dc:creator>ebunn3</dc:creator>
      <dc:date>2022-04-20T11:49:25Z</dc:date>
    </item>
  </channel>
</rss>

