Path: modernize C++11
* use nullptr
This commit is contained in:
@@ -65,7 +65,7 @@ PyMOD_INIT_FUNC(Path)
|
||||
}
|
||||
catch(const Base::Exception& e) {
|
||||
PyErr_SetString(PyExc_ImportError, e.what());
|
||||
PyMOD_Return(NULL);
|
||||
PyMOD_Return(nullptr);
|
||||
}
|
||||
|
||||
PyObject* pathModule = Path::initModule();
|
||||
|
||||
@@ -167,7 +167,7 @@ private:
|
||||
Py::Object read(const Py::Tuple& args)
|
||||
{
|
||||
char* Name;
|
||||
const char* DocName=0;
|
||||
const char* DocName=nullptr;
|
||||
if (!PyArg_ParseTuple(args.ptr(), "et|s","utf-8",&Name,&DocName))
|
||||
throw Py::Exception();
|
||||
std::string EncodedName = std::string(Name);
|
||||
@@ -316,11 +316,11 @@ private:
|
||||
Py::Object fromShapes(const Py::Tuple& args, const Py::Dict &kwds)
|
||||
{
|
||||
PARAM_PY_DECLARE_INIT(PARAM_FARG,AREA_PARAMS_PATH)
|
||||
PyObject *pShapes=NULL;
|
||||
PyObject *start=NULL;
|
||||
PyObject *pShapes=nullptr;
|
||||
PyObject *start=nullptr;
|
||||
PyObject *return_end=Py_False;
|
||||
static char* kwd_list[] = {"shapes", "start", "return_end",
|
||||
PARAM_FIELD_STRINGS(ARG,AREA_PARAMS_PATH), NULL};
|
||||
PARAM_FIELD_STRINGS(ARG,AREA_PARAMS_PATH), nullptr};
|
||||
if (!PyArg_ParseTupleAndKeywords(args.ptr(), kwds.ptr(),
|
||||
"O|O!O" PARAM_PY_KWDS(AREA_PARAMS_PATH),
|
||||
kwd_list, &pShapes, &(Base::VectorPy::Type), &start, &return_end,
|
||||
@@ -353,7 +353,7 @@ private:
|
||||
try {
|
||||
gp_Pnt pend;
|
||||
std::unique_ptr<Toolpath> path(new Toolpath);
|
||||
Area::toPath(*path,shapes,start?&pstart:0, &pend,
|
||||
Area::toPath(*path,shapes,start?&pstart:nullptr, &pend,
|
||||
PARAM_PY_FIELDS(PARAM_FARG,AREA_PARAMS_PATH));
|
||||
if(!PyObject_IsTrue(return_end))
|
||||
return Py::asObject(new PathPy(path.release()));
|
||||
@@ -368,11 +368,11 @@ private:
|
||||
{
|
||||
PARAM_PY_DECLARE_INIT(PARAM_FARG,AREA_PARAMS_ARC_PLANE)
|
||||
PARAM_PY_DECLARE_INIT(PARAM_FARG,AREA_PARAMS_SORT)
|
||||
PyObject *pShapes=NULL;
|
||||
PyObject *start=NULL;
|
||||
PyObject *pShapes=nullptr;
|
||||
PyObject *start=nullptr;
|
||||
static char* kwd_list[] = {"shapes", "start",
|
||||
PARAM_FIELD_STRINGS(ARG,AREA_PARAMS_ARC_PLANE),
|
||||
PARAM_FIELD_STRINGS(ARG,AREA_PARAMS_SORT), NULL};
|
||||
PARAM_FIELD_STRINGS(ARG,AREA_PARAMS_SORT), nullptr};
|
||||
if (!PyArg_ParseTupleAndKeywords(args.ptr(), kwds.ptr(),
|
||||
"O|O!"
|
||||
PARAM_PY_KWDS(AREA_PARAMS_ARC_PLANE)
|
||||
@@ -407,8 +407,8 @@ private:
|
||||
|
||||
try {
|
||||
bool need_arc_plane = arc_plane==Area::ArcPlaneAuto;
|
||||
std::list<TopoDS_Shape> wires = Area::sortWires(shapes,start!=0,&pstart,
|
||||
&pend, 0, &arc_plane, PARAM_PY_FIELDS(PARAM_FARG,AREA_PARAMS_SORT));
|
||||
std::list<TopoDS_Shape> wires = Area::sortWires(shapes,start!=nullptr,&pstart,
|
||||
&pend, nullptr, &arc_plane, PARAM_PY_FIELDS(PARAM_FARG,AREA_PARAMS_SORT));
|
||||
Py::List list;
|
||||
for(auto &wire : wires) {
|
||||
list.append(Part::shape2pyshape(TopoDS::Wire(wire)));
|
||||
|
||||
@@ -530,7 +530,7 @@ void Area::addToBuild(CArea &area, const TopoDS_Shape &shape) {
|
||||
TopoDS_Shape plane = getPlane();
|
||||
CArea areaOpen;
|
||||
mySkippedShapes += addShape(area,shape,&myTrsf,myParams.Deflection,
|
||||
myParams.Coplanar==CoplanarNone?NULL:&plane,
|
||||
myParams.Coplanar==CoplanarNone?nullptr:&plane,
|
||||
myHaveSolid||myParams.Coplanar==CoplanarForce,&areaOpen,
|
||||
myParams.OpenMode==OpenModeEdges,myParams.Reorient);
|
||||
|
||||
@@ -1083,7 +1083,7 @@ void Area::showShape(const TopoDS_Shape &shape, const char *name, const char *fm
|
||||
}
|
||||
|
||||
template<class T>
|
||||
static void showShapes(const T &shapes, const char *name, const char *fmt=0, ...) {
|
||||
static void showShapes(const T &shapes, const char *name, const char *fmt=nullptr, ...) {
|
||||
if(FC_LOG_INSTANCE.level()>FC_LOGLEVEL_TRACE) {
|
||||
BRep_Builder builder;
|
||||
TopoDS_Compound comp;
|
||||
@@ -1492,11 +1492,11 @@ std::vector<shared_ptr<Area> > Area::makeSections(
|
||||
builder.MakeCompound(comp);
|
||||
|
||||
for(TopExp_Explorer xp(s.shape.Moved(loc), TopAbs_SOLID); xp.More(); xp.Next()) {
|
||||
showShape(xp.Current(),0,"section_%u_shape",i);
|
||||
showShape(xp.Current(),nullptr,"section_%u_shape",i);
|
||||
std::list<TopoDS_Wire> wires;
|
||||
Part::CrossSection section(a,b,c,xp.Current());
|
||||
wires = section.slice(-d);
|
||||
showShapes(wires,0,"section_%u_wire",i);
|
||||
showShapes(wires,nullptr,"section_%u_wire",i);
|
||||
if(wires.empty()) {
|
||||
AREA_LOG("Section returns no wires");
|
||||
continue;
|
||||
@@ -1515,7 +1515,7 @@ std::vector<shared_ptr<Area> > Area::makeSections(
|
||||
if (shape.IsNull())
|
||||
AREA_WARN("FaceMakerBullseye return null shape on section");
|
||||
else {
|
||||
showShape(shape,0,"section_%u_face",i);
|
||||
showShape(shape,nullptr,"section_%u_face",i);
|
||||
for(auto it=wires.begin(),itNext=it;it!=wires.end();it=itNext) {
|
||||
++itNext;
|
||||
if(BRep_Tool::IsClosed(*it))
|
||||
@@ -1537,7 +1537,7 @@ std::vector<shared_ptr<Area> > Area::makeSections(
|
||||
// Make sure the compound has at least one edge
|
||||
if(TopExp_Explorer(comp,TopAbs_EDGE).More()) {
|
||||
const TopoDS_Shape &shape = comp.Moved(locInverse);
|
||||
showShape(shape,0,"section_%u_result",i);
|
||||
showShape(shape,nullptr,"section_%u_result",i);
|
||||
area->add(shape,s.op);
|
||||
}else if(area->myShapes.empty()){
|
||||
auto itNext = it;
|
||||
@@ -1552,7 +1552,7 @@ std::vector<shared_ptr<Area> > Area::makeSections(
|
||||
if(area->myShapes.size()){
|
||||
sections.push_back(area);
|
||||
FC_TIME_LOG(t1,"makeSection " << z);
|
||||
showShape(area->getShape(),0,"section_%u_final",i);
|
||||
showShape(area->getShape(),nullptr,"section_%u_final",i);
|
||||
break;
|
||||
}
|
||||
if(retried) {
|
||||
@@ -2961,7 +2961,7 @@ std::list<TopoDS_Shape> Area::sortWires(const std::list<TopoDS_Shape> &shapes,
|
||||
gp_Pnt pstart,pend;
|
||||
if(_pstart)
|
||||
pstart = *_pstart;
|
||||
bool use_bound = !has_start || _pstart==NULL;
|
||||
bool use_bound = !has_start || _pstart==nullptr;
|
||||
|
||||
//Second stage, group shape by its plane, and find overall boundary
|
||||
|
||||
@@ -3227,7 +3227,7 @@ void Area::toPath(Toolpath &path, const std::list<TopoDS_Shape> &shapes,
|
||||
if(_pstart) pstart = *_pstart;
|
||||
|
||||
double stepdown_hint = 1.0;
|
||||
wires = sortWires(shapes,_pstart!=0,&pstart,pend,&stepdown_hint,
|
||||
wires = sortWires(shapes,_pstart!=nullptr,&pstart,pend,&stepdown_hint,
|
||||
PARAM_REF(PARAM_FARG,AREA_PARAMS_ARC_PLANE),
|
||||
PARAM_FIELDS(PARAM_FARG,AREA_PARAMS_SORT));
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ public:
|
||||
/** Declare all parameters defined in #AREA_PARAMS_ALL as member variable */
|
||||
PARAM_ENUM_DECLARE(AREA_PARAMS_ALL)
|
||||
|
||||
Area(const AreaParams *params = NULL);
|
||||
Area(const AreaParams *params = nullptr);
|
||||
Area(const Area &other, bool deep_copy=true);
|
||||
virtual ~Area();
|
||||
|
||||
@@ -197,7 +197,7 @@ public:
|
||||
* If no workplane is set using setPlane(), the active workplane is derived from
|
||||
* the added children shapes using the same algorithm empolyed by setPlane().
|
||||
*/
|
||||
TopoDS_Shape getPlane(gp_Trsf *trsf=0);
|
||||
TopoDS_Shape getPlane(gp_Trsf *trsf=nullptr);
|
||||
|
||||
/** Add a child shape with given operation code
|
||||
*
|
||||
@@ -287,7 +287,7 @@ public:
|
||||
* \arg \c to_edges: if true, discretize all curves, and insert as open
|
||||
* line segments
|
||||
* */
|
||||
static void addWire(CArea &area, const TopoDS_Wire &wire, const gp_Trsf *trsf=NULL,
|
||||
static void addWire(CArea &area, const TopoDS_Wire &wire, const gp_Trsf *trsf=nullptr,
|
||||
double deflection=0.01, bool to_edges=false);
|
||||
|
||||
/** Add a OCC generic shape to CArea
|
||||
@@ -307,9 +307,9 @@ public:
|
||||
* \return Returns the number of non coplaner. Planar testing only happens
|
||||
* if \c plane is supplied
|
||||
* */
|
||||
static int addShape(CArea &area, const TopoDS_Shape &shape, const gp_Trsf *trsf=NULL,
|
||||
double deflection=0.01,const TopoDS_Shape *plane = NULL,
|
||||
bool force_coplanar=true, CArea *areaOpen=NULL, bool to_edges=false,
|
||||
static int addShape(CArea &area, const TopoDS_Shape &shape, const gp_Trsf *trsf=nullptr,
|
||||
double deflection=0.01,const TopoDS_Shape *plane = nullptr,
|
||||
bool force_coplanar=true, CArea *areaOpen=nullptr, bool to_edges=false,
|
||||
bool reorient=true);
|
||||
|
||||
/** Convert curves in CArea into an OCC shape
|
||||
@@ -320,7 +320,7 @@ public:
|
||||
* its original position.
|
||||
* */
|
||||
static TopoDS_Shape toShape(const CArea &area, bool fill,
|
||||
const gp_Trsf *trsf=NULL, int reoirent=0);
|
||||
const gp_Trsf *trsf=nullptr, int reoirent=0);
|
||||
|
||||
/** Convert a single curve into an OCC wire
|
||||
*
|
||||
@@ -328,7 +328,7 @@ public:
|
||||
* \arg \c trsf: optional transform matrix to transform the shape back into
|
||||
* its original position.
|
||||
* */
|
||||
static TopoDS_Shape toShape(const CCurve &curve, const gp_Trsf *trsf=NULL, int reorient=0);
|
||||
static TopoDS_Shape toShape(const CCurve &curve, const gp_Trsf *trsf=nullptr, int reorient=0);
|
||||
|
||||
/** Check if two OCC shape is coplanar */
|
||||
static bool isCoplanar(const TopoDS_Shape &s1, const TopoDS_Shape &s2);
|
||||
@@ -354,8 +354,8 @@ public:
|
||||
* \return sorted wires
|
||||
*/
|
||||
static std::list<TopoDS_Shape> sortWires(const std::list<TopoDS_Shape> &shapes,
|
||||
bool has_start=false, gp_Pnt *pstart=NULL, gp_Pnt *pend=NULL, double *stepdown_hint=NULL,
|
||||
short *arc_plane = NULL, PARAM_ARGS_DEF(PARAM_FARG,AREA_PARAMS_SORT));
|
||||
bool has_start=false, gp_Pnt *pstart=nullptr, gp_Pnt *pend=nullptr, double *stepdown_hint=nullptr,
|
||||
short *arc_plane = nullptr, PARAM_ARGS_DEF(PARAM_FARG,AREA_PARAMS_SORT));
|
||||
|
||||
/** Convert a list of wires to gcode
|
||||
*
|
||||
@@ -367,7 +367,7 @@ public:
|
||||
* See #AREA_PARAMS_PATH for other arguments
|
||||
*/
|
||||
static void toPath(Toolpath &path, const std::list<TopoDS_Shape> &shapes,
|
||||
const gp_Pnt *pstart=NULL, gp_Pnt *pend=NULL,
|
||||
const gp_Pnt *pstart=nullptr, gp_Pnt *pend=nullptr,
|
||||
PARAM_ARGS_DEF(PARAM_FARG,AREA_PARAMS_PATH));
|
||||
|
||||
static int project(TopoDS_Shape &out, const TopoDS_Shape &in,
|
||||
@@ -384,7 +384,7 @@ public:
|
||||
static void setDefaultParams(const AreaStaticParams ¶ms);
|
||||
static const AreaStaticParams &getDefaultParams();
|
||||
|
||||
static void showShape(const TopoDS_Shape &shape, const char *name, const char *fmt=0, ...);
|
||||
static void showShape(const TopoDS_Shape &shape, const char *name, const char *fmt=nullptr, ...);
|
||||
};
|
||||
|
||||
} //namespace Path
|
||||
|
||||
@@ -34,10 +34,10 @@
|
||||
|
||||
|
||||
static PyObject * areaAbort(PyObject *, PyObject *args, PyObject *kwd) {
|
||||
static char *kwlist[] = {"aborting", NULL};
|
||||
static char *kwlist[] = {"aborting", nullptr};
|
||||
PyObject *pObj = Py_True;
|
||||
if (!PyArg_ParseTupleAndKeywords(args,kwd,"|O",kwlist,&pObj))
|
||||
return 0;
|
||||
return nullptr;
|
||||
Area::abort(PyObject_IsTrue(pObj));
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
@@ -45,7 +45,7 @@ static PyObject * areaAbort(PyObject *, PyObject *args, PyObject *kwd) {
|
||||
|
||||
static PyObject * areaSetParams(PyObject *, PyObject *args, PyObject *kwd) {
|
||||
|
||||
static char *kwlist[] = {PARAM_FIELD_STRINGS(NAME,AREA_PARAMS_STATIC_CONF),NULL};
|
||||
static char *kwlist[] = {PARAM_FIELD_STRINGS(NAME,AREA_PARAMS_STATIC_CONF),nullptr};
|
||||
|
||||
if(args && PySequence_Size(args)>0)
|
||||
PyErr_SetString(PyExc_ValueError,"Non-keyword argument is not supported");
|
||||
@@ -65,7 +65,7 @@ static PyObject * areaSetParams(PyObject *, PyObject *args, PyObject *kwd) {
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwd,
|
||||
"|" PARAM_PY_KWDS(AREA_PARAMS_STATIC_CONF), kwlist,
|
||||
PARAM_REF(PARAM_FNAME,AREA_PARAMS_STATIC_CONF)))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
#define AREA_GET(_param) \
|
||||
params.PARAM_FNAME(_param) = \
|
||||
@@ -80,7 +80,7 @@ static PyObject * areaSetParams(PyObject *, PyObject *args, PyObject *kwd) {
|
||||
|
||||
static PyObject* areaGetParams(PyObject *, PyObject *args) {
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
const AreaStaticParams ¶ms = Area::getDefaultParams();
|
||||
|
||||
@@ -92,9 +92,9 @@ static PyObject* areaGetParams(PyObject *, PyObject *args) {
|
||||
|
||||
static PyObject * areaGetParamsDesc(PyObject *, PyObject *args, PyObject *kwd) {
|
||||
PyObject *pcObj = Py_False;
|
||||
static char *kwlist[] = {"as_string", NULL};
|
||||
static char *kwlist[] = {"as_string", nullptr};
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwd, "|O",kwlist,&pcObj))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
if(PyObject_IsTrue(pcObj))
|
||||
return PyUnicode_FromString(PARAM_PY_DOC(NAME,AREA_PARAMS_STATIC_CONF));
|
||||
@@ -106,13 +106,13 @@ static PyObject * areaGetParamsDesc(PyObject *, PyObject *args, PyObject *kwd) {
|
||||
|
||||
static const PyMethodDef areaOverrides[] = {
|
||||
{
|
||||
"setParams",NULL,0,
|
||||
"setParams",nullptr,0,
|
||||
"setParam(key=value...): Set algorithm parameters. You can call getParamsDesc() to \n"
|
||||
"get a list of supported parameters and their descriptions.\n"
|
||||
PARAM_PY_DOC(NAME,AREA_PARAMS_CONF)
|
||||
},
|
||||
{
|
||||
"add",NULL,0,
|
||||
"add",nullptr,0,
|
||||
"add((shape...)," PARAM_PY_ARGS_DOC(ARG,AREA_PARAMS_OPCODE) "):\n"
|
||||
"Add TopoShape(s) with given operation code\n"
|
||||
PARAM_PY_DOC(ARG,AREA_PARAMS_OPCODE)
|
||||
@@ -124,21 +124,21 @@ static const PyMethodDef areaOverrides[] = {
|
||||
},
|
||||
|
||||
{
|
||||
"makeOffset",NULL,0,
|
||||
"makeOffset",nullptr,0,
|
||||
"makeOffset(index=-1, " PARAM_PY_ARGS_DOC(ARG,AREA_PARAMS_OFFSET) "):\n"
|
||||
"Make an 2D offset of the shape.\n"
|
||||
"\n* index (-1): the index of the section. -1 means all sections. No effect on planar shape.\n"
|
||||
PARAM_PY_DOC(ARG,AREA_PARAMS_OFFSET),
|
||||
},
|
||||
{
|
||||
"makePocket",NULL,0,
|
||||
"makePocket",nullptr,0,
|
||||
"makePocket(index=-1, " PARAM_PY_ARGS_DOC(ARG,AREA_PARAMS_POCKET) "):\n"
|
||||
"Generate pocket toolpath of the shape.\n"
|
||||
"\n* index (-1): the index of the section. -1 means all sections. No effect on planar shape.\n"
|
||||
PARAM_PY_DOC(ARG,AREA_PARAMS_POCKET),
|
||||
},
|
||||
{
|
||||
"makeSections",NULL,0,
|
||||
"makeSections",nullptr,0,
|
||||
"makeSections(" PARAM_PY_ARGS_DOC(ARG,AREA_PARAMS_SECTION_EXTRA) ", heights=[], plane=None):\n"
|
||||
"Make a list of area holding the sectioned children shapes on given heights\n"
|
||||
PARAM_PY_DOC(ARG,AREA_PARAMS_SECTION_EXTRA)
|
||||
@@ -224,7 +224,7 @@ int AreaPy::PyInit(PyObject* , PyObject* )
|
||||
PyObject* AreaPy::setPlane(PyObject *args) {
|
||||
PyObject *pcObj;
|
||||
if (!PyArg_ParseTuple(args, "O!", &(Part::TopoShapePy::Type), &pcObj))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
#define GET_TOPOSHAPE(_p) static_cast<Part::TopoShapePy*>(_p)->getTopoShapePtr()->getShape()
|
||||
getAreaPtr()->setPlane(GET_TOPOSHAPE(pcObj));
|
||||
@@ -236,9 +236,9 @@ PyObject* AreaPy::getShape(PyObject *args, PyObject *keywds)
|
||||
{
|
||||
PyObject *pcObj = Py_False;
|
||||
short index=-1;
|
||||
static char *kwlist[] = {"index","rebuild", NULL};
|
||||
static char *kwlist[] = {"index","rebuild", nullptr};
|
||||
if (!PyArg_ParseTupleAndKeywords(args, keywds,"|hO",kwlist,&index,&pcObj))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
if(PyObject_IsTrue(pcObj))
|
||||
@@ -255,12 +255,12 @@ PyObject* AreaPy::add(PyObject *args, PyObject *keywds)
|
||||
//Strangely, PyArg_ParseTupleAndKeywords requires all arguments to be keyword based,
|
||||
//even non-optional ones? That doesn't make sense in python. Seems only in python 3
|
||||
//they added '$' to address that issue.
|
||||
static char *kwlist[] = {"shape",PARAM_FIELD_STRINGS(ARG,AREA_PARAMS_OPCODE), NULL};
|
||||
static char *kwlist[] = {"shape",PARAM_FIELD_STRINGS(ARG,AREA_PARAMS_OPCODE), nullptr};
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, keywds,
|
||||
"O|" PARAM_PY_KWDS(AREA_PARAMS_OPCODE),
|
||||
kwlist,&pcObj,PARAM_REF(PARAM_FARG,AREA_PARAMS_OPCODE)))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
if (PyObject_TypeCheck(pcObj, &(Part::TopoShapePy::Type))) {
|
||||
@@ -274,7 +274,7 @@ PyObject* AreaPy::add(PyObject *args, PyObject *keywds)
|
||||
PyObject* item = (*it).ptr();
|
||||
if(!PyObject_TypeCheck(item, &(Part::TopoShapePy::Type))) {
|
||||
PyErr_SetString(PyExc_TypeError, "non-shape object in sequence");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
for (Py::Sequence::iterator it = shapeSeq.begin(); it != shapeSeq.end(); ++it){
|
||||
@@ -288,13 +288,13 @@ PyObject* AreaPy::add(PyObject *args, PyObject *keywds)
|
||||
} PY_CATCH_OCC
|
||||
|
||||
PyErr_SetString(PyExc_TypeError, "shape must be 'TopoShape' or list of 'TopoShape'");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject* AreaPy::makeOffset(PyObject *args, PyObject *keywds)
|
||||
{
|
||||
//Generate a keyword string defined in the ARG field of OFFSET parameter list
|
||||
static char *kwlist[] = {"index",PARAM_FIELD_STRINGS(ARG,AREA_PARAMS_OFFSET), NULL};
|
||||
static char *kwlist[] = {"index",PARAM_FIELD_STRINGS(ARG,AREA_PARAMS_OFFSET), nullptr};
|
||||
short index = -1;
|
||||
|
||||
//Declare variables defined in the ARG field of the OFFSET parameter list with
|
||||
@@ -305,7 +305,7 @@ PyObject* AreaPy::makeOffset(PyObject *args, PyObject *keywds)
|
||||
if (!PyArg_ParseTupleAndKeywords(args, keywds,
|
||||
"|h" PARAM_PY_KWDS(AREA_PARAMS_OFFSET), kwlist,
|
||||
&index,PARAM_REF(PARAM_FARG,AREA_PARAMS_OFFSET)))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
//Expand the variable as function call arguments
|
||||
@@ -317,7 +317,7 @@ PyObject* AreaPy::makeOffset(PyObject *args, PyObject *keywds)
|
||||
|
||||
PyObject* AreaPy::makePocket(PyObject *args, PyObject *keywds)
|
||||
{
|
||||
static char *kwlist[] = {"index",PARAM_FIELD_STRINGS(ARG,AREA_PARAMS_POCKET), NULL};
|
||||
static char *kwlist[] = {"index",PARAM_FIELD_STRINGS(ARG,AREA_PARAMS_POCKET), nullptr};
|
||||
short index = -1;
|
||||
|
||||
PARAM_PY_DECLARE_INIT(PARAM_FARG,AREA_PARAMS_POCKET)
|
||||
@@ -327,7 +327,7 @@ PyObject* AreaPy::makePocket(PyObject *args, PyObject *keywds)
|
||||
if (!PyArg_ParseTupleAndKeywords(args, keywds,
|
||||
"|h" PARAM_PY_KWDS(AREA_PARAMS_POCKET), kwlist,
|
||||
&index,PARAM_REF(PARAM_FARG,AREA_PARAMS_POCKET)))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
TopoDS_Shape resultShape = getAreaPtr()->makePocket(index,
|
||||
@@ -339,9 +339,9 @@ PyObject* AreaPy::makePocket(PyObject *args, PyObject *keywds)
|
||||
PyObject* AreaPy::makeSections(PyObject *args, PyObject *keywds)
|
||||
{
|
||||
static char *kwlist[] = {PARAM_FIELD_STRINGS(ARG,AREA_PARAMS_SECTION_EXTRA),
|
||||
"heights", "plane", NULL};
|
||||
PyObject *heights = NULL;
|
||||
PyObject *plane = NULL;
|
||||
"heights", "plane", nullptr};
|
||||
PyObject *heights = nullptr;
|
||||
PyObject *plane = nullptr;
|
||||
|
||||
PARAM_PY_DECLARE_INIT(PARAM_FARG,AREA_PARAMS_SECTION_EXTRA)
|
||||
|
||||
@@ -349,7 +349,7 @@ PyObject* AreaPy::makeSections(PyObject *args, PyObject *keywds)
|
||||
"|" PARAM_PY_KWDS(AREA_PARAMS_SECTION_EXTRA) "OO!", kwlist,
|
||||
PARAM_REF(PARAM_FARG,AREA_PARAMS_SECTION_EXTRA),
|
||||
&heights, &(Part::TopoShapePy::Type), &plane))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
std::vector<double> h;
|
||||
@@ -364,13 +364,13 @@ PyObject* AreaPy::makeSections(PyObject *args, PyObject *keywds)
|
||||
PyObject* item = (*it).ptr();
|
||||
if(!PyObject_TypeCheck(item, &(PyFloat_Type))) {
|
||||
PyErr_SetString(PyExc_TypeError, "heights must only contain float type");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
h.push_back(PyFloat_AsDouble(item));
|
||||
}
|
||||
}else{
|
||||
PyErr_SetString(PyExc_TypeError, "heights must be of type float or list/tuple of float");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -387,12 +387,12 @@ PyObject* AreaPy::makeSections(PyObject *args, PyObject *keywds)
|
||||
|
||||
PyObject* AreaPy::setDefaultParams(PyObject *, PyObject *)
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject* AreaPy::setParams(PyObject *args, PyObject *keywds)
|
||||
{
|
||||
static char *kwlist[] = {PARAM_FIELD_STRINGS(NAME,AREA_PARAMS_CONF),NULL};
|
||||
static char *kwlist[] = {PARAM_FIELD_STRINGS(NAME,AREA_PARAMS_CONF),nullptr};
|
||||
|
||||
//Declare variables defined in the NAME field of the CONF parameter list
|
||||
PARAM_PY_DECLARE(PARAM_FNAME,AREA_PARAMS_CONF);
|
||||
@@ -421,7 +421,7 @@ PyObject* AreaPy::setParams(PyObject *args, PyObject *keywds)
|
||||
PyObject* AreaPy::getParams(PyObject *args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
const AreaParams ¶ms =getAreaPtr()->getParams();
|
||||
|
||||
@@ -432,16 +432,16 @@ PyObject* AreaPy::getParams(PyObject *args)
|
||||
|
||||
PyObject* AreaPy::getDefaultParams(PyObject *)
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject* AreaPy::abort(PyObject *, PyObject *) {
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject* AreaPy::getParamsDesc(PyObject *, PyObject *)
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Py::List AreaPy::getSections(void) const {
|
||||
@@ -479,7 +479,7 @@ void AreaPy::setWorkplane(Py::Object obj) {
|
||||
|
||||
PyObject *AreaPy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int AreaPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
|
||||
|
||||
@@ -71,9 +71,9 @@ PyObject *CommandPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Py
|
||||
// constructor method
|
||||
int CommandPy::PyInit(PyObject* args, PyObject* kwd)
|
||||
{
|
||||
PyObject *parameters = NULL;
|
||||
PyObject *parameters = nullptr;
|
||||
char *name = "";
|
||||
static char *kwlist[] = {"name", "parameters", NULL};
|
||||
static char *kwlist[] = {"name", "parameters", nullptr};
|
||||
if ( PyArg_ParseTupleAndKeywords(args, kwd, "|sO!", kwlist, &name, &PyDict_Type, ¶meters) ) {
|
||||
std::string sname(name);
|
||||
boost::to_upper(sname);
|
||||
@@ -204,7 +204,7 @@ PyObject* CommandPy::toGCode(PyObject *args)
|
||||
|
||||
PyObject* CommandPy::setFromGCode(PyObject *args)
|
||||
{
|
||||
char *pstr=0;
|
||||
char *pstr=nullptr;
|
||||
if (PyArg_ParseTuple(args, "s", &pstr)) {
|
||||
std::string gcode(pstr);
|
||||
try {
|
||||
@@ -267,7 +267,7 @@ PyObject *CommandPy::getCustomAttributes(const char* attr) const
|
||||
return Py_None;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int CommandPy::setCustomAttributes(const char* attr, PyObject* obj)
|
||||
|
||||
@@ -44,7 +44,7 @@ PARAM_ENUM_STRING_DECLARE(static const char *Enums,AREA_PARAMS_ALL)
|
||||
FeatureArea::FeatureArea()
|
||||
:myInited(false)
|
||||
{
|
||||
ADD_PROPERTY(Sources,(0));
|
||||
ADD_PROPERTY(Sources,(nullptr));
|
||||
ADD_PROPERTY(WorkPlane,(TopoDS_Shape()));
|
||||
|
||||
PARAM_PROP_ADD("Area",AREA_PARAMS_OPCODE);
|
||||
@@ -166,7 +166,7 @@ PROPERTY_SOURCE(Path::FeatureAreaView, Part::Feature)
|
||||
|
||||
FeatureAreaView::FeatureAreaView()
|
||||
{
|
||||
ADD_PROPERTY(Source,(0));
|
||||
ADD_PROPERTY(Source,(nullptr));
|
||||
ADD_PROPERTY_TYPE(SectionIndex,(0),"Section",App::Prop_None,"The start index of the section to show, negative value for reverse index from bottom");
|
||||
ADD_PROPERTY_TYPE(SectionCount,(1),"Section",App::Prop_None,"Number of sections to show, 0 to show all section starting from SectionIndex");
|
||||
}
|
||||
|
||||
@@ -45,14 +45,14 @@ std::string FeatureAreaPy::representation(void) const
|
||||
PyObject* FeatureAreaPy::getArea(PyObject *args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return new AreaPy(new Area(getFeatureAreaPtr()->getArea()));
|
||||
}
|
||||
|
||||
PyObject* FeatureAreaPy::setParams(PyObject *args, PyObject *keywds)
|
||||
{
|
||||
static char *kwlist[] = {PARAM_FIELD_STRINGS(NAME,AREA_PARAMS_CONF),NULL};
|
||||
static char *kwlist[] = {PARAM_FIELD_STRINGS(NAME,AREA_PARAMS_CONF),nullptr};
|
||||
|
||||
//Declare variables defined in the NAME field of the CONF parameter list
|
||||
PARAM_PY_DECLARE(PARAM_FNAME,AREA_PARAMS_CONF);
|
||||
@@ -69,7 +69,7 @@ PyObject* FeatureAreaPy::setParams(PyObject *args, PyObject *keywds)
|
||||
if (!PyArg_ParseTupleAndKeywords(args, keywds,
|
||||
"|" PARAM_PY_KWDS(AREA_PARAMS_CONF), kwlist,
|
||||
PARAM_REF(PARAM_FNAME,AREA_PARAMS_CONF)))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
#define AREA_GET(_param) \
|
||||
feature->PARAM_FNAME(_param).setValue(\
|
||||
@@ -98,7 +98,7 @@ void FeatureAreaPy::setWorkPlane(Py::Object obj) {
|
||||
|
||||
PyObject *FeatureAreaPy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ PROPERTY_SOURCE(Path::FeatureCompound, Path::Feature)
|
||||
|
||||
FeatureCompound::FeatureCompound()
|
||||
{
|
||||
ADD_PROPERTY_TYPE( Group, (0), "Base",Prop_None,"Ordered list of paths to combine");
|
||||
ADD_PROPERTY_TYPE( Group, (nullptr), "Base",Prop_None,"Ordered list of paths to combine");
|
||||
ADD_PROPERTY_TYPE( UsePlacements, (false), "Base",Prop_None,"Specifies if the placements of children must be computed");
|
||||
}
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ PyObject* FeaturePathCompoundPy::removeObject(PyObject *args)
|
||||
|
||||
PyObject *FeaturePathCompoundPy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ PARAM_ENUM_STRING_DECLARE(static const char *Enums,AREA_PARAMS_PATH)
|
||||
|
||||
FeatureShape::FeatureShape()
|
||||
{
|
||||
ADD_PROPERTY(Sources,(0));
|
||||
ADD_PROPERTY(Sources,(nullptr));
|
||||
ADD_PROPERTY_TYPE(StartPoint,(Base::Vector3d()),"Path",App::Prop_None,"Feed start position");
|
||||
ADD_PROPERTY_TYPE(UseStartPoint,(false),"Path",App::Prop_None,"Enable feed start position");
|
||||
PARAM_PROP_ADD("Path",AREA_PARAMS_PATH);
|
||||
@@ -86,7 +86,7 @@ App::DocumentObjectExecReturn *FeatureShape::execute(void)
|
||||
shapes.push_back(shape);
|
||||
}
|
||||
|
||||
Area::toPath(path,shapes,UseStartPoint.getValue()?&pstart:0,0,PARAM_PROP_ARGS(AREA_PARAMS_PATH));
|
||||
Area::toPath(path,shapes,UseStartPoint.getValue()?&pstart:nullptr,nullptr,PARAM_PROP_ARGS(AREA_PARAMS_PATH));
|
||||
|
||||
Path.setValue(path);
|
||||
return App::DocumentObject::StdReturn;
|
||||
|
||||
@@ -57,7 +57,7 @@ PyObject *PathPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Pytho
|
||||
// constructor method
|
||||
int PathPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
{
|
||||
PyObject *pcObj=0;
|
||||
PyObject *pcObj=nullptr;
|
||||
char *gcode;
|
||||
if (PyArg_ParseTuple(args, "|O!", &(PyList_Type), &pcObj)) {
|
||||
if (pcObj) {
|
||||
@@ -195,7 +195,7 @@ PyObject* PathPy::getCycleTime(PyObject * args)
|
||||
if (PyArg_ParseTuple(args, "dddd", &hFeed, &vFeed, &hRapid, &vRapid)){
|
||||
return PyFloat_FromDouble(getToolpathPtr()->getCycleTime(hFeed, vFeed, hRapid, vRapid));
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// GCode methods
|
||||
@@ -211,7 +211,7 @@ PyObject* PathPy::toGCode(PyObject * args)
|
||||
|
||||
PyObject* PathPy::setFromGCode(PyObject * args)
|
||||
{
|
||||
char *pstr=0;
|
||||
char *pstr=nullptr;
|
||||
if (PyArg_ParseTuple(args, "s", &pstr)) {
|
||||
std::string gcode(pstr);
|
||||
getToolpathPtr()->setFromGCode(gcode);
|
||||
@@ -225,7 +225,7 @@ PyObject* PathPy::setFromGCode(PyObject * args)
|
||||
|
||||
PyObject *PathPy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int PathPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
|
||||
|
||||
@@ -139,7 +139,7 @@ void PropertyPath::SaveDocFile (Base::Writer &) const
|
||||
void PropertyPath::RestoreDocFile(Base::Reader &reader)
|
||||
{
|
||||
App::PropertyContainer *container = getContainer();
|
||||
App::DocumentObject *obj = 0;
|
||||
App::DocumentObject *obj = nullptr;
|
||||
if (container->isDerivedFrom(App::DocumentObject::getClassTypeId())) {
|
||||
obj = static_cast<App::DocumentObject*>(container);
|
||||
}
|
||||
|
||||
@@ -60,17 +60,17 @@ int ToolPy::PyInit(PyObject* args, PyObject* kwd)
|
||||
char *name="Default tool";
|
||||
char *type = "Undefined";
|
||||
char *mat = "Undefined";
|
||||
PyObject *dia = 0;
|
||||
PyObject *len = 0;
|
||||
PyObject *fla = 0;
|
||||
PyObject *cor = 0;
|
||||
PyObject *ang = 0;
|
||||
PyObject *hei = 0;
|
||||
PyObject *dia = nullptr;
|
||||
PyObject *len = nullptr;
|
||||
PyObject *fla = nullptr;
|
||||
PyObject *cor = nullptr;
|
||||
PyObject *ang = nullptr;
|
||||
PyObject *hei = nullptr;
|
||||
int version = 1;
|
||||
|
||||
static char *kwlist[] = {"name", "tooltype", "material", "diameter", "lengthOffset", "flatRadius", "cornerRadius", "cuttingEdgeAngle", "cuttingEdgeHeight" , "version", NULL};
|
||||
static char *kwlist[] = {"name", "tooltype", "material", "diameter", "lengthOffset", "flatRadius", "cornerRadius", "cuttingEdgeAngle", "cuttingEdgeHeight" , "version", nullptr};
|
||||
|
||||
PyObject *dict = 0;
|
||||
PyObject *dict = nullptr;
|
||||
if (!kwd && (PyObject_TypeCheck(args, &PyDict_Type) || PyArg_ParseTuple(args, "O!", &PyDict_Type, &dict))) {
|
||||
static PyObject *arg = PyTuple_New(0);
|
||||
if (PyObject_TypeCheck(args, &PyDict_Type)) {
|
||||
@@ -209,7 +209,7 @@ void ToolPy::setCuttingEdgeHeight(Py::Float arg)
|
||||
|
||||
PyObject *ToolPy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int ToolPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
|
||||
@@ -227,7 +227,7 @@ PyObject* ToolPy::copy(PyObject * args)
|
||||
|
||||
PyObject* ToolPy::setFromTemplate(PyObject * args)
|
||||
{
|
||||
char *pstr = 0;
|
||||
char *pstr = nullptr;
|
||||
if (PyArg_ParseTuple(args, "s", &pstr)) {
|
||||
// embed actual string in dummy tag so XMLReader can consume that on construction
|
||||
std::ostringstream os;
|
||||
@@ -239,12 +239,12 @@ PyObject* ToolPy::setFromTemplate(PyObject * args)
|
||||
}
|
||||
|
||||
PyErr_Clear();
|
||||
if (!PyInit(args, 0)) {
|
||||
if (!PyInit(args, nullptr)) {
|
||||
Py_Return ;
|
||||
}
|
||||
|
||||
PyErr_SetString(PyExc_TypeError, "argument must be a string or dictionary");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject* ToolPy::templateAttrs(PyObject * args)
|
||||
|
||||
@@ -222,7 +222,7 @@ PyObject* TooltablePy::deleteTool(PyObject * args)
|
||||
|
||||
PyObject *TooltablePy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int TooltablePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
|
||||
@@ -252,7 +252,7 @@ void TooltablePy::setName(Py::String arg)
|
||||
|
||||
PyObject* TooltablePy::setFromTemplate(PyObject * args)
|
||||
{
|
||||
PyObject *dict = 0;
|
||||
PyObject *dict = nullptr;
|
||||
if (PyArg_ParseTuple(args, "O!", &PyDict_Type, &dict)) {
|
||||
Py::Dict d(dict);
|
||||
setTools(d);
|
||||
@@ -260,7 +260,7 @@ PyObject* TooltablePy::setFromTemplate(PyObject * args)
|
||||
}
|
||||
|
||||
PyErr_SetString(PyExc_TypeError, "argument must be a dictionary returned from templateAttrs()");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject* TooltablePy::templateAttrs(PyObject * args)
|
||||
@@ -272,7 +272,7 @@ PyObject* TooltablePy::templateAttrs(PyObject * args)
|
||||
// will fail to properly track the reference counts and aborts
|
||||
// in debug mode.
|
||||
Path::ToolPy* tool = new Path::ToolPy(new Path::Tool(*i->second));
|
||||
PyObject *attrs = tool->templateAttrs(0);
|
||||
PyObject *attrs = tool->templateAttrs(nullptr);
|
||||
PyDict_SetItem(dict, PYINT_FROMLONG(i->first), attrs);
|
||||
Py_DECREF(tool);
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ void Voronoi::colorExterior(const Voronoi::diagram_type::edge_type *edge, std::s
|
||||
edge->color(colorValue);
|
||||
edge->twin()->color(colorValue);
|
||||
auto v = edge->vertex1();
|
||||
if (v == NULL || !edge->is_primary()) {
|
||||
if (v == nullptr || !edge->is_primary()) {
|
||||
return;
|
||||
}
|
||||
v->color(colorValue);
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace Path
|
||||
segment_type retrieveSegment(const cell_type *cell) const;
|
||||
|
||||
typedef std::map<int, double> angle_map_t;
|
||||
double angleOfSegment(int i, angle_map_t *angle = 0) const;
|
||||
double angleOfSegment(int i, angle_map_t *angle = nullptr) const;
|
||||
bool segmentsAreConnected(int i, int j) const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -34,7 +34,7 @@ TYPESYSTEM_SOURCE(Path::VoronoiCell , Base::Persistence)
|
||||
VoronoiCell::VoronoiCell(Voronoi::diagram_type *d, long index)
|
||||
: dia(d)
|
||||
, index(index)
|
||||
, ptr(0)
|
||||
, ptr(nullptr)
|
||||
{
|
||||
if (dia && long(dia->num_cells()) > index) {
|
||||
ptr = &(dia->cells()[index]);
|
||||
@@ -55,12 +55,12 @@ VoronoiCell::~VoronoiCell() {
|
||||
}
|
||||
|
||||
bool VoronoiCell::isBound(void) const {
|
||||
if (ptr != 0 && dia.isValid() && index != Voronoi::InvalidIndex) {
|
||||
if (ptr != nullptr && dia.isValid() && index != Voronoi::InvalidIndex) {
|
||||
if (&(dia->cells()[index]) == ptr) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
ptr = 0;
|
||||
ptr = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ class PathExport VoronoiCell
|
||||
TYPESYSTEM_HEADER();
|
||||
public:
|
||||
|
||||
VoronoiCell(Voronoi::diagram_type *dia = 0, long index = Voronoi::InvalidIndex);
|
||||
VoronoiCell(Voronoi::diagram_type *dia = nullptr, long index = Voronoi::InvalidIndex);
|
||||
VoronoiCell(Voronoi::diagram_type *dia, const Voronoi::diagram_type::cell_type *cell);
|
||||
~VoronoiCell();
|
||||
|
||||
|
||||
@@ -89,10 +89,10 @@ const Voronoi::voronoi_diagram_type::cell_type* getCellFromPy(VoronoiCellPy *c,
|
||||
if (throwIfNotBound) {
|
||||
throw Py::TypeError("Cell not bound to voronoi diagram");
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
VoronoiCell* getVoronoiCellFromPy(const VoronoiCellPy *c, PyObject *args = 0) {
|
||||
VoronoiCell* getVoronoiCellFromPy(const VoronoiCellPy *c, PyObject *args = nullptr) {
|
||||
VoronoiCell *self = c->getVoronoiCellPtr();
|
||||
if (!self->isBound()) {
|
||||
throw Py::TypeError("Cell not bound to voronoi diagram");
|
||||
@@ -193,7 +193,7 @@ PyObject* VoronoiCellPy::getSource(PyObject *args)
|
||||
|
||||
PyObject* VoronoiCellPy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int VoronoiCellPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
|
||||
|
||||
@@ -35,7 +35,7 @@ TYPESYSTEM_SOURCE(Path::VoronoiEdge , Base::Persistence)
|
||||
VoronoiEdge::VoronoiEdge(Voronoi::diagram_type *d, long index)
|
||||
: dia(d)
|
||||
, index(index)
|
||||
, ptr(0)
|
||||
, ptr(nullptr)
|
||||
{
|
||||
if (dia && long(dia->num_edges()) > index) {
|
||||
ptr = &(dia->edges()[index]);
|
||||
@@ -56,11 +56,11 @@ VoronoiEdge::~VoronoiEdge() {
|
||||
}
|
||||
|
||||
bool VoronoiEdge::isBound(void) const {
|
||||
if (ptr != 0 && dia.isValid() && index != Voronoi::InvalidIndex) {
|
||||
if (ptr != nullptr && dia.isValid() && index != Voronoi::InvalidIndex) {
|
||||
if (&(dia->edges()[index]) == ptr) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
ptr = 0;
|
||||
ptr = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ class PathExport VoronoiEdge
|
||||
TYPESYSTEM_HEADER();
|
||||
public:
|
||||
|
||||
VoronoiEdge(Voronoi::diagram_type *dia = 0, long index = Voronoi::InvalidIndex);
|
||||
VoronoiEdge(Voronoi::diagram_type *dia = nullptr, long index = Voronoi::InvalidIndex);
|
||||
VoronoiEdge(Voronoi::diagram_type *dia, const Voronoi::diagram_type::edge_type *edge);
|
||||
~VoronoiEdge();
|
||||
|
||||
|
||||
@@ -245,10 +245,10 @@ const Voronoi::voronoi_diagram_type::edge_type* getEdgeFromPy(VoronoiEdgePy *e,
|
||||
if (throwIfNotBound) {
|
||||
throw Py::TypeError("Edge not bound to voronoi diagram");
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
VoronoiEdge* getVoronoiEdgeFromPy(const VoronoiEdgePy *e, PyObject *args = 0) {
|
||||
VoronoiEdge* getVoronoiEdgeFromPy(const VoronoiEdgePy *e, PyObject *args = nullptr) {
|
||||
VoronoiEdge *self = e->getVoronoiEdgePtr();
|
||||
if (!self->isBound()) {
|
||||
throw Py::TypeError("Edge not bound to voronoi diagram");
|
||||
@@ -618,7 +618,7 @@ PyObject* VoronoiEdgePy::getSegmentAngle(PyObject *args)
|
||||
|
||||
PyObject* VoronoiEdgePy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int VoronoiEdgePy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
|
||||
|
||||
@@ -88,7 +88,7 @@ Voronoi::point_type getPointFromPy(PyObject *obj) {
|
||||
}
|
||||
|
||||
PyObject* VoronoiPy::addPoint(PyObject *args) {
|
||||
PyObject *obj = 0;
|
||||
PyObject *obj = nullptr;
|
||||
if (PyArg_ParseTuple(args, "O", &obj)) {
|
||||
getVoronoiPtr()->addPoint(getPointFromPy(obj));
|
||||
}
|
||||
@@ -97,8 +97,8 @@ PyObject* VoronoiPy::addPoint(PyObject *args) {
|
||||
}
|
||||
|
||||
PyObject* VoronoiPy::addSegment(PyObject *args) {
|
||||
PyObject *objBegin = 0;
|
||||
PyObject *objEnd = 0;
|
||||
PyObject *objBegin = nullptr;
|
||||
PyObject *objEnd = nullptr;
|
||||
|
||||
if (PyArg_ParseTuple(args, "OO", &objBegin, &objEnd)) {
|
||||
auto p0 = getPointFromPy(objBegin);
|
||||
@@ -188,7 +188,7 @@ static bool callbackWithVertex(Voronoi::diagram_type *dia, PyObject *callback, c
|
||||
#endif
|
||||
Py_DECREF(arglist);
|
||||
Py_DECREF(vx);
|
||||
if (result == NULL) {
|
||||
if (result == nullptr) {
|
||||
bail = true;
|
||||
} else {
|
||||
rc = result == Py_True;
|
||||
@@ -208,7 +208,7 @@ static bool callbackWithVertex(Voronoi::diagram_type *dia, PyObject *callback, c
|
||||
|
||||
PyObject* VoronoiPy::colorExterior(PyObject *args) {
|
||||
Voronoi::color_type color = 0;
|
||||
PyObject *callback = 0;
|
||||
PyObject *callback = nullptr;
|
||||
if (!PyArg_ParseTuple(args, "k|O", &color, &callback)) {
|
||||
throw Py::RuntimeError("colorExterior requires an integer (color) argument");
|
||||
}
|
||||
@@ -237,7 +237,7 @@ PyObject* VoronoiPy::colorExterior(PyObject *args) {
|
||||
}
|
||||
}
|
||||
if (bail) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -334,7 +334,7 @@ PyObject* VoronoiPy::numSegments(PyObject *args)
|
||||
|
||||
PyObject *VoronoiPy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int VoronoiPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
|
||||
|
||||
@@ -35,7 +35,7 @@ TYPESYSTEM_SOURCE(Path::VoronoiVertex , Base::Persistence)
|
||||
VoronoiVertex::VoronoiVertex(Voronoi::diagram_type *d, long index)
|
||||
: dia(d)
|
||||
, index(index)
|
||||
, ptr(0)
|
||||
, ptr(nullptr)
|
||||
{
|
||||
if (dia && long(dia->num_vertices()) > index) {
|
||||
ptr = &(dia->vertices()[index]);
|
||||
@@ -56,11 +56,11 @@ VoronoiVertex::~VoronoiVertex() {
|
||||
}
|
||||
|
||||
bool VoronoiVertex::isBound(void) const {
|
||||
if (ptr != 0 && dia.isValid() && index != Voronoi::InvalidIndex) {
|
||||
if (ptr != nullptr && dia.isValid() && index != Voronoi::InvalidIndex) {
|
||||
if (&(dia->vertices()[index]) == ptr) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
ptr = 0;
|
||||
ptr = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ class PathExport VoronoiVertex
|
||||
TYPESYSTEM_HEADER();
|
||||
public:
|
||||
|
||||
VoronoiVertex(Voronoi::diagram_type *dia = 0, long index = Voronoi::InvalidIndex);
|
||||
VoronoiVertex(Voronoi::diagram_type *dia = nullptr, long index = Voronoi::InvalidIndex);
|
||||
VoronoiVertex(Voronoi::diagram_type *dia, const Voronoi::diagram_type::vertex_type *v);
|
||||
~VoronoiVertex();
|
||||
|
||||
|
||||
@@ -89,10 +89,10 @@ const Voronoi::voronoi_diagram_type::vertex_type* getVertexFromPy(VoronoiVertexP
|
||||
if (throwIfNotBound) {
|
||||
throw Py::TypeError("Vertex not bound to voronoi diagram");
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
VoronoiVertex* getVoronoiVertexFromPy(const VoronoiVertexPy *v, PyObject *args = 0) {
|
||||
VoronoiVertex* getVoronoiVertexFromPy(const VoronoiVertexPy *v, PyObject *args = nullptr) {
|
||||
VoronoiVertex *self = v->getVoronoiVertexPtr();
|
||||
if (!self->isBound()) {
|
||||
throw Py::TypeError("Vertex not bound to voronoi diagram");
|
||||
@@ -160,7 +160,7 @@ PyObject* VoronoiVertexPy::toPoint(PyObject *args)
|
||||
|
||||
PyObject* VoronoiVertexPy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int VoronoiVertexPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
|
||||
|
||||
@@ -54,7 +54,7 @@ PyMOD_INIT_FUNC(PathGui)
|
||||
{
|
||||
if (!Gui::Application::Instance) {
|
||||
PyErr_SetString(PyExc_ImportError, "Cannot load Gui module in console application.");
|
||||
PyMOD_Return(0);
|
||||
PyMOD_Return(nullptr);
|
||||
}
|
||||
try {
|
||||
Base::Interpreter().runString("import PartGui");
|
||||
@@ -62,7 +62,7 @@ PyMOD_INIT_FUNC(PathGui)
|
||||
}
|
||||
catch(const Base::Exception& e) {
|
||||
PyErr_SetString(PyExc_ImportError, e.what());
|
||||
PyMOD_Return(0);
|
||||
PyMOD_Return(nullptr);
|
||||
}
|
||||
PyObject* mod = PathGui::initModule();
|
||||
Base::Console().Log("Loading GUI of Path module... done\n");
|
||||
|
||||
@@ -134,7 +134,7 @@ private:
|
||||
Py::Object insert(const Py::Tuple& args)
|
||||
{
|
||||
char* Name;
|
||||
char* DocName=0;
|
||||
char* DocName=nullptr;
|
||||
if (!PyArg_ParseTuple(args.ptr(), "et|s","utf-8",&Name,&DocName))
|
||||
throw Py::Exception();
|
||||
|
||||
@@ -168,7 +168,7 @@ private:
|
||||
}
|
||||
processor = Dlg.getProcessor();
|
||||
|
||||
App::Document *pcDoc = 0;
|
||||
App::Document *pcDoc = nullptr;
|
||||
if (DocName)
|
||||
pcDoc = App::GetApplication().getDocument(DocName);
|
||||
else
|
||||
|
||||
@@ -69,7 +69,7 @@ void CmdPathArea::activated(int iMsg)
|
||||
std::string areaName;
|
||||
bool addView = true;
|
||||
for(const Gui::SelectionObject &selObj :
|
||||
getSelection().getSelectionEx(NULL, Part::Feature::getClassTypeId()))
|
||||
getSelection().getSelectionEx(nullptr, Part::Feature::getClassTypeId()))
|
||||
{
|
||||
const Part::Feature *pcObj = static_cast<const Part::Feature*>(selObj.getObject());
|
||||
const std::vector<std::string> &subnames = selObj.getSubNames();
|
||||
@@ -152,7 +152,7 @@ void CmdPathAreaWorkplane::activated(int iMsg)
|
||||
std::string planeName;
|
||||
|
||||
for(Gui::SelectionObject &selObj :
|
||||
getSelection().getSelectionEx(NULL, Part::Feature::getClassTypeId()))
|
||||
getSelection().getSelectionEx(nullptr, Part::Feature::getClassTypeId()))
|
||||
{
|
||||
const std::vector<std::string> &subnames = selObj.getSubNames();
|
||||
if(subnames.size()>1) {
|
||||
@@ -212,7 +212,7 @@ void CmdPathAreaWorkplane::activated(int iMsg)
|
||||
|
||||
bool CmdPathAreaWorkplane::isActive(void)
|
||||
{
|
||||
return !getSelection().getSelectionEx(NULL, Path::FeatureArea::getClassTypeId()).empty();
|
||||
return !getSelection().getSelectionEx(nullptr, Path::FeatureArea::getClassTypeId()).empty();
|
||||
}
|
||||
|
||||
|
||||
@@ -291,7 +291,7 @@ void CmdPathShape::activated(int iMsg)
|
||||
std::list<std::string> cmds;
|
||||
std::ostringstream sources;
|
||||
for(const Gui::SelectionObject &selObj :
|
||||
getSelection().getSelectionEx(NULL, Part::Feature::getClassTypeId()))
|
||||
getSelection().getSelectionEx(nullptr, Part::Feature::getClassTypeId()))
|
||||
{
|
||||
const Part::Feature *pcObj = static_cast<const Part::Feature*>(selObj.getObject());
|
||||
const std::vector<std::string> &subnames = selObj.getSubNames();
|
||||
|
||||
@@ -35,7 +35,7 @@ class DlgSettingsPathColor : public Gui::Dialog::PreferencePage
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DlgSettingsPathColor(QWidget* parent = 0);
|
||||
DlgSettingsPathColor(QWidget* parent = nullptr);
|
||||
~DlgSettingsPathColor();
|
||||
|
||||
void saveSettings();
|
||||
|
||||
@@ -41,7 +41,7 @@ class TaskWidgetPathCompound : public Gui::TaskView::TaskBox
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TaskWidgetPathCompound(ViewProviderPathCompound *CompoundView, QWidget *parent=0);
|
||||
TaskWidgetPathCompound(ViewProviderPathCompound *CompoundView, QWidget *parent=nullptr);
|
||||
~TaskWidgetPathCompound();
|
||||
|
||||
std::vector<std::string> getList(void) const;
|
||||
|
||||
@@ -148,7 +148,7 @@ bool ViewProviderAreaView::canDragObject(App::DocumentObject* obj) const
|
||||
void ViewProviderAreaView::dragObject(App::DocumentObject* )
|
||||
{
|
||||
Path::FeatureAreaView* feature = static_cast<Path::FeatureAreaView*>(getObject());
|
||||
feature->Source.setValue(NULL);
|
||||
feature->Source.setValue(nullptr);
|
||||
}
|
||||
|
||||
bool ViewProviderAreaView::canDropObjects() const
|
||||
|
||||
@@ -75,13 +75,13 @@ public:
|
||||
instance = new PathSelectionObserver();
|
||||
}
|
||||
|
||||
void setArrow(SoSwitch *pcSwitch=0) {
|
||||
void setArrow(SoSwitch *pcSwitch=nullptr) {
|
||||
if(pcSwitch==pcLastArrowSwitch)
|
||||
return;
|
||||
if(pcLastArrowSwitch) {
|
||||
pcLastArrowSwitch->whichChild = -1;
|
||||
pcLastArrowSwitch->unref();
|
||||
pcLastArrowSwitch = 0;
|
||||
pcLastArrowSwitch = nullptr;
|
||||
}
|
||||
if(pcSwitch) {
|
||||
pcSwitch->ref();
|
||||
@@ -102,7 +102,7 @@ public:
|
||||
if(!obj)
|
||||
return;
|
||||
Base::Matrix4D mat;
|
||||
auto sobj = obj->getSubObject(msg.pSubName,0,&mat);
|
||||
auto sobj = obj->getSubObject(msg.pSubName,nullptr,&mat);
|
||||
if(!sobj)
|
||||
return;
|
||||
Base::Matrix4D linkMat;
|
||||
@@ -131,7 +131,7 @@ public:
|
||||
setArrow();
|
||||
}
|
||||
|
||||
SoSwitch *pcLastArrowSwitch = 0;
|
||||
SoSwitch *pcLastArrowSwitch = nullptr;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ ViewProviderPath::ViewProviderPath()
|
||||
|
||||
DisplayMode.setStatus(App::Property::Status::Hidden, true);
|
||||
|
||||
static const char *SelectionStyleEnum[] = {"Shape","BoundBox","None",0};
|
||||
static const char *SelectionStyleEnum[] = {"Shape","BoundBox","None",nullptr};
|
||||
SelectionStyle.setEnums(SelectionStyleEnum);
|
||||
unsigned long sstyle = hGrp->GetInt("DefaultSelectionStyle",0);
|
||||
SelectionStyle.setValue(sstyle);
|
||||
@@ -325,7 +325,7 @@ std::string ViewProviderPath::getElement(const SoDetail* detail) const
|
||||
SoDetail* ViewProviderPath::getDetail(const char* subelement) const
|
||||
{
|
||||
int index = std::atoi(subelement);
|
||||
SoDetail* detail = 0;
|
||||
SoDetail* detail = nullptr;
|
||||
if (index>0 && index<=(int)command2Edge.size()) {
|
||||
index = command2Edge[index-1];
|
||||
if(index>=0 && edgeStart>=0 && edgeStart<=index) {
|
||||
@@ -521,7 +521,7 @@ public:
|
||||
{
|
||||
(void)last;
|
||||
|
||||
gx(id, NULL, pts, 0);
|
||||
gx(id, nullptr, pts, 0);
|
||||
|
||||
points.push_back(p[0]);
|
||||
markers.push_back(p[0]);
|
||||
@@ -581,7 +581,7 @@ private:
|
||||
colorindex.push_back(color);
|
||||
}
|
||||
|
||||
if (next != NULL) {
|
||||
if (next != nullptr) {
|
||||
points.push_back(*next);
|
||||
markers.push_back(*next);
|
||||
colorindex.push_back(color);
|
||||
|
||||
@@ -71,7 +71,7 @@ PyMOD_INIT_FUNC(PathSimulator)
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
PyErr_SetString(PyExc_ImportError, e.what());
|
||||
PyMOD_Return(NULL);
|
||||
PyMOD_Return(nullptr);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -68,7 +68,7 @@ Base::Placement * PathSim::ApplyCommand(Base::Placement * pos, Command * cmd)
|
||||
Point3D fromPos(*pos);
|
||||
Point3D toPos(*pos);
|
||||
toPos.UpdateCmd(*cmd);
|
||||
if (m_tool != NULL)
|
||||
if (m_tool != nullptr)
|
||||
{
|
||||
if (cmd->Name == "G0" || cmd->Name == "G1")
|
||||
{
|
||||
|
||||
@@ -57,11 +57,11 @@ int PathSimPy::PyInit(PyObject* /*args*/, PyObject* /*kwd*/)
|
||||
|
||||
PyObject* PathSimPy::BeginSimulation(PyObject * args, PyObject * kwds)
|
||||
{
|
||||
static char *kwlist[] = { "stock", "resolution", NULL };
|
||||
static char *kwlist[] = { "stock", "resolution", nullptr };
|
||||
PyObject *pObjStock;
|
||||
float resolution;
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!f", kwlist, &(Part::TopoShapePy::Type), &pObjStock, &resolution))
|
||||
return 0;
|
||||
return nullptr;
|
||||
PathSim *sim = getPathSimPtr();
|
||||
Part::TopoShape *stock = static_cast<Part::TopoShapePy*>(pObjStock)->getTopoShapePtr();
|
||||
sim->BeginSimulation(stock, resolution);
|
||||
@@ -74,7 +74,7 @@ PyObject* PathSimPy::SetToolShape(PyObject * args)
|
||||
PyObject *pObjToolShape;
|
||||
float resolution;
|
||||
if (!PyArg_ParseTuple(args, "O!f", &(Part::TopoShapePy::Type), &pObjToolShape, &resolution))
|
||||
return 0;
|
||||
return nullptr;
|
||||
PathSim *sim = getPathSimPtr();
|
||||
const TopoDS_Shape& toolShape = static_cast<Part::TopoShapePy*>(pObjToolShape)->getTopoShapePtr()->getShape();
|
||||
sim->SetToolShape(toolShape, resolution);
|
||||
@@ -85,12 +85,12 @@ PyObject* PathSimPy::SetToolShape(PyObject * args)
|
||||
PyObject* PathSimPy::GetResultMesh(PyObject * args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return 0;
|
||||
return nullptr;
|
||||
cStock *stock = getPathSimPtr()->m_stock;
|
||||
if (stock == NULL)
|
||||
if (stock == nullptr)
|
||||
{
|
||||
PyErr_SetString(PyExc_RuntimeError, "Simulation has stock object");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Mesh::MeshObject *meshOuter = new Mesh::MeshObject();
|
||||
@@ -107,11 +107,11 @@ PyObject* PathSimPy::GetResultMesh(PyObject * args)
|
||||
|
||||
PyObject* PathSimPy::ApplyCommand(PyObject * args, PyObject * kwds)
|
||||
{
|
||||
static char *kwlist[] = { "position", "command", NULL };
|
||||
static char *kwlist[] = { "position", "command", nullptr };
|
||||
PyObject *pObjPlace;
|
||||
PyObject *pObjCmd;
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!O!", kwlist, &(Base::PlacementPy::Type), &pObjPlace, &(Path::CommandPy::Type), &pObjCmd))
|
||||
return 0;
|
||||
return nullptr;
|
||||
PathSim *sim = getPathSimPtr();
|
||||
Base::Placement *pos = static_cast<Base::PlacementPy*>(pObjPlace)->getPlacementPtr();
|
||||
Path::Command *cmd = static_cast<Path::CommandPy*>(pObjCmd)->getCommandPtr();
|
||||
@@ -130,7 +130,7 @@ Py::Object PathSimPy::getTool(void) const
|
||||
|
||||
PyObject *PathSimPy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int PathSimPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
|
||||
|
||||
Reference in New Issue
Block a user