First draft of makeThread

This commit is contained in:
wmayer
2012-06-15 13:04:07 +02:00
parent 1912ba66cc
commit 21add8911d
4 changed files with 92 additions and 2 deletions

View File

@@ -785,6 +785,24 @@ static PyObject * makeHelix(PyObject *self, PyObject *args)
}
}
static PyObject * makeThread(PyObject *self, PyObject *args)
{
double pitch, height, depth, radius;
if (!PyArg_ParseTuple(args, "dddd", &pitch, &height, &depth, &radius))
return 0;
try {
TopoShape helix;
TopoDS_Shape wire = helix.makeThread(pitch, height, depth, radius);
return new TopoShapeWirePy(new TopoShape(wire));
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
return 0;
}
}
static PyObject * makeLine(PyObject *self, PyObject *args)
{
PyObject *obj1, *obj2;
@@ -1475,6 +1493,9 @@ struct PyMethodDef Part_methods[] = {
"By default a cylindrical surface is used to create the helix. If the fourth parameter is set\n"
"(the apex given in degree) a conical surface is used instead"},
{"makeThread" ,makeThread,METH_VARARGS,
"makeThread(pitch,depth,height,radius) -- Make a thread with a given pitch, depth, height and radius"},
{"makeRevolution" ,makeRevolution,METH_VARARGS,
"makeRevolution(Curve,[vmin,vmax,angle,pnt,dir]) -- Make a revolved shape\n"
"by rotating the curve or a portion of it around an axis given by (pnt,dir).\n"