how to measure of thickness

how to measure of thickness

mumeBHVY2
Participant Participant
738 Views
1 Reply
Message 1 of 2

how to measure of thickness

mumeBHVY2
Participant
Participant

Hi

 

i have given a part document in inventor and i want to calculate thickness of faces and highlight the face whose thickness is less than given thickness using api

below is the approach i am trying but it gives correct result for document which have less faces but when it comes to large document the result are not correct and also it takes more time for large part sholud their is another approach i can try

 

public List<Face[]> checkMeasuement()
{

TransientGeometry geo = m_inventorApplication.TransientGeometry;

doc = (PartDocument)m_inventorApplication.ActiveDocument;
def = doc.ComponentDefinition;


SurfaceBodies bodies = def.SurfaceBodies;
if (bodies.Count == 0)
{
MessageBox.Show("part not found", "3D Print Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
{
foreach (SurfaceBody body in bodies)
{
foreach (Face f1 in body.Faces)
{

 

ObjectsEnumerator found;
ObjectsEnumerator pts;
double[] d2 = new double[3];
double a = (f1.Evaluator.ParamRangeRect.MaxPoint.X + f1.Evaluator.ParamRangeRect.MinPoint.X) / 2;
double b = (f1.Evaluator.ParamRangeRect.MaxPoint.Y + f1.Evaluator.ParamRangeRect.MinPoint.Y) / 2;
double[] d = new double[2];
d[0] = a;
d[1] = b;
f1.Evaluator.GetNormal(ref d, ref d2);

try
{
def.FindUsingRay(f1.PointOnFace, geo.CreateUnitVector(-d2[0], -d2[1], -d2[2]), 0.01, out found, out pts, true);
face1 = (Face)found[2];
face2 = (Face)found[1];

}
catch (Exception e)
{
def.FindUsingRay(f1.PointOnFace, geo.CreateUnitVector(d2[0], d2[1], d2[2]), 0.01, out found, out pts, true);
try
{

face1 = (Face)found[2];
face2 = (Face)found[1];
}
catch (Exception f)
{

}


}
Face[] faces = new Face[2];
faces[0] = face1;
faces[1] = face2;
list.Add(faces);

 

}
}
}

return list;
}
}
}

0 Likes
739 Views
1 Reply
Reply (1)
Message 2 of 2

chandra.shekar.g
Autodesk Support
Autodesk Support

@mumeBHVY2,

 

What if, the part contains cylindrical or spline face. In this case, face can not be considered to calculate thickness. Overall, there must be strict rules to calculate thickness of face.

 

Please provide non confidential file to study the feasibility of thickness of face.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes