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.
This is the code I used to project a shape onto plane
Handle(HLRBRep_Algo)myAlgo = new HLRBRep_Algo();
myAlgo->Add(R);
Prs3d_Projector myProj(false,0, 0,0,zloc,0,0,1, 0,0,1);//zloc is z coordinate of projection point
myAlgo->Projector(myProj.Projector());
myAlgo->Update();
HLRBRep_HLRToShape aHLRToShape(myAlgo);
TopoDS_Shape Proj = aHLRToShape.VCompound();
Handle (AIS_Shape) DispP = new AIS_Shape(Proj);
myAISContext->Display(DispP,Standard_False);
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.
Fri, 07/17/2009 - 12:16
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);
while(faceExplorer.More()){
TopoDS_Face currentFace = TopoDS::Face(faceExplorer.Current());
// do smth. with the face
faceExplorer.Next();
}
Fri, 07/17/2009 - 18:20
for the projection, you can use the HLR algorithms. check the sample.
Stephane
Tue, 07/21/2009 - 03:04
Is there any way to get outerbounds like outerwire of a shape?
Tue, 07/21/2009 - 04:20
Divya,
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.
-Ding
Thu, 07/23/2009 - 08:39
Hi,
This is the code I used to project a shape onto plane
Handle(HLRBRep_Algo)myAlgo = new HLRBRep_Algo();
myAlgo->Add(R);
Prs3d_Projector myProj(false,0, 0,0,zloc,0,0,1, 0,0,1);//zloc is z coordinate of projection point
myAlgo->Projector(myProj.Projector());
myAlgo->Update();
HLRBRep_HLRToShape aHLRToShape(myAlgo);
TopoDS_Shape Proj = aHLRToShape.VCompound();
Handle (AIS_Shape) DispP = new AIS_Shape(Proj);
myAISContext->Display(DispP,Standard_False);
Can anyone tell me what am I doing wrong here?
Sat, 07/10/2010 - 05:53
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.