Skip to content

Commit

Permalink
Path: Fix header uniformity and remove trailing whitespace
Browse files Browse the repository at this point in the history
This PR fixes header uniformity across all Path files. It also removes all trailing whitespace.
  • Loading branch information
luzpaz authored and wwmayer committed Nov 5, 2020
1 parent 48365ec commit b75cd3d
Show file tree
Hide file tree
Showing 231 changed files with 545 additions and 743 deletions.
2 changes: 1 addition & 1 deletion src/Mod/Path/App/AppPath.cpp
@@ -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. *
* *
Expand Down
38 changes: 19 additions & 19 deletions src/Mod/Path/App/AppPathPy.cpp
@@ -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. *
* *
Expand Down Expand Up @@ -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")
Expand All @@ -124,7 +124,7 @@ class Module : public Py::ExtensionModule<Module>
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"
Expand All @@ -151,12 +151,12 @@ class Module : public Py::ExtensionModule<Module>
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();
Expand Down Expand Up @@ -188,7 +188,7 @@ class Module : public Py::ExtensionModule<Module>
pcDoc = App::GetApplication().getDocument(DocName);
else
pcDoc = App::GetApplication().getActiveDocument();
if (!pcDoc)
if (!pcDoc)
pcDoc = App::GetApplication().newDocument(DocName);

try {
Expand Down Expand Up @@ -257,7 +257,7 @@ class Module : public Py::ExtensionModule<Module>
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());
Expand All @@ -283,7 +283,7 @@ class Module : public Py::ExtensionModule<Module>
else {
Path::Command cmd;
cmd.setFromPlacement(tpl);

// write arc data if needed
BRepAdaptor_Curve adapt(edge);
if (adapt.GetType() == GeomAbs_Circle) {
Expand Down Expand Up @@ -327,8 +327,8 @@ class Module : public Py::ExtensionModule<Module>
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();
Expand All @@ -337,7 +337,7 @@ class Module : public Py::ExtensionModule<Module>
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) {
Expand Down Expand Up @@ -376,14 +376,14 @@ class Module : public Py::ExtensionModule<Module>
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();
Expand All @@ -409,7 +409,7 @@ class Module : public Py::ExtensionModule<Module>
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,
Expand Down
6 changes: 4 additions & 2 deletions src/Mod/Path/App/Area.cpp
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 2017 Zheng, Lei (realthunder) <realthunder.dev@gmail.com>*
* Copyright (c) 2017 Zheng Lei (realthunder) <realthunder.dev@gmail.com> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
Expand All @@ -19,6 +19,8 @@
* Suite 330, Boston, MA 02111-1307, USA *
* *
****************************************************************************/


#include "PreCompiled.h"

// From Boost 1.75 on the geometry component requires C++14
Expand Down Expand Up @@ -3209,7 +3211,7 @@ void Area::toPath(Toolpath &path, const std::list<TopoDS_Shape> &shapes,
wires = sortWires(shapes,_pstart!=0,&pstart,pend,&stepdown_hint,
PARAM_REF(PARAM_FARG,AREA_PARAMS_ARC_PLANE),
PARAM_FIELDS(PARAM_FARG,AREA_PARAMS_SORT));

if (wires.size() == 0)
return;

Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Path/App/Area.h
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 2017 Zheng, Lei (realthunder) <realthunder.dev@gmail.com>*
* Copyright (c) 2017 Zheng Lei (realthunder) <realthunder.dev@gmail.com> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Path/App/AreaParams.h
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 2017 Zheng, Lei (realthunder) <realthunder.dev@gmail.com>*
* Copyright (c) 2017 Zheng Lei (realthunder) <realthunder.dev@gmail.com> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Path/App/AreaPyImp.cpp
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 2017 Zheng, Lei (realthunder) <realthunder.dev@gmail.com>*
* Copyright (c) 2017 Zheng Lei (realthunder) <realthunder.dev@gmail.com> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Path/App/Command.cpp
@@ -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. *
* *
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Path/App/Command.h
@@ -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. *
* *
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Path/App/CommandPyImp.cpp
@@ -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. *
* *
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Path/App/FeatureArea.cpp
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 2017 Zheng, Lei (realthunder) <realthunder.dev@gmail.com>*
* Copyright (c) 2017 Zheng Lei (realthunder) <realthunder.dev@gmail.com> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Path/App/FeatureArea.h
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 2017 Zheng, Lei (realthunder) <realthunder.dev@gmail.com>*
* Copyright (c) 2017 Zheng Lei (realthunder) <realthunder.dev@gmail.com> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Path/App/FeatureAreaPyImp.cpp
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 2017 Zheng, Lei (realthunder) <realthunder.dev@gmail.com>*
* Copyright (c) 2017 Zheng Lei (realthunder) <realthunder.dev@gmail.com> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Path/App/FeaturePath.cpp
@@ -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. *
* *
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Path/App/FeaturePath.h
@@ -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. *
* *
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Path/App/FeaturePathCompound.cpp
@@ -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. *
* *
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Path/App/FeaturePathCompound.h
@@ -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. *
* *
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Path/App/FeaturePathShape.cpp
@@ -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. *
* *
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Path/App/FeaturePathShape.h
@@ -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. *
* *
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Path/App/ParamsHelper.h
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 2017 Zheng, Lei (realthunder) <realthunder.dev@gmail.com>*
* Copyright (c) 2017 Zheng Lei (realthunder) <realthunder.dev@gmail.com> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Path/App/Path.cpp
@@ -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. *
* *
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Path/App/Path.h
@@ -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. *
* *
Expand Down
10 changes: 5 additions & 5 deletions src/Mod/Path/App/PathPyImp.cpp
@@ -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. *
* *
Expand Down Expand Up @@ -50,7 +50,7 @@ std::string PathPy::representation(void) const

PyObject *PathPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper
{
// create a new instance of PathPy and the Twin object
// create a new instance of PathPy and the Twin object
return new PathPy(new Toolpath);
}

Expand All @@ -68,7 +68,7 @@ int PathPy::PyInit(PyObject* args, PyObject* /*kwd*/)
getToolpathPtr()->addCommand(cmd);
} else {
PyErr_SetString(PyExc_TypeError, "The list must contain only Path Commands");
return -1;
return -1;
}
}
}
Expand All @@ -80,7 +80,7 @@ int PathPy::PyInit(PyObject* args, PyObject* /*kwd*/)
return 0;
}
PyErr_SetString(PyExc_TypeError, "Argument must be a list of commands or a gcode string");
return -1;
return -1;
}


Expand Down Expand Up @@ -234,7 +234,7 @@ PyObject *PathPy::getCustomAttributes(const char* /*attr*/) const

int PathPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
{
return 0;
return 0;
}


11 changes: 5 additions & 6 deletions src/Mod/Path/App/PathSegmentWalker.cpp
@@ -1,6 +1,4 @@
/*
***************************************************************************
* *
/***************************************************************************
* Copyright (c) 2019 sliptonic <shopinthewoods@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify *
Expand All @@ -19,8 +17,9 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA *
* *
***************************************************************************
*/
***************************************************************************/


#include "PreCompiled.h"
#include "PathSegmentWalker.h"

Expand Down Expand Up @@ -53,7 +52,7 @@ Base::Vector3d compensateRotation(const Base::Vector3d &pt, const Base::Rotation

Base::Rotation yawPitchRoll(double a, double b, double c)
{
Base::Rotation rot;
Base::Rotation rot;
rot.setYawPitchRoll(-c, -b, -a);
return rot;
}
Expand Down

0 comments on commit b75cd3d

Please sign in to comment.