mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-15 18:18:35 +05:00
Mantis issue 0021414: There is a difference between vectors and other edges in Geometry.
This commit is contained in:
parent
08bcf651cb
commit
5d0c88cda6
@ -33,6 +33,8 @@
|
|||||||
#include <GEOMImpl_HealingDriver.hxx>
|
#include <GEOMImpl_HealingDriver.hxx>
|
||||||
#include <GEOMImpl_Types.hxx>
|
#include <GEOMImpl_Types.hxx>
|
||||||
#include <GEOMImpl_IHealing.hxx>
|
#include <GEOMImpl_IHealing.hxx>
|
||||||
|
#include <GEOMImpl_IVector.hxx>
|
||||||
|
#include <GEOMImpl_VectorDriver.hxx>
|
||||||
#include <GEOMImpl_CopyDriver.hxx>
|
#include <GEOMImpl_CopyDriver.hxx>
|
||||||
|
|
||||||
#include <Basics_OCCTVersion.hxx>
|
#include <Basics_OCCTVersion.hxx>
|
||||||
@ -819,18 +821,30 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::ChangeOrientation (Handle(GEOM_
|
|||||||
if (aLastFunction.IsNull())
|
if (aLastFunction.IsNull())
|
||||||
return NULL; //There is no function which creates an object to be processed
|
return NULL; //There is no function which creates an object to be processed
|
||||||
|
|
||||||
|
if (theObject->GetType() == GEOM_VECTOR) { // Mantis issue 21066
|
||||||
|
//Add the function
|
||||||
|
aFunction = theObject->AddFunction(GEOMImpl_VectorDriver::GetID(), VECTOR_REVERSE);
|
||||||
|
|
||||||
|
//Check if the function is set correctly
|
||||||
|
if (aFunction.IsNull()) return NULL;
|
||||||
|
if (aFunction->GetDriverGUID() != GEOMImpl_VectorDriver::GetID()) return NULL;
|
||||||
|
|
||||||
|
// prepare "data container" class IVector
|
||||||
|
GEOMImpl_IVector aVI (aFunction);
|
||||||
|
aVI.SetCurve(aLastFunction);
|
||||||
|
}
|
||||||
|
else {
|
||||||
//Add the function
|
//Add the function
|
||||||
aFunction = theObject->AddFunction(GEOMImpl_HealingDriver::GetID(), CHANGE_ORIENTATION);
|
aFunction = theObject->AddFunction(GEOMImpl_HealingDriver::GetID(), CHANGE_ORIENTATION);
|
||||||
|
|
||||||
if (aFunction.IsNull())
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
//Check if the function is set correctly
|
//Check if the function is set correctly
|
||||||
|
if (aFunction.IsNull()) return NULL;
|
||||||
if (aFunction->GetDriverGUID() != GEOMImpl_HealingDriver::GetID()) return NULL;
|
if (aFunction->GetDriverGUID() != GEOMImpl_HealingDriver::GetID()) return NULL;
|
||||||
|
|
||||||
// prepare "data container" class IHealing
|
// prepare "data container" class IHealing
|
||||||
GEOMImpl_IHealing HI (aFunction);
|
GEOMImpl_IHealing HI (aFunction);
|
||||||
HI.SetOriginal(aLastFunction);
|
HI.SetOriginal(aLastFunction);
|
||||||
|
}
|
||||||
|
|
||||||
//Compute the translation
|
//Compute the translation
|
||||||
try {
|
try {
|
||||||
@ -876,20 +890,32 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::ChangeOrientationCopy (Handle(G
|
|||||||
// Add a new object
|
// Add a new object
|
||||||
Handle(GEOM_Object) aNewObject = GetEngine()->AddObject(GetDocID(), theObject->GetType());
|
Handle(GEOM_Object) aNewObject = GetEngine()->AddObject(GetDocID(), theObject->GetType());
|
||||||
|
|
||||||
|
if (theObject->GetType() == GEOM_VECTOR) { // Mantis issue 21066
|
||||||
|
//Add the function
|
||||||
|
aFunction = aNewObject->AddFunction(GEOMImpl_VectorDriver::GetID(), VECTOR_REVERSE);
|
||||||
|
|
||||||
|
//Check if the function is set correctly
|
||||||
|
if (aFunction.IsNull()) return NULL;
|
||||||
|
if (aFunction->GetDriverGUID() != GEOMImpl_VectorDriver::GetID()) return NULL;
|
||||||
|
|
||||||
|
// prepare "data container" class IVector
|
||||||
|
GEOMImpl_IVector aVI (aFunction);
|
||||||
|
aVI.SetCurve(aLastFunction);
|
||||||
|
}
|
||||||
|
else {
|
||||||
//Add the function
|
//Add the function
|
||||||
aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), CHANGE_ORIENTATION);
|
aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), CHANGE_ORIENTATION);
|
||||||
|
|
||||||
if (aFunction.IsNull())
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
//Check if the function is set correctly
|
//Check if the function is set correctly
|
||||||
|
if (aFunction.IsNull()) return NULL;
|
||||||
if (aFunction->GetDriverGUID() != GEOMImpl_HealingDriver::GetID()) return NULL;
|
if (aFunction->GetDriverGUID() != GEOMImpl_HealingDriver::GetID()) return NULL;
|
||||||
|
|
||||||
// prepare "data container" class IHealing
|
// prepare "data container" class IHealing
|
||||||
GEOMImpl_IHealing HI(aFunction);
|
GEOMImpl_IHealing aHI (aFunction);
|
||||||
HI.SetOriginal( aLastFunction );
|
aHI.SetOriginal(aLastFunction);
|
||||||
|
}
|
||||||
|
|
||||||
//Compute the translation
|
// Compute the result
|
||||||
try {
|
try {
|
||||||
#if OCC_VERSION_LARGE > 0x06010000
|
#if OCC_VERSION_LARGE > 0x06010000
|
||||||
OCC_CATCH_SIGNALS;
|
OCC_CATCH_SIGNALS;
|
||||||
|
@ -40,6 +40,9 @@
|
|||||||
#include "GEOMImpl_IGlue.hxx"
|
#include "GEOMImpl_IGlue.hxx"
|
||||||
|
|
||||||
#include "GEOMImpl_Block6Explorer.hxx"
|
#include "GEOMImpl_Block6Explorer.hxx"
|
||||||
|
#include "GEOMImpl_IHealingOperations.hxx"
|
||||||
|
|
||||||
|
#include <GEOMImpl_Gen.hxx>
|
||||||
|
|
||||||
#include "GEOM_Function.hxx"
|
#include "GEOM_Function.hxx"
|
||||||
#include "GEOM_ISubShape.hxx"
|
#include "GEOM_ISubShape.hxx"
|
||||||
@ -1774,6 +1777,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::ReverseShape(Handle(GEOM_Object)
|
|||||||
|
|
||||||
if (theShape.IsNull()) return NULL;
|
if (theShape.IsNull()) return NULL;
|
||||||
|
|
||||||
|
/*
|
||||||
//Add a new reversed object
|
//Add a new reversed object
|
||||||
Handle(GEOM_Object) aReversed = GetEngine()->AddObject(GetDocID(), theShape->GetType());
|
Handle(GEOM_Object) aReversed = GetEngine()->AddObject(GetDocID(), theShape->GetType());
|
||||||
|
|
||||||
@ -1813,6 +1817,21 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::ReverseShape(Handle(GEOM_Object)
|
|||||||
<< " = geompy.ChangeOrientation(" << theShape << ")";
|
<< " = geompy.ChangeOrientation(" << theShape << ")";
|
||||||
|
|
||||||
SetErrorCode(OK);
|
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;
|
return aReversed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
//
|
//
|
||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
//
|
|
||||||
|
|
||||||
#include <GEOMImpl_ShapeDriver.hxx>
|
#include <GEOMImpl_ShapeDriver.hxx>
|
||||||
|
|
||||||
@ -449,6 +448,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
|
|||||||
aShape = C;
|
aShape = C;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
else if (aType == REVERSE_ORIENTATION) {
|
else if (aType == REVERSE_ORIENTATION) {
|
||||||
Handle(GEOM_Function) aRefShape = aCI.GetBase();
|
Handle(GEOM_Function) aRefShape = aCI.GetBase();
|
||||||
TopoDS_Shape aShape_i = aRefShape->GetValue();
|
TopoDS_Shape aShape_i = aRefShape->GetValue();
|
||||||
@ -471,6 +471,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
|
|||||||
aShape = tds;
|
aShape = tds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
else if (aType == EDGE_WIRE) {
|
else if (aType == EDGE_WIRE) {
|
||||||
Handle(GEOM_Function) aRefBase = aCI.GetBase();
|
Handle(GEOM_Function) aRefBase = aCI.GetBase();
|
||||||
TopoDS_Shape aWire = aRefBase->GetValue();
|
TopoDS_Shape aWire = aRefBase->GetValue();
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
//
|
//
|
||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
//
|
|
||||||
|
|
||||||
// GEOM_Object types
|
// GEOM_Object types
|
||||||
|
|
||||||
@ -113,11 +113,11 @@
|
|||||||
#define POINT_SURFACE_COORD 7
|
#define POINT_SURFACE_COORD 7
|
||||||
#define POINT_CURVE_LENGTH 8
|
#define POINT_CURVE_LENGTH 8
|
||||||
|
|
||||||
|
// Vector
|
||||||
#define VECTOR_TWO_PNT 1
|
#define VECTOR_TWO_PNT 1
|
||||||
#define VECTOR_DX_DY_DZ 2
|
#define VECTOR_DX_DY_DZ 2
|
||||||
#define VECTOR_TANGENT_CURVE_PAR 3
|
#define VECTOR_TANGENT_CURVE_PAR 3
|
||||||
#define VECTOR_FACE_NORMALE 4
|
#define VECTOR_REVERSE 4
|
||||||
#define VERTEX_BY_INDEX 5
|
|
||||||
|
|
||||||
#define PLANE_PNT_VEC 1
|
#define PLANE_PNT_VEC 1
|
||||||
#define PLANE_FACE 2
|
#define PLANE_FACE 2
|
||||||
@ -222,15 +222,16 @@
|
|||||||
|
|
||||||
#define POLYLINE_POINTS 1
|
#define POLYLINE_POINTS 1
|
||||||
|
|
||||||
|
#define SPLINE_BEZIER 1
|
||||||
|
#define SPLINE_INTERPOLATION 2
|
||||||
|
|
||||||
#define CIRCLE_THREE_PNT 1
|
#define CIRCLE_THREE_PNT 1
|
||||||
#define CIRCLE_PNT_VEC_R 2
|
#define CIRCLE_PNT_VEC_R 2
|
||||||
#define CIRCLE_CENTER_TWO_PNT 3
|
#define CIRCLE_CENTER_TWO_PNT 3
|
||||||
|
|
||||||
#define SPLINE_BEZIER 1
|
|
||||||
#define SPLINE_INTERPOLATION 2
|
|
||||||
|
|
||||||
#define ELLIPSE_PNT_VEC_RR 1
|
#define ELLIPSE_PNT_VEC_RR 1
|
||||||
|
|
||||||
|
// Arc
|
||||||
#define CIRC_ARC_THREE_PNT 1
|
#define CIRC_ARC_THREE_PNT 1
|
||||||
#define CIRC_ARC_CENTER 2
|
#define CIRC_ARC_CENTER 2
|
||||||
#define ELLIPSE_ARC_CENTER_TWO_PNT 3
|
#define ELLIPSE_ARC_CENTER_TWO_PNT 3
|
||||||
@ -252,6 +253,7 @@
|
|||||||
#define CHAMFER_SHAPE_FACES_AD 6
|
#define CHAMFER_SHAPE_FACES_AD 6
|
||||||
#define CHAMFER_SHAPE_EDGES_AD 7
|
#define CHAMFER_SHAPE_EDGES_AD 7
|
||||||
|
|
||||||
|
// Shape creation
|
||||||
#define WIRE_EDGES 1
|
#define WIRE_EDGES 1
|
||||||
#define FACE_WIRE 2
|
#define FACE_WIRE 2
|
||||||
#define SHELL_FACES 3
|
#define SHELL_FACES 3
|
||||||
@ -261,7 +263,7 @@
|
|||||||
#define SUBSHAPE_SORTED 7
|
#define SUBSHAPE_SORTED 7
|
||||||
#define SUBSHAPE_NOT_SORTED 8
|
#define SUBSHAPE_NOT_SORTED 8
|
||||||
#define FACE_WIRES 9
|
#define FACE_WIRES 9
|
||||||
#define REVERSE_ORIENTATION 10
|
//#define REVERSE_ORIENTATION 10
|
||||||
#define EDGE_WIRE 11
|
#define EDGE_WIRE 11
|
||||||
#define EDGE_CURVE_LENGTH 12
|
#define EDGE_CURVE_LENGTH 12
|
||||||
|
|
||||||
@ -288,7 +290,10 @@
|
|||||||
#define SKETCHER_NINE_DOUBLS 1
|
#define SKETCHER_NINE_DOUBLS 1
|
||||||
#define SKETCHER_PLANE 2
|
#define SKETCHER_PLANE 2
|
||||||
|
|
||||||
|
// Measures
|
||||||
#define CDG_MEASURE 1
|
#define CDG_MEASURE 1
|
||||||
|
#define VECTOR_FACE_NORMALE 4
|
||||||
|
#define VERTEX_BY_INDEX 5
|
||||||
|
|
||||||
#define GROUP_FUNCTION 1
|
#define GROUP_FUNCTION 1
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
//
|
//
|
||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
//
|
|
||||||
|
|
||||||
#include <Standard_Stream.hxx>
|
#include <Standard_Stream.hxx>
|
||||||
|
|
||||||
@ -31,7 +30,9 @@
|
|||||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||||
|
|
||||||
#include <TopAbs.hxx>
|
#include <TopAbs.hxx>
|
||||||
|
#include <TopExp.hxx>
|
||||||
#include <TopoDS.hxx>
|
#include <TopoDS.hxx>
|
||||||
|
#include <TopoDS_Edge.hxx>
|
||||||
#include <TopoDS_Shape.hxx>
|
#include <TopoDS_Shape.hxx>
|
||||||
#include <TopoDS_Vertex.hxx>
|
#include <TopoDS_Vertex.hxx>
|
||||||
|
|
||||||
@ -72,7 +73,8 @@ Standard_Integer GEOMImpl_VectorDriver::Execute(TFunction_Logbook& log) const
|
|||||||
|
|
||||||
GEOMImpl_IVector aPI (aFunction);
|
GEOMImpl_IVector aPI (aFunction);
|
||||||
Standard_Integer aType = aFunction->GetType();
|
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;
|
TopoDS_Shape aShape;
|
||||||
|
|
||||||
@ -85,7 +87,8 @@ Standard_Integer GEOMImpl_VectorDriver::Execute(TFunction_Logbook& log) const
|
|||||||
Standard_ConstructionError::Raise(aMsg.ToCString());
|
Standard_ConstructionError::Raise(aMsg.ToCString());
|
||||||
}
|
}
|
||||||
aShape = BRepBuilderAPI_MakeEdge(P1, P2).Shape();
|
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) aRefPnt1 = aPI.GetPoint1();
|
||||||
Handle(GEOM_Function) aRefPnt2 = aPI.GetPoint2();
|
Handle(GEOM_Function) aRefPnt2 = aPI.GetPoint2();
|
||||||
TopoDS_Shape aShape1 = aRefPnt1->GetValue();
|
TopoDS_Shape aShape1 = aRefPnt1->GetValue();
|
||||||
@ -130,6 +133,18 @@ Standard_Integer GEOMImpl_VectorDriver::Execute(TFunction_Logbook& log) const
|
|||||||
if(aBuilder.IsDone())
|
if(aBuilder.IsDone())
|
||||||
aShape = aBuilder.Shape();
|
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;
|
if (aShape.IsNull()) return 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user