Solid Faces

The faces of a solid can be retrieved in a List of TopoDSShape objects using the GeomUtils method ExtractFaces

var faces = GeomUtils.ExtractFaces(nb.Shape);

If we want to detect the face normal, we can call the ExtractDirection method or the ExtractPlane method and use the Axis component. There are some issues with the way OpenCascade handles normals for 3D solids. For example, if we extrude a circle we will have 3 faces: top, bottom and side. The side face has no direction, and the other two have normals with the same direction and different locations.
As Roman Lygin explains in this OpenCascade forum post, we need to also check the face orientation when determining the correct face direction:

var orientation = face.Orientation();
if (orientation == TopAbsOrientation.TopAbs_REVERSED)
    var axis = direction.Reversed;

To make face normal checking easier, we can use a helper method to display a line for each face direction:

foreach(var face in faces)
    Direction.ShowFaceDirection(face, Document);

The face directions are displayed like this:

face-display-sample

  0 COMMENTS
3D Tools

Leave a Reply

Pages
Blogroll





The best Android Market
AndroidPit