Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Call an Add-in from another Add-in

5 REPLIES 5
Reply
Message 1 of 6
JohnBuehler
274 Views, 5 Replies

Call an Add-in from another Add-in

Is it possible to call/start one add-in from another? I have several small commands that would make great common components that could be stand-alone add-ins that I would like to call from several other add-ins rather than adding the code into each add-in itself. Am I missing something or is this not possible?

5 REPLIES 5
Message 2 of 6
kandennti
in reply to: JohnBuehler

Hi @JohnBuehler .

 

I have not tried it, but if the add-in has already been activated and the command ID is known, I believe it is possible to call it with the CommandDefinition.execute method.

https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-7ffc950f-92e8-47bc-8228-54b67ae8e2c8 


In the case of python, if it is something very simple, like a script rather than an add-in, I think it is possible to load and run the script as a module.
The add-ins we publish here were created in such a way.

https://github.com/kantoku-code/Fusion360_Developers_Small_ToolKit 


However, if the script uses dialogs, it will not work because the add-in will also be closed after the script is closed.

Message 3 of 6
JohnBuehler
in reply to: kandennti

Thank you @kandennti ,

 

My ideal is to create a panel which can be configured through an initialization file. Each command on the panel would c all another (not yet loaded) addin command. This shouldn't cause a closure of the panel when the UI of the called component changes as multiple addins are managed this way by the framework. I am using C++ so in theory I could load the secondary .dll and run it however then the secondary addin would be a child of the first rather than a child of fusion. 

 

Another use might be to run a single addin that starts a collection of your favorite add-ins and sets up the environment in the way that you want. Other than setting them all to start at start-up. 

 

Like many things in the API, it doesn't seem like a big ask, but the maturity of the API is still well behind the product. 

 

Thank you again - John

Message 4 of 6
BrianEkins
in reply to: JohnBuehler

I'm having a hard time understanding what exactly it is you want to do.

 

An add-in is a program that can be set to be loaded and run when Fusion starts up. When it's loaded, it connects to events it wants to respond to and typically creates a button in the UI for each command that the add-in supports. An add-in can create any number of commands.

 

All commands in Fusion, both native and custom commands, have a command ID. As mentioned above, you can access the command definition that represents the command using its ID and then execute the command. This is equivalent to the user clicking the button in the UI. 

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 5 of 6
JohnBuehler
in reply to: BrianEkins

Hi @BrianEkins 

 

Let's say that I have a collection of 50 small addins, each one representing an individual command. Using these 50 addins I would like to create a more complex product consisting of its own panel, a few commands that are unique to this new addin and a series of workflows that would each use a few of those 50 smaller addins. 

 

I could, merge a COPY of the code from each of these 50 addins into my new "super addin" and compile this as a single dll.

 

This however doesn't bode well for managing common code.

 

I could also, as you suggest, set each of the utilized addins to start at startup making them available from both the add-ins panel and the "super addin".

 

This isn't really a problem unless one or more fail to auto-start or for some reason you want them to terminate at the end of their execution. If the super addin self configured at startup defining what sub-addins (commands) should be available, and that configuration changed from time to time, we would have to deal with ensuring that each was configured correctly to auto-start, or not.

 

While this may not be a common request, I do think that the ability to launch secondary add-ins makes sense in some cases.

 

John

Message 6 of 6
BrianEkins
in reply to: JohnBuehler

You can define your custom UI using any commands available in the system. These can be standard Fusion commands, commands from your add-in, and commands from any other add-in. When adding buttons you use the CommandDefinition of the command. All available commands are available in the CommandDefinitions collection, which you get from the UserInterface.commandDefinitions property.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report