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.
This commit is contained in:
rnc 2012-10-10 14:55:29 +00:00
parent d063ba2bae
commit d6b8a348a4
3 changed files with 35 additions and 31 deletions

View File

@ -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";

View File

@ -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()

View File

@ -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))