Skip to content

Commit

Permalink
Path: fixed fromShapes and sortWires parameter parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
realthunder committed Jan 31, 2017
1 parent f834206 commit a6380f6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
23 changes: 12 additions & 11 deletions src/Mod/Path/App/AppPathPy.cpp
Expand Up @@ -119,20 +119,21 @@ class Module : public Py::ExtensionModule<Module>
"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* <key>: 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* <key>: any key supported by Path.Area, see Path.Area.getParamDesc() for description"
);
initialize("This module is the Path module."); // register with Python
}
Expand Down Expand Up @@ -327,10 +328,10 @@ class Module : public Py::ExtensionModule<Module>
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<TopoDS_Shape> shapes;
Expand Down Expand Up @@ -380,10 +381,10 @@ class Module : public Py::ExtensionModule<Module>
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<TopoDS_Shape> shapes;
Expand Down
4 changes: 2 additions & 2 deletions src/Mod/Path/App/AreaParams.h
Expand Up @@ -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 \
Expand Down

0 comments on commit a6380f6

Please sign in to comment.