Path: Fix header uniformity and remove trailing whitespace

This PR fixes header uniformity across all Path files. It also removes all trailing whitespace.
This commit is contained in:
luz paz
2020-11-03 13:09:58 -05:00
committed by wwmayer
parent 48365ecdbb
commit b75cd3dd52
231 changed files with 545 additions and 743 deletions

View File

@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (c) Yorik van Havre (yorik@uncreated.net) 2014 *
* Copyright (c) 2014 Yorik van Havre <yorik@uncreated.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
@@ -93,12 +93,12 @@
catch(const char *e) \
{ \
PyErr_SetString(Base::BaseExceptionFreeCADError,e); \
} throw Py::Exception();
} throw Py::Exception();
namespace Path {
class Module : public Py::ExtensionModule<Module>
{
public:
Module() : Py::ExtensionModule<Module>("Path")
@@ -124,7 +124,7 @@ public:
PARAM_PY_DOC(ARG, AREA_PARAMS_PATH)
);
add_keyword_method("sortWires",&Module::sortWires,
"sortWires(shapes, start=Vector(), "
"sortWires(shapes, start=Vector(), "
PARAM_PY_ARGS_DOC(ARG,AREA_PARAMS_ARC_PLANE)
PARAM_PY_ARGS_DOC(ARG,AREA_PARAMS_SORT) ")\n"
"\nReturns (wires,end), where 'wires' is sorted across Z value and with optimized travel distance,\n"
@@ -151,12 +151,12 @@ private:
std::string EncodedName = std::string(Name);
PyMem_Free(Name);
Base::FileInfo file(EncodedName.c_str());
if (PyObject_TypeCheck(pObj, &(App::DocumentObjectPy::Type))) {
App::DocumentObject* obj = static_cast<App::DocumentObjectPy*>(pObj)->getDocumentObjectPtr();
if (obj->getTypeId().isDerivedFrom(Base::Type::fromName("Path::Feature"))) {
const Toolpath& path = static_cast<Path::Feature*>(obj)->Path.getValue();
std::string gcode = path.toGCode();
std::string gcode = path.toGCode();
std::ofstream ofile(EncodedName.c_str());
ofile << gcode;
ofile.close();
@@ -188,7 +188,7 @@ private:
pcDoc = App::GetApplication().getDocument(DocName);
else
pcDoc = App::GetApplication().getActiveDocument();
if (!pcDoc)
if (!pcDoc)
pcDoc = App::GetApplication().newDocument(DocName);
try {
@@ -257,7 +257,7 @@ private:
Path::Toolpath result;
bool first = true;
Base::Placement last;
TopExp_Explorer ExpEdges (shape,TopAbs_EDGE);
while (ExpEdges.More()) {
const TopoDS_Edge& edge = TopoDS::Edge(ExpEdges.Current());
@@ -283,7 +283,7 @@ private:
else {
Path::Command cmd;
cmd.setFromPlacement(tpl);
// write arc data if needed
BRepAdaptor_Curve adapt(edge);
if (adapt.GetType() == GeomAbs_Circle) {
@@ -327,8 +327,8 @@ private:
PyObject *return_end=Py_False;
static char* kwd_list[] = {"shapes", "start", "return_end",
PARAM_FIELD_STRINGS(ARG,AREA_PARAMS_PATH), NULL};
if (!PyArg_ParseTupleAndKeywords(args.ptr(), kwds.ptr(),
"O|O!O" PARAM_PY_KWDS(AREA_PARAMS_PATH),
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,
PARAM_REF(PARAM_FARG,AREA_PARAMS_PATH)))
throw Py::Exception();
@@ -337,7 +337,7 @@ private:
if (PyObject_TypeCheck(pShapes, &(Part::TopoShapePy::Type)))
shapes.push_back(static_cast<Part::TopoShapePy*>(pShapes)->getTopoShapePtr()->getShape());
else if (PyObject_TypeCheck(pShapes, &(PyList_Type)) ||
PyObject_TypeCheck(pShapes, &(PyTuple_Type)))
PyObject_TypeCheck(pShapes, &(PyTuple_Type)))
{
Py::Sequence shapeSeq(pShapes);
for (Py::Sequence::iterator it = shapeSeq.begin(); it != shapeSeq.end(); ++it) {
@@ -376,14 +376,14 @@ private:
PARAM_PY_DECLARE_INIT(PARAM_FARG,AREA_PARAMS_SORT)
PyObject *pShapes=NULL;
PyObject *start=NULL;
static char* kwd_list[] = {"shapes", "start",
PARAM_FIELD_STRINGS(ARG,AREA_PARAMS_ARC_PLANE),
static char* kwd_list[] = {"shapes", "start",
PARAM_FIELD_STRINGS(ARG,AREA_PARAMS_ARC_PLANE),
PARAM_FIELD_STRINGS(ARG,AREA_PARAMS_SORT), NULL};
if (!PyArg_ParseTupleAndKeywords(args.ptr(), kwds.ptr(),
"O|O!"
PARAM_PY_KWDS(AREA_PARAMS_ARC_PLANE)
if (!PyArg_ParseTupleAndKeywords(args.ptr(), kwds.ptr(),
"O|O!"
PARAM_PY_KWDS(AREA_PARAMS_ARC_PLANE)
PARAM_PY_KWDS(AREA_PARAMS_SORT),
kwd_list, &pShapes, &(Base::VectorPy::Type), &start,
kwd_list, &pShapes, &(Base::VectorPy::Type), &start,
PARAM_REF(PARAM_FARG,AREA_PARAMS_ARC_PLANE),
PARAM_REF(PARAM_FARG,AREA_PARAMS_SORT)))
throw Py::Exception();
@@ -409,7 +409,7 @@ private:
Base::Vector3d vec = static_cast<Base::VectorPy*>(start)->value();
pstart.SetCoord(vec.x, vec.y, vec.z);
}
try {
bool need_arc_plane = arc_plane==Area::ArcPlaneAuto;
std::list<TopoDS_Shape> wires = Area::sortWires(shapes,start!=0,&pstart,