TimPaterson / Fusion360-Batch-Post

Fusion add-in to post all CAM setups at once, optionally dividing them into folders.
The Unlicense
128 stars 25 forks source link

Add setting for changing post units #2

Closed mateo4778 closed 4 years ago

mateo4778 commented 4 years ago

Thanks a lot for your work on this script, it's already saved my workflow immensely. I hacked a few things into it to get it to work for my use case and I wanted to pass them along in case they could be useful to someone else.

Just add the below into CommandEventHandler.notify.

            # check box to force units
            input = inputs.addDropDownCommandInput("units", 
                                             "Post Units",
                                             adsk.core.DropDownStyles.TextListDropDownStyle)
            input.listItems.add('Document Unit', True if docSettings["units"] == 0 else False, '')
            input.listItems.add('Inches', True if docSettings["units"] == 1 else False, '')
            input.listItems.add('Millimeters', True if docSettings["units"] == 2 else False, '')

Then add the following into the if/elif with the other input.id checks in CommandInputChangedHandler.notify.

            elif input.id == "units":
                if input.selectedItem.name == "Millimeters":
                    self.docSettings[input.id] = 2
                elif input.selectedItem.name == "Inches":
                    self.docSettings[input.id] = 1
                else:
                    self.docSettings[input.id] = 0
TimPaterson commented 4 years ago

Selection of units has been added!