how to measure of thickness
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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;
}
}
}