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: 

Can you run an .exe in the API?

4 REPLIES 4
Reply
Message 1 of 5
TMC.Engineering
824 Views, 4 Replies

Can you run an .exe in the API?

As the title says can you run a application inside fusion

 

Thanks

Timm

Engineer, Maker
System: Aorus X3 Plus V3, Windows 10
Plymouth Michigan, USA
Owner TMC Engineering
4 REPLIES 4
Message 2 of 5
MattWynn
in reply to: TMC.Engineering

In C++ you can do anything...

 

What language are you programming in? script or addin?


Matt Wynn
Senior Manager, Software Development, Fusion Fabrication
Message 3 of 5

This wouldn't be something that is provided by the Fusion API, but you are free to use the language features of your script to do so.  You don't mention what language your script is in.  If it is Python, you can use 'os.system' or the 'subprocess' module to spawn child processes.  If it is C++, you can use 'std::system' or one of any number of frameworks out there (like boost::Process) or platform specific functions (such as CreateProcess on Windows).  JavaScript unfortunately has to run under the security restrictions of the host web browser, so you don't have direct access to the operating system to spawn processes.

 

Kris



Kris Kaplan
Message 4 of 5

Sorry for the limited info this is not my area.  my goal is to show a webpage inside a window in fusion.

 

I have an .exe done in C#. In it there has a web browser control that navigates to the m.wolframalpha.com

 

so I think i am looking for a way to display this executable in a fusion window.

 

thanks for your help and patience with my fumbling around.

 

 

Timm

Engineer, Maker
System: Aorus X3 Plus V3, Windows 10
Plymouth Michigan, USA
Owner TMC Engineering
Message 5 of 5

The easiest solution would be to use a Python script that uses the 'webbrowser' module, and calls "webbrowser.open_new('m.wolframalpha.com')".  But this will launch that url in a new page in the user's default system web browser, not in a child window in Fusion.  But it would be a simple, cross platform solution.

 

To create a child window in Fusion with a web browser would be a more advanced problem, and depends on what behavior you expect (is this a modal or modeless window).  From an in Fusion process script to do this modelessly, you would probably need to run a side thread (which likely means C++) and use a native library (e.g. Win32) to create a window, use whatever webbrowser library you choose created in that window, and manage the message loop on it.  Not a trivial task.  If you want to use your existing exe, by default it will create it's own root window.  So you would either need to invoke it with the current Fusion process id as a command line arg, or have it search for the (hopefully only) running Fusion instance and get its process id, and when you create the browser window, set the parent to Fusion's main window.

 

Kris



Kris Kaplan

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