Is it possible to call existing functions in the Fusion UI from scripts?

Is it possible to call existing functions in the Fusion UI from scripts?

Anonymous
Not applicable
809 Views
2 Replies
Message 1 of 3

Is it possible to call existing functions in the Fusion UI from scripts?

Anonymous
Not applicable

Hi,

I want to write a script that really should just simply be an automated sequence of already existing commands in the Fusion UI. In this particular case, I would just like to call the coil command in a loop, creating a series of coils with different parameters. Looking at the API, it looks like i'd have to do this at a much lower API level, calling functions to generate a coil-shaped path, then creating a profile then doing a sweep, and so on. This is all significantly more hassle than just running the coil command. Is there a way to run commands like coild from a script?

 

Thanks!

 

Regards,

    CS

Accepted solutions (1)
810 Views
2 Replies
Replies (2)
Message 2 of 3

prainsberry
Autodesk
Autodesk

That is the way that it works for most features, but some features (such as coil) have not been completed yet in the API.  I will defer to the dev team for any thoughts on if/when it might be available.  

 

I may have some thng that could help though.  I just recently wrote a script for generating helical curve with the API.  It might be a good starting point if you wanted to use this curve as an input to a sweep feature as you suggested.

 

https://github.com/tapnair/HelixGenerator

 

Let me know if this works out.

 



Patrick Rainsberry
Developer Advocate, Fusion 360
0 Likes
Message 3 of 3

KrisKaplan
Autodesk
Autodesk
Accepted solution

The design of the API is primarily from a data model perspective.  Many UI commands (including feature commands like coil) have fairly extensive potential inputs and (sometimes subtle) dependence on user interactions.  For many commands, coming up with an argument set/interface to drive this from the API could be quite complicated/confusing, and more sensative to change over time.  The '?Input' objects are intended to be the rough equivalent to the inputs in the command UI.  But as you mentioned, some concepts like sketch profiles and paths are split out into their own subsystem and would be created in a separate step and set as an input to the higher level object (e.g. a feature) whereas the UI commands generate these objects based on user interactions/selections.

 

There is the ability to directly execute the UI commands using the CommandDefinition.execute API.  However, this typically is just equivalent to starting the command in the UI (leaving the completion of the command up to user interactions).  There is the ability to specify inputs through the 'inputs' NamedValues argument to accept inputs from a script.  If a complete set of valid inputs are specified, the command could execute without user interactions.  However, at this time very few commands support gathering inputs from the execute API.

 

Kris



Kris Kaplan