
Tue, 10/20/2009 - 19:24
I use the following code to build a solid, and use BRepCheck_Shell method th chech the solid's shell, the result show that the shell of the solid is not closed and have wrong orientation.
Handle(Geom_SurfaceOfRevolution) _s1 = new Geom_SurfaceOfRevolution( aCurve, aAxis);
//to create two side face
Handle(Geom_Curve) _c1, _c2;
Standard_Real u1,u2,v1,v2;
_s1->Bounds(u1,u2,v1,v2);
if(_s1->IsUClosed())
{
_c1=_s1->VIso(v1);
_c2=_s1->VIso(v2);
}
if(_s1->IsVClosed())
{
_c1=_s1->UIso(u1);
_c2=_s1->UIso(u2);
}
/////////////////////////////////////////////////////////////////
BRep_Builder B;
TopoDS_Edge e1,e2;
TopoDS_Wire w1,w2;
TopoDS_Face f1,f2;
TopoDS_Face b_face;
TopoDS_Shell shell;
b_face = BRepBuilderAPI_MakeFace(_s1);
e1 = BRepBuilderAPI_MakeEdge(_c1);
e2 = BRepBuilderAPI_MakeEdge(_c2);
e1.Orientation(TopAbs_REVERSED);
e2.Orientation(TopAbs_FORWARD);
B.UpdateEdge (e1,aTol);
B.UpdateEdge (e2,aTol);
B.MakeWire(w1);
B.MakeWire(w2);
B.Add(w1,e1);
B.Add(w2,e2);
f1 = BRepBuilderAPI_MakeFace(w1);
f2 = BRepBuilderAPI_MakeFace(w2);
f1.Orientation(TopAbs_REVERSED);
f2.Orientation(TopAbs_FORWARD);
b_face.Orientation(TopAbs_FORWARD);
B.UpdateFace (f1,aTol);
B.UpdateFace (f2,aTol);
B.UpdateFace (b_face,aTol);
B.MakeShell(shell);
B.Add(shell,f1);
B.Add(shell,b_face);
B.Add(shell,f2);
TopoDS_Solid mysolid;
B.MakeSolid(mysolid);
B.Add(mysolid,shell);
BRepCheck_Shell acheck(shell);
if(acheck.Closed(Standard_False)==BRepCheck_NoError)
cout
else
cout
if(acheck.Orientation(Standard_False)==BRepCheck_NoError)
cout
else
cout
Any ideas on what's wrong with the code?
Thanks in advance.
Wed, 10/21/2009 - 22:48
Hi WangYue,
actually why don't you construct a face directly using _s1?
Anyway, at first glance there are some things missing in your code:
- construction of pcurves and assigning them to edges on faces
- setting the parameters of the edges is missing
- no vertices are created
Maybe it helps
Pawel
Thu, 10/22/2009 - 18:42
Thanks, Pawel
It is ok now!