本文整理汇总了C++中Handle_Geom_Curve::FirstParameter方法的典型用法代码示例。如果您正苦于以下问题:C++ Handle_Geom_Curve::FirstParameter方法的具体用法?C++ Handle_Geom_Curve::FirstParameter怎么用?C++ Handle_Geom_Curve::FirstParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Handle_Geom_Curve
的用法示例。
在下文中一共展示了Handle_Geom_Curve::FirstParameter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: toBSpline
PyObject* GeometryCurvePy::toBSpline(PyObject * args)
{
Handle_Geom_Geometry g = getGeometryPtr()->handle();
Handle_Geom_Curve c = Handle_Geom_Curve::DownCast(g);
try {
if (!c.IsNull()) {
double u,v;
u=c->FirstParameter();
v=c->LastParameter();
if (!PyArg_ParseTuple(args, "|dd", &u,&v))
return 0;
ShapeConstruct_Curve scc;
Handle_Geom_BSplineCurve spline = scc.ConvertToBSpline(c, u, v, Precision::Confusion());
if (spline.IsNull())
Standard_NullValue::Raise("Conversion to B-Spline failed");
return new BSplineCurvePy(new GeomBSplineCurve(spline));
}
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve");
return 0;
}
示例2: toShape
PyObject* GeometryCurvePy::toShape(PyObject *args)
{
Handle_Geom_Geometry g = getGeometryPtr()->handle();
Handle_Geom_Curve c = Handle_Geom_Curve::DownCast(g);
try {
if (!c.IsNull()) {
double u,v;
u=c->FirstParameter();
v=c->LastParameter();
if (!PyArg_ParseTuple(args, "|dd", &u,&v))
return 0;
BRepBuilderAPI_MakeEdge mkBuilder(c, u, v);
TopoDS_Shape sh = mkBuilder.Shape();
return new TopoShapeEdgePy(new TopoShape(sh));
}
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve");
return 0;
}
示例3: length
PyObject* GeometryCurvePy::length(PyObject *args)
{
Handle_Geom_Geometry g = getGeometryPtr()->handle();
Handle_Geom_Curve c = Handle_Geom_Curve::DownCast(g);
try {
if (!c.IsNull()) {
double u=c->FirstParameter();
double v=c->LastParameter();
double t=Precision::Confusion();
if (!PyArg_ParseTuple(args, "|ddd", &u,&v,&t))
return 0;
GeomAdaptor_Curve adapt(c);
double len = GCPnts_AbscissaPoint::Length(adapt,u,v,t);
return PyFloat_FromDouble(len);
}
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
PyErr_SetString(PartExceptionOCCError, "Geometry is not a curve");
return 0;
}
示例4: PyInit
// constructor method
int TopoShapeEdgePy::PyInit(PyObject* args, PyObject* /*kwd*/)
{
PyObject *pcObj, *pcObj2;
double first=DBL_MAX, last=DBL_MAX;
if (PyArg_ParseTuple(args, "O!|dd", &(Part::GeometryPy::Type), &pcObj, &first, &last)) {
Geometry* geom = static_cast<GeometryPy*>(pcObj)->getGeometryPtr();
Handle_Geom_Curve curve = Handle_Geom_Curve::DownCast(geom->handle());
if (curve.IsNull()) {
PyErr_SetString(PyExc_Exception, "geometry is not a curve type");
return -1;
}
if (first==DBL_MAX)
first = curve->FirstParameter();
if (last==DBL_MAX)
last = curve->LastParameter();
try {
BRepBuilderAPI_MakeEdge mkEdge(curve, first, last);
getTopoShapePtr()->_Shape = mkEdge.Edge();
return 0;
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
return -1;
}
}
PyErr_Clear();
if (PyArg_ParseTuple(args, "O!", &(Part::TopoShapePy::Type), &pcObj)) {
TopoShape* shape = static_cast<TopoShapePy*>(pcObj)->getTopoShapePtr();
if (shape && !shape->_Shape.IsNull() && shape->_Shape.ShapeType() == TopAbs_EDGE) {
this->getTopoShapePtr()->_Shape = shape->_Shape;
return 0;
}
else {
PyErr_SetString(PyExc_TypeError, "Shape is not an edge");
return -1;
}
}
PyErr_Clear();
if (PyArg_ParseTuple(args, "O!O!", &(Part::TopoShapeVertexPy::Type), &pcObj,
&(Part::TopoShapeVertexPy::Type), &pcObj2)) {
TopoShape* shape1 = static_cast<TopoShapePy*>(pcObj)->getTopoShapePtr();
TopoShape* shape2 = static_cast<TopoShapePy*>(pcObj2)->getTopoShapePtr();
const TopoDS_Vertex& v1 = TopoDS::Vertex(shape1->_Shape);
const TopoDS_Vertex& v2 = TopoDS::Vertex(shape2->_Shape);
try {
BRepBuilderAPI_MakeEdge mkEdge(v1, v2);
getTopoShapePtr()->_Shape = mkEdge.Edge();
return 0;
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PyExc_Exception, e->GetMessageString());
return -1;
}
}
PyErr_SetString(PyExc_Exception, "Curve or shape expected");
return -1;
}