Hello there
I am tring redo Bolt example for my purposes. There is some part of original code.
if not cmdDef: cmdDef = commandDefinitions.addButtonDefinition('Bolt', 'Create Bolt', 'Create a bolt.', './resources') # relative resource file path is specified
I need to change names of some variables and do little changes in apperiance.
But after renaming nothing hapend untill I reload Fusion 360.
if not cmdDef: cmdDef = commandDefinitions.addButtonDefinition('Box', 'Create Box', 'Create a box.', './resources') # relative resource file path is specified
Another problem that afrer renaming, at some moment UI input window changed to default. And I couldn't turn it back.
Tnx for your reply.
Let me refrase.
I am trying to do a script, which would do a box via the code.
Actually, general part is done (it works through hardcode parameters), but I wonna add input paramaters window like in picture above.
Where user could fill in thickness, sizes etc for desired box.
When I tried to use Bolt example as a template, I had some problems.
In code I renamed all variables, handlers, and other names from Bolt to Box (for example: BoltCommandExecuteHandler => BoxCommandExecuteHandler).
I looked at the whole code to double check it.
But as a result I have default input window:
I hope that it became a little clearer.
Oh, I see what you are saying.
I don't quite see the purpose of re-naming someone elses Add-in anyhow. You will be better off learning how to create a dialogue box by writing your own add-in from the ground up.
regards,
That's not a default input window but is a command window that contains the command inputs defined by that add-in. You need to look at the handler for the command created event. You'll find the API calls there where it's creating the selection and drop down command inputs that you're seeing. You'll want to replace those calls a string value input and several value inputs. And in the handler function for the execute event you'll need to read the values of those inputs and use those to create the box.
You are right, it is not a "default" windows as I thought before.
My problem was in renaming. I named my inner class - Box(), this name the same as build-in comand Box.
Problem disappered when I change name to something unique - BOX() or Boxx() - work fine.
But I still don't know how to change this parameters without reload Fusion 360 - to see changes.
returnValue = commandDefinitions_var.addButtonDefinition(id, name, tooltip, resourceFolder)
You shouldn't have to shut down and restart Fusion after every code change if you're add-in is behaving correctly. Mainly, by "behaving correctly" I mean that it cleans up everything in the stop function that it added to the UI in the run function. Otherwise it will try creating a command definition using the name of one that already exists and will fail there.
Assuming your add-in does clean up after itself correctly, here are the steps to stopping and restarting an add-in after making changes to your code:
That should be it.
If you're debugging your add-in, you should first make sure that you're not at a break point and your program is halted. You can click the "Continue Execution" button to have it continue running. If there are any message boxes displayed you'll need to click on those so your add-in and continue. You can also click the "Exit Debug" command to stop execution, which will likely cause one or more message boxes to be displayed that you'll need to dismiss. Then you'll still need to stop and restart your add-in in the "Scripts and Add-Ins" dialog.