Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get Mass and Area with Inventor Apprentice

1 REPLY 1
Reply
Message 1 of 2
Anonymous
299 Views, 1 Reply

Get Mass and Area with Inventor Apprentice

I need some help in retrieve mass and area value with Inventor Apprentice.

 

Below is the code to retrieve volume.

 

ApprenticeServerComponent apprentice = new ApprenticeServerComponent();
ApprenticeServerDocument input = apprentice.Open(@"C:\Files\Input\test.ipt");

 

SurfaceBody body = input.ComponentDefinition.SurfaceBodies[1];

Debug.Print(System.Convert.ToString(body.Volume[0.1]));

 

Can anyone suggest how to get mass and area?

Tags (3)
1 REPLY 1
Message 2 of 2
Sergio.D.Suárez
in reply to: Anonymous

Hi, I don't have apprentice installed, so I can't test the code. I will show you how I access with ilogic.

 

Dim doc As PartDocument = ThisApplication.ActiveDocument
Dim oCD As PartComponentDefinition = doc.ComponentDefinition

Dim oSurfBody As SurfaceBody = oCD.SurfaceBodies(1)

Dim
oArea As Double = 0 For Each oFace As Face In oSurfBody.Faces oArea = Round(oArea + oFace.Evaluator.Area,4) Next Dim oMass As Double = Round(oCD.MassProperties.Mass, 4) MessageBox.Show(oMass) MessageBox.Show(oArea)

 I hope this helps you to adapt your code to your need. Cheers


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report