Is SurfaceBody.MassProperties removed from Inventor 2024 API?

Is SurfaceBody.MassProperties removed from Inventor 2024 API?

nnikbin
Collaborator Collaborator
401 Views
3 Replies
Message 1 of 4

Is SurfaceBody.MassProperties removed from Inventor 2024 API?

nnikbin
Collaborator
Collaborator

I use C# and when I want to access SurfaceBody.MassProperties, I get the following error:

 

Error CS1061 'SurfaceBody' does not contain a definition for 'MassProperties' and no accessible extension method 'MassProperties' accepting a first argument of type 'SurfaceBody' could be found (are you missing a using directive or an assembly reference?)

 

Is it defined in an assembly reference the should be added to the project?

0 Likes
Accepted solutions (2)
402 Views
3 Replies
Replies (3)
Message 2 of 4

CattabianiI
Collaborator
Collaborator
Accepted solution

Is SurfaceBody.MassProperties removed from Inventor 2024 API?
No, and it's documented in the link you posted: https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=SurfaceBody_MassProperties


> Is it defined in an assembly reference the should be added to the project?
You should reference the Autodesk.Inventor.Interop.dll of Inventor 2024.

 

Message 3 of 4

Andrii_Humeniuk
Advisor
Advisor
Accepted solution

Hello. Everything works for me. Here is a piece of code in C#:

 

PartDocument oDoc = m_InvApp.ActiveDocument as PartDocument;
PartComponentDefinition oDef = oDoc.ComponentDefinition;
MessageBox.Show(oDef.SurfaceBodies[1].MassProperties.Mass + " kg", "MassBody");

 Screenshot 2023-04-20 131335.png

Andrii Humeniuk - CAD Coordinator, Autodesk Certified Instructor

LinkedIn | My free Inventor Addin | My Repositories

Did you find this reply helpful ? If so please use the Accept as Solution/Like.

EESignature

Message 4 of 4

nnikbin
Collaborator
Collaborator

Thank you @CattabianiI  and @Andrii_Humeniuk,

My project was facing the issue because it was linked to an outdated version (26) of Autodesk.Inventor.Interop.

0 Likes