Can you run an .exe in the API?

Can you run an .exe in the API?

TMC.Engineering
Collaborator Collaborator
1,140 Views
4 Replies
Message 1 of 5

Can you run an .exe in the API?

TMC.Engineering
Collaborator
Collaborator

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
0 Likes
1,141 Views
4 Replies
Replies (4)
Message 2 of 5

MattWynn
Alumni
Alumni

In C++ you can do anything...

 

What language are you programming in? script or addin?


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

KrisKaplan
Autodesk
Autodesk

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

TMC.Engineering
Collaborator
Collaborator

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
0 Likes
Message 5 of 5

KrisKaplan
Autodesk
Autodesk

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
0 Likes