mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-27 14:40:33 +05:00
Mantis issue 0021392: EDF 1631 GEOM: Dump study of sketcher 3D with relatives coordinates.
This commit is contained in:
parent
b0cc47d13b
commit
89c42a4f37
@ -2785,10 +2785,10 @@ module GEOM
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Create a sketcher (wire or face), following the textual description,
|
* \brief Create a sketcher (wire or face), following the textual description,
|
||||||
* passed through \a theCommand argument.
|
* passed through \a theCommand argument.
|
||||||
*
|
*
|
||||||
* Edges of the resulting wire or face will be arcs of circles and/or linear segments. \n
|
* Edges of the resulting wire or face will be arcs of circles and/or linear segments. \n
|
||||||
* Format of the description string have to be the following:
|
* Format of the description string has to be the following:
|
||||||
*
|
*
|
||||||
* "Sketcher[:F x1 y1]:CMD[:CMD[:CMD...]]"
|
* "Sketcher[:F x1 y1]:CMD[:CMD[:CMD...]]"
|
||||||
*
|
*
|
||||||
@ -2816,32 +2816,60 @@ module GEOM
|
|||||||
* coordinates of the working plane.
|
* coordinates of the working plane.
|
||||||
* \param theWorkingPlane Nine double values, defining origin,
|
* \param theWorkingPlane Nine double values, defining origin,
|
||||||
* OZ and OX directions of the working plane.
|
* OZ and OX directions of the working plane.
|
||||||
* \return New GEOM_Object, containing the created wire.
|
* \return New GEOM_Object, containing the created wire or face.
|
||||||
*/
|
*/
|
||||||
GEOM_Object MakeSketcher (in string theCommand, in ListOfDouble theWorkingPlane);
|
GEOM_Object MakeSketcher (in string theCommand, in ListOfDouble theWorkingPlane);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Create a 3D sketcher, following the numerical description,
|
|
||||||
* passed through points created by \a theCoordinates argument.
|
|
||||||
*
|
|
||||||
* Format of the description string have to be the following:
|
|
||||||
*
|
|
||||||
* "Make3DSketcher[x1, y1, z1, x2, y2, z2, ..., xN, yN, zN]"
|
|
||||||
*/
|
|
||||||
|
|
||||||
GEOM_Object Make3DSketcher (in ListOfDouble theCoordinates);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Create a sketcher (wire or face), following the textual description,
|
* \brief Create a sketcher (wire or face), following the textual description,
|
||||||
* passed through \a theCommand argument.
|
* passed through \a theCommand argument.
|
||||||
*
|
*
|
||||||
* For format of the description string see the previous method.\n
|
* For format of the description string see the previous method.\n
|
||||||
|
*
|
||||||
* \param theCommand String, defining the sketcher in local
|
* \param theCommand String, defining the sketcher in local
|
||||||
* coordinates of the working plane.
|
* coordinates of the working plane.
|
||||||
* \param theWorkingPlane Planar Face or LCS(Marker) of the working plane.
|
* \param theWorkingPlane Planar Face or LCS(Marker) of the working plane.
|
||||||
* \return New GEOM_Object, containing the created wire.
|
* \return New GEOM_Object, containing the created wire or face.
|
||||||
*/
|
*/
|
||||||
GEOM_Object MakeSketcherOnPlane (in string theCommand, in GEOM_Object theWorkingPlane);
|
GEOM_Object MakeSketcherOnPlane (in string theCommand, in GEOM_Object theWorkingPlane);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Create a 3D sketcher, following the textual description,
|
||||||
|
* passed through \a theCommand argument.
|
||||||
|
*
|
||||||
|
* Format of the description string has to be the following:
|
||||||
|
*
|
||||||
|
* "3DSketcher:CMD[:CMD[:CMD...]]"
|
||||||
|
*
|
||||||
|
* Where CMD is one of
|
||||||
|
* - "TT x y z" : Create segment by point at X & Y or set the first point
|
||||||
|
* - "T dx dy dz" : Create segment by point with DX & DY
|
||||||
|
* .
|
||||||
|
* \n
|
||||||
|
* - "OXY angleX angle2 length" : Create segment by two angles and length
|
||||||
|
* - "OYZ angleY angle2 length" : Create segment by two angles and length
|
||||||
|
* - "OXZ angleX angle2 length" : Create segment by two angles and length
|
||||||
|
* .
|
||||||
|
* \n
|
||||||
|
* - "WW" : Close Wire (to finish)
|
||||||
|
*
|
||||||
|
* \param theCommand String, defining the sketcher in local
|
||||||
|
* coordinates of the working plane.
|
||||||
|
* \return New GEOM_Object, containing the created wire.
|
||||||
|
*/
|
||||||
|
GEOM_Object Make3DSketcherCommand (in string theCommand);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Create a 3D sketcher, made of a straight segments, joining points
|
||||||
|
* with coordinates passed through \a theCoordinates argument.
|
||||||
|
*
|
||||||
|
* Order of coordinates has to be the following:
|
||||||
|
* x1, y1, z1, x2, y2, z2, ..., xN, yN, zN
|
||||||
|
*
|
||||||
|
* \param theCoordinates List of double values.
|
||||||
|
* \return New GEOM_Object, containing the created wire.
|
||||||
|
*/
|
||||||
|
GEOM_Object Make3DSketcher (in ListOfDouble theCoordinates);
|
||||||
};
|
};
|
||||||
|
|
||||||
// # GEOM_ILocalOperations:
|
// # GEOM_ILocalOperations:
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -15,12 +15,11 @@
|
|||||||
// 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 GEOMGUI : GUI for Geometry component
|
// GEOM GEOMGUI : GUI for Geometry component
|
||||||
// File : EntityGUI_3DSketcherDlg.h
|
// File : EntityGUI_3DSketcherDlg.h
|
||||||
// Author : DMV, OCN
|
// Author : DMV, OCN
|
||||||
//
|
|
||||||
#ifndef ENTITYGUI_3DSKETCHERDLG_H
|
#ifndef ENTITYGUI_3DSKETCHERDLG_H
|
||||||
#define ENTITYGUI_3DSKETCHERDLG_H
|
#define ENTITYGUI_3DSKETCHERDLG_H
|
||||||
|
|
||||||
@ -53,14 +52,15 @@ class EntityGUI_3DSketcherDlg : public GEOMBase_Skeleton
|
|||||||
|
|
||||||
struct XYZ
|
struct XYZ
|
||||||
{
|
{
|
||||||
XYZ() { x = y = z = 0.0; xt = yt = zt = "0.0"; }
|
XYZ() { x = y = z = 0.0; command = params = ""; }
|
||||||
double x, y, z;
|
double x, y, z; // for preview only
|
||||||
QString xt, yt, zt;
|
QString command;
|
||||||
|
QString params;
|
||||||
};
|
};
|
||||||
typedef QList<XYZ> XYZList;
|
typedef QList<XYZ> XYZList;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EntityGUI_3DSketcherDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0, const double = 2. );
|
EntityGUI_3DSketcherDlg (GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0, const double = 2.);
|
||||||
~EntityGUI_3DSketcherDlg();
|
~EntityGUI_3DSketcherDlg();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -961,7 +961,7 @@ std::list<int> GEOM_Engine::getAllTextures(int theDocID)
|
|||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
* ProcessFunction: Dump fucntion description into script
|
* ProcessFunction: Dump function description into script
|
||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
bool ProcessFunction(Handle(GEOM_Function)& theFunction,
|
bool ProcessFunction(Handle(GEOM_Function)& theFunction,
|
||||||
@ -1036,6 +1036,95 @@ bool ProcessFunction(Handle(GEOM_Function)& theFunction,
|
|||||||
|
|
||||||
//Replace parameter by notebook variables
|
//Replace parameter by notebook variables
|
||||||
ReplaceVariables(aDescr,theVariables);
|
ReplaceVariables(aDescr,theVariables);
|
||||||
|
|
||||||
|
//Process sketcher functions, replacing string command by calls to Sketcher interface
|
||||||
|
if (aDescr.Search( "Make3DSketcher" ) != -1) {
|
||||||
|
TCollection_AsciiString aNewDescr;
|
||||||
|
int i = 1;
|
||||||
|
TCollection_AsciiString aSubStr = aDescr.Token("\n\t", i);
|
||||||
|
for (; !aSubStr.IsEmpty(); aSubStr = aDescr.Token("\n\t", i)) {
|
||||||
|
if (aSubStr.Search( "Make3DSketcherCommand" ) != -1) {
|
||||||
|
TCollection_AsciiString aResult = aSubStr.Token(" ", 1);
|
||||||
|
// "3DSketcher:CMD[:CMD[:CMD...]]"
|
||||||
|
TCollection_AsciiString aCommand = aSubStr.Token("\"", 2);
|
||||||
|
|
||||||
|
// Split the command string to separate CMDs
|
||||||
|
int icmd = 2;
|
||||||
|
TColStd_SequenceOfAsciiString aSequence;
|
||||||
|
if (aCommand.Length()) {
|
||||||
|
TCollection_AsciiString aToken = aCommand.Token(":", icmd);
|
||||||
|
while (aToken.Length() > 0) {
|
||||||
|
aSequence.Append(aToken);
|
||||||
|
aToken = aCommand.Token(":", ++icmd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aSequence.Length() > 0) {
|
||||||
|
if (i > 1)
|
||||||
|
aNewDescr += "\n\t";
|
||||||
|
|
||||||
|
aNewDescr += "sk = geompy.Sketcher3D()";
|
||||||
|
int nbCMDs = aSequence.Length();
|
||||||
|
for (icmd = 1; icmd <= nbCMDs; icmd++) {
|
||||||
|
aNewDescr += "\n\t";
|
||||||
|
|
||||||
|
TCollection_AsciiString aCMD = aSequence.Value(icmd);
|
||||||
|
|
||||||
|
// Split the CMD into string values
|
||||||
|
TColStd_SequenceOfAsciiString aStrVals;
|
||||||
|
int ival = 1;
|
||||||
|
TCollection_AsciiString aToken = aCMD.Token(" ", ival);
|
||||||
|
while (aToken.Length() > 0) {
|
||||||
|
aStrVals.Append(aToken);
|
||||||
|
aToken = aCMD.Token(" ", ++ival);
|
||||||
|
}
|
||||||
|
|
||||||
|
TCollection_AsciiString aCMDpref = aStrVals.Value(1);
|
||||||
|
if (aCMDpref == "TT") {
|
||||||
|
aNewDescr += "sk.addPointsAbsolute(";
|
||||||
|
aNewDescr += aStrVals.Value(2) + ", " + aStrVals.Value(3) + ", " + aStrVals.Value(4) + ")";
|
||||||
|
}
|
||||||
|
else if (aCMDpref == "T") {
|
||||||
|
aNewDescr += "sk.addPointsRelative(";
|
||||||
|
aNewDescr += aStrVals.Value(2) + ", " + aStrVals.Value(3) + ", " + aStrVals.Value(4) + ")";
|
||||||
|
}
|
||||||
|
else if (aCMDpref == "WW") {
|
||||||
|
aNewDescr += "sk.close()";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
aNewDescr += "sk.addPointAnglesLength(\"";
|
||||||
|
aNewDescr += aCMDpref + "\", " +
|
||||||
|
aStrVals.Value(2) + ", " + aStrVals.Value(3) + ", " + aStrVals.Value(4) + ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
aNewDescr += "\n\t";
|
||||||
|
aNewDescr += aResult + " = sk.wire()";
|
||||||
|
}
|
||||||
|
} // Make3DSketcherCommand
|
||||||
|
else if (aSubStr.Search( "Make3DSketcher" ) != -1) {
|
||||||
|
TCollection_AsciiString aResult = aSubStr.Token(" ", 1);
|
||||||
|
TCollection_AsciiString aCommand = aSubStr.Token("[", 2);
|
||||||
|
aCommand = aCommand.Token("]", 1);
|
||||||
|
if (i > 1)
|
||||||
|
aNewDescr += "\n\t";
|
||||||
|
aNewDescr += "sk = geompy.Sketcher3D()";
|
||||||
|
aNewDescr += "\n\t";
|
||||||
|
aNewDescr += "sk.addPointsAbsolute(";
|
||||||
|
aNewDescr += aCommand + ")";
|
||||||
|
aNewDescr += "\n\t";
|
||||||
|
aNewDescr += aResult + " = sk.wire()";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (i > 1)
|
||||||
|
aNewDescr += "\n\t";
|
||||||
|
aNewDescr += aSubStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
aDescr = aNewDescr;
|
||||||
|
}
|
||||||
|
|
||||||
if ( theIsDumpCollected ) {
|
if ( theIsDumpCollected ) {
|
||||||
int i = 1;
|
int i = 1;
|
||||||
bool isBefore = true;
|
bool isBefore = true;
|
||||||
|
@ -15,7 +15,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>
|
||||||
|
|
||||||
@ -26,9 +25,13 @@
|
|||||||
|
|
||||||
#include <GEOMImpl_IMeasureOperations.hxx>
|
#include <GEOMImpl_IMeasureOperations.hxx>
|
||||||
|
|
||||||
|
#include <Basics_Utils.hxx>
|
||||||
|
|
||||||
// OCCT Includes
|
// OCCT Includes
|
||||||
#include <BRepBuilderAPI_MakePolygon.hxx>
|
#include <BRepBuilderAPI_MakePolygon.hxx>
|
||||||
#include <BRepBuilderAPI_MakeVertex.hxx>
|
#include <BRepBuilderAPI_MakeVertex.hxx>
|
||||||
|
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||||
|
#include <BRepBuilderAPI_MakeWire.hxx>
|
||||||
#include <TopoDS.hxx>
|
#include <TopoDS.hxx>
|
||||||
#include <TopoDS_Shape.hxx>
|
#include <TopoDS_Shape.hxx>
|
||||||
#include <TopoDS_Wire.hxx>
|
#include <TopoDS_Wire.hxx>
|
||||||
@ -63,41 +66,232 @@ Standard_Integer GEOMImpl_3DSketcherDriver::Execute(TFunction_Logbook& log) cons
|
|||||||
{
|
{
|
||||||
if (Label().IsNull()) return 0;
|
if (Label().IsNull()) return 0;
|
||||||
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
|
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
|
||||||
|
|
||||||
GEOMImpl_I3DSketcher aCI (aFunction);
|
GEOMImpl_I3DSketcher aCI (aFunction);
|
||||||
|
|
||||||
TopoDS_Shape aShape;
|
TopoDS_Shape aShape;
|
||||||
|
|
||||||
Handle(TColStd_HArray1OfReal) aCoordsArray = aCI.GetCoordinates();
|
if (aFunction->GetType() == SKETCHER3D_COORDS) {
|
||||||
int anArrayLength = aCoordsArray->Length();
|
Handle(TColStd_HArray1OfReal) aCoordsArray = aCI.GetCoordinates();
|
||||||
|
int anArrayLength = aCoordsArray->Length();
|
||||||
|
|
||||||
std::list<gp_Pnt> points;
|
std::list<gp_Pnt> points;
|
||||||
|
|
||||||
for (int i = 0; i <= (anArrayLength-3); i += 3) {
|
|
||||||
gp_Pnt aPnt = gp_Pnt(aCoordsArray->Value(i+1), aCoordsArray->Value(i+2), aCoordsArray->Value(i+3));
|
|
||||||
if (points.empty() || aPnt.Distance(points.back()) > gp::Resolution())
|
|
||||||
points.push_back(aPnt);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( points.size() == 1) { // Only Start Point
|
for (int i = 0; i <= (anArrayLength-3); i += 3) {
|
||||||
BRepBuilderAPI_MakeVertex mkVertex (points.back());
|
gp_Pnt aPnt = gp_Pnt(aCoordsArray->Value(i+1), aCoordsArray->Value(i+2), aCoordsArray->Value(i+3));
|
||||||
aShape = mkVertex.Shape();
|
if (points.empty() || aPnt.Distance(points.back()) > gp::Resolution())
|
||||||
}
|
points.push_back(aPnt);
|
||||||
else if ( points.size() > 1) { // Make Wire
|
|
||||||
BRepBuilderAPI_MakePolygon aMakePoly;
|
|
||||||
std::list<gp_Pnt>::iterator it;
|
|
||||||
for (it = points.begin(); it != points.end(); ++it) {
|
|
||||||
aMakePoly.Add(*it);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (points.size() > 2 &&
|
if ( points.size() == 1) { // Only Start Point
|
||||||
points.back().X() == points.front().X() &&
|
BRepBuilderAPI_MakeVertex mkVertex (points.back());
|
||||||
points.back().Y() == points.front().Y() &&
|
aShape = mkVertex.Shape();
|
||||||
points.back().Z() == points.front().Z())
|
}
|
||||||
aMakePoly.Close();
|
else if ( points.size() > 1) { // Make Wire
|
||||||
|
BRepBuilderAPI_MakePolygon aMakePoly;
|
||||||
if (aMakePoly.IsDone())
|
std::list<gp_Pnt>::iterator it;
|
||||||
aShape = aMakePoly.Wire();
|
for (it = points.begin(); it != points.end(); ++it) {
|
||||||
|
aMakePoly.Add(*it);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (points.size() > 2 &&
|
||||||
|
points.back().X() == points.front().X() &&
|
||||||
|
points.back().Y() == points.front().Y() &&
|
||||||
|
points.back().Z() == points.front().Z())
|
||||||
|
aMakePoly.Close();
|
||||||
|
|
||||||
|
if (aMakePoly.IsDone())
|
||||||
|
aShape = aMakePoly.Wire();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (aFunction->GetType() == SKETCHER3D_COMMAND) {
|
||||||
|
Kernel_Utils::Localizer loc;
|
||||||
|
|
||||||
|
TCollection_AsciiString aCommand = aCI.GetCommand();
|
||||||
|
// "3DSketcher:CMD[:CMD[:CMD...]]"
|
||||||
|
|
||||||
|
// Split the command string to separate CMDs
|
||||||
|
int icmd = 2;
|
||||||
|
TColStd_SequenceOfAsciiString aSequence;
|
||||||
|
if (aCommand.Length()) {
|
||||||
|
TCollection_AsciiString aToken = aCommand.Token(":", icmd);
|
||||||
|
while (aToken.Length() > 0) {
|
||||||
|
aSequence.Append(aToken);
|
||||||
|
aToken = aCommand.Token(":", ++icmd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int nbEdges = 0;
|
||||||
|
bool isFirstPointSet = false;
|
||||||
|
gp_XYZ p = gp::Origin().XYZ();
|
||||||
|
BRepBuilderAPI_MakeVertex MV0 (p);
|
||||||
|
TopoDS_Vertex V = TopoDS::Vertex(MV0.Shape());
|
||||||
|
|
||||||
|
gp_XYZ p0 = p;
|
||||||
|
TopoDS_Vertex V0 = V;
|
||||||
|
|
||||||
|
bool doClose = false;
|
||||||
|
BRepBuilderAPI_MakeWire MW;
|
||||||
|
|
||||||
|
int nbCMDs = aSequence.Length();
|
||||||
|
for (icmd = 1; icmd <= nbCMDs; icmd++) {
|
||||||
|
TCollection_AsciiString aCMD = aSequence.Value(icmd);
|
||||||
|
|
||||||
|
// Split the CMD into string values
|
||||||
|
TColStd_SequenceOfAsciiString aStrVals;
|
||||||
|
int ival = 1;
|
||||||
|
TCollection_AsciiString aToken = aCMD.Token(" ", ival);
|
||||||
|
while (aToken.Length() > 0) {
|
||||||
|
aStrVals.Append(aToken);
|
||||||
|
aToken = aCMD.Token(" ", ++ival);
|
||||||
|
}
|
||||||
|
|
||||||
|
// "TT x y z" : Create segment by point at X & Y or set the first point
|
||||||
|
// "T dx dy dz" : Create segment by point with DX & DY
|
||||||
|
//
|
||||||
|
// "OXY angleX angle2 length" : Create segment by two angles and length
|
||||||
|
// "OYZ angleY angle2 length" : Create segment by two angles and length
|
||||||
|
// "OXZ angleX angle2 length" : Create segment by two angles and length
|
||||||
|
//
|
||||||
|
// "WW" : Close Wire (to finish)
|
||||||
|
|
||||||
|
switch (aStrVals.Value(1).Value(1))
|
||||||
|
{
|
||||||
|
case 'T':
|
||||||
|
{
|
||||||
|
if (aStrVals.Length() != 4)
|
||||||
|
Standard_ConstructionError::Raise("3D Sketcher error: Bad format of command.");
|
||||||
|
|
||||||
|
gp_XYZ vp;
|
||||||
|
vp.SetX(aStrVals.Value(2).RealValue());
|
||||||
|
vp.SetY(aStrVals.Value(3).RealValue());
|
||||||
|
vp.SetZ(aStrVals.Value(4).RealValue());
|
||||||
|
|
||||||
|
if (aStrVals.Value(1) == "TT") { // absolute coordinates
|
||||||
|
if (!isFirstPointSet) {
|
||||||
|
p = vp;
|
||||||
|
BRepBuilderAPI_MakeVertex MV (p);
|
||||||
|
V = TopoDS::Vertex(MV.Shape());
|
||||||
|
|
||||||
|
p0 = p;
|
||||||
|
V0 = V;
|
||||||
|
|
||||||
|
isFirstPointSet = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if ((vp - p).SquareModulus() > Precision::Confusion()) {
|
||||||
|
BRepBuilderAPI_MakeVertex MV (vp);
|
||||||
|
TopoDS_Vertex VV = TopoDS::Vertex(MV.Shape());
|
||||||
|
BRepBuilderAPI_MakeEdge ME (V, VV);
|
||||||
|
MW.Add(ME);
|
||||||
|
nbEdges++;
|
||||||
|
|
||||||
|
p = vp;
|
||||||
|
V = VV;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (aStrVals.Value(1) == "T") { // relative coordinates
|
||||||
|
if (vp.SquareModulus() > Precision::Confusion()) {
|
||||||
|
vp = p + vp;
|
||||||
|
|
||||||
|
BRepBuilderAPI_MakeVertex MV (vp);
|
||||||
|
TopoDS_Vertex VV = TopoDS::Vertex(MV.Shape());
|
||||||
|
BRepBuilderAPI_MakeEdge ME (V, VV);
|
||||||
|
MW.Add(ME);
|
||||||
|
nbEdges++;
|
||||||
|
|
||||||
|
p = vp;
|
||||||
|
V = VV;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Standard_ConstructionError::Raise("3D Sketcher error: Bad format of command.");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'O':
|
||||||
|
{
|
||||||
|
if (aStrVals.Length() != 4)
|
||||||
|
Standard_ConstructionError::Raise("3D Sketcher error: Bad format of command.");
|
||||||
|
|
||||||
|
double anAngle = aStrVals.Value(2).RealValue() * M_PI/180.0;
|
||||||
|
double anAngle2 = aStrVals.Value(3).RealValue() * M_PI/180.0;
|
||||||
|
double aLength = aStrVals.Value(4).RealValue();
|
||||||
|
|
||||||
|
double aProjectedLength = aLength * cos(anAngle2);
|
||||||
|
|
||||||
|
gp_XYZ vp;
|
||||||
|
vp.SetX(aStrVals.Value(2).RealValue());
|
||||||
|
vp.SetY(aStrVals.Value(3).RealValue());
|
||||||
|
vp.SetZ(aStrVals.Value(4).RealValue());
|
||||||
|
|
||||||
|
if (aStrVals.Value(1) == "OXY") {
|
||||||
|
vp.SetX(p.X() + aProjectedLength * cos(anAngle));
|
||||||
|
vp.SetY(p.Y() + aProjectedLength * sin(anAngle));
|
||||||
|
vp.SetZ(p.Z() + aLength * sin(anAngle2));
|
||||||
|
}
|
||||||
|
else if (aStrVals.Value(1) == "OYZ") {
|
||||||
|
vp.SetX(p.X() + aLength * sin(anAngle2));
|
||||||
|
vp.SetY(p.Y() + aProjectedLength * cos(anAngle));
|
||||||
|
vp.SetZ(p.Z() + aProjectedLength * sin(anAngle));
|
||||||
|
}
|
||||||
|
else if (aStrVals.Value(1) == "OXZ") {
|
||||||
|
vp.SetX(p.X() + aProjectedLength * cos(anAngle));
|
||||||
|
vp.SetY(p.Y() + aLength * sin(anAngle2));
|
||||||
|
vp.SetZ(p.Z() + aProjectedLength * sin(anAngle));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Standard_ConstructionError::Raise("3D Sketcher error: Bad format of command.");
|
||||||
|
|
||||||
|
BRepBuilderAPI_MakeVertex MV (vp);
|
||||||
|
TopoDS_Vertex VV = TopoDS::Vertex(MV.Shape());
|
||||||
|
BRepBuilderAPI_MakeEdge ME (V, VV);
|
||||||
|
MW.Add(ME);
|
||||||
|
nbEdges++;
|
||||||
|
|
||||||
|
p = vp;
|
||||||
|
V = VV;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'W':
|
||||||
|
{
|
||||||
|
if (aStrVals.Length() != 1)
|
||||||
|
Standard_ConstructionError::Raise("3D Sketcher error: Bad format of command.");
|
||||||
|
|
||||||
|
if (aStrVals.Value(1) == "WW")
|
||||||
|
doClose = true;
|
||||||
|
else
|
||||||
|
Standard_ConstructionError::Raise("3D Sketcher error: Bad format of command.");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
Standard_ConstructionError::Raise("3D Sketcher error: Bad format of command.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (doClose &&
|
||||||
|
nbEdges > 1 && // as 3D sketcher has only straight edges
|
||||||
|
(p - p0).SquareModulus() > Precision::Confusion()) {
|
||||||
|
BRepBuilderAPI_MakeEdge ME (V, V0);
|
||||||
|
MW.Add(ME);
|
||||||
|
nbEdges++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nbEdges > 0) {
|
||||||
|
if (!MW.IsDone())
|
||||||
|
Standard_ConstructionError::Raise("3D Sketcher error: Wire construction failed.");
|
||||||
|
|
||||||
|
aShape = MW;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (isFirstPointSet) {
|
||||||
|
aShape = V0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aShape.IsNull()) return 0;
|
if (aShape.IsNull()) return 0;
|
||||||
|
@ -15,28 +15,35 @@
|
|||||||
// 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
|
||||||
//
|
|
||||||
|
|
||||||
//NOTE: This is an interface to a function for the Sketcher creation.
|
//NOTE: This is an interface to a function for the Sketcher creation.
|
||||||
//
|
|
||||||
#include "GEOM_Function.hxx"
|
#include "GEOM_Function.hxx"
|
||||||
|
|
||||||
#include <TColStd_HArray1OfReal.hxx>
|
#include <TColStd_HArray1OfReal.hxx>
|
||||||
|
|
||||||
#define SKETCH_ARG_COORDS 1
|
|
||||||
|
|
||||||
class GEOMImpl_I3DSketcher
|
class GEOMImpl_I3DSketcher
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
GEOMImpl_I3DSketcher(Handle(GEOM_Function) theFunction): _func(theFunction) {}
|
GEOMImpl_I3DSketcher (Handle(GEOM_Function) theFunction): _func(theFunction) {}
|
||||||
|
|
||||||
void SetCoordinates(const Handle(TColStd_HArray1OfReal)& theValue)
|
void SetCoordinates (const Handle(TColStd_HArray1OfReal)& theValue)
|
||||||
{ _func->SetRealArray(SKETCH_ARG_COORDS, theValue); }
|
{ _func->SetRealArray(SKETCH_ARG_COORDS, theValue); }
|
||||||
|
|
||||||
Handle(TColStd_HArray1OfReal) GetCoordinates() { return _func->GetRealArray(SKETCH_ARG_COORDS); }
|
Handle(TColStd_HArray1OfReal) GetCoordinates() { return _func->GetRealArray(SKETCH_ARG_COORDS); }
|
||||||
|
|
||||||
private:
|
void SetCommand (const TCollection_AsciiString& theCommand)
|
||||||
|
{ _func->SetString(SKETCH_ARG_COMMAND, theCommand); }
|
||||||
|
|
||||||
|
TCollection_AsciiString GetCommand() { return _func->GetString(SKETCH_ARG_COMMAND); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
enum {
|
||||||
|
SKETCH_ARG_COORDS = 1,
|
||||||
|
SKETCH_ARG_COMMAND = 2
|
||||||
|
};
|
||||||
|
|
||||||
Handle(GEOM_Function) _func;
|
Handle(GEOM_Function) _func;
|
||||||
};
|
};
|
||||||
|
@ -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
|
||||||
//
|
|
||||||
|
|
||||||
#ifdef WNT
|
#ifdef WNT
|
||||||
// E.A. : On windows with python 2.6, there is a conflict
|
// E.A. : On windows with python 2.6, there is a conflict
|
||||||
@ -1166,73 +1165,6 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcher (const char* theCom
|
|||||||
return aSketcher;
|
return aSketcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
|
||||||
/*!
|
|
||||||
* Make3DSketcher
|
|
||||||
*/
|
|
||||||
//=============================================================================
|
|
||||||
Handle(GEOM_Object) GEOMImpl_ICurvesOperations::Make3DSketcher (std::list<double> theCoordinates)
|
|
||||||
{
|
|
||||||
SetErrorCode(KO);
|
|
||||||
|
|
||||||
//Add a new Sketcher object
|
|
||||||
Handle(GEOM_Object) a3DSketcher = GetEngine()->AddObject(GetDocID(), GEOM_3DSKETCHER);
|
|
||||||
|
|
||||||
//Add a new Sketcher function
|
|
||||||
Handle(GEOM_Function) aFunction =
|
|
||||||
a3DSketcher->AddFunction(GEOMImpl_3DSketcherDriver::GetID(), GEOM_3DSKETCHER);
|
|
||||||
if (aFunction.IsNull()) return NULL;
|
|
||||||
|
|
||||||
//Check if the function is set correctly
|
|
||||||
if (aFunction->GetDriverGUID() != GEOMImpl_3DSketcherDriver::GetID()) return NULL;
|
|
||||||
|
|
||||||
GEOMImpl_I3DSketcher aCI (aFunction);
|
|
||||||
|
|
||||||
int nbOfCoords = 0;
|
|
||||||
std::list<double>::iterator it = theCoordinates.begin();
|
|
||||||
for (; it != theCoordinates.end(); it++)
|
|
||||||
nbOfCoords++;
|
|
||||||
|
|
||||||
Handle(TColStd_HArray1OfReal) aCoordsArray = new TColStd_HArray1OfReal (1, nbOfCoords);
|
|
||||||
|
|
||||||
it = theCoordinates.begin();
|
|
||||||
int ind = 1;
|
|
||||||
for (; it != theCoordinates.end(); it++, ind++)
|
|
||||||
aCoordsArray->SetValue(ind, *it);
|
|
||||||
|
|
||||||
aCI.SetCoordinates(aCoordsArray);
|
|
||||||
|
|
||||||
//Compute the Sketcher value
|
|
||||||
try {
|
|
||||||
#if OCC_VERSION_LARGE > 0x06010000
|
|
||||||
OCC_CATCH_SIGNALS;
|
|
||||||
#endif
|
|
||||||
if (!GetSolver()->ComputeFunction(aFunction)) {
|
|
||||||
SetErrorCode("3D Sketcher driver failed");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Standard_Failure) {
|
|
||||||
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
|
||||||
SetErrorCode(aFail->GetMessageString());
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Make a Python command
|
|
||||||
GEOM::TPythonDump pd (aFunction);
|
|
||||||
pd << a3DSketcher << " = geompy.Make3DSketcher([";
|
|
||||||
|
|
||||||
it = theCoordinates.begin();
|
|
||||||
pd << (*it++);
|
|
||||||
while (it != theCoordinates.end()) {
|
|
||||||
pd << ", " << (*it++);
|
|
||||||
}
|
|
||||||
pd << "])";
|
|
||||||
|
|
||||||
SetErrorCode(OK);
|
|
||||||
return a3DSketcher;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
* MakeSketcherOnPlane
|
* MakeSketcherOnPlane
|
||||||
@ -1289,3 +1221,121 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcherOnPlane
|
|||||||
SetErrorCode(OK);
|
SetErrorCode(OK);
|
||||||
return aSketcher;
|
return aSketcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* Make3DSketcherCommand
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
Handle(GEOM_Object) GEOMImpl_ICurvesOperations::Make3DSketcherCommand (const char* theCommand)
|
||||||
|
{
|
||||||
|
SetErrorCode(KO);
|
||||||
|
|
||||||
|
if (!theCommand || strcmp(theCommand, "") == 0) return NULL;
|
||||||
|
|
||||||
|
//Add a new Sketcher object
|
||||||
|
Handle(GEOM_Object) aSketcher = GetEngine()->AddObject(GetDocID(), GEOM_3DSKETCHER);
|
||||||
|
|
||||||
|
//Add a new Sketcher function
|
||||||
|
Handle(GEOM_Function) aFunction =
|
||||||
|
aSketcher->AddFunction(GEOMImpl_3DSketcherDriver::GetID(), SKETCHER3D_COMMAND);
|
||||||
|
if (aFunction.IsNull()) return NULL;
|
||||||
|
|
||||||
|
//Check if the function is set correctly
|
||||||
|
if (aFunction->GetDriverGUID() != GEOMImpl_3DSketcherDriver::GetID()) return NULL;
|
||||||
|
|
||||||
|
GEOMImpl_I3DSketcher aCI (aFunction);
|
||||||
|
|
||||||
|
TCollection_AsciiString aCommand ((char*) theCommand);
|
||||||
|
aCI.SetCommand(aCommand);
|
||||||
|
|
||||||
|
//Compute the 3D Sketcher value
|
||||||
|
try {
|
||||||
|
#if OCC_VERSION_LARGE > 0x06010000
|
||||||
|
OCC_CATCH_SIGNALS;
|
||||||
|
#endif
|
||||||
|
if (!GetSolver()->ComputeFunction(aFunction)) {
|
||||||
|
SetErrorCode("3D Sketcher driver failed");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Standard_Failure) {
|
||||||
|
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||||
|
SetErrorCode(aFail->GetMessageString());
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Make a Python command
|
||||||
|
GEOM::TPythonDump pd (aFunction);
|
||||||
|
pd << aSketcher << " = geompy.Make3DSketcherCommand(\"" << aCommand.ToCString() << "\")";
|
||||||
|
|
||||||
|
SetErrorCode(OK);
|
||||||
|
return aSketcher;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* Make3DSketcher
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
Handle(GEOM_Object) GEOMImpl_ICurvesOperations::Make3DSketcher (std::list<double> theCoordinates)
|
||||||
|
{
|
||||||
|
SetErrorCode(KO);
|
||||||
|
|
||||||
|
//Add a new Sketcher object
|
||||||
|
Handle(GEOM_Object) a3DSketcher = GetEngine()->AddObject(GetDocID(), GEOM_3DSKETCHER);
|
||||||
|
|
||||||
|
//Add a new Sketcher function
|
||||||
|
Handle(GEOM_Function) aFunction =
|
||||||
|
a3DSketcher->AddFunction(GEOMImpl_3DSketcherDriver::GetID(), SKETCHER3D_COORDS);
|
||||||
|
if (aFunction.IsNull()) return NULL;
|
||||||
|
|
||||||
|
//Check if the function is set correctly
|
||||||
|
if (aFunction->GetDriverGUID() != GEOMImpl_3DSketcherDriver::GetID()) return NULL;
|
||||||
|
|
||||||
|
GEOMImpl_I3DSketcher aCI (aFunction);
|
||||||
|
|
||||||
|
int nbOfCoords = 0;
|
||||||
|
std::list<double>::iterator it = theCoordinates.begin();
|
||||||
|
for (; it != theCoordinates.end(); it++)
|
||||||
|
nbOfCoords++;
|
||||||
|
|
||||||
|
Handle(TColStd_HArray1OfReal) aCoordsArray = new TColStd_HArray1OfReal (1, nbOfCoords);
|
||||||
|
|
||||||
|
it = theCoordinates.begin();
|
||||||
|
int ind = 1;
|
||||||
|
for (; it != theCoordinates.end(); it++, ind++)
|
||||||
|
aCoordsArray->SetValue(ind, *it);
|
||||||
|
|
||||||
|
aCI.SetCoordinates(aCoordsArray);
|
||||||
|
|
||||||
|
//Compute the Sketcher value
|
||||||
|
try {
|
||||||
|
#if OCC_VERSION_LARGE > 0x06010000
|
||||||
|
OCC_CATCH_SIGNALS;
|
||||||
|
#endif
|
||||||
|
if (!GetSolver()->ComputeFunction(aFunction)) {
|
||||||
|
SetErrorCode("3D Sketcher driver failed");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Standard_Failure) {
|
||||||
|
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||||
|
SetErrorCode(aFail->GetMessageString());
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Make a Python command
|
||||||
|
GEOM::TPythonDump pd (aFunction);
|
||||||
|
pd << a3DSketcher << " = geompy.Make3DSketcher([";
|
||||||
|
|
||||||
|
it = theCoordinates.begin();
|
||||||
|
pd << (*it++);
|
||||||
|
while (it != theCoordinates.end()) {
|
||||||
|
pd << ", " << (*it++);
|
||||||
|
}
|
||||||
|
pd << "])";
|
||||||
|
|
||||||
|
SetErrorCode(OK);
|
||||||
|
return a3DSketcher;
|
||||||
|
}
|
||||||
|
@ -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
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef _GEOMImpl_ICurvesOperations_HXX_
|
#ifndef _GEOMImpl_ICurvesOperations_HXX_
|
||||||
#define _GEOMImpl_ICurvesOperations_HXX_
|
#define _GEOMImpl_ICurvesOperations_HXX_
|
||||||
@ -78,16 +77,17 @@ class GEOMImpl_ICurvesOperations : public GEOM_IOperations {
|
|||||||
bool theIsClosed = false,
|
bool theIsClosed = false,
|
||||||
bool theDoReordering = false);
|
bool theDoReordering = false);
|
||||||
|
|
||||||
Standard_EXPORT Handle(GEOM_Object) MakeCurveParametric(const char* thexExpr, const char* theyExpr, const char* thezExpr,
|
Standard_EXPORT Handle(GEOM_Object) MakeCurveParametric
|
||||||
double theParamMin, double theParamMax, double theParamStep,
|
(const char* thexExpr, const char* theyExpr, const char* thezExpr,
|
||||||
CurveType theCurveType,
|
double theParamMin, double theParamMax, double theParamStep,
|
||||||
int theParamNbStep=0, bool theNewMethod=false);
|
CurveType theCurveType, int theParamNbStep=0, bool theNewMethod=false);
|
||||||
|
|
||||||
Standard_EXPORT Handle(GEOM_Object) MakeSketcher (const char* theCommand,
|
Standard_EXPORT Handle(GEOM_Object) MakeSketcher (const char* theCommand,
|
||||||
std::list<double> theWorkingPlane);
|
std::list<double> theWorkingPlane);
|
||||||
Standard_EXPORT Handle(GEOM_Object) Make3DSketcher (std::list<double> theCoordinates);
|
|
||||||
Standard_EXPORT Handle(GEOM_Object) MakeSketcherOnPlane (const char* theCommand,
|
Standard_EXPORT Handle(GEOM_Object) MakeSketcherOnPlane (const char* theCommand,
|
||||||
Handle(GEOM_Object) theWorkingPlane);
|
Handle(GEOM_Object) theWorkingPlane);
|
||||||
|
Standard_EXPORT Handle(GEOM_Object) Make3DSketcherCommand (const char* theCommand);
|
||||||
|
Standard_EXPORT Handle(GEOM_Object) Make3DSketcher (std::list<double> theCoordinates);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -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
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
// GEOM_Object types
|
// GEOM_Object types
|
||||||
@ -295,7 +294,10 @@
|
|||||||
#define GLUE_EDGES_BY_LIST 4
|
#define GLUE_EDGES_BY_LIST 4
|
||||||
|
|
||||||
#define SKETCHER_NINE_DOUBLS 1
|
#define SKETCHER_NINE_DOUBLS 1
|
||||||
#define SKETCHER_PLANE 2
|
#define SKETCHER_PLANE 2
|
||||||
|
|
||||||
|
#define SKETCHER3D_COORDS 1
|
||||||
|
#define SKETCHER3D_COMMAND 2
|
||||||
|
|
||||||
// Measures
|
// Measures
|
||||||
#define CDG_MEASURE 1
|
#define CDG_MEASURE 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>
|
||||||
|
|
||||||
@ -433,13 +432,15 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSplineInterpolation
|
|||||||
* MakeCurveParametric
|
* MakeCurveParametric
|
||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCurveParametric(const char* thexExpr, const char* theyExpr, const char* thezExpr,
|
GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCurveParametric
|
||||||
double theParamMin, double theParamMax, double theParamStep,
|
(const char* thexExpr, const char* theyExpr, const char* thezExpr,
|
||||||
GEOM::curve_type theCurveType) {
|
double theParamMin, double theParamMax, double theParamStep,
|
||||||
|
GEOM::curve_type theCurveType)
|
||||||
|
{
|
||||||
GEOM::GEOM_Object_var aGEOMObject;
|
GEOM::GEOM_Object_var aGEOMObject;
|
||||||
//Set a not done flag
|
//Set a not done flag
|
||||||
GetOperations()->SetNotDone();
|
GetOperations()->SetNotDone();
|
||||||
|
|
||||||
GEOMImpl_ICurvesOperations::CurveType aType;
|
GEOMImpl_ICurvesOperations::CurveType aType;
|
||||||
switch(theCurveType) {
|
switch(theCurveType) {
|
||||||
case GEOM::Polyline:
|
case GEOM::Polyline:
|
||||||
@ -453,18 +454,17 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCurveParametric(const char*
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Make Polyline
|
// Make Polyline
|
||||||
Handle(GEOM_Object) anObject =
|
Handle(GEOM_Object) anObject =
|
||||||
GetOperations()->MakeCurveParametric(thexExpr, theyExpr, thezExpr,
|
GetOperations()->MakeCurveParametric(thexExpr, theyExpr, thezExpr,
|
||||||
theParamMin, theParamMax,
|
theParamMin, theParamMax,
|
||||||
theParamStep, aType);
|
theParamStep, aType);
|
||||||
|
|
||||||
if (!GetOperations()->IsDone() || anObject.IsNull())
|
if (!GetOperations()->IsDone() || anObject.IsNull())
|
||||||
return aGEOMObject._retn();
|
return aGEOMObject._retn();
|
||||||
|
|
||||||
return GetObject(anObject);
|
return GetObject(anObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -473,13 +473,15 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCurveParametric(const char*
|
|||||||
* MakeCurveParametricNew
|
* MakeCurveParametricNew
|
||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCurveParametricNew(const char* thexExpr, const char* theyExpr, const char* thezExpr,
|
GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCurveParametricNew
|
||||||
double theParamMin, double theParamMax, CORBA::Long theParamNbStep,
|
(const char* thexExpr, const char* theyExpr, const char* thezExpr,
|
||||||
GEOM::curve_type theCurveType) {
|
double theParamMin, double theParamMax, CORBA::Long theParamNbStep,
|
||||||
|
GEOM::curve_type theCurveType)
|
||||||
|
{
|
||||||
GEOM::GEOM_Object_var aGEOMObject;
|
GEOM::GEOM_Object_var aGEOMObject;
|
||||||
//Set a not done flag
|
//Set a not done flag
|
||||||
GetOperations()->SetNotDone();
|
GetOperations()->SetNotDone();
|
||||||
|
|
||||||
GEOMImpl_ICurvesOperations::CurveType aType;
|
GEOMImpl_ICurvesOperations::CurveType aType;
|
||||||
switch(theCurveType) {
|
switch(theCurveType) {
|
||||||
case GEOM::Polyline:
|
case GEOM::Polyline:
|
||||||
@ -493,18 +495,17 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCurveParametricNew(const cha
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Make Polyline
|
// Make Polyline
|
||||||
Handle(GEOM_Object) anObject =
|
Handle(GEOM_Object) anObject =
|
||||||
GetOperations()->MakeCurveParametric(thexExpr, theyExpr, thezExpr,
|
GetOperations()->MakeCurveParametric(thexExpr, theyExpr, thezExpr,
|
||||||
theParamMin, theParamMax,
|
theParamMin, theParamMax,
|
||||||
0.0, aType, theParamNbStep, true);
|
0.0, aType, theParamNbStep, true);
|
||||||
|
|
||||||
if (!GetOperations()->IsDone() || anObject.IsNull())
|
if (!GetOperations()->IsDone() || anObject.IsNull())
|
||||||
return aGEOMObject._retn();
|
return aGEOMObject._retn();
|
||||||
|
|
||||||
return GetObject(anObject);
|
return GetObject(anObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -534,6 +535,46 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcher
|
|||||||
return GetObject(anObject);
|
return GetObject(anObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* MakeSketcherOnPlane
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcherOnPlane
|
||||||
|
(const char* theCommand, GEOM::GEOM_Object_ptr theWorkingPlane)
|
||||||
|
{
|
||||||
|
//Set a not done flag
|
||||||
|
GetOperations()->SetNotDone();
|
||||||
|
|
||||||
|
Handle(GEOM_Object) aWorkingPlane = GetObjectImpl(theWorkingPlane);
|
||||||
|
|
||||||
|
// Make Sketcher
|
||||||
|
Handle(GEOM_Object) anObject =
|
||||||
|
GetOperations()->MakeSketcherOnPlane(theCommand, aWorkingPlane);
|
||||||
|
if (!GetOperations()->IsDone() || anObject.IsNull())
|
||||||
|
return GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
|
return GetObject(anObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* Make3DSketcherCommand
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::Make3DSketcherCommand (const char* theCommand)
|
||||||
|
{
|
||||||
|
//Set a not done flag
|
||||||
|
GetOperations()->SetNotDone();
|
||||||
|
|
||||||
|
// Make 3D Sketcher
|
||||||
|
Handle(GEOM_Object) anObject = GetOperations()->Make3DSketcherCommand(theCommand);
|
||||||
|
if (!GetOperations()->IsDone() || anObject.IsNull())
|
||||||
|
return GEOM::GEOM_Object::_nil();
|
||||||
|
|
||||||
|
return GetObject(anObject);
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
* Make3DSketcher
|
* Make3DSketcher
|
||||||
@ -559,25 +600,3 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::Make3DSketcher
|
|||||||
|
|
||||||
return GetObject(anObject);
|
return GetObject(anObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
|
||||||
/*!
|
|
||||||
* MakeSketcherOnPlane
|
|
||||||
*/
|
|
||||||
//=============================================================================
|
|
||||||
GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcherOnPlane
|
|
||||||
(const char* theCommand, GEOM::GEOM_Object_ptr theWorkingPlane)
|
|
||||||
{
|
|
||||||
//Set a not done flag
|
|
||||||
GetOperations()->SetNotDone();
|
|
||||||
|
|
||||||
Handle(GEOM_Object) aWorkingPlane = GetObjectImpl(theWorkingPlane);
|
|
||||||
|
|
||||||
// Make Sketcher
|
|
||||||
Handle(GEOM_Object) anObject =
|
|
||||||
GetOperations()->MakeSketcherOnPlane(theCommand, aWorkingPlane);
|
|
||||||
if (!GetOperations()->IsDone() || anObject.IsNull())
|
|
||||||
return GEOM::GEOM_Object::_nil();
|
|
||||||
|
|
||||||
return GetObject(anObject);
|
|
||||||
}
|
|
||||||
|
@ -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
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef _GEOM_ICurvesOperations_i_HeaderFile
|
#ifndef _GEOM_ICurvesOperations_i_HeaderFile
|
||||||
#define _GEOM_ICurvesOperations_i_HeaderFile
|
#define _GEOM_ICurvesOperations_i_HeaderFile
|
||||||
@ -33,49 +32,49 @@
|
|||||||
|
|
||||||
#include "GEOMImpl_ICurvesOperations.hxx"
|
#include "GEOMImpl_ICurvesOperations.hxx"
|
||||||
|
|
||||||
class GEOM_I_EXPORT GEOM_ICurvesOperations_i :
|
class GEOM_I_EXPORT GEOM_ICurvesOperations_i :
|
||||||
public virtual POA_GEOM::GEOM_ICurvesOperations,
|
public virtual POA_GEOM::GEOM_ICurvesOperations,
|
||||||
public virtual GEOM_IOperations_i
|
public virtual GEOM_IOperations_i
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GEOM_ICurvesOperations_i (PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine,
|
GEOM_ICurvesOperations_i (PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine,
|
||||||
::GEOMImpl_ICurvesOperations* theImpl);
|
::GEOMImpl_ICurvesOperations* theImpl);
|
||||||
~GEOM_ICurvesOperations_i();
|
~GEOM_ICurvesOperations_i();
|
||||||
|
|
||||||
GEOM::GEOM_Object_ptr MakeCirclePntVecR (GEOM::GEOM_Object_ptr theCenter,
|
GEOM::GEOM_Object_ptr MakeCirclePntVecR (GEOM::GEOM_Object_ptr theCenter,
|
||||||
GEOM::GEOM_Object_ptr theVector,
|
GEOM::GEOM_Object_ptr theVector,
|
||||||
double theR);
|
double theR);
|
||||||
|
|
||||||
GEOM::GEOM_Object_ptr MakeCircleThreePnt (GEOM::GEOM_Object_ptr thePnt1,
|
GEOM::GEOM_Object_ptr MakeCircleThreePnt (GEOM::GEOM_Object_ptr thePnt1,
|
||||||
GEOM::GEOM_Object_ptr thePnt2,
|
GEOM::GEOM_Object_ptr thePnt2,
|
||||||
GEOM::GEOM_Object_ptr thePnt3);
|
GEOM::GEOM_Object_ptr thePnt3);
|
||||||
|
|
||||||
GEOM::GEOM_Object_ptr MakeCircleCenter2Pnt (GEOM::GEOM_Object_ptr thePnt1,
|
GEOM::GEOM_Object_ptr MakeCircleCenter2Pnt (GEOM::GEOM_Object_ptr thePnt1,
|
||||||
GEOM::GEOM_Object_ptr thePnt2,
|
GEOM::GEOM_Object_ptr thePnt2,
|
||||||
GEOM::GEOM_Object_ptr thePnt3);
|
GEOM::GEOM_Object_ptr thePnt3);
|
||||||
|
|
||||||
GEOM::GEOM_Object_ptr MakeEllipse (GEOM::GEOM_Object_ptr theCenter,
|
GEOM::GEOM_Object_ptr MakeEllipse (GEOM::GEOM_Object_ptr theCenter,
|
||||||
GEOM::GEOM_Object_ptr theVector,
|
GEOM::GEOM_Object_ptr theVector,
|
||||||
double theRMajor, double theRMinor);
|
double theRMajor, double theRMinor);
|
||||||
|
|
||||||
GEOM::GEOM_Object_ptr MakeEllipseVec (GEOM::GEOM_Object_ptr theCenter,
|
GEOM::GEOM_Object_ptr MakeEllipseVec (GEOM::GEOM_Object_ptr theCenter,
|
||||||
GEOM::GEOM_Object_ptr theVector,
|
GEOM::GEOM_Object_ptr theVector,
|
||||||
double theRMajor, double theRMinor,
|
double theRMajor, double theRMinor,
|
||||||
GEOM::GEOM_Object_ptr theVectorMajor);
|
GEOM::GEOM_Object_ptr theVectorMajor);
|
||||||
|
|
||||||
GEOM::GEOM_Object_ptr MakeArc (GEOM::GEOM_Object_ptr thePnt1,
|
GEOM::GEOM_Object_ptr MakeArc (GEOM::GEOM_Object_ptr thePnt1,
|
||||||
GEOM::GEOM_Object_ptr thePnt2,
|
GEOM::GEOM_Object_ptr thePnt2,
|
||||||
GEOM::GEOM_Object_ptr thePnt3);
|
GEOM::GEOM_Object_ptr thePnt3);
|
||||||
|
|
||||||
GEOM::GEOM_Object_ptr MakeArcCenter (GEOM::GEOM_Object_ptr thePnt1,
|
GEOM::GEOM_Object_ptr MakeArcCenter (GEOM::GEOM_Object_ptr thePnt1,
|
||||||
GEOM::GEOM_Object_ptr thePnt2,
|
GEOM::GEOM_Object_ptr thePnt2,
|
||||||
GEOM::GEOM_Object_ptr thePnt3,
|
GEOM::GEOM_Object_ptr thePnt3,
|
||||||
bool theSense);
|
bool theSense);
|
||||||
|
|
||||||
GEOM::GEOM_Object_ptr MakeArcOfEllipse (GEOM::GEOM_Object_ptr thePnt1,
|
GEOM::GEOM_Object_ptr MakeArcOfEllipse (GEOM::GEOM_Object_ptr thePnt1,
|
||||||
GEOM::GEOM_Object_ptr thePnt2,
|
GEOM::GEOM_Object_ptr thePnt2,
|
||||||
GEOM::GEOM_Object_ptr thePnt3);
|
GEOM::GEOM_Object_ptr thePnt3);
|
||||||
|
|
||||||
GEOM::GEOM_Object_ptr MakePolyline (const GEOM::ListOfGO& thePoints,
|
GEOM::GEOM_Object_ptr MakePolyline (const GEOM::ListOfGO& thePoints,
|
||||||
CORBA::Boolean theIsClosed);
|
CORBA::Boolean theIsClosed);
|
||||||
|
|
||||||
@ -86,20 +85,24 @@ class GEOM_I_EXPORT GEOM_ICurvesOperations_i :
|
|||||||
CORBA::Boolean theIsClosed,
|
CORBA::Boolean theIsClosed,
|
||||||
CORBA::Boolean theDoReordering);
|
CORBA::Boolean theDoReordering);
|
||||||
|
|
||||||
GEOM::GEOM_Object_ptr MakeCurveParametric(const char* thexExpr, const char* theyExpr, const char* thezExpr,
|
GEOM::GEOM_Object_ptr MakeCurveParametric
|
||||||
double theParamMin, double theParamMax, double theParamStep,
|
(const char* thexExpr, const char* theyExpr, const char* thezExpr,
|
||||||
GEOM::curve_type theCurveType);
|
double theParamMin, double theParamMax, double theParamStep,
|
||||||
|
GEOM::curve_type theCurveType);
|
||||||
GEOM::GEOM_Object_ptr MakeCurveParametricNew(const char* thexExpr, const char* theyExpr, const char* thezExpr,
|
|
||||||
double theParamMin, double theParamMax, CORBA::Long theParamNbStep,
|
GEOM::GEOM_Object_ptr MakeCurveParametricNew
|
||||||
GEOM::curve_type theCurveType);
|
(const char* thexExpr, const char* theyExpr, const char* thezExpr,
|
||||||
|
double theParamMin, double theParamMax, CORBA::Long theParamNbStep,
|
||||||
|
GEOM::curve_type theCurveType);
|
||||||
|
|
||||||
GEOM::GEOM_Object_ptr MakeSketcher (const char* theCommand, const GEOM::ListOfDouble& theWorkingPlane);
|
GEOM::GEOM_Object_ptr MakeSketcher (const char* theCommand, const GEOM::ListOfDouble& theWorkingPlane);
|
||||||
|
|
||||||
GEOM::GEOM_Object_ptr Make3DSketcher (const GEOM::ListOfDouble& theCoordinates);
|
|
||||||
|
|
||||||
GEOM::GEOM_Object_ptr MakeSketcherOnPlane (const char* theCommand, GEOM::GEOM_Object_ptr theWorkingPlane);
|
GEOM::GEOM_Object_ptr MakeSketcherOnPlane (const char* theCommand, GEOM::GEOM_Object_ptr theWorkingPlane);
|
||||||
|
|
||||||
|
GEOM::GEOM_Object_ptr Make3DSketcherCommand (const char* theCommand);
|
||||||
|
|
||||||
|
GEOM::GEOM_Object_ptr Make3DSketcher (const GEOM::ListOfDouble& theCoordinates);
|
||||||
|
|
||||||
::GEOMImpl_ICurvesOperations* GetOperations()
|
::GEOMImpl_ICurvesOperations* GetOperations()
|
||||||
{ return (::GEOMImpl_ICurvesOperations*)GetImpl(); }
|
{ return (::GEOMImpl_ICurvesOperations*)GetImpl(); }
|
||||||
};
|
};
|
||||||
|
@ -1622,7 +1622,6 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
|||||||
# - "C radius length" : Create arc by direction, radius and length(in degree)
|
# - "C radius length" : Create arc by direction, radius and length(in degree)
|
||||||
# - "AA x y": Create arc by point at X & Y
|
# - "AA x y": Create arc by point at X & Y
|
||||||
# - "A dx dy" : Create arc by point with DX & DY
|
# - "A dx dy" : Create arc by point with DX & DY
|
||||||
# - "A dx dy" : Create arc by point with DX & DY
|
|
||||||
# - "UU x y radius flag1": Create arc by point at X & Y with given radiUs
|
# - "UU x y radius flag1": Create arc by point at X & Y with given radiUs
|
||||||
# - "U dx dy radius flag1" : Create arc by point with DX & DY with given radiUs
|
# - "U dx dy radius flag1" : Create arc by point with DX & DY with given radiUs
|
||||||
# - "EE x y xc yc flag1 flag2": Create arc by point at X & Y with given cEnter coordinates
|
# - "EE x y xc yc flag1 flag2": Create arc by point at X & Y with given cEnter coordinates
|
||||||
@ -1672,7 +1671,6 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
|||||||
- "C radius length" : Create arc by direction, radius and length(in degree)
|
- "C radius length" : Create arc by direction, radius and length(in degree)
|
||||||
- "AA x y": Create arc by point at X & Y
|
- "AA x y": Create arc by point at X & Y
|
||||||
- "A dx dy" : Create arc by point with DX & DY
|
- "A dx dy" : Create arc by point with DX & DY
|
||||||
- "A dx dy" : Create arc by point with DX & DY
|
|
||||||
- "UU x y radius flag1": Create arc by point at X & Y with given radiUs
|
- "UU x y radius flag1": Create arc by point at X & Y with given radiUs
|
||||||
- "U dx dy radius flag1" : Create arc by point with DX & DY with given radiUs
|
- "U dx dy radius flag1" : Create arc by point with DX & DY with given radiUs
|
||||||
- "EE x y xc yc flag1 flag2": Create arc by point at X & Y with given cEnter coordinates
|
- "EE x y xc yc flag1 flag2": Create arc by point at X & Y with given cEnter coordinates
|
||||||
@ -1729,8 +1727,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
|||||||
Returns:
|
Returns:
|
||||||
New GEOM.GEOM_Object, containing the created wire.
|
New GEOM.GEOM_Object, containing the created wire.
|
||||||
"""
|
"""
|
||||||
|
theCommand,Parameters = ParseSketcherCommand(theCommand)
|
||||||
anObj = self.CurvesOp.MakeSketcherOnPlane(theCommand, theWorkingPlane)
|
anObj = self.CurvesOp.MakeSketcherOnPlane(theCommand, theWorkingPlane)
|
||||||
RaiseIfFailed("MakeSketcherOnPlane", self.CurvesOp)
|
RaiseIfFailed("MakeSketcherOnPlane", self.CurvesOp)
|
||||||
|
anObj.SetParameters(Parameters)
|
||||||
return anObj
|
return anObj
|
||||||
|
|
||||||
## Create a sketcher wire, following the numerical description,
|
## Create a sketcher wire, following the numerical description,
|
||||||
@ -1758,6 +1758,21 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
|||||||
anObj.SetParameters(Parameters)
|
anObj.SetParameters(Parameters)
|
||||||
return anObj
|
return anObj
|
||||||
|
|
||||||
|
## Obtain a 3D sketcher interface
|
||||||
|
def Sketcher3D (self):
|
||||||
|
"""
|
||||||
|
Example of usage:
|
||||||
|
sk = geompy.Sketcher3D()
|
||||||
|
sk.addPointsAbsolute(0, 0, 0)
|
||||||
|
sk.addPointsAbsolute(70, 0, 0)
|
||||||
|
sk.addPointsRelative(0, 0, 130)
|
||||||
|
sk.addPointAnglesLength("OXY", 50, 0, 100)
|
||||||
|
sk.addPointAnglesLength("OXZ", 30, 80, 130)
|
||||||
|
a3D_Sketcher_1 = sk.makeWire()
|
||||||
|
"""
|
||||||
|
sk = Sketcher3D (self)
|
||||||
|
return sk
|
||||||
|
|
||||||
# end of l3_sketcher
|
# end of l3_sketcher
|
||||||
## @}
|
## @}
|
||||||
|
|
||||||
@ -1771,7 +1786,7 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
|||||||
#
|
#
|
||||||
# @return New GEOM.GEOM_Object, containing the created box.
|
# @return New GEOM.GEOM_Object, containing the created box.
|
||||||
# @ref tui_creation_box "Example"
|
# @ref tui_creation_box "Example"
|
||||||
def MakeBox(self,x1,y1,z1,x2,y2,z2):
|
def MakeBox (self, x1,y1,z1, x2,y2,z2):
|
||||||
"""
|
"""
|
||||||
Create a box by coordinates of two opposite vertices.
|
Create a box by coordinates of two opposite vertices.
|
||||||
|
|
||||||
@ -8836,6 +8851,67 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
|||||||
RaiseIfFailed("AddTexture", self.InsertOp)
|
RaiseIfFailed("AddTexture", self.InsertOp)
|
||||||
return ID
|
return ID
|
||||||
|
|
||||||
|
## 3D Sketcher functionality
|
||||||
|
## Use geompy.Sketcher3D() to obtain an instance of this class
|
||||||
|
def printVar (var):
|
||||||
|
if isinstance(var, str):
|
||||||
|
return "\'%s\'"%var
|
||||||
|
else:
|
||||||
|
return "%.7f"%var
|
||||||
|
|
||||||
|
class Sketcher3D:
|
||||||
|
def __init__(self, geompyD):
|
||||||
|
self.geompyD = geompyD
|
||||||
|
self.myCommand = "3DSketcher"
|
||||||
|
pass
|
||||||
|
|
||||||
|
def addPointsAbsolute (self, *listCoords):
|
||||||
|
ii = 1
|
||||||
|
for cc in listCoords:
|
||||||
|
if ii == 1:
|
||||||
|
self.myCommand = self.myCommand + ":TT"
|
||||||
|
#self.myCommand = self.myCommand + " %.7f"%cc
|
||||||
|
self.myCommand = self.myCommand + " %s"%printVar(cc)
|
||||||
|
if ii == 3:
|
||||||
|
ii = 1
|
||||||
|
else:
|
||||||
|
ii = ii + 1
|
||||||
|
pass
|
||||||
|
|
||||||
|
def addPointsRelative (self, *listCoords):
|
||||||
|
ii = 1
|
||||||
|
for cc in listCoords:
|
||||||
|
if ii == 1:
|
||||||
|
self.myCommand = self.myCommand + ":T"
|
||||||
|
#self.myCommand = self.myCommand + " %.7f"%cc
|
||||||
|
self.myCommand = self.myCommand + " %s"%printVar(cc)
|
||||||
|
if ii == 3:
|
||||||
|
ii = 1
|
||||||
|
else:
|
||||||
|
ii = ii + 1
|
||||||
|
pass
|
||||||
|
|
||||||
|
## axes can be: "OXY", "OYZ" or "OXZ"
|
||||||
|
def addPointAnglesLength (self, axes, angle1, angle2, length):
|
||||||
|
#self.myCommand = self.myCommand + ":%s %.7f %.7f %.7f" % (axes, angle1, angle2, length)
|
||||||
|
self.myCommand = self.myCommand + ":%s %s %s %s" % (axes, printVar(angle1), printVar(angle2), printVar(length))
|
||||||
|
pass
|
||||||
|
|
||||||
|
def close (self):
|
||||||
|
self.myCommand = self.myCommand + ":WW"
|
||||||
|
pass
|
||||||
|
|
||||||
|
## Obtain the sketcher result
|
||||||
|
def wire (self):
|
||||||
|
print "myCommand =", self.myCommand
|
||||||
|
Command,Parameters = ParseSketcherCommand(self.myCommand)
|
||||||
|
print "Command =", Command
|
||||||
|
wire = self.geompyD.CurvesOp.Make3DSketcherCommand(Command)
|
||||||
|
self.myCommand = "3DSketcher"
|
||||||
|
RaiseIfFailed("Sketcher3D", self.geompyD.CurvesOp)
|
||||||
|
wire.SetParameters(Parameters)
|
||||||
|
return wire
|
||||||
|
|
||||||
import omniORB
|
import omniORB
|
||||||
#Register the new proxy for GEOM_Gen
|
#Register the new proxy for GEOM_Gen
|
||||||
omniORB.registerObjref(GEOM._objref_GEOM_Gen._NP_RepositoryId, geompyDC)
|
omniORB.registerObjref(GEOM._objref_GEOM_Gen._NP_RepositoryId, geompyDC)
|
||||||
|
Loading…
Reference in New Issue
Block a user