mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-13 10:10:34 +05:00
0019827: EDF 736 GEOM : Duplication of a object along an elliptic path
This commit is contained in:
parent
8349cab071
commit
91ac593848
Binary file not shown.
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 29 KiB |
@ -60,17 +60,19 @@ and the Distance parameter (ranging from 0 to 1) defining how far the object wi
|
||||
otherwise it will be removed.
|
||||
\n <b>Select Unpublished edges</b> checkbox allows to select subshape edges on
|
||||
the other objects.
|
||||
\n <b>Arguments:</b> Name + one or several objects + Translation path.
|
||||
\n <b>Reverse Direction</b> checkbox allows to REVERSE the direction of the object movement along its path.
|
||||
|
||||
<b>Arguments:</b> Name + one or several objects + Translation path.
|
||||
\n <b>Advanced option:</b>
|
||||
\ref restore_presentation_parameters_page "Set presentation
|
||||
parameters and subshapes from arguments".
|
||||
|
||||
|
||||
\image html transformation13.png
|
||||
|
||||
\image html transformation14.png
|
||||
|
||||
\image html transformation12.png
|
||||
|
||||
\image html transformation14.png
|
||||
|
||||
\n <b>TUI Command:</b> <em>geompy.MakePosition(theObject, theStartLCS,
|
||||
theEndLCS),</em> where \em theObject is a shape, location of which is
|
||||
modified, \em theStartLCS is a location to move the shape from, \em
|
||||
|
@ -123,7 +123,7 @@ cs2 = geompy.MakeMarker(30,40,40, 1,0,0, 0,1,0)
|
||||
|
||||
# modify the location of the given object
|
||||
position = geompy.MakePosition(cylinder, cs1, cs2)
|
||||
position2 = geompy.PositionAlongPath(position, circle, 0.75, 1)
|
||||
position2 = geompy.PositionAlongPath(position, circle, 0.75, 1, 1)
|
||||
|
||||
# add objects in the study
|
||||
id_cs1 = geompy.addToStudy(cs1, "Coordinate system 1")
|
||||
|
@ -799,13 +799,15 @@ module GEOM
|
||||
* \param thePath Wire or Edge along that the object will be translated.
|
||||
* \param theDistance progress of Path (0 = actual location, 1 = end of path location).
|
||||
* \param theCopy is a true or false parameter. true is to create a copy, false to move the object.
|
||||
* \param theCopy is a true or false parameter. true is to reverse direction, false is to move normal direction.
|
||||
* \return New GEOM_Object, containing the displaced shape.
|
||||
*/
|
||||
|
||||
GEOM_Object PositionAlongPath (in GEOM_Object theObject,
|
||||
in GEOM_Object thePath,
|
||||
in double theDistance,
|
||||
in boolean theCopy);
|
||||
in boolean theCopy,
|
||||
in boolean theReverse);
|
||||
|
||||
/*!
|
||||
* Recompute the shape from its arguments.
|
||||
|
@ -346,7 +346,8 @@ module GEOM
|
||||
GEOM_Object PositionAlongPath (in GEOM_Object theObject,
|
||||
in GEOM_Object thePath,
|
||||
in double theDistance,
|
||||
in boolean theCopy);
|
||||
in boolean theCopy,
|
||||
in boolean theReverse);
|
||||
|
||||
//-----------------------------------------------------------//
|
||||
// ShapesOperations //
|
||||
|
@ -687,6 +687,20 @@ void DlgRef_4Sel1Spin2Check::ShowRows( int fromRow, int toRow, bool toShow )
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////
|
||||
// DlgRef_4Sel1Spin3Check
|
||||
//////////////////////////////////////////
|
||||
|
||||
DlgRef_4Sel1Spin3Check::DlgRef_4Sel1Spin3Check( QWidget* parent, Qt::WindowFlags f )
|
||||
: QWidget( parent, f )
|
||||
{
|
||||
setupUi( this );
|
||||
}
|
||||
|
||||
DlgRef_4Sel1Spin3Check::~DlgRef_4Sel1Spin3Check()
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////
|
||||
// DlgRef_6Sel
|
||||
//////////////////////////////////////////
|
||||
|
@ -746,6 +746,22 @@ public:
|
||||
void ShowRows( int, int, bool = true );
|
||||
};
|
||||
|
||||
//////////////////////////////////////////
|
||||
// DlgRef_4Sel1Spin2Check
|
||||
//////////////////////////////////////////
|
||||
|
||||
#include "ui_DlgRef_4Sel1Spin3Check_QTD.h"
|
||||
|
||||
class DLGREF_EXPORT DlgRef_4Sel1Spin3Check : public QWidget,
|
||||
public Ui::DlgRef_4Sel1Spin3Check_QTD
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DlgRef_4Sel1Spin3Check( QWidget* = 0, Qt::WindowFlags = 0 );
|
||||
~DlgRef_4Sel1Spin3Check();
|
||||
};
|
||||
|
||||
//////////////////////////////////////////
|
||||
// DlgRef_6Sel
|
||||
//////////////////////////////////////////
|
||||
|
@ -57,6 +57,7 @@ HEADERS += DlgRef_3Spin_QTD.h
|
||||
HEADERS += DlgRef_3Spin1Check_QTD.h
|
||||
HEADERS += DlgRef_3Sel3Spin1Check_QTD.h
|
||||
HEADERS += DlgRef_4Sel1Spin2Check_QTD.h
|
||||
HEADERS += DlgRef_4Sel1Spin3Check_QTD.h
|
||||
HEADERS += DlgRef_SpinBox.h
|
||||
HEADERS += DlgRef_1Sel1Spin.h
|
||||
HEADERS += DlgRef_1Sel2Spin.h
|
||||
|
@ -82,6 +82,7 @@ UIC_FILES = \
|
||||
ui_DlgRef_4Sel1List1Check_QTD.h \
|
||||
ui_DlgRef_4Sel1List_QTD.h \
|
||||
ui_DlgRef_4Sel1Spin2Check_QTD.h \
|
||||
ui_DlgRef_4Sel1Spin3Check_QTD.h \
|
||||
ui_DlgRef_6Sel_QTD.h \
|
||||
ui_DlgRef_Skeleton_QTD.h
|
||||
|
||||
|
@ -1304,6 +1304,10 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>GEOM_REVERSE</source>
|
||||
<translation>Reverse</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_REVERSE_DIRECTION</source>
|
||||
<translation>Reverse Direction</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_REVERSE_PLANE</source>
|
||||
<translation>Reverse the plane normal</translation>
|
||||
|
@ -27,6 +27,7 @@
|
||||
#define POSITION_ARG_END_LCS 3
|
||||
#define POSITION_ARG_PATH 5
|
||||
#define POSITION_ARG_DISTANCE 6
|
||||
#define POSITION_ARG_REVERSE 7
|
||||
|
||||
class GEOMImpl_IPosition
|
||||
{
|
||||
@ -56,6 +57,9 @@ class GEOMImpl_IPosition
|
||||
|
||||
double GetDistance() { return _func->GetReal(POSITION_ARG_DISTANCE); }
|
||||
|
||||
void SetReverse(bool theReverse) { _func->SetReal(POSITION_ARG_REVERSE, theReverse); }
|
||||
bool GetReverse() { return _func->GetReal(POSITION_ARG_REVERSE); }
|
||||
|
||||
private:
|
||||
|
||||
Handle(GEOM_Function) _func;
|
||||
|
@ -1341,7 +1341,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShapeCopy
|
||||
//=============================================================================
|
||||
Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionAlongPath
|
||||
(Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePath,
|
||||
double theDistance, bool theCopy)
|
||||
double theDistance, bool theCopy, bool theReverse)
|
||||
{
|
||||
SetErrorCode(KO);
|
||||
|
||||
@ -1370,6 +1370,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionAlongPath
|
||||
aTI.SetShape(anOriginal);
|
||||
aTI.SetPath(thePath->GetLastFunction());
|
||||
aTI.SetDistance(theDistance);
|
||||
aTI.SetReverse(theReverse);
|
||||
|
||||
//Compute the position
|
||||
try {
|
||||
@ -1390,13 +1391,13 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionAlongPath
|
||||
//Make a Python command
|
||||
if (theCopy) {
|
||||
GEOM::TPythonDump(aFunction) << aCopy << " = geompy.PositionAlongPath("
|
||||
<< theObject << ", " << thePath << ", " << theDistance << ", " << theCopy << ")";
|
||||
<< theObject << ", " << thePath << ", " << theDistance << ", " << theCopy << ", " << theReverse << ")";
|
||||
SetErrorCode(OK);
|
||||
return aCopy;
|
||||
}
|
||||
|
||||
GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.PositionAlongPath("
|
||||
<< theObject << ", " << thePath << ", " << theDistance << ", " << theCopy << ")";
|
||||
<< theObject << ", " << thePath << ", " << theDistance << ", " << theCopy << ", " << theReverse << ")";
|
||||
|
||||
SetErrorCode(OK);
|
||||
return theObject;
|
||||
|
@ -121,7 +121,8 @@ class GEOMImpl_ITransformOperations : public GEOM_IOperations
|
||||
Standard_EXPORT Handle(GEOM_Object) PositionAlongPath (Handle(GEOM_Object) theObject,
|
||||
Handle(GEOM_Object) thePath,
|
||||
double theDistance,
|
||||
bool theCopy);
|
||||
bool theCopy,
|
||||
bool theReverse);
|
||||
|
||||
Standard_EXPORT Handle(GEOM_Object) Rotate (Handle(GEOM_Object) theObject,
|
||||
Handle(GEOM_Object) theAxis,
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <GCPnts_AbscissaPoint.hxx>
|
||||
#include <ShHealOper_EdgeDivide.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <BRepTools_WireExplorer.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
@ -48,6 +49,8 @@
|
||||
#include <BRepGProp.hxx>
|
||||
#include <ShapeAnalysis_Edge.hxx>
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
#include <BRepGProp.hxx>
|
||||
#include <ShapeFix_Wire.hxx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
@ -145,6 +148,7 @@ Standard_Integer GEOMImpl_PositionDriver::Execute(TFunction_Logbook& log) const
|
||||
Handle(GEOM_Function) aRefShape = aCI.GetShape();
|
||||
Handle(GEOM_Function) aPathShape = aCI.GetPath();
|
||||
double aValue = aCI.GetDistance();
|
||||
bool aReversed = aCI.GetReverse();
|
||||
|
||||
TopoDS_Shape aShapeBase = aRefShape->GetValue();
|
||||
TopoDS_Shape aPath = aPathShape->GetValue();
|
||||
@ -152,31 +156,70 @@ Standard_Integer GEOMImpl_PositionDriver::Execute(TFunction_Logbook& log) const
|
||||
if (aShapeBase.IsNull() || aPath.IsNull())
|
||||
return 0;
|
||||
|
||||
//Get a Center Of Mass Of Base Object
|
||||
GProp_GProps aSystem;
|
||||
gp_Pnt aCenterMass;
|
||||
if (aShapeBase.ShapeType() == TopAbs_VERTEX) {
|
||||
aCenterMass = BRep_Tool::Pnt(TopoDS::Vertex(aShapeBase));
|
||||
} else if (aShapeBase.ShapeType() == TopAbs_EDGE || aShapeBase.ShapeType() == TopAbs_WIRE) {
|
||||
BRepGProp::LinearProperties(aShapeBase, aSystem);
|
||||
aCenterMass = aSystem.CentreOfMass();
|
||||
} else if (aShapeBase.ShapeType() == TopAbs_FACE || aShapeBase.ShapeType() == TopAbs_SHELL) {
|
||||
BRepGProp::SurfaceProperties(aShapeBase, aSystem);
|
||||
aCenterMass = aSystem.CentreOfMass();
|
||||
} else {
|
||||
BRepGProp::VolumeProperties(aShapeBase, aSystem);
|
||||
aCenterMass = aSystem.CentreOfMass();
|
||||
}
|
||||
|
||||
TopoDS_Shape aTrimmedPath;
|
||||
gp_Trsf aTrsf;
|
||||
Handle(Geom_Curve) aCurve;
|
||||
Standard_Real aFirst =0.,aLast=0.;
|
||||
Standard_Real aParam = 0.;
|
||||
Standard_Real aLength = 0.;
|
||||
|
||||
gp_Pnt aPFirst, aPLast;
|
||||
|
||||
if ( aPath.ShapeType() == TopAbs_EDGE ) {
|
||||
if ( aPath.ShapeType() == TopAbs_EDGE ) { // The Path is Edge
|
||||
TopoDS_Edge anEdge = TopoDS::Edge(aPath);
|
||||
// Computation by Parameter
|
||||
|
||||
BRep_Tool::Range(anEdge,aFirst,aLast);
|
||||
aCurve = BRep_Tool::Curve(anEdge,aFirst,aLast);
|
||||
aParam = aFirst + aValue*(aLast - aFirst);
|
||||
} else if ( aPath.ShapeType() == TopAbs_WIRE ) {
|
||||
if (aReversed)
|
||||
aCurve = aCurve->Reversed();
|
||||
|
||||
aCurve->D0(aFirst, aPFirst);
|
||||
aCurve->D0(aLast, aPLast);
|
||||
|
||||
// Translate a CenterMass of Base Shape to the start of the path
|
||||
if ( !aPFirst.IsEqual(aCenterMass, gp::Resolution()) ) {
|
||||
gp_Trsf aCurTrsf;
|
||||
aCurTrsf.SetTranslation(aCenterMass, aPFirst);
|
||||
aTrsf.PreMultiply(aCurTrsf);
|
||||
}
|
||||
aParam = aFirst + aValue*(aLast - aFirst); // Calculate parameter
|
||||
} else if ( aPath.ShapeType() == TopAbs_WIRE ) { // The path Shape is Wire
|
||||
TopoDS_Wire aWire = TopoDS::Wire(aPath);
|
||||
|
||||
// fix edges order
|
||||
Handle(ShapeFix_Wire) aFixWire = new ShapeFix_Wire;
|
||||
aFixWire->Load(aWire);
|
||||
aFixWire->FixReorder();
|
||||
aWire = aFixWire->Wire();
|
||||
|
||||
TopExp_Explorer ex;
|
||||
TopTools_SequenceOfShape Edges;
|
||||
Standard_Real nbEdges = 0.;
|
||||
BRepTools_WireExplorer aWE (TopoDS::Wire(aPath));
|
||||
for (; aWE.More(); aWE.Next(), nbEdges++)
|
||||
BRepTools_WireExplorer aWE (aWire);
|
||||
for (; aWE.More(); aWE.Next(), nbEdges++) // Explore a Wire on Edges
|
||||
Edges.Append(aWE.Current());
|
||||
|
||||
Standard_Real aSummOfLen =0.;
|
||||
Standard_Real aCurLen =0.;
|
||||
GeomAdaptor_Curve aAdC;
|
||||
for(int i=1; i<=Edges.Length(); i++) {
|
||||
|
||||
for(int i=1; i<=Edges.Length(); i++) { // Calculate summary Lenght of edges
|
||||
TopoDS_Edge anEdge = TopoDS::Edge(Edges.Value(i));
|
||||
BRep_Tool::Range(anEdge,aFirst,aLast);
|
||||
aCurve = BRep_Tool::Curve(anEdge,aFirst,aLast);
|
||||
@ -185,29 +228,61 @@ Standard_Integer GEOMImpl_PositionDriver::Execute(TFunction_Logbook& log) const
|
||||
aSummOfLen += aCurLen;
|
||||
}
|
||||
|
||||
// Move BaseShape to the Start Of the Curve
|
||||
TopoDS_Edge anEdge;
|
||||
if (!aReversed)
|
||||
anEdge = TopoDS::Edge(Edges.Value(1));
|
||||
else
|
||||
anEdge = TopoDS::Edge(Edges.Value(Edges.Length()));
|
||||
|
||||
BRep_Tool::Range(anEdge,aFirst,aLast);
|
||||
aCurve = BRep_Tool::Curve(anEdge,aFirst,aLast);
|
||||
aCurve->D0(aFirst, aPFirst);
|
||||
aCurve->D0(aLast, aPLast);
|
||||
if ( !aPFirst.IsEqual(aCenterMass, gp::Resolution()) ) {
|
||||
gp_Trsf aCurTrsf;
|
||||
if (aReversed && anEdge.Orientation() == TopAbs_FORWARD)
|
||||
aPFirst = aPLast;
|
||||
|
||||
aCurTrsf.SetTranslation(aCenterMass, aPFirst);
|
||||
aTrsf.PreMultiply(aCurTrsf);
|
||||
}
|
||||
|
||||
Standard_Real aWireLen = aSummOfLen*aValue;
|
||||
aSummOfLen = 0;
|
||||
for(int i=1; i<=Edges.Length(); i++) {
|
||||
TopoDS_Edge anEdge = TopoDS::Edge(Edges.Value(i));
|
||||
BRep_Tool::Range(anEdge,aFirst,aLast);
|
||||
aCurve = BRep_Tool::Curve(anEdge,aFirst,aLast);
|
||||
aAdC.Load(aCurve,aFirst,aLast);
|
||||
aCurLen = GCPnts_AbscissaPoint::Length(aAdC,aFirst,aLast);
|
||||
TopoDS_Edge anEdge;
|
||||
if (!aReversed)
|
||||
anEdge = TopoDS::Edge(Edges.Value(i));
|
||||
else
|
||||
anEdge = TopoDS::Edge(Edges.Value(Edges.Length() - i + 1));
|
||||
|
||||
if ( aWireLen > (aSummOfLen + aCurLen) ) {
|
||||
aSummOfLen += aCurLen; // Transform a Base object along this Edge
|
||||
aCurve = BRep_Tool::Curve(anEdge,aFirst,aLast);
|
||||
BRep_Tool::Range(anEdge,aFirst,aLast);
|
||||
|
||||
if (!aReversed && anEdge.Orientation() == TopAbs_REVERSED)
|
||||
aCurve = aCurve->Reversed();
|
||||
|
||||
if (aReversed && anEdge.Orientation() == TopAbs_FORWARD)
|
||||
aCurve = aCurve->Reversed();
|
||||
|
||||
aAdC.Load(aCurve,aFirst,aLast);
|
||||
aCurLen = GCPnts_AbscissaPoint::Length(aAdC,aFirst,aLast);
|
||||
|
||||
if ( aWireLen > (aSummOfLen + aCurLen) ) { // Transform a Base object along this Edge
|
||||
aSummOfLen += aCurLen;
|
||||
gp_Pnt aP1, aP2;
|
||||
gp_Vec aStartVec1, aStartVec2, aDestVec1, aDestVec2;
|
||||
aCurve->D2(aFirst, aP1, aStartVec1, aStartVec2 );
|
||||
aCurve->D2(aLast, aP2, aDestVec1, aDestVec2 );
|
||||
gp_Trsf aCurTrsf;
|
||||
if (aStartVec2.Magnitude() < gp::Resolution() || aDestVec2.Magnitude() < gp::Resolution()) // one of the second derivatives is null
|
||||
aCurTrsf.SetTranslation(aP1, aP2);
|
||||
else {
|
||||
if (aStartVec2.Magnitude() > gp::Resolution() && aDestVec2.Magnitude() > gp::Resolution()) {
|
||||
gp_Ax3 aStartAx3(aP1, aStartVec1, aStartVec2);
|
||||
gp_Ax3 aDestAx3(aP2, aDestVec1, aDestVec2);
|
||||
aCurTrsf.SetDisplacement(aStartAx3, aDestAx3);
|
||||
}
|
||||
} else
|
||||
aCurTrsf.SetTranslation(aP1, aP2);
|
||||
|
||||
aTrsf.PreMultiply(aCurTrsf);
|
||||
}
|
||||
else {
|
||||
@ -221,21 +296,26 @@ Standard_Integer GEOMImpl_PositionDriver::Execute(TFunction_Logbook& log) const
|
||||
} else
|
||||
return 0; // Unknown Type
|
||||
|
||||
gp_Trsf aCurTrsf;
|
||||
gp_Pnt aP1, aP2;
|
||||
gp_Vec aStartVec1, aStartVec2, aDestVec1, aDestVec2;
|
||||
aCurve->D2(aFirst, aP1, aStartVec1, aStartVec2 );
|
||||
aCurve->D2(aParam, aP2, aDestVec1, aDestVec2 );
|
||||
gp_Trsf aCurTrsf;
|
||||
|
||||
if (aStartVec2.Magnitude() < gp::Resolution() || aDestVec2.Magnitude() < gp::Resolution()) // one of the second derivatives is null
|
||||
aCurTrsf.SetTranslation(aP1, aP2);
|
||||
else {
|
||||
if (aStartVec2.Magnitude() > gp::Resolution() && aDestVec2.Magnitude() > gp::Resolution()) {
|
||||
gp_Ax3 aStartAx3(aP1, aStartVec1, aStartVec2);
|
||||
gp_Ax3 aDestAx3(aP2, aDestVec1, aDestVec2);
|
||||
aCurTrsf.SetDisplacement(aStartAx3, aDestAx3);
|
||||
}
|
||||
|
||||
} else
|
||||
aCurTrsf.SetTranslation(aP1, aP2);
|
||||
|
||||
aTrsf.PreMultiply(aCurTrsf);
|
||||
|
||||
if ( !aPFirst.IsEqual(aCenterMass, gp::Resolution()) ) {
|
||||
gp_Trsf aCurTrsf;
|
||||
aCurTrsf.SetTranslation(aPFirst, aCenterMass);
|
||||
aTrsf.PreMultiply(aCurTrsf);
|
||||
}
|
||||
|
||||
// Perform transformation
|
||||
BRepBuilderAPI_Transform aBRepTrsf (aShapeBase, aTrsf, Standard_False);
|
||||
|
@ -997,7 +997,8 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::PositionAlongPath
|
||||
(GEOM::GEOM_Object_ptr theObject,
|
||||
GEOM::GEOM_Object_ptr thePath,
|
||||
CORBA::Double theDistance,
|
||||
CORBA::Boolean theCopy)
|
||||
CORBA::Boolean theCopy,
|
||||
CORBA::Boolean theReverse)
|
||||
{
|
||||
GEOM::GEOM_Object_var aGEOMObject;
|
||||
|
||||
@ -1021,7 +1022,7 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::PositionAlongPath
|
||||
|
||||
//Perform the position
|
||||
Handle(GEOM_Object) anObject =
|
||||
GetOperations()->PositionAlongPath(aBasicObject, aPathObject, theDistance, theCopy);
|
||||
GetOperations()->PositionAlongPath(aBasicObject, aPathObject, theDistance, theCopy, theReverse);
|
||||
if (!GetOperations()->IsDone() || anObject.IsNull())
|
||||
return aGEOMObject._retn();
|
||||
|
||||
|
@ -144,7 +144,8 @@ class GEOM_I_EXPORT GEOM_ITransformOperations_i :
|
||||
GEOM::GEOM_Object_ptr PositionAlongPath (GEOM::GEOM_Object_ptr theObject,
|
||||
GEOM::GEOM_Object_ptr thePath,
|
||||
CORBA::Double theDistance,
|
||||
CORBA::Boolean theCopy);
|
||||
CORBA::Boolean theCopy,
|
||||
CORBA::Boolean theReverse);
|
||||
|
||||
GEOM::GEOM_Object_ptr RotateThreePoints (GEOM::GEOM_Object_ptr theObject,
|
||||
GEOM::GEOM_Object_ptr theCentPoint,
|
||||
|
@ -1826,12 +1826,13 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::PositionShapeCopy (GEOM::GEOM_Object_ptr th
|
||||
GEOM::GEOM_Object_ptr GEOM_Superv_i::PositionAlongPath (GEOM::GEOM_Object_ptr theObject,
|
||||
GEOM::GEOM_Object_ptr thePath,
|
||||
CORBA::Double theDistance,
|
||||
CORBA::Boolean theCopy)
|
||||
CORBA::Boolean theCopy,
|
||||
CORBA::Boolean theReverse)
|
||||
{
|
||||
beginService( " GEOM_Superv_i::PositionAlongPath" );
|
||||
MESSAGE("GEOM_Superv_i::PositionAlongPath");
|
||||
getTransfOp();
|
||||
GEOM::GEOM_Object_ptr anObj = myTransfOp->PositionAlongPath(theObject, thePath, theDistance, theCopy);
|
||||
GEOM::GEOM_Object_ptr anObj = myTransfOp->PositionAlongPath(theObject, thePath, theDistance, theCopy, theReverse);
|
||||
endService( " GEOM_Superv_i::PositionAlongPath" );
|
||||
return anObj;
|
||||
}
|
||||
|
@ -422,7 +422,8 @@ public:
|
||||
GEOM::GEOM_Object_ptr PositionAlongPath (GEOM::GEOM_Object_ptr theObject,
|
||||
GEOM::GEOM_Object_ptr thePath,
|
||||
CORBA::Double theDistance,
|
||||
CORBA::Boolean theCopy);
|
||||
CORBA::Boolean theCopy,
|
||||
CORBA::Boolean theReverse);
|
||||
|
||||
//-----------------------------------------------------------//
|
||||
// ShapesOperations //
|
||||
|
@ -207,7 +207,7 @@ def TestAll (geompy, math):
|
||||
MirrorAxis = geompy.MakeMirrorByAxis(Box, Line1) #
|
||||
MirrorPnt = geompy.MakeMirrorByPoint(Box, p200) #
|
||||
Position = geompy.MakePosition(Box, cs1, cs2) #(3 GEOM_Object_ptr)->GEOM_Object_ptr
|
||||
Position2 = geompy.PositionAlongPath(Box, Arc, 0.5, 1) #(2 GEOM_Object_ptr, 1 Double, 1 Bool)->GEOM_Object_ptr
|
||||
Position2 = geompy.PositionAlongPath(Box, Arc, 0.5, 1, 0) #(2 GEOM_Object_ptr, 1 Double, 2 Bool)->GEOM_Object_ptr
|
||||
Offset = geompy.MakeOffset(Box, 10.) #(GEOM_Object_ptr, Double)->GEOM_Object_ptr
|
||||
Orientation = geompy.ChangeOrientation(Box)
|
||||
|
||||
|
@ -2247,12 +2247,14 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
||||
# @param theObject The object to be displaced.
|
||||
# @param thePath Wire or Edge along that the object will be translated.
|
||||
# @param theDistance progress of Path (0 = start location, 1 = end of path location).
|
||||
# @param theCopy is to create a copy objects if true.
|
||||
# @param theReverse - 0 for usual direction, 1 to reverse path direction.
|
||||
# @return New GEOM_Object, containing the displaced shape.
|
||||
#
|
||||
# @ref tui_modify_location "Example"
|
||||
def PositionAlongPath(self,theObject, thePath, theDistance, theCopy):
|
||||
def PositionAlongPath(self,theObject, thePath, theDistance, theCopy, theReverse):
|
||||
# Example: see GEOM_TestAll.py
|
||||
anObj = self.TrsfOp.PositionAlongPath(theObject, thePath, theDistance, theCopy)
|
||||
anObj = self.TrsfOp.PositionAlongPath(theObject, thePath, theDistance, theCopy, theReverse)
|
||||
RaiseIfFailed("PositionAlongPath", self.TrsfOp)
|
||||
return anObj
|
||||
|
||||
|
@ -66,7 +66,7 @@ TransformationGUI_PositionDlg::TransformationGUI_PositionDlg
|
||||
mainFrame()->RadioButton2->setIcon(image1);
|
||||
mainFrame()->RadioButton3->setIcon(image2);
|
||||
|
||||
Group1 = new DlgRef_4Sel1Spin2Check(centralWidget());
|
||||
Group1 = new DlgRef_4Sel1Spin3Check(centralWidget());
|
||||
Group1->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
|
||||
Group1->TextLabel1->setText(tr("GEOM_OBJECTS"));
|
||||
Group1->TextLabel2->setText(tr("GEOM_START_LCS"));
|
||||
@ -79,6 +79,7 @@ TransformationGUI_PositionDlg::TransformationGUI_PositionDlg
|
||||
Group1->PushButton5->setIcon(imageselect);
|
||||
Group1->CheckButton1->setText(tr("GEOM_CREATE_COPY"));
|
||||
Group1->CheckButton2->setText(tr("SELECT_UNPUBLISHED_EDGES"));
|
||||
Group1->CheckButton3->setText(tr("GEOM_REVERSE_DIRECTION"));
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
|
||||
layout->setMargin(0); layout->setSpacing(6);
|
||||
@ -122,7 +123,7 @@ void TransformationGUI_PositionDlg::Init()
|
||||
Group1->LineEdit5->setText("");
|
||||
|
||||
initSpinBox(Group1->SpinBox_DX, 0, 1, 0.05, 6); // VSR:TODO : DBL_DIGITS_DISPLAY
|
||||
Group1->SpinBox_DX->setValue(1);
|
||||
Group1->SpinBox_DX->setValue(0);
|
||||
|
||||
Group1->CheckButton2->setEnabled(false);
|
||||
|
||||
@ -150,6 +151,7 @@ void TransformationGUI_PositionDlg::Init()
|
||||
connect(Group1->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
|
||||
|
||||
connect(Group1->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(SelectionTypeButtonClicked()));
|
||||
connect(Group1->CheckButton3, SIGNAL(toggled(bool)), this, SLOT(ValueChangedInSpinBox()));
|
||||
|
||||
initName(tr("GEOM_POSITION"));
|
||||
|
||||
@ -192,6 +194,7 @@ void TransformationGUI_PositionDlg::ConstructorsClicked (int constructorId)
|
||||
Group1->PushButton1->click();
|
||||
|
||||
Group1->CheckButton2->hide();
|
||||
Group1->CheckButton3->hide();
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
@ -210,6 +213,7 @@ void TransformationGUI_PositionDlg::ConstructorsClicked (int constructorId)
|
||||
Group1->PushButton1->click();
|
||||
|
||||
Group1->CheckButton2->hide();
|
||||
Group1->CheckButton3->hide();
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
@ -232,6 +236,7 @@ void TransformationGUI_PositionDlg::ConstructorsClicked (int constructorId)
|
||||
Group1->PushButton1->click();
|
||||
|
||||
Group1->CheckButton2->show();
|
||||
Group1->CheckButton3->show();
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -333,6 +338,9 @@ void TransformationGUI_PositionDlg::SelectionIntoArgument()
|
||||
return;
|
||||
else
|
||||
myEditCurrentArgument->setText(aName);
|
||||
|
||||
if (getConstructorId() == 2)
|
||||
Group1->PushButton5->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == Group1->LineEdit2) {
|
||||
if (aSelList.Extent() != 1)
|
||||
@ -363,10 +371,8 @@ void TransformationGUI_PositionDlg::SelectionIntoArgument()
|
||||
aName = GEOMBase::GetName(myEndLCS);
|
||||
myEditCurrentArgument->setText(aName);
|
||||
|
||||
if (!myEndLCS->_is_nil() && !myObjects.length() && getConstructorId() != 2)
|
||||
if (!myEndLCS->_is_nil() && !myObjects.length())
|
||||
Group1->PushButton1->click();
|
||||
else if (getConstructorId() == 2 && !myObjects.length())
|
||||
Group1->PushButton5->click();
|
||||
}
|
||||
else if (myEditCurrentArgument == Group1->LineEdit5) {
|
||||
myPath = GEOM::GEOM_Object::_nil();
|
||||
@ -413,6 +419,9 @@ void TransformationGUI_PositionDlg::SelectionIntoArgument()
|
||||
|
||||
myEditCurrentArgument->setText(aName);
|
||||
myPath = aSelectedObject;
|
||||
|
||||
if (!myPath->_is_nil() && !myObjects.length())
|
||||
Group1->PushButton1->click();
|
||||
}
|
||||
|
||||
// clear selection
|
||||
@ -631,9 +640,10 @@ bool TransformationGUI_PositionDlg::execute (ObjectList& objects)
|
||||
case 2:
|
||||
{
|
||||
double aDistance = Group1->SpinBox_DX->value();
|
||||
bool toReverse = Group1->CheckButton3->isChecked();
|
||||
for (int i = 0; i < myObjects.length(); i++) {
|
||||
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
|
||||
PositionAlongPath(myObjects[i], myPath, aDistance, toCreateCopy);
|
||||
PositionAlongPath(myObjects[i], myPath, aDistance, toCreateCopy, toReverse);
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#include <GEOMBase_Skeleton.h>
|
||||
|
||||
class DlgRef_4Sel1Spin2Check;
|
||||
class DlgRef_4Sel1Spin3Check;
|
||||
|
||||
//=================================================================================
|
||||
// class : TransformationGUI_PositionDlg
|
||||
@ -64,7 +64,7 @@ private:
|
||||
// to initialize the first selection field with a selected object on the dialog creation
|
||||
bool myInitial;
|
||||
|
||||
DlgRef_4Sel1Spin2Check* Group1;
|
||||
DlgRef_4Sel1Spin3Check* Group1;
|
||||
|
||||
private slots:
|
||||
void ClickOnOk();
|
||||
|
Loading…
Reference in New Issue
Block a user