本文整理汇总了C++中Handle_Geom_BSplineCurve类的典型用法代码示例。如果您正苦于以下问题:C++ Handle_Geom_BSplineCurve类的具体用法?C++ Handle_Geom_BSplineCurve怎么用?C++ Handle_Geom_BSplineCurve使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Handle_Geom_BSplineCurve类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getPolesAndWeights
PyObject* BSplineCurvePy::getPolesAndWeights(PyObject * args)
{
if (!PyArg_ParseTuple(args, ""))
return 0;
try {
Handle_Geom_BSplineCurve curve = Handle_Geom_BSplineCurve::DownCast
(getGeometryPtr()->handle());
TColgp_Array1OfPnt p(1,curve->NbPoles());
curve->Poles(p);
TColStd_Array1OfReal w(1,curve->NbPoles());
curve->Weights(w);
Py::List poles;
for (Standard_Integer i=p.Lower(); i<=p.Upper(); i++) {
gp_Pnt pnt = p(i);
double weight = w(i);
Py::Tuple t(4);
t.setItem(0, Py::Float(pnt.X()));
t.setItem(1, Py::Float(pnt.Y()));
t.setItem(2, Py::Float(pnt.Z()));
t.setItem(3, Py::Float(weight));
poles.append(t);
}
return Py::new_reference_to(poles);
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
示例2: getEndPoint
Py::Object BSplineCurvePy::getEndPoint(void) const
{
Handle_Geom_BSplineCurve c = Handle_Geom_BSplineCurve::DownCast
(getGeometryPtr()->handle());
gp_Pnt pnt = c->EndPoint();
return Py::Vector(Base::Vector3d(pnt.X(), pnt.Y(), pnt.Z()));
}
示例3: list
PyObject* BSplineCurvePy::setKnots(PyObject * args)
{
PyObject* obj;
if (!PyArg_ParseTuple(args, "O", &obj))
return 0;
try {
Py::Sequence list(obj);
TColStd_Array1OfReal k(1,list.size());
int index=1;
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
Py::Float val(*it);
k(index++) = (double)val;
}
Handle_Geom_BSplineCurve curve = Handle_Geom_BSplineCurve::DownCast
(getGeometryPtr()->handle());
curve->SetKnots(k);
Py_Return;
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
示例4: getResolution
PyObject* BSplineCurvePy::getResolution(PyObject * args)
{
double tol;
if (!PyArg_ParseTuple(args, "d", &tol))
return 0;
try {
Handle_Geom_BSplineCurve curve = Handle_Geom_BSplineCurve::DownCast
(getGeometryPtr()->handle());
double utol;
curve->Resolution(tol,utol);
return Py_BuildValue("d",utol);
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
示例5: isClosed
PyObject* BSplineCurvePy::isClosed(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return 0;
Handle_Geom_BSplineCurve curve = Handle_Geom_BSplineCurve::DownCast
(getGeometryPtr()->handle());
Standard_Boolean val = curve->IsClosed();
return PyBool_FromLong(val ? 1 : 0);
}
示例6: c
//! Can this BSpline be represented by a straight line?
bool BSpline::isLine()
{
bool result = false;
BRepAdaptor_Curve c(occEdge);
Handle_Geom_BSplineCurve spline = c.BSpline();
if (spline->NbPoles() == 2) {
result = true;
}
return result;
}
示例7: getKnot
PyObject* BSplineCurvePy::getKnot(PyObject * args)
{
int Index;
if (!PyArg_ParseTuple(args, "i", &Index))
return 0;
Handle_Geom_BSplineCurve curve = Handle_Geom_BSplineCurve::DownCast
(getGeometryPtr()->handle());
double M = curve->Knot(Index);
return Py_BuildValue("d",M);
}
示例8: increaseDegree
PyObject* BSplineCurvePy::increaseDegree(PyObject * args)
{
int degree;
if (!PyArg_ParseTuple(args, "i", °ree))
return 0;
PY_TRY {
Handle_Geom_BSplineCurve curve = Handle_Geom_BSplineCurve::DownCast
(getGeometryPtr()->handle());
curve->IncreaseDegree(degree);
Py_Return;
} PY_CATCH_OCC ;
}
示例9: setPeriodic
PyObject* BSplineCurvePy::setPeriodic(PyObject * args)
{
if (!PyArg_ParseTuple(args, ""))
return 0;
try {
Handle_Geom_BSplineCurve curve = Handle_Geom_BSplineCurve::DownCast
(getGeometryPtr()->handle());
curve->SetPeriodic();
Py_Return;
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
示例10: getMultiplicity
PyObject* BSplineCurvePy::getMultiplicity(PyObject * args)
{
int index;
if (!PyArg_ParseTuple(args, "i", &index))
return 0;
try {
Handle_Geom_BSplineCurve curve = Handle_Geom_BSplineCurve::DownCast
(getGeometryPtr()->handle());
int mult = curve->Multiplicity(index);
return Py_BuildValue("i", mult);
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
示例11: setKnot
PyObject* BSplineCurvePy::setKnot(PyObject * args)
{
int Index, M=-1;
double K;
if (!PyArg_ParseTuple(args, "id|i", &Index, &K, &M))
return 0;
Handle_Geom_BSplineCurve curve = Handle_Geom_BSplineCurve::DownCast
(getGeometryPtr()->handle());
if (M == -1) {
curve->SetKnot(Index, K);
}
else {
curve->SetKnot(Index, K, M);
}
Py_Return;
}
示例12: setWeight
PyObject* BSplineCurvePy::setWeight(PyObject * args)
{
int index;
double weight;
if (!PyArg_ParseTuple(args, "id", &index,&weight))
return 0;
try {
Handle_Geom_BSplineCurve curve = Handle_Geom_BSplineCurve::DownCast
(getGeometryPtr()->handle());
curve->SetWeight(index,weight);
Py_Return;
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
示例13: getWeight
PyObject* BSplineCurvePy::getWeight(PyObject * args)
{
int index;
if (!PyArg_ParseTuple(args, "i", &index))
return 0;
try {
Handle_Geom_BSplineCurve curve = Handle_Geom_BSplineCurve::DownCast
(getGeometryPtr()->handle());
Standard_OutOfRange_Raise_if
(index < 1 || index > curve->NbPoles() , "Weight index out of range");
double weight = curve->Weight(index);
return Py_BuildValue("d", weight);
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
}
示例14: incrementMultiplicity
PyObject* BSplineCurvePy::incrementMultiplicity(PyObject * args)
{
int start, end, mult;
if (!PyArg_ParseTuple(args, "iii", &start, &end, &mult))
return 0;
try {
Handle_Geom_BSplineCurve curve = Handle_Geom_BSplineCurve::DownCast
(getGeometryPtr()->handle());
curve->IncrementMultiplicity(start, end, mult);
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(PartExceptionOCCError, e->GetMessageString());
return 0;
}
Py_Return;
}
示例15: increaseMultiplicity
PyObject* BSplineCurvePy::increaseMultiplicity(PyObject * args)
{
int mult=-1;
int start, end;
if (!PyArg_ParseTuple(args, "ii|i", &start, &end, &mult))
return 0;
Handle_Geom_BSplineCurve curve = Handle_Geom_BSplineCurve::DownCast
(getGeometryPtr()->handle());
if (mult == -1) {
mult = end;
curve->IncreaseMultiplicity(start, mult);
}
else {
curve->IncreaseMultiplicity(start, end, mult);
}
Py_Return;
}