From d6b8a348a4276a58899ce9fea4ccdbb1c2864c6b Mon Sep 17 00:00:00 2001 From: rnc Date: Wed, 10 Oct 2012 14:55:29 +0000 Subject: [PATCH] EDF 1337 : Sketcher 3D define a point by angle Changed the name and order of parameter of tui methods for building a point by angles in order ot be consistent with GUI. --- src/GEOM/GEOM_Engine.cxx | 12 ++++----- src/GEOM_SWIG/GEOM_TestAll.py | 8 ++++-- src/GEOM_SWIG/gsketcher.py | 46 +++++++++++++++++------------------ 3 files changed, 35 insertions(+), 31 deletions(-) diff --git a/src/GEOM/GEOM_Engine.cxx b/src/GEOM/GEOM_Engine.cxx index 988157174..501909d7a 100644 --- a/src/GEOM/GEOM_Engine.cxx +++ b/src/GEOM/GEOM_Engine.cxx @@ -1105,15 +1105,15 @@ bool ProcessFunction(Handle(GEOM_Function)& theFunction, TCollection_AsciiString aCMDtrunc = aStrVals.Value(1); aCMDtrunc.Trunc(3); if (aCMDpref.Value(4) == 'C') - aNewDescr += "sk.addPointAngleHRad"; + aNewDescr += "sk.addPointRadiusAngleH"; else - aNewDescr += "sk.addPointAnglesRad"; + aNewDescr += "sk.addPointRadiusAngles"; if (aCMDpref.Value(5) == 'A') - aNewDescr += "Absolute(\""; + aNewDescr += "Absolute("; else - aNewDescr += "Relative(\""; - aNewDescr += aCMDtrunc + "\", " + - aStrVals.Value(2) + ", " + aStrVals.Value(3) + ", " + aStrVals.Value(4) + ")"; + aNewDescr += "Relative("; + aNewDescr += aStrVals.Value(4) + ", " + + aStrVals.Value(2) + ", " + aStrVals.Value(3) + ", " + "\""+aCMDtrunc+"\"" + ")"; } } aNewDescr += "\n\t"; diff --git a/src/GEOM_SWIG/GEOM_TestAll.py b/src/GEOM_SWIG/GEOM_TestAll.py index b74b80816..af022ee8d 100644 --- a/src/GEOM_SWIG/GEOM_TestAll.py +++ b/src/GEOM_SWIG/GEOM_TestAll.py @@ -109,8 +109,12 @@ def TestAll (geompy, math): sk = geompy.Sketcher3D() sk.addPointsAbsolute(0,0,0, 70,0,0) sk.addPointsRelative(0, 0, 130) - sk.addPointAnglesLength("OXY", 50, 0, 100) - sk.addPointAnglesLength("OXZ", 30, 80, 130) + sk.addPointRadiusAnglesRelative(100, 50, 0,"OXY") + sk.addPointRadiusAnglesRelative(130, 30, 80, "OXZ") + sk.addPointRadiusAnglesAbsolute(500, 60, 30,"OXY") + sk.addPointRadiusAngleHRelative(100, 50, 0,"OXY") + sk.addPointRadiusAngleHRelative(130, 30, 40, "OXZ") + sk.addPointRadiusAngleHAbsolute(800, 60, 30,"OXY") sk.close() Sketcher3d_1 = sk.wire() diff --git a/src/GEOM_SWIG/gsketcher.py b/src/GEOM_SWIG/gsketcher.py index f5ccc63bc..11ef9bb6d 100644 --- a/src/GEOM_SWIG/gsketcher.py +++ b/src/GEOM_SWIG/gsketcher.py @@ -123,26 +123,26 @@ class Sketcher3D: # origin (0, 0, 0) will become the first sketcher point. # The radius and angles coordinates are defined # in a local coordinate system which origin is the last point of the sketch - # - # @param axes can be: "OXY", "OYZ" or "OXZ" + # + # @param length length of the segment # @param angle1 angle in a plane, defined by the \a axes # @param angle2 angle from the plane, defined by the \a axes - # @param length length of the segment - def addPointAnglesRadRelative (self, axes, angle1, angle2, length): + # @param axes can be: "OXY", "OYZ" or "OXZ" + def addPointRadiusAnglesRelative (self, length, angle1, angle2, axes="OXY"): """ Add one straight segment, defined by two angles and length. If the first point of sketcher is not yet defined, the origin (0, 0, 0) will become the first sketcher point. Parameters: - axes can be: "OXY", "OYZ" or "OXZ" + length length of the segment angle1 angle in a plane, defined by the \a axes angle2 angle from the plane, defined by the \a axes - length length of the segment + axes can be: "OXY", "OYZ" or "OXZ" Example of usage: sk = geompy.Sketcher3D() - sk.addPointAnglesRadRelative("OXY", 50, 0, 100) + sk.addPointRadiusAnglesRelative(100, 50, 0, "OXY") a3D_Sketcher_1 = sk.wire() """ self.myCommand = self.myCommand + ":%s"%axes+"SR"+" %s %s %s" % (printVar(angle1), printVar(angle2), printVar(length)) @@ -154,25 +154,25 @@ class Sketcher3D: # The radius and angles coordinates are defined # in a coordinate system which origin is the global coordinate system origin # - # @param axes can be: "OXY", "OYZ" or "OXZ" + # @param radius distance to the coordinate system origin # @param angle1 angle in a plane, defined by the \a axes # @param angle2 angle from the plane, defined by the \a axes - # @param radius distance to the coordinate system origin - def addPointAnglesRadAbsolute (self, axes, angle1, angle2, radius): + # @param axes can be: "OXY", "OYZ" or "OXZ" + def addPointRadiusAnglesAbsolute (self, radius, angle1, angle2, axes="OXY"): """ Add one straight segment, defined by two angles and length. If the first point of sketcher is not yet defined, the origin (0, 0, 0) will become the first sketcher point. Parameters: - axes can be: "OXY", "OYZ" or "OXZ" + radius distance to the coordinate system origin angle1 angle in a plane, defined by the \a axes angle2 angle from the plane, defined by the \a axes - radius distance to the coordinate system origin + axes can be: "OXY", "OYZ" or "OXZ" Example of usage: sk = geompy.Sketcher3D() - sk.addPointAnglesRadAbsolute("OXY", 50, 0, 100) + sk.addPointRadiusAnglesAbsolute(100, 50, 0, "OXY") a3D_Sketcher_1 = sk.wire() """ self.myCommand = self.myCommand + ":%s"%axes+"SA"+" %s %s %s" % (printVar(angle1), printVar(angle2), printVar(radius)) @@ -188,21 +188,21 @@ class Sketcher3D: # @param angle angle in a plane, defined by the \a axes # @param height height from the plane, defined by the \a axes # @param radius distance to the coordinate system origin - def addPointAngleHRadRelative (self, axes, angle, height, length): + def addPointRadiusAngleHRelative (self, length, angle, height, axes="OXY"): """ Add one straight segment, defined by two angles and length. If the first point of sketcher is not yet defined, the origin (0, 0, 0) will become the first sketcher point. Parameters: - axes can be: "OXY", "OYZ" or "OXZ" - angle1 angle in a plane, defined by the \a axes - height height from the plane, defined by the \a axes radius distance to the coordinate system origin + angle angle in a plane, defined by the \a axes + height height from the plane, defined by the \a axes + axes can be: "OXY", "OYZ" or "OXZ" Example of usage: sk = geompy.Sketcher3D() - sk.addPointAngleHRadRelative("OXY", 50, 40, 100) + sk.addPointRadiusAngleHRelative(100, 50, 40, "OXY") a3D_Sketcher_1 = sk.wire() """ self.myCommand = self.myCommand + ":%s"%axes+"CR"+" %s %s %s" % (printVar(angle), printVar(height), printVar(length)) @@ -213,12 +213,12 @@ class Sketcher3D: # origin (0, 0, 0) will become the first sketcher point. # The radius height and angle coordinates are defined # in a coordinate system which origin is the global coordinate system origin - # - # @param axes can be: "OXY", "OYZ" or "OXZ" + # + # @param radius distance to the coordinate system origin # @param angle angle in a plane, defined by the \a axes # @param height height from the plane, defined by the \a axes - # @param radius distance to the coordinate system origin - def addPointAngleHRadAbsolute (self, axes, angle, height, radius): + # @param axes can be: "OXY", "OYZ" or "OXZ" + def addPointRadiusAngleHAbsolute (self, radius, angle, height, axes="OXY"): """ Add one straight segment, defined by two angles and length. If the first point of sketcher is not yet defined, the @@ -232,7 +232,7 @@ class Sketcher3D: Example of usage: sk = geompy.Sketcher3D() - sk.addPointAngleHRadAbsolute("OXY", 50, 40, 100) + sk.addPointRadiusAngleHAbsolute( 100, 50, 40, "OXY") a3D_Sketcher_1 = sk.wire() """ self.myCommand = self.myCommand + ":%s"%axes+"CA"+" %s %s %s" % (printVar(angle), printVar(height), printVar(radius)) -- 2.39.2