Part: modernize C++11
* use nullptr
This commit is contained in:
@@ -94,7 +94,7 @@ int BSplineCurvePy::PyInit(PyObject* args, PyObject* kwd)
|
||||
PyObject* BSplineCurvePy::__reduce__(PyObject *args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
Py::Tuple tuple(2);
|
||||
|
||||
@@ -121,7 +121,7 @@ PyObject* BSplineCurvePy::__reduce__(PyObject *args)
|
||||
PyObject* BSplineCurvePy::isRational(PyObject *args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return 0;
|
||||
return nullptr;
|
||||
Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
Standard_Boolean val = curve->IsRational();
|
||||
@@ -131,7 +131,7 @@ PyObject* BSplineCurvePy::isRational(PyObject *args)
|
||||
PyObject* BSplineCurvePy::isPeriodic(PyObject *args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return 0;
|
||||
return nullptr;
|
||||
Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
Standard_Boolean val = curve->IsPeriodic();
|
||||
@@ -141,7 +141,7 @@ PyObject* BSplineCurvePy::isPeriodic(PyObject *args)
|
||||
PyObject* BSplineCurvePy::isClosed(PyObject *args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return 0;
|
||||
return nullptr;
|
||||
Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
Standard_Boolean val = curve->IsClosed();
|
||||
@@ -152,7 +152,7 @@ PyObject* BSplineCurvePy::increaseDegree(PyObject * args)
|
||||
{
|
||||
int degree;
|
||||
if (!PyArg_ParseTuple(args, "i", °ree))
|
||||
return 0;
|
||||
return nullptr;
|
||||
PY_TRY {
|
||||
Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
@@ -166,7 +166,7 @@ PyObject* BSplineCurvePy::increaseMultiplicity(PyObject * args)
|
||||
int mult=-1;
|
||||
int start, end;
|
||||
if (!PyArg_ParseTuple(args, "ii|i", &start, &end, &mult))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast
|
||||
@@ -183,7 +183,7 @@ PyObject* BSplineCurvePy::increaseMultiplicity(PyObject * args)
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ PyObject* BSplineCurvePy::incrementMultiplicity(PyObject * args)
|
||||
{
|
||||
int start, end, mult;
|
||||
if (!PyArg_ParseTuple(args, "iii", &start, &end, &mult))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast
|
||||
@@ -200,7 +200,7 @@ PyObject* BSplineCurvePy::incrementMultiplicity(PyObject * args)
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Py_Return;
|
||||
@@ -212,7 +212,7 @@ PyObject* BSplineCurvePy::insertKnot(PyObject * args)
|
||||
int M=1;
|
||||
PyObject* add = Py_True;
|
||||
if (!PyArg_ParseTuple(args, "d|idO!", &U, &M, &tol, &PyBool_Type, &add))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast
|
||||
@@ -221,7 +221,7 @@ PyObject* BSplineCurvePy::insertKnot(PyObject * args)
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Py_Return;
|
||||
@@ -236,7 +236,7 @@ PyObject* BSplineCurvePy::insertKnots(PyObject * args)
|
||||
if (!PyArg_ParseTuple(args, "OO|dO!", &obj1,
|
||||
&obj2,
|
||||
&tol, &PyBool_Type, &add))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
Py::Sequence knots(obj1);
|
||||
@@ -261,7 +261,7 @@ PyObject* BSplineCurvePy::insertKnots(PyObject * args)
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Py_Return;
|
||||
@@ -272,7 +272,7 @@ PyObject* BSplineCurvePy::removeKnot(PyObject * args)
|
||||
double tol;
|
||||
int Index,M;
|
||||
if (!PyArg_ParseTuple(args, "iid", &Index, &M, &tol))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast
|
||||
@@ -282,7 +282,7 @@ PyObject* BSplineCurvePy::removeKnot(PyObject * args)
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,7 +290,7 @@ PyObject* BSplineCurvePy::segment(PyObject * args)
|
||||
{
|
||||
double u1,u2;
|
||||
if (!PyArg_ParseTuple(args, "dd", &u1,&u2))
|
||||
return 0;
|
||||
return nullptr;
|
||||
try {
|
||||
Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
@@ -300,7 +300,7 @@ PyObject* BSplineCurvePy::segment(PyObject * args)
|
||||
if (std::abs(tempCurve->FirstParameter()-u1) > Precision::Approximation() ||
|
||||
std::abs(tempCurve->LastParameter()-u2) > Precision::Approximation()) {
|
||||
Standard_Failure::Raise("Failed to segment BSpline curve");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
else {
|
||||
curve->Segment(u1,u2);
|
||||
@@ -309,7 +309,7 @@ PyObject* BSplineCurvePy::segment(PyObject * args)
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -318,7 +318,7 @@ PyObject* BSplineCurvePy::setKnot(PyObject * args)
|
||||
int Index, M=-1;
|
||||
double K;
|
||||
if (!PyArg_ParseTuple(args, "id|i", &Index, &K, &M))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast
|
||||
@@ -334,7 +334,7 @@ PyObject* BSplineCurvePy::setKnot(PyObject * args)
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,7 +342,7 @@ PyObject* BSplineCurvePy::getKnot(PyObject * args)
|
||||
{
|
||||
int Index;
|
||||
if (!PyArg_ParseTuple(args, "i", &Index))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast
|
||||
@@ -353,7 +353,7 @@ PyObject* BSplineCurvePy::getKnot(PyObject * args)
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -361,7 +361,7 @@ PyObject* BSplineCurvePy::setKnots(PyObject * args)
|
||||
{
|
||||
PyObject* obj;
|
||||
if (!PyArg_ParseTuple(args, "O", &obj))
|
||||
return 0;
|
||||
return nullptr;
|
||||
try {
|
||||
Py::Sequence list(obj);
|
||||
TColStd_Array1OfReal k(1,list.size());
|
||||
@@ -378,14 +378,14 @@ PyObject* BSplineCurvePy::setKnots(PyObject * args)
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
PyObject* BSplineCurvePy::getKnots(PyObject * args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return 0;
|
||||
return nullptr;
|
||||
try {
|
||||
Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
@@ -399,7 +399,7 @@ PyObject* BSplineCurvePy::getKnots(PyObject * args)
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -409,7 +409,7 @@ PyObject* BSplineCurvePy::setPole(PyObject * args)
|
||||
double weight=-1.0;
|
||||
PyObject* p;
|
||||
if (!PyArg_ParseTuple(args, "iO!|d", &index, &(Base::VectorPy::Type), &p, &weight))
|
||||
return 0;
|
||||
return nullptr;
|
||||
Base::Vector3d vec = static_cast<Base::VectorPy*>(p)->value();
|
||||
gp_Pnt pnt(vec.x, vec.y, vec.z);
|
||||
try {
|
||||
@@ -423,7 +423,7 @@ PyObject* BSplineCurvePy::setPole(PyObject * args)
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -431,7 +431,7 @@ PyObject* BSplineCurvePy::getPole(PyObject * args)
|
||||
{
|
||||
int index;
|
||||
if (!PyArg_ParseTuple(args, "i", &index))
|
||||
return 0;
|
||||
return nullptr;
|
||||
try {
|
||||
Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
@@ -444,14 +444,14 @@ PyObject* BSplineCurvePy::getPole(PyObject * args)
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
PyObject* BSplineCurvePy::getPoles(PyObject * args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return 0;
|
||||
return nullptr;
|
||||
try {
|
||||
Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
@@ -468,14 +468,14 @@ PyObject* BSplineCurvePy::getPoles(PyObject * args)
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
PyObject* BSplineCurvePy::getPolesAndWeights(PyObject * args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return 0;
|
||||
return nullptr;
|
||||
try {
|
||||
Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
@@ -499,7 +499,7 @@ PyObject* BSplineCurvePy::getPolesAndWeights(PyObject * args)
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -508,7 +508,7 @@ PyObject* BSplineCurvePy::setWeight(PyObject * args)
|
||||
int index;
|
||||
double weight;
|
||||
if (!PyArg_ParseTuple(args, "id", &index,&weight))
|
||||
return 0;
|
||||
return nullptr;
|
||||
try {
|
||||
Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
@@ -517,7 +517,7 @@ PyObject* BSplineCurvePy::setWeight(PyObject * args)
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -525,7 +525,7 @@ PyObject* BSplineCurvePy::getWeight(PyObject * args)
|
||||
{
|
||||
int index;
|
||||
if (!PyArg_ParseTuple(args, "i", &index))
|
||||
return 0;
|
||||
return nullptr;
|
||||
try {
|
||||
Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
@@ -536,14 +536,14 @@ PyObject* BSplineCurvePy::getWeight(PyObject * args)
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
PyObject* BSplineCurvePy::getWeights(PyObject * args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return 0;
|
||||
return nullptr;
|
||||
try {
|
||||
Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
@@ -557,7 +557,7 @@ PyObject* BSplineCurvePy::getWeights(PyObject * args)
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -565,7 +565,7 @@ PyObject* BSplineCurvePy::getResolution(PyObject * args)
|
||||
{
|
||||
double tol;
|
||||
if (!PyArg_ParseTuple(args, "d", &tol))
|
||||
return 0;
|
||||
return nullptr;
|
||||
try {
|
||||
Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
@@ -575,7 +575,7 @@ PyObject* BSplineCurvePy::getResolution(PyObject * args)
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -585,7 +585,7 @@ PyObject* BSplineCurvePy::movePoint(PyObject * args)
|
||||
int index1, index2;
|
||||
PyObject* pnt;
|
||||
if (!PyArg_ParseTuple(args, "dO!ii", &U, &(Base::VectorPy::Type),&pnt, &index1, &index2))
|
||||
return 0;
|
||||
return nullptr;
|
||||
try {
|
||||
Base::Vector3d p = static_cast<Base::VectorPy*>(pnt)->value();
|
||||
Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast
|
||||
@@ -596,14 +596,14 @@ PyObject* BSplineCurvePy::movePoint(PyObject * args)
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
PyObject* BSplineCurvePy::setNotPeriodic(PyObject * args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return 0;
|
||||
return nullptr;
|
||||
try {
|
||||
Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
@@ -612,14 +612,14 @@ PyObject* BSplineCurvePy::setNotPeriodic(PyObject * args)
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
PyObject* BSplineCurvePy::setPeriodic(PyObject * args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return 0;
|
||||
return nullptr;
|
||||
try {
|
||||
Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
@@ -628,7 +628,7 @@ PyObject* BSplineCurvePy::setPeriodic(PyObject * args)
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -636,7 +636,7 @@ PyObject* BSplineCurvePy::setOrigin(PyObject * args)
|
||||
{
|
||||
int index;
|
||||
if (!PyArg_ParseTuple(args, "i", &index))
|
||||
return 0;
|
||||
return nullptr;
|
||||
try {
|
||||
Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
@@ -645,7 +645,7 @@ PyObject* BSplineCurvePy::setOrigin(PyObject * args)
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -653,7 +653,7 @@ PyObject* BSplineCurvePy::getMultiplicity(PyObject * args)
|
||||
{
|
||||
int index;
|
||||
if (!PyArg_ParseTuple(args, "i", &index))
|
||||
return 0;
|
||||
return nullptr;
|
||||
try {
|
||||
Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
@@ -662,14 +662,14 @@ PyObject* BSplineCurvePy::getMultiplicity(PyObject * args)
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
PyObject* BSplineCurvePy::getMultiplicities(PyObject * args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return 0;
|
||||
return nullptr;
|
||||
try {
|
||||
Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast
|
||||
(getGeometryPtr()->handle());
|
||||
@@ -683,7 +683,7 @@ PyObject* BSplineCurvePy::getMultiplicities(PyObject * args)
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
Py::Long BSplineCurvePy::getDegree(void) const
|
||||
@@ -772,7 +772,7 @@ PyObject* BSplineCurvePy::toBiArcs(PyObject * args)
|
||||
{
|
||||
double tolerance = 0.001;
|
||||
if (!PyArg_ParseTuple(args, "d", &tolerance))
|
||||
return 0;
|
||||
return nullptr;
|
||||
try {
|
||||
GeomBSplineCurve* curve = getGeomBSplineCurvePtr();
|
||||
std::list<Geometry*> arcs;
|
||||
@@ -788,7 +788,7 @@ PyObject* BSplineCurvePy::toBiArcs(PyObject * args)
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -801,7 +801,7 @@ PyObject* BSplineCurvePy::approximate(PyObject *args, PyObject *kwds)
|
||||
char* continuity = "C2";
|
||||
double tol3d = 1e-3;
|
||||
char* parType = "ChordLength";
|
||||
PyObject* par = 0;
|
||||
PyObject* par = nullptr;
|
||||
double weight1 = 0;
|
||||
double weight2 = 0;
|
||||
double weight3 = 0;
|
||||
@@ -889,7 +889,7 @@ PyObject* BSplineCurvePy::approximate(PyObject *args, PyObject *kwds)
|
||||
}
|
||||
else {
|
||||
Standard_Failure::Raise("Smoothing approximation failed");
|
||||
return 0; // goes to the catch block
|
||||
return nullptr; // goes to the catch block
|
||||
}
|
||||
}
|
||||
|
||||
@@ -910,7 +910,7 @@ PyObject* BSplineCurvePy::approximate(PyObject *args, PyObject *kwds)
|
||||
}
|
||||
else {
|
||||
Standard_Failure::Raise("Approximation with parameters failed");
|
||||
return 0; // goes to the catch block
|
||||
return nullptr; // goes to the catch block
|
||||
}
|
||||
}
|
||||
|
||||
@@ -931,12 +931,12 @@ PyObject* BSplineCurvePy::approximate(PyObject *args, PyObject *kwds)
|
||||
}
|
||||
else {
|
||||
Standard_Failure::Raise("failed to approximate points");
|
||||
return 0; // goes to the catch block
|
||||
return nullptr; // goes to the catch block
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -946,7 +946,7 @@ PyObject* BSplineCurvePy::getCardinalSplineTangents(PyObject *args, PyObject *kw
|
||||
PyObject* tgs;
|
||||
double parameter;
|
||||
|
||||
static char* kwds_interp1[] = {"Points", "Parameter", NULL};
|
||||
static char* kwds_interp1[] = {"Points", "Parameter", nullptr};
|
||||
if (PyArg_ParseTupleAndKeywords(args, kwds, "Od",kwds_interp1, &pts, ¶meter)) {
|
||||
Py::Sequence list(pts);
|
||||
std::vector<gp_Pnt> interpPoints;
|
||||
@@ -968,7 +968,7 @@ PyObject* BSplineCurvePy::getCardinalSplineTangents(PyObject *args, PyObject *kw
|
||||
}
|
||||
|
||||
PyErr_Clear();
|
||||
static char* kwds_interp2[] = {"Points", "Parameters", NULL};
|
||||
static char* kwds_interp2[] = {"Points", "Parameters", nullptr};
|
||||
if (PyArg_ParseTupleAndKeywords(args, kwds, "OO",kwds_interp2, &pts, &tgs)) {
|
||||
Py::Sequence list(pts);
|
||||
std::vector<gp_Pnt> interpPoints;
|
||||
@@ -997,28 +997,28 @@ PyObject* BSplineCurvePy::getCardinalSplineTangents(PyObject *args, PyObject *kw
|
||||
return Py::new_reference_to(vec);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject* BSplineCurvePy::interpolate(PyObject *args, PyObject *kwds)
|
||||
{
|
||||
PyObject* obj;
|
||||
PyObject* par = 0;
|
||||
PyObject* par = nullptr;
|
||||
double tol3d = Precision::Approximation();
|
||||
PyObject* periodic = Py_False;
|
||||
PyObject* t1 = 0; PyObject* t2 = 0;
|
||||
PyObject* ts = 0; PyObject* fl = 0;
|
||||
PyObject* t1 = nullptr; PyObject* t2 = nullptr;
|
||||
PyObject* ts = nullptr; PyObject* fl = nullptr;
|
||||
PyObject* scale = Py_True;
|
||||
|
||||
static char* kwds_interp[] = {"Points", "PeriodicFlag", "Tolerance", "InitialTangent", "FinalTangent",
|
||||
"Tangents", "TangentFlags", "Parameters", "Scale", NULL};
|
||||
"Tangents", "TangentFlags", "Parameters", "Scale", nullptr};
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|O!dO!O!OOOO!",kwds_interp,
|
||||
&obj, &PyBool_Type, &periodic, &tol3d,
|
||||
&Base::VectorPy::Type, &t1,
|
||||
&Base::VectorPy::Type, &t2,
|
||||
&ts, &fl, &par, &PyBool_Type, &scale))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
Py::Sequence list(obj);
|
||||
@@ -1092,14 +1092,14 @@ PyObject* BSplineCurvePy::interpolate(PyObject *args, PyObject *kwds)
|
||||
}
|
||||
else {
|
||||
Standard_Failure::Raise("failed to interpolate points");
|
||||
return 0; // goes to the catch block
|
||||
return nullptr; // goes to the catch block
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
std::string err = e.GetMessageString();
|
||||
if (err.empty()) err = e.DynamicType()->Name();
|
||||
PyErr_SetString(PartExceptionOCCError, err.c_str());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1110,7 +1110,7 @@ PyObject* BSplineCurvePy::buildFromPoles(PyObject *args)
|
||||
PyObject* periodic = Py_False;
|
||||
PyObject* interpolate = Py_False;
|
||||
if (!PyArg_ParseTuple(args, "O|O!iO!",&obj, &PyBool_Type, &periodic, °ree, &PyBool_Type, interpolate))
|
||||
return 0;
|
||||
return nullptr;
|
||||
try {
|
||||
Py::Sequence list(obj);
|
||||
TColgp_Array1OfPnt poles(1, list.size());
|
||||
@@ -1151,7 +1151,7 @@ PyObject* BSplineCurvePy::buildFromPoles(PyObject *args)
|
||||
}
|
||||
else {
|
||||
Standard_Failure::Raise("failed to create spline");
|
||||
return 0; // goes to the catch block
|
||||
return nullptr; // goes to the catch block
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -1171,19 +1171,19 @@ PyObject* BSplineCurvePy::buildFromPoles(PyObject *args)
|
||||
}
|
||||
else {
|
||||
Standard_Failure::Raise("failed to create spline");
|
||||
return 0; // goes to the catch block
|
||||
return nullptr; // goes to the catch block
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
PyObject* BSplineCurvePy::buildFromPolesMultsKnots(PyObject *args, PyObject *keywds)
|
||||
{
|
||||
static char *kwlist[] = {"poles", "mults", "knots", "periodic", "degree", "weights", "CheckRational", NULL};
|
||||
static char *kwlist[] = {"poles", "mults", "knots", "periodic", "degree", "weights", "CheckRational", nullptr};
|
||||
PyObject* periodic = Py_False;
|
||||
PyObject* CheckRational = Py_True;
|
||||
PyObject* poles = Py_None;
|
||||
@@ -1199,7 +1199,7 @@ PyObject* BSplineCurvePy::buildFromPolesMultsKnots(PyObject *args, PyObject *key
|
||||
&PyBool_Type, &periodic,
|
||||
°ree, &weights,
|
||||
&PyBool_Type, &CheckRational))
|
||||
return 0;
|
||||
return nullptr;
|
||||
try {
|
||||
// poles have to be present
|
||||
Py::Sequence list(poles);
|
||||
@@ -1207,7 +1207,7 @@ PyObject* BSplineCurvePy::buildFromPolesMultsKnots(PyObject *args, PyObject *key
|
||||
number_of_poles = list.size();
|
||||
if ((number_of_poles) < 2) {
|
||||
Standard_Failure::Raise("need two or more poles");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
TColgp_Array1OfPnt occpoles(1, number_of_poles);
|
||||
Standard_Integer index = 1;
|
||||
@@ -1221,7 +1221,7 @@ PyObject* BSplineCurvePy::buildFromPolesMultsKnots(PyObject *args, PyObject *key
|
||||
number_of_knots = PyObject_Length(mults);
|
||||
if (PyObject_Length(knots) != number_of_knots) {
|
||||
Standard_Failure::Raise("number of knots and mults mismatch");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -1291,7 +1291,7 @@ PyObject* BSplineCurvePy::buildFromPolesMultsKnots(PyObject *args, PyObject *key
|
||||
if (weights != Py_None) { //weights are given
|
||||
if (PyObject_Length(weights) != number_of_poles) {
|
||||
Standard_Failure::Raise("number of poles and weights mismatch");
|
||||
return 0;
|
||||
return nullptr;
|
||||
} //complain about mismatch
|
||||
Py::Sequence weightssq(weights);
|
||||
Standard_Integer index = 1;
|
||||
@@ -1309,7 +1309,7 @@ PyObject* BSplineCurvePy::buildFromPolesMultsKnots(PyObject *args, PyObject *key
|
||||
if ((PyObject_IsTrue(periodic) && sum_of_mults != number_of_poles) ||
|
||||
(PyObject_Not(periodic) && sum_of_mults - degree -1 != number_of_poles)) {
|
||||
Standard_Failure::Raise("number of poles and sum of mults mismatch");
|
||||
return(0);
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
Handle(Geom_BSplineCurve) spline = new Geom_BSplineCurve(occpoles,occweights,occknots,occmults,degree,
|
||||
@@ -1321,13 +1321,13 @@ PyObject* BSplineCurvePy::buildFromPolesMultsKnots(PyObject *args, PyObject *key
|
||||
}
|
||||
else {
|
||||
Standard_Failure::Raise("failed to create spline");
|
||||
return 0; // goes to the catch block
|
||||
return nullptr; // goes to the catch block
|
||||
}
|
||||
}
|
||||
catch (const Standard_Failure& e) {
|
||||
Standard_CString msg = e.GetMessageString();
|
||||
PyErr_SetString(PartExceptionOCCError, msg ? msg : "");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1335,7 +1335,7 @@ PyObject* BSplineCurvePy::buildFromPolesMultsKnots(PyObject *args, PyObject *key
|
||||
PyObject* BSplineCurvePy::toBezier(PyObject *args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
Handle(Geom_BSplineCurve) spline = Handle(Geom_BSplineCurve)::DownCast
|
||||
@@ -1353,7 +1353,7 @@ PyObject* BSplineCurvePy::toBezier(PyObject *args)
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1361,7 +1361,7 @@ PyObject* BSplineCurvePy::join(PyObject *args)
|
||||
{
|
||||
PyObject* c;
|
||||
if (!PyArg_ParseTuple(args, "O!", &BSplineCurvePy::Type, &c))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
GeomBSplineCurve* curve1 = this->getGeomBSplineCurvePtr();
|
||||
@@ -1375,7 +1375,7 @@ PyObject* BSplineCurvePy::join(PyObject *args)
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1384,7 +1384,7 @@ PyObject* BSplineCurvePy::makeC1Continuous(PyObject *args)
|
||||
double tol = Precision::Approximation();
|
||||
double ang_tol = 1.0e-7;
|
||||
if (!PyArg_ParseTuple(args, "|dd", &tol, &ang_tol))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
GeomBSplineCurve* spline = this->getGeomBSplineCurvePtr();
|
||||
@@ -1395,13 +1395,13 @@ PyObject* BSplineCurvePy::makeC1Continuous(PyObject *args)
|
||||
std::string err = e.GetMessageString();
|
||||
if (err.empty()) err = e.DynamicType()->Name();
|
||||
PyErr_SetString(PartExceptionOCCError, err.c_str());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
PyObject* BSplineCurvePy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int BSplineCurvePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
|
||||
|
||||
Reference in New Issue
Block a user