mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-27 22:40:34 +05:00
0022674: [CEA 1261] Regression of function MakeShell
This commit is contained in:
parent
9bbd71521c
commit
3592a48619
@ -95,11 +95,6 @@
|
|||||||
#include <Standard_TypeMismatch.hxx>
|
#include <Standard_TypeMismatch.hxx>
|
||||||
#include <Standard_ConstructionError.hxx>
|
#include <Standard_ConstructionError.hxx>
|
||||||
|
|
||||||
// Uncomment this definition to check if type of created shape is the same
|
|
||||||
// as expected. For further details please see the Mantis issue
|
|
||||||
// http://salome.mantis.opencascade.com/view.php?id=22674
|
|
||||||
//#define RESULT_TYPE_CHECK
|
|
||||||
|
|
||||||
//modified by NIZNHY-PKV Wed Dec 28 13:48:20 2011f
|
//modified by NIZNHY-PKV Wed Dec 28 13:48:20 2011f
|
||||||
//static
|
//static
|
||||||
// void KeepEdgesOrder(const Handle(TopTools_HSequenceOfShape)& aEdges,
|
// void KeepEdgesOrder(const Handle(TopTools_HSequenceOfShape)& aEdges,
|
||||||
@ -139,16 +134,12 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
|
|||||||
|
|
||||||
TopoDS_Shape aShape;
|
TopoDS_Shape aShape;
|
||||||
TCollection_AsciiString aWarning;
|
TCollection_AsciiString aWarning;
|
||||||
#ifdef RESULT_TYPE_CHECK
|
|
||||||
TopAbs_ShapeEnum anExpectedType = TopAbs_SHAPE;
|
TopAbs_ShapeEnum anExpectedType = TopAbs_SHAPE;
|
||||||
#endif
|
|
||||||
|
|
||||||
BRep_Builder B;
|
BRep_Builder B;
|
||||||
|
|
||||||
if (aType == WIRE_EDGES) {
|
if (aType == WIRE_EDGES) {
|
||||||
#ifdef RESULT_TYPE_CHECK
|
|
||||||
anExpectedType = TopAbs_WIRE;
|
anExpectedType = TopAbs_WIRE;
|
||||||
#endif
|
|
||||||
|
|
||||||
Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
|
Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
|
||||||
|
|
||||||
@ -159,9 +150,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
|
|||||||
aShape = MakeWireFromEdges(aShapes, aTolerance);
|
aShape = MakeWireFromEdges(aShapes, aTolerance);
|
||||||
}
|
}
|
||||||
else if (aType == FACE_WIRE) {
|
else if (aType == FACE_WIRE) {
|
||||||
#ifdef RESULT_TYPE_CHECK
|
|
||||||
anExpectedType = TopAbs_FACE;
|
anExpectedType = TopAbs_FACE;
|
||||||
#endif
|
|
||||||
|
|
||||||
Handle(GEOM_Function) aRefBase = aCI.GetBase();
|
Handle(GEOM_Function) aRefBase = aCI.GetBase();
|
||||||
TopoDS_Shape aShapeBase = aRefBase->GetValue();
|
TopoDS_Shape aShapeBase = aRefBase->GetValue();
|
||||||
@ -196,9 +185,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (aType == FACE_WIRES) {
|
else if (aType == FACE_WIRES) {
|
||||||
#ifdef RESULT_TYPE_CHECK
|
|
||||||
anExpectedType = TopAbs_FACE;
|
anExpectedType = TopAbs_FACE;
|
||||||
#endif
|
|
||||||
|
|
||||||
// Try to build a face from a set of wires and edges
|
// Try to build a face from a set of wires and edges
|
||||||
int ind;
|
int ind;
|
||||||
@ -316,9 +303,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (aType == SHELL_FACES) {
|
else if (aType == SHELL_FACES) {
|
||||||
#ifdef RESULT_TYPE_CHECK
|
|
||||||
anExpectedType = TopAbs_SHELL;
|
anExpectedType = TopAbs_SHELL;
|
||||||
#endif
|
|
||||||
|
|
||||||
Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
|
Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
|
||||||
unsigned int ind, nbshapes = aShapes->Length();
|
unsigned int ind, nbshapes = aShapes->Length();
|
||||||
@ -377,9 +362,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
|
|||||||
|
|
||||||
}
|
}
|
||||||
else if (aType == SOLID_SHELL) {
|
else if (aType == SOLID_SHELL) {
|
||||||
#ifdef RESULT_TYPE_CHECK
|
|
||||||
anExpectedType = TopAbs_SOLID;
|
anExpectedType = TopAbs_SOLID;
|
||||||
#endif
|
|
||||||
|
|
||||||
Handle(GEOM_Function) aRefShell = aCI.GetBase();
|
Handle(GEOM_Function) aRefShell = aCI.GetBase();
|
||||||
TopoDS_Shape aShapeShell = aRefShell->GetValue();
|
TopoDS_Shape aShapeShell = aRefShell->GetValue();
|
||||||
@ -408,9 +391,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
|
|||||||
|
|
||||||
}
|
}
|
||||||
else if (aType == SOLID_SHELLS) {
|
else if (aType == SOLID_SHELLS) {
|
||||||
#ifdef RESULT_TYPE_CHECK
|
|
||||||
anExpectedType = TopAbs_SOLID;
|
anExpectedType = TopAbs_SOLID;
|
||||||
#endif
|
|
||||||
|
|
||||||
Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
|
Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
|
||||||
unsigned int ind, nbshapes = aShapes->Length();
|
unsigned int ind, nbshapes = aShapes->Length();
|
||||||
@ -444,9 +425,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
|
|||||||
aShape = Sol;
|
aShape = Sol;
|
||||||
}
|
}
|
||||||
else if (aType == COMPOUND_SHAPES) {
|
else if (aType == COMPOUND_SHAPES) {
|
||||||
#ifdef RESULT_TYPE_CHECK
|
|
||||||
anExpectedType = TopAbs_COMPOUND;
|
anExpectedType = TopAbs_COMPOUND;
|
||||||
#endif
|
|
||||||
|
|
||||||
Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
|
Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
|
||||||
unsigned int ind, nbshapes = aShapes->Length();
|
unsigned int ind, nbshapes = aShapes->Length();
|
||||||
@ -491,9 +470,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
else if (aType == EDGE_WIRE) {
|
else if (aType == EDGE_WIRE) {
|
||||||
#ifdef RESULT_TYPE_CHECK
|
|
||||||
anExpectedType = TopAbs_EDGE;
|
anExpectedType = TopAbs_EDGE;
|
||||||
#endif
|
|
||||||
|
|
||||||
Handle(GEOM_Function) aRefBase = aCI.GetBase();
|
Handle(GEOM_Function) aRefBase = aCI.GetBase();
|
||||||
TopoDS_Shape aWire = aRefBase->GetValue();
|
TopoDS_Shape aWire = aRefBase->GetValue();
|
||||||
@ -504,9 +481,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
|
|||||||
aShape = MakeEdgeFromWire(aWire, LinTol, AngTol);
|
aShape = MakeEdgeFromWire(aWire, LinTol, AngTol);
|
||||||
}
|
}
|
||||||
else if (aType == EDGE_CURVE_LENGTH) {
|
else if (aType == EDGE_CURVE_LENGTH) {
|
||||||
#ifdef RESULT_TYPE_CHECK
|
|
||||||
anExpectedType = TopAbs_EDGE;
|
anExpectedType = TopAbs_EDGE;
|
||||||
#endif
|
|
||||||
|
|
||||||
GEOMImpl_IVector aVI (aFunction);
|
GEOMImpl_IVector aVI (aFunction);
|
||||||
|
|
||||||
@ -582,10 +557,6 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
|
|||||||
if (aME.IsDone())
|
if (aME.IsDone())
|
||||||
aShape = aME.Shape();
|
aShape = aME.Shape();
|
||||||
} else if (aType == SHAPE_ISOLINE) {
|
} else if (aType == SHAPE_ISOLINE) {
|
||||||
#ifdef RESULT_TYPE_CHECK
|
|
||||||
anExpectedType = TopAbs_EDGE;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
GEOMImpl_IIsoline aII (aFunction);
|
GEOMImpl_IIsoline aII (aFunction);
|
||||||
Handle(GEOM_Function) aRefFace = aII.GetFace();
|
Handle(GEOM_Function) aRefFace = aII.GetFace();
|
||||||
TopoDS_Shape aShapeFace = aRefFace->GetValue();
|
TopoDS_Shape aShapeFace = aRefFace->GetValue();
|
||||||
@ -627,34 +598,12 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
|
|||||||
aShape = aSfs->Shape();
|
aShape = aSfs->Shape();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RESULT_TYPE_CHECK
|
|
||||||
// Check if the result shape type is compatible with the expected.
|
// Check if the result shape type is compatible with the expected.
|
||||||
const TopAbs_ShapeEnum aShType = aShape.ShapeType();
|
const TopAbs_ShapeEnum aShType = aShape.ShapeType();
|
||||||
|
|
||||||
if (anExpectedType != TopAbs_SHAPE && anExpectedType != aShType) {
|
if (anExpectedType != TopAbs_SHAPE && anExpectedType != aShType) {
|
||||||
if (aShType == TopAbs_COMPOUND) {
|
Standard_ConstructionError::Raise("Result type check failed");
|
||||||
// The result is compound. Check its sub-shapes.
|
|
||||||
TopoDS_Iterator anIter(aShape);
|
|
||||||
|
|
||||||
if (!anIter.More()) {
|
|
||||||
// The result is an empty compound.
|
|
||||||
Standard_ConstructionError::Raise("Result type check failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (; anIter.More(); anIter.Next()) {
|
|
||||||
const TopAbs_ShapeEnum aSubType = anIter.Value().ShapeType();
|
|
||||||
|
|
||||||
if (anExpectedType != aSubType) {
|
|
||||||
// There is an incompatible type.
|
|
||||||
Standard_ConstructionError::Raise("Result type check failed");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// There is an incompatible type.
|
|
||||||
Standard_ConstructionError::Raise("Result type check failed");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
aFunction->SetValue(aShape);
|
aFunction->SetValue(aShape);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user