NEED HELP : Bug in BRepBuilderAPI_MakeFace?

Hi!

I try to create a face giving a pre existing face and a closed wire, so that the new surface corresponds to the part of the old surface that is contained within the wire.

The BRepBuilderAPI_MakeFace doen not seam to work because it does not succed in creating the new face.

Can anybody give me a hint?

Thanks, Sofia

My code is:

// Surf: preexisting surf
// e: edge projected on surface

BRepBuilderAPI_MakeFace MF(Surf,Umin, Umax, Vmin, Vmax);

BRepBuilderAPI_MakeWire wire(e);

BRepBuilderAPI_MakeFace MF2(MF.Face(),wire.Wire());

if (MF2.IsDone())
{
// DISPLAY
TDF_Label label_60 = heelRootLabel.FindChild(60,Standard_True);
TNaming_Builder aBuilderOpposite(label_60);
aBuilderOpposite.Generated(MF.Face());
Handle(TPrsStd_AISPresentation) prs= TPrsStd_AISPresentation::Set(label_60, TNaming_NamedShape::GetID());
prs->Display(1);
prs->Update();
myAISContext->UpdateCurrentViewer();
}

LI's picture

_BspSurf is the geometry surface of face
_BspSurfNew is the geometry surface of face1
Suppose that you know how to make a face from a geometry surface.
Firstly, make face1 according to face, thus you have only one wire in face1.

Handle(Geom_BSplineSurface) _BspSurf,_BspSurfNew; _BspSurfNew =new Geom_BSplineSurface(Poles,
UKnots,
VKnots,
UMults,
VMults,
_BspSurf->UDegree(),
_BspSurf->VDegree(),
_BspSurf->IsUPeriodic(),_BspSurf->IsVPeriodic());

Then try:

int nEdgesOfFace;
Handle(Geom_Surface) gsrf1=BRep_Tool::Surface(face1);
BRepBuilderAPI_MakeFace mybuilder;
mybuilder = BRepBuilderAPI_MakeFace();
mybuilder.Init(face1);
for(expw.Init(face,TopAbs_WIRE);expw.More(); expw.Next())
{
BRepBuilderAPI_MakeWire mkwire;
TopoDS_Wire wire = TopoDS::Wire(expw.Current());
TopTools_IndexedMapOfShape eInFmap;
nEdgesOfFace=0;
for (expe.Init(expw.Current(), TopAbs_EDGE);expe.More(); expe.Next()){
TopoDS_Edge edge = TopoDS::Edge(expe.Current());
Handle(Geom_Curve) myCurve=BRep_Tool::Curve(edge,dummy1,dummy2);
if(!myCurve.IsNull()){
//withdraw of the CurveOnSurface
double aFirst,aLast;
Handle(Geom2d_Curve) aC2D = BRep_Tool::CurveOnSurface(edge,face,aFirst,aLast);
//future development************
//To use a Geom2d_TrimmedCurve instead.
/* Handle(Geom2d_TrimmedCurve) T = Handle(Geom2d_TrimmedCurve)::DownCast(C);
if (!T.IsNull())
basisCurve = Handle(Curve)::DownCast(T->BasisCurve()->Copy());
else
basisCurve = Handle(Curve)::DownCast(C->Copy());*/
//future development***************
TopoDS_Edge edge1=BRepBuilderAPI_MakeEdge(aC2D,gsrf1,aC2D->FirstParameter(),aC2D->LastParameter());
BRepLib::BuildCurve3d(edge1);
if (edge1.IsNull())
{
cout <1e10||Abs(dummy1)>1e10)
{
//further test is need here
}
if(myCurve1.IsNull()){
cout <<"Unfortunately Failed! "<

LI's picture

Handle(Geom_BSplineSurface) _BspSurf,_BspSurfNew;
*** code to get _BspSurf from face is neglected***
_BspSurfNew =new Geom_BSplineSurface(Poles,
UKnots,
VKnots,
UMults,
VMults,
_BspSurf->UDegree(),
_BspSurf->VDegree(),
_BspSurf->IsUPeriodic(),_BspSurf->IsVPeriodic());