Community
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?
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
Sergio Daniel Suarez
Mechanical Designer
| Upwork Profile | LinkedIn