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: 

CppCLR_WinFormsProject (C++ with .NET Win Forms)

6 REPLIES 6
Reply
Message 1 of 7
maurizio_manzi
223 Views, 6 Replies

CppCLR_WinFormsProject (C++ with .NET Win Forms)

Hello,
I would like to use Windows Forms (.NET) in my C++ project.

For this I have to load a template of the type "CppCLR_WinFormsProject" (C++ with Win Forms) in visual studio. Unfortunately, I can't find any instructions on how to then connect to the Fusion360 API (links, etc.).

On the other hand, if I use the Fusion C++ template, I have no way of accessing the WinForms afterwards.

How do I connect to the Fusion360 API in a self-created VS project?

Best Regards

Maurizio

 

6 REPLIES 6
Message 2 of 7

Hi @maurizio_manzi ,

 

From my point of view the correct way should be from Fusion360 to C++ and from them to .NET components.

For it to work, you have to load .NET components from C++ to enable the environment for execution of windows forms.  If you take a look in google, you'll find valuables resources to run windows forms from C++; for sure, some one did it before.  Once you succeed this part, you might continue running the C++ from Fusion360.

 

I wonder why you need windows forms.  There is any specific functionality you'd like to have that is not found in the currents API's?

 

Regards,

Jorge 

 

Message 3 of 7

Hello,
Thank you for your answer.

I tried this way, but then UI doesn't appear on new item tab.

With Windows Forms I have a control-designer, which I don't have with the API...

Best regards

Maurizio

 

Message 4 of 7

Hi,

 

When you said "UI doesn't appear on new item tab" you mean to add some other control type to the commands control?

If this is the case, I don't thing is going to be possible because there is not an public API to extend the commands.

For me the only way is to display an independent window with the controls you want, with the interaction to Fusion360 through the C++ API.

Or maybe some other type of interface like in javascript which is lighter than a windows client.  Did you check already the HTML paletts?  Could be an alternative i believe.

 

Regards,

Jorge

 

Message 5 of 7
BrianEkins
in reply to: maurizio_manzi

The C++ project that works with Fusion must be unmanaged C++ and then you want to use some managed (.NET) functions with it. Here's a good article I found that should be a good starting point.

 

https://www.codeproject.com/Tips/695387/Calling-Csharp-NET-methods-from-unmanaged-C-Cplusp

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

Thank you,

but this is the way for use c# dll in C++

I want to use the .NET-Windows-Form-Designer in my C++ project.

Best regards

Maurizio

Message 7 of 7
BrianEkins
in reply to: maurizio_manzi

I don't believe you can directly use .NET WinForms within an unmanaged C++ DLL. That article illustrates a way to call a managed DLL from an unmanaged program. I haven't used managed C++ and don't know how it works with WinForms, or if it does. Of course, C# does, so you could create your UI using it but then call that DLL from your Fusion C++ add-in.

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