Hi Quenan,
I would do that like this:
1. Read Iges file.
2. Use TopExp_Explorer or TopTools_IndexedMapOfShape to find all the faces of the imported shape.
3. For each face obtain the U and V parameters and iterate.
4. At each U-V-point get the surface normal using BRepLProp_SLProps
It would look something like this:
TopTools_IndexedMapOfShape aMap;
BRepClass3d_SolidClassifier solidClassifier(shape);
TopExp::MapShapes(shape, TopAbs_FACE, aMap);
BRepLProp_SLProps surfaceProperties(1, Precision::Confusion());
double u0, u1, v0, v1;
double u, v;
double uDelta, vDelta;
for(int i = 1; i <= aMap.Extent(); i++)
{
BRepAdaptor_Surface surface(TopoDS::Face(aMap(i)));
surfaceProperties.SetSurface(surface);
u0 = surface.FirstUParameter();
u1 = surface.LastUParameter();
v0 = surface.FirstVParameter();
v1 = surface.LastVParameter();
u = u0;
v = v0;
uDelta = surface.UResolution(resolution);
vDelta = surface.VResolution(resolution);
while(u <= u1)
{
v = v0;
while(v <= v1)
{
GetSurfaceProperties(u, v,
surfaceProperties, solidClassifier,
output, propertyToCompute);
v += vDelta;
}
if(v != v1)
{
v = v1;
GetSurfaceProperties(u, v,
surfaceProperties, solidClassifier,
output, propertyToCompute);
}
u += uDelta;
}
if(u != u1)
{
u = u1;
v = v0;
while(v <= v1)
{
GetSurfaceProperties(u, v,
surfaceProperties, solidClassifier,
output, propertyToCompute);
v += vDelta;
}
if(v != v1)
{
v = v1;
GetSurfaceProperties(u, v,
surfaceProperties, solidClassifier,
output, propertyToCompute);
}
}
}
Commenter-1