Continue bug 10627 fixing: guarantee non-regression behaviour, applying ShapeFix_Wire::FixReorder only in case, when standard method gives bad result.

This commit is contained in:
jfa 2005-11-30 15:19:52 +00:00
parent b2c75e4e65
commit 728e6e5834

View File

@ -82,6 +82,8 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
TopoDS_Wire aWire; TopoDS_Wire aWire;
B.MakeWire(aWire); B.MakeWire(aWire);
BRepBuilderAPI_MakeWire MW;
bool isMWDone = true;
// add edges // add edges
for (ind = 1; ind <= nbshapes; ind++) { for (ind = 1; ind <= nbshapes; ind++) {
@ -90,15 +92,26 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
if (aShape_i.IsNull()) { if (aShape_i.IsNull()) {
Standard_NullObject::Raise("Shape for wire construction is null"); Standard_NullObject::Raise("Shape for wire construction is null");
} }
if (aShape_i.ShapeType() == TopAbs_EDGE) if (aShape_i.ShapeType() == TopAbs_EDGE) {
B.Add(aWire, TopoDS::Edge(aShape_i)); B.Add(aWire, TopoDS::Edge(aShape_i));
else if (aShape_i.ShapeType() == TopAbs_WIRE) MW.Add(TopoDS::Edge(aShape_i));
} else if (aShape_i.ShapeType() == TopAbs_WIRE) {
B.Add(aWire, TopoDS::Wire(aShape_i)); B.Add(aWire, TopoDS::Wire(aShape_i));
else MW.Add(TopoDS::Wire(aShape_i));
} else {
Standard_TypeMismatch::Raise Standard_TypeMismatch::Raise
("Shape for wire construction is neither an edge nor a wire"); ("Shape for wire construction is neither an edge nor a wire");
} }
if (!MW.IsDone()) {
// check status after each edge/wire addition, because the final status
// can be OK even in case, when some edges/wires was not accepted.
isMWDone = false;
}
}
if (isMWDone) {
aShape = MW;
} else {
// fix edges order // fix edges order
Handle(ShapeFix_Wire) aFW = new ShapeFix_Wire; Handle(ShapeFix_Wire) aFW = new ShapeFix_Wire;
aFW->Load(aWire); aFW->Load(aWire);
@ -113,8 +126,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
} else { } else {
} }
aShape = aFW->WireAPIMake(); aShape = aFW->WireAPIMake();
if (aShape.IsNull()) }
Standard_ConstructionError::Raise("Wire construction failed");
} else if (aType == FACE_WIRE) { } else if (aType == FACE_WIRE) {
Handle(GEOM_Function) aRefBase = aCI.GetBase(); Handle(GEOM_Function) aRefBase = aCI.GetBase();