Provide possibility to create non-planar faces on wires, not having underlying surface: use filling algorithm

This commit is contained in:
jfa 2005-09-13 10:20:06 +00:00
parent 0f0729266b
commit b82f9072d0

View File

@ -5,6 +5,8 @@
#include <GEOMImpl_IShapes.hxx> #include <GEOMImpl_IShapes.hxx>
#include <GEOMImpl_IShapesOperations.hxx> #include <GEOMImpl_IShapesOperations.hxx>
#include <GEOMImpl_Types.hxx> #include <GEOMImpl_Types.hxx>
#include <GEOMImpl_Block6Explorer.hxx>
#include <GEOM_Function.hxx> #include <GEOM_Function.hxx>
#include <BRep_Tool.hxx> #include <BRep_Tool.hxx>
@ -18,7 +20,6 @@
#include <BRepCheck_Shell.hxx> #include <BRepCheck_Shell.hxx>
#include <BRepClass3d_SolidClassifier.hxx> #include <BRepClass3d_SolidClassifier.hxx>
#include <BRepBuilderAPI_MakeWire.hxx> #include <BRepBuilderAPI_MakeWire.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <TopAbs.hxx> #include <TopAbs.hxx>
#include <TopoDS.hxx> #include <TopoDS.hxx>
@ -106,14 +107,22 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
("Shape for face construction is null or not a wire"); ("Shape for face construction is null or not a wire");
} }
TopoDS_Wire W = TopoDS::Wire(aShapeBase); TopoDS_Wire W = TopoDS::Wire(aShapeBase);
BRepBuilderAPI_MakeFace MF (W, aCI.GetIsPlanar()); //BRepBuilderAPI_MakeFace MF (W, aCI.GetIsPlanar());
if (!MF.IsDone()) { //if (!MF.IsDone()) {
// Standard_ConstructionError::Raise("Face construction failed");
//}
//aShape = MF.Shape();
GEOMImpl_Block6Explorer::MakeFace(W, aCI.GetIsPlanar(), aShape);
if (aShape.IsNull()) {
Standard_ConstructionError::Raise("Face construction failed"); Standard_ConstructionError::Raise("Face construction failed");
} }
aShape = MF.Shape();
} else if (aType == FACE_WIRES) { } else if (aType == FACE_WIRES) {
Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes(); Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
int nbshapes = aShapes->Length();
if (nbshapes < 1) {
Standard_ConstructionError::Raise("No wires given");
}
// first wire // first wire
Handle(GEOM_Function) aRefWire = Handle(GEOM_Function)::DownCast(aShapes->Value(1)); Handle(GEOM_Function) aRefWire = Handle(GEOM_Function)::DownCast(aShapes->Value(1));
@ -124,17 +133,21 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
TopoDS_Wire W = TopoDS::Wire(aWire); TopoDS_Wire W = TopoDS::Wire(aWire);
// basic face // basic face
BRepBuilderAPI_MakeFace MF (W, aCI.GetIsPlanar()); //BRepBuilderAPI_MakeFace MF (W, aCI.GetIsPlanar());
if (!MF.IsDone()) { //if (!MF.IsDone()) {
// Standard_ConstructionError::Raise("Face construction failed");
//}
//TopoDS_Shape FFace = MF.Shape();
TopoDS_Shape FFace;
GEOMImpl_Block6Explorer::MakeFace(W, aCI.GetIsPlanar(), FFace);
if (FFace.IsNull()) {
Standard_ConstructionError::Raise("Face construction failed"); Standard_ConstructionError::Raise("Face construction failed");
} }
TopoDS_Shape FFace = MF.Shape();
if (!FFace.IsNull()) {
unsigned int ind, nbshapes = aShapes->Length();
if (nbshapes == 1) { if (nbshapes == 1) {
aShape = FFace; aShape = FFace;
} else if (nbshapes >= 2) { } else {
TopoDS_Compound C; TopoDS_Compound C;
BRep_Builder aBuilder; BRep_Builder aBuilder;
aBuilder.MakeCompound(C); aBuilder.MakeCompound(C);
@ -144,7 +157,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
TopoDS_Shape aLocalS = FFace.Oriented(TopAbs_FORWARD); TopoDS_Shape aLocalS = FFace.Oriented(TopAbs_FORWARD);
FR.Init(TopoDS::Face(aLocalS), Standard_False, Standard_True); FR.Init(TopoDS::Face(aLocalS), Standard_False, Standard_True);
for (ind = 1; ind <= nbshapes; ind++) { for (int ind = 1; ind <= nbshapes; ind++) {
Handle(GEOM_Function) aRefWire_i = Handle(GEOM_Function) aRefWire_i =
Handle(GEOM_Function)::DownCast(aShapes->Value(ind)); Handle(GEOM_Function)::DownCast(aShapes->Value(ind));
TopoDS_Shape aWire_i = aRefWire_i->GetValue(); TopoDS_Shape aWire_i = aRefWire_i->GetValue();
@ -172,7 +185,6 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
} }
} }
} }
}
} else if (aType == SHELL_FACES) { } else if (aType == SHELL_FACES) {
Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes(); Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
unsigned int ind, nbshapes = aShapes->Length(); unsigned int ind, nbshapes = aShapes->Length();