mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-26 17:30:35 +05:00
Fix for bug 10627. Now you can pass edges for wire construction in any order.
This commit is contained in:
parent
15d25b4e0d
commit
a7429605d8
@ -9,6 +9,9 @@
|
|||||||
|
|
||||||
#include <GEOM_Function.hxx>
|
#include <GEOM_Function.hxx>
|
||||||
|
|
||||||
|
// OCCT Includes
|
||||||
|
#include <ShapeFix_Wire.hxx>
|
||||||
|
|
||||||
#include <BRep_Tool.hxx>
|
#include <BRep_Tool.hxx>
|
||||||
#include <BRep_Builder.hxx>
|
#include <BRep_Builder.hxx>
|
||||||
#include <BRepAlgo_FaceRestrictor.hxx>
|
#include <BRepAlgo_FaceRestrictor.hxx>
|
||||||
@ -77,8 +80,10 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
|
|||||||
Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
|
Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
|
||||||
unsigned int ind, nbshapes = aShapes->Length();
|
unsigned int ind, nbshapes = aShapes->Length();
|
||||||
|
|
||||||
|
TopoDS_Wire aWire;
|
||||||
|
B.MakeWire(aWire);
|
||||||
|
|
||||||
// add edges
|
// add edges
|
||||||
BRepBuilderAPI_MakeWire MW;
|
|
||||||
for (ind = 1; ind <= nbshapes; ind++) {
|
for (ind = 1; ind <= nbshapes; ind++) {
|
||||||
Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aShapes->Value(ind));
|
Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aShapes->Value(ind));
|
||||||
TopoDS_Shape aShape_i = aRefShape->GetValue();
|
TopoDS_Shape aShape_i = aRefShape->GetValue();
|
||||||
@ -86,18 +91,28 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
|
|||||||
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)
|
||||||
MW.Add(TopoDS::Edge(aShape_i));
|
B.Add(aWire, TopoDS::Edge(aShape_i));
|
||||||
else if (aShape_i.ShapeType() == TopAbs_WIRE)
|
else if (aShape_i.ShapeType() == TopAbs_WIRE)
|
||||||
MW.Add(TopoDS::Wire(aShape_i));
|
B.Add(aWire, TopoDS::Wire(aShape_i));
|
||||||
else
|
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()) {
|
// fix edges order
|
||||||
|
Handle(ShapeFix_Wire) aFW = new ShapeFix_Wire;
|
||||||
|
aFW->Load(aWire);
|
||||||
|
aFW->FixReorder();
|
||||||
|
|
||||||
|
if (aFW->StatusReorder(ShapeExtend_FAIL1)) {
|
||||||
|
Standard_ConstructionError::Raise("Wire construction failed: several loops detected");
|
||||||
|
} else if (aFW->StatusReorder(ShapeExtend_FAIL)) {
|
||||||
Standard_ConstructionError::Raise("Wire construction failed");
|
Standard_ConstructionError::Raise("Wire construction failed");
|
||||||
|
} else if (aFW->StatusReorder(ShapeExtend_DONE2)) {
|
||||||
|
Standard_ConstructionError::Raise("Wire construction failed: some gaps detected");
|
||||||
|
} else {
|
||||||
}
|
}
|
||||||
aShape = MW;
|
aShape = aFW->Wire();
|
||||||
|
|
||||||
} else if (aType == FACE_WIRE) {
|
} else if (aType == FACE_WIRE) {
|
||||||
Handle(GEOM_Function) aRefBase = aCI.GetBase();
|
Handle(GEOM_Function) aRefBase = aCI.GetBase();
|
||||||
|
Loading…
Reference in New Issue
Block a user