Hi Chris,
Thanks for your answer. However, the method you've posted produces incorrect examples in my case. I'm gonna try and explain what I'm doing, so maybe you can see if I'm doing something else wrong, because basically I'm iterating through the faces of my shape (a compound consisting of one of more solids, in general) and the method you gave me returns results such as (-1,0,0), (0,1,0) etc. when the faces (which are planar, for certain) are nothing but parallel to XoY or XoZ planes. Maybe there are no surfaces assigned to the faces, is that possible? I've isolated one example, just for you to check, it's basically
an extrusion of a rectangle, let's call it a wall:
double xdim = profile->XDim/2, ydim = profile->YDim/2;
gp_Trsf trsf = profile->Position;
polygon.Add(gp_Pnt(-xdim, -ydim, 0).Transformed(trsf));
polygon.Add(gp_Pnt(xdim, -ydim, 0).Transformed(trsf));
polygon.Add(gp_Pnt(xdim, ydim, 0).Transformed(trsf));
polygon.Add(gp_Pnt(-xdim, ydim, 0).Transformed(trsf));
polygon.Close();
// Build a rectangular wire
TopoDS_Wire wire = polygon.Wire();
// Build a face from the wire
BRepBuilderAPI_MakeFace faceBuilder(wire);
TopoDS_Face face = faceBuilder.Face();
// Make a prism and position it
TopoDS_Shape prism = BRepPrimAPI_MakePrism(face , vec);
BRepBuilderAPI_Transform transformer(prism, profilePlacement);
prism = transformer.Shape();
Now as I've told you, the "wall" is nowhere near being aligned to X or Y axes, and yet I get the results I've mentioned. I'm just realizing that the face must have an assigned surface, because otherwise your method will probably crash, since BRep_Tool::Surface(face) would probably return NULL. So what may be the problem here? Do I have to transform the direction returned using some local coordinate system transformation?
Thanks,
Janko Jerinic