From a6380f64a53089c58711e9132790a1530644a925 Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Wed, 1 Feb 2017 02:01:33 +0800 Subject: [PATCH] Path: fixed fromShapes and sortWires parameter parsing --- src/Mod/Path/App/AppPathPy.cpp | 23 ++++++++++++----------- src/Mod/Path/App/AreaParams.h | 4 ++-- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/Mod/Path/App/AppPathPy.cpp b/src/Mod/Path/App/AppPathPy.cpp index f7b53cde1..d2c10f97f 100644 --- a/src/Mod/Path/App/AppPathPy.cpp +++ b/src/Mod/Path/App/AppPathPy.cpp @@ -119,20 +119,21 @@ public: "fromShape(Shape): Returns a Path object from a Part Shape" ); add_keyword_method("fromShapes",&Module::fromShapes, - "fromShapes(shapes, sort=True, start=Vector(), " PARAM_PY_ARGS_DOC(ARG,AREA_PARAMS_PATH) ")\n" + "fromShapes(shapes, start=Vector(), " PARAM_PY_ARGS_DOC(ARG,AREA_PARAMS_PATH) ", key=value...)\n" "\nReturns a Path object from a list of shapes\n" "\n* shapes: input list of shapes.\n" "\n* start (Vector()): optional start position.\n" PARAM_PY_DOC(ARG, AREA_PARAMS_PATH) + "\n* : any key supported by Path.Area, see Path.Area.getParamDesc() for description" ); add_keyword_method("sortWires",&Module::sortWires, - "sortWires(shapes, start=Vector(), params=None, " PARAM_PY_ARGS_DOC(ARG,AREA_PARAMS_SORT) ")\n" + "sortWires(shapes, start=Vector(), " PARAM_PY_ARGS_DOC(ARG,AREA_PARAMS_SORT) ", key=value...)\n" "\nReturns (wires,end), where 'wires' is sorted accross Z value and with optimized travel distance,\n" "and 'end' is the ending position of the whole wires\n" "\n* shapes: input shape list\n" "\n* start (Vector()): optional start position.\n" - "\n* params (None): optional dictionary for configuring Path.Area internally used to sort the wires.\n" PARAM_PY_DOC(ARG, AREA_PARAMS_SORT) + "\n* : any key supported by Path.Area, see Path.Area.getParamDesc() for description" ); initialize("This module is the Path module."); // register with Python } @@ -327,10 +328,10 @@ private: PARAM_FIELD_STRINGS(ARG,AREA_PARAMS_PATH), PARAM_FIELD_STRINGS(NAME,AREA_PARAMS_CONF), NULL}; if (!PyArg_ParseTupleAndKeywords(args.ptr(), kwds.ptr(), - "O|O!" PARAM_PY_KWDS(AREA_PARAMS_PATH), kwd_list, - &pShapes, &(Base::VectorPy::Type), &start, - PARAM_REF(PARAM_FARG,AREA_PARAMS_PATH), - PARAM_REF(PARAM_FNAME,AREA_PARAMS_CONF))) + "O|O!" PARAM_PY_KWDS(AREA_PARAMS_PATH) PARAM_PY_KWDS(AREA_PARAMS_CONF), + kwd_list, &pShapes, &(Base::VectorPy::Type), &start, + PARAM_REF(PARAM_FARG,AREA_PARAMS_PATH), + PARAM_REF(PARAM_FNAME,AREA_PARAMS_CONF))) throw Py::Exception(); std::list shapes; @@ -380,10 +381,10 @@ private: PARAM_FIELD_STRINGS(ARG,AREA_PARAMS_SORT), PARAM_FIELD_STRINGS(NAME,AREA_PARAMS_CONF), NULL}; if (!PyArg_ParseTupleAndKeywords(args.ptr(), kwds.ptr(), - "O|O!" PARAM_PY_KWDS(AREA_PARAMS_SORT), kwd_list, - &pShapes, &(Base::VectorPy::Type), &start, - PARAM_REF(PARAM_FARG,AREA_PARAMS_SORT), - PARAM_REF(PARAM_FNAME,AREA_PARAMS_CONF))) + "O|O!" PARAM_PY_KWDS(AREA_PARAMS_SORT) PARAM_PY_KWDS(AREA_PARAMS_CONF), + kwd_list, &pShapes, &(Base::VectorPy::Type), &start, + PARAM_REF(PARAM_FARG,AREA_PARAMS_SORT), + PARAM_REF(PARAM_FNAME,AREA_PARAMS_CONF))) throw Py::Exception(); std::list shapes; diff --git a/src/Mod/Path/App/AreaParams.h b/src/Mod/Path/App/AreaParams.h index 9a6583ff1..c59fa34a1 100644 --- a/src/Mod/Path/App/AreaParams.h +++ b/src/Mod/Path/App/AreaParams.h @@ -155,8 +155,8 @@ #define AREA_PARAMS_MIN_DIST \ ((double, min_dist, MinDistance, 0.0, \ - "minimum distance for the generated new wires. Wires maybe broken if the algorithm see fits.\n"\ - "Set to zero to disable wire breaking.")) + "minimum distance for the generated new wires. Wires maybe broken if the\n"\ + "algorithm see fits. Set to zero to disable wire breaking.")) /** Area wire sorting parameters */ #define AREA_PARAMS_SORT \