#include <GEOMImpl_HealingDriver.hxx>
#include <GEOMImpl_Types.hxx>
#include <GEOMImpl_IHealing.hxx>
+#include <GEOMImpl_IVector.hxx>
+#include <GEOMImpl_VectorDriver.hxx>
#include <GEOMImpl_CopyDriver.hxx>
#include <Basics_OCCTVersion.hxx>
if (aLastFunction.IsNull())
return NULL; //There is no function which creates an object to be processed
- //Add the function
- aFunction = theObject->AddFunction(GEOMImpl_HealingDriver::GetID(), CHANGE_ORIENTATION);
+ if (theObject->GetType() == GEOM_VECTOR) { // Mantis issue 21066
+ //Add the function
+ aFunction = theObject->AddFunction(GEOMImpl_VectorDriver::GetID(), VECTOR_REVERSE);
- if (aFunction.IsNull())
- return NULL;
+ //Check if the function is set correctly
+ if (aFunction.IsNull()) return NULL;
+ if (aFunction->GetDriverGUID() != GEOMImpl_VectorDriver::GetID()) return NULL;
- //Check if the function is set correctly
- if (aFunction->GetDriverGUID() != GEOMImpl_HealingDriver::GetID()) return NULL;
+ // prepare "data container" class IVector
+ GEOMImpl_IVector aVI (aFunction);
+ aVI.SetCurve(aLastFunction);
+ }
+ else {
+ //Add the function
+ aFunction = theObject->AddFunction(GEOMImpl_HealingDriver::GetID(), CHANGE_ORIENTATION);
- // prepare "data container" class IHealing
- GEOMImpl_IHealing HI(aFunction);
- HI.SetOriginal( aLastFunction );
+ //Check if the function is set correctly
+ if (aFunction.IsNull()) return NULL;
+ if (aFunction->GetDriverGUID() != GEOMImpl_HealingDriver::GetID()) return NULL;
+
+ // prepare "data container" class IHealing
+ GEOMImpl_IHealing HI (aFunction);
+ HI.SetOriginal(aLastFunction);
+ }
//Compute the translation
try {
return NULL; //There is no function which creates an object to be processed
// Add a new object
- Handle(GEOM_Object) aNewObject = GetEngine()->AddObject( GetDocID(), theObject->GetType() );
+ Handle(GEOM_Object) aNewObject = GetEngine()->AddObject(GetDocID(), theObject->GetType());
- //Add the function
- aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), CHANGE_ORIENTATION);
+ if (theObject->GetType() == GEOM_VECTOR) { // Mantis issue 21066
+ //Add the function
+ aFunction = aNewObject->AddFunction(GEOMImpl_VectorDriver::GetID(), VECTOR_REVERSE);
- if (aFunction.IsNull())
- return NULL;
+ //Check if the function is set correctly
+ if (aFunction.IsNull()) return NULL;
+ if (aFunction->GetDriverGUID() != GEOMImpl_VectorDriver::GetID()) return NULL;
- //Check if the function is set correctly
- if (aFunction->GetDriverGUID() != GEOMImpl_HealingDriver::GetID()) return NULL;
+ // prepare "data container" class IVector
+ GEOMImpl_IVector aVI (aFunction);
+ aVI.SetCurve(aLastFunction);
+ }
+ else {
+ //Add the function
+ aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), CHANGE_ORIENTATION);
- // prepare "data container" class IHealing
- GEOMImpl_IHealing HI(aFunction);
- HI.SetOriginal( aLastFunction );
+ //Check if the function is set correctly
+ if (aFunction.IsNull()) return NULL;
+ if (aFunction->GetDriverGUID() != GEOMImpl_HealingDriver::GetID()) return NULL;
- //Compute the translation
+ // prepare "data container" class IHealing
+ GEOMImpl_IHealing aHI (aFunction);
+ aHI.SetOriginal(aLastFunction);
+ }
+
+ // Compute the result
try {
#if OCC_VERSION_LARGE > 0x06010000
OCC_CATCH_SIGNALS;
#include "GEOMImpl_IGlue.hxx"
#include "GEOMImpl_Block6Explorer.hxx"
+#include "GEOMImpl_IHealingOperations.hxx"
+
+#include <GEOMImpl_Gen.hxx>
#include "GEOM_Function.hxx"
#include "GEOM_ISubShape.hxx"
if (theShape.IsNull()) return NULL;
+ /*
//Add a new reversed object
Handle(GEOM_Object) aReversed = GetEngine()->AddObject(GetDocID(), theShape->GetType());
<< " = geompy.ChangeOrientation(" << theShape << ")";
SetErrorCode(OK);
+ */
+
+ Handle(GEOM_Object) aReversed;
+
+ GEOM_Engine* anEngine = GetEngine();
+ //GEOMImpl_Gen* aGen = dynamic_cast<GEOMImpl_Gen*>(anEngine);
+ GEOMImpl_Gen* aGen = (GEOMImpl_Gen*)anEngine;
+
+ if (aGen) {
+ GEOMImpl_IHealingOperations* anIHealingOperations =
+ aGen->GetIHealingOperations(GetDocID());
+ aReversed = anIHealingOperations->ChangeOrientation(theShape);
+ SetErrorCode(anIHealingOperations->GetErrorCode());
+ }
+
return aReversed;
}
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
#include <GEOMImpl_ShapeDriver.hxx>
aShape = C;
}
+ /*
else if (aType == REVERSE_ORIENTATION) {
Handle(GEOM_Function) aRefShape = aCI.GetBase();
TopoDS_Shape aShape_i = aRefShape->GetValue();
aShape = tds;
}
}
+ */
else if (aType == EDGE_WIRE) {
Handle(GEOM_Function) aRefBase = aCI.GetBase();
TopoDS_Shape aWire = aRefBase->GetValue();
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-//GEOM_Object types
+
+// GEOM_Object types
#define GEOM_COPY 0
#define GEOM_IMPORT 1
#define POINT_SURFACE_COORD 7
#define POINT_CURVE_LENGTH 8
+// Vector
#define VECTOR_TWO_PNT 1
#define VECTOR_DX_DY_DZ 2
#define VECTOR_TANGENT_CURVE_PAR 3
-#define VECTOR_FACE_NORMALE 4
-#define VERTEX_BY_INDEX 5
+#define VECTOR_REVERSE 4
#define PLANE_PNT_VEC 1
#define PLANE_FACE 2
#define POLYLINE_POINTS 1
+#define SPLINE_BEZIER 1
+#define SPLINE_INTERPOLATION 2
+
#define CIRCLE_THREE_PNT 1
#define CIRCLE_PNT_VEC_R 2
#define CIRCLE_CENTER_TWO_PNT 3
-#define SPLINE_BEZIER 1
-#define SPLINE_INTERPOLATION 2
-
#define ELLIPSE_PNT_VEC_RR 1
+// Arc
#define CIRC_ARC_THREE_PNT 1
#define CIRC_ARC_CENTER 2
#define ELLIPSE_ARC_CENTER_TWO_PNT 3
#define CHAMFER_SHAPE_FACES_AD 6
#define CHAMFER_SHAPE_EDGES_AD 7
+// Shape creation
#define WIRE_EDGES 1
#define FACE_WIRE 2
#define SHELL_FACES 3
#define SUBSHAPE_SORTED 7
#define SUBSHAPE_NOT_SORTED 8
#define FACE_WIRES 9
-#define REVERSE_ORIENTATION 10
+//#define REVERSE_ORIENTATION 10
#define EDGE_WIRE 11
#define EDGE_CURVE_LENGTH 12
#define SKETCHER_NINE_DOUBLS 1
#define SKETCHER_PLANE 2
+// Measures
#define CDG_MEASURE 1
+#define VECTOR_FACE_NORMALE 4
+#define VERTEX_BY_INDEX 5
#define GROUP_FUNCTION 1
#define SHAPES_ON_SHAPE 1
-//Curve constructor type
+// Curve constructor type
#define POINT_CONSTRUCTOR 0
#define COORD_CONSTRUCTOR 1
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
#include <Standard_Stream.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <TopAbs.hxx>
+#include <TopExp.hxx>
#include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
GEOMImpl_IVector aPI (aFunction);
Standard_Integer aType = aFunction->GetType();
- if (aType != VECTOR_DX_DY_DZ && aType != VECTOR_TWO_PNT && aType != VECTOR_TANGENT_CURVE_PAR) return 0;
+ if (aType != VECTOR_DX_DY_DZ && aType != VECTOR_TWO_PNT &&
+ aType != VECTOR_TANGENT_CURVE_PAR && aType != VECTOR_REVERSE) return 0;
TopoDS_Shape aShape;
Standard_ConstructionError::Raise(aMsg.ToCString());
}
aShape = BRepBuilderAPI_MakeEdge(P1, P2).Shape();
- } else if (aType == VECTOR_TWO_PNT) {
+ }
+ else if (aType == VECTOR_TWO_PNT) {
Handle(GEOM_Function) aRefPnt1 = aPI.GetPoint1();
Handle(GEOM_Function) aRefPnt2 = aPI.GetPoint2();
TopoDS_Shape aShape1 = aRefPnt1->GetValue();
}
aShape = BRepBuilderAPI_MakeEdge(V1, V2).Shape();
}
- else if(aType == VECTOR_TANGENT_CURVE_PAR) {
+ else if (aType == VECTOR_TANGENT_CURVE_PAR) {
Handle(GEOM_Function) aRefCurve = aPI.GetCurve();
TopoDS_Shape aRefShape = aRefCurve->GetValue();
if (aRefShape.ShapeType() != TopAbs_EDGE) {
if(aBuilder.IsDone())
aShape = aBuilder.Shape();
}
+ else if (aType == VECTOR_REVERSE) {
+ Handle(GEOM_Function) aRefVec = aPI.GetCurve();
+ TopoDS_Shape aRefShape = aRefVec->GetValue();
+ if (aRefShape.ShapeType() != TopAbs_EDGE) {
+ Standard_TypeMismatch::Raise
+ ("Reversed vector creation aborted : vector shape is not an edge");
+ }
+ TopoDS_Edge anE = TopoDS::Edge(aRefShape);
+ TopoDS_Vertex V1, V2;
+ TopExp::Vertices(anE, V1, V2, Standard_True);
+ aShape = BRepBuilderAPI_MakeEdge(V2, V1).Shape();
+ }
if (aShape.IsNull()) return 0;
}
}
- return _anOtherObject ;
+ return _anOtherObject;
}