project shape onto a plane

Hi all,

Can any one suggest me how to project a TopoDS_Shape onto a plane?
I can project a face.But,i'm unable to explore face out of this shape.

Please help!

Marco Matt's picture

Hi Divya,

i dont have any experience with projections, but you can get the faces of the shape by using TopExp_Explorer.

TopoDS_Shape shape;
TopExp_Explorer faceExplorer(shape, TopAbs_FACE);

TopoDS_Face currentFace = TopoDS::Face(faceExplorer.Current());
// do smth. with the face

Stephane Routelous's picture

for the projection, you can use the HLR algorithms. check the sample.


Divya's picture

Is there any way to get outerbounds like outerwire of a shape?

Cauchy Ding's picture


To get out hole of a shell, you can use ShapeAnalysis_FreeBounds.
ShapeAnalysis_FreeBounds safb(compoundShape);
shape = safb.GetClosedWires ();
for(exp.Init(shape, TopAbs_WIRE); exp.More(); exp.Next())
hole = exp.Current();
PS: ShapeAnalysis_FreeBounds also find the inner holes of a face, so you should omit these holes.


Divya's picture


This is the code I used to project a shape onto plane

Handle(HLRBRep_Algo)myAlgo = new HLRBRep_Algo();
Prs3d_Projector myProj(false,0, 0,0,zloc,0,0,1, 0,0,1);//zloc is z coordinate of projection point
HLRBRep_HLRToShape aHLRToShape(myAlgo);
TopoDS_Shape Proj = aHLRToShape.VCompound();
Handle (AIS_Shape) DispP = new AIS_Shape(Proj);

Can anyone tell me what am I doing wrong here?

Mark's picture

This works: Prs3d_Projector myProj(false,0, 0,0,zloc, 0,0,1, 0,1,0);

From doxygen documentation -
- DX, DY and DZ are the coordinates of the
projection vector;
- XUp, YUp and ZUp are the coordinates of the
vertical direction vector.

If you dig through the code, these two vectors are crossed to form a 3rd vector. So these two must be at 90 degrees to each other.