fixes #1319
allow Part.makeHelix to use 'vertical height' parm correct lefthanded conical helixes in TopoShape::makeHelix
This commit is contained in:
parent
392cf965af
commit
33a4b6d7ba
|
@ -858,12 +858,19 @@ static PyObject * makeTorus(PyObject *self, PyObject *args)
|
|||
static PyObject * makeHelix(PyObject *self, PyObject *args)
|
||||
{
|
||||
double pitch, height, radius, angle=-1.0;
|
||||
if (!PyArg_ParseTuple(args, "ddd|d", &pitch, &height, &radius, &angle))
|
||||
PyObject *pleft=Py_False;
|
||||
PyObject *pvertHeight=Py_False;
|
||||
if (!PyArg_ParseTuple(args, "ddd|dO!O!", &pitch, &height, &radius, &angle,
|
||||
&(PyBool_Type), &pleft,
|
||||
&(PyBool_Type), &pvertHeight))
|
||||
return 0;
|
||||
|
||||
try {
|
||||
TopoShape helix;
|
||||
TopoDS_Shape wire = helix.makeHelix(pitch, height, radius, angle);
|
||||
Standard_Boolean anIsLeft = PyObject_IsTrue(pleft) ? Standard_True : Standard_False;
|
||||
Standard_Boolean anIsVertHeight = PyObject_IsTrue(pvertHeight) ? Standard_True : Standard_False;
|
||||
TopoDS_Shape wire = helix.makeHelix(pitch, height, radius, angle,
|
||||
anIsLeft, anIsVertHeight);
|
||||
return new TopoShapeWirePy(new TopoShape(wire));
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
|
|
|
@ -1610,11 +1610,13 @@ TopoDS_Shape TopoShape::makeHelix(Standard_Real pitch, Standard_Real height,
|
|||
|
||||
gp_Pnt2d aPnt(0, 0);
|
||||
gp_Dir2d aDir(2. * M_PI, pitch);
|
||||
Standard_Real coneDir = 1.0;
|
||||
if (leftHanded) {
|
||||
//aPnt.SetCoord(0.0, height);
|
||||
//aDir.SetCoord(2.0 * PI, -pitch);
|
||||
aPnt.SetCoord(2. * M_PI, 0.0);
|
||||
aDir.SetCoord(-2. * M_PI, pitch);
|
||||
coneDir = -1.0;
|
||||
}
|
||||
gp_Ax2d aAx2d(aPnt, aDir);
|
||||
|
||||
|
@ -1627,7 +1629,7 @@ TopoDS_Shape TopoShape::makeHelix(Standard_Real pitch, Standard_Real height,
|
|||
if (angle >= Precision::Confusion()) {
|
||||
// calculate end point for conical helix
|
||||
Standard_Real v = height / cos(angle);
|
||||
Standard_Real u = (height/pitch) * 2.0 * M_PI;
|
||||
Standard_Real u = coneDir * (height/pitch) * 2.0 * M_PI;
|
||||
gp_Pnt2d cend(u, v);
|
||||
end = cend;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user