CppCLR_WinFormsProject (C++ with .NET Win Forms)

maurizio_manzi
Advocate

CppCLR_WinFormsProject (C++ with .NET Win Forms)

maurizio_manzi
Advocate
Advocate

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

 

0 Likes
Reply
557 Views
6 Replies
Replies (6)

Jorge_Jaramillo
Collaborator
Collaborator

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 

 

0 Likes

maurizio_manzi
Advocate
Advocate

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

 

0 Likes

Jorge_Jaramillo
Collaborator
Collaborator

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

 

0 Likes

BrianEkins
Mentor
Mentor

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

maurizio_manzi
Advocate
Advocate

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

0 Likes

BrianEkins
Mentor
Mentor

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