PCH: Path App

This commit is contained in:
Abdullah Tahiri
2019-05-03 14:13:19 +02:00
committed by abdullahtahiriyo
parent 31d1c1d212
commit c03424c70e
8 changed files with 168 additions and 90 deletions

View File

@@ -23,66 +23,65 @@
#ifndef _PreComp_
# include <cfloat>
#endif
#include <boost/version.hpp>
#include <boost/config.hpp>
#if defined(BOOST_MSVC) && (BOOST_VERSION == 105500)
# include <boost/version.hpp>
# include <boost/config.hpp>
# if defined(BOOST_MSVC) && (BOOST_VERSION == 105500)
// for fixing issue https://svn.boost.org/trac/boost/ticket/9332
# include "boost_fix/intrusive/detail/memory_util.hpp"
# include "boost_fix/container/detail/memory_util.hpp"
#endif
#include <boost/geometry.hpp>
#include <boost/geometry/index/rtree.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/register/point.hpp>
#include <boost/range/adaptor/indexed.hpp>
#include <boost/range/adaptor/transformed.hpp>
# endif
# include <boost/geometry.hpp>
# include <boost/geometry/index/rtree.hpp>
# include <boost/geometry/geometries/geometries.hpp>
# include <boost/geometry/geometries/register/point.hpp>
# include <boost/range/adaptor/indexed.hpp>
# include <boost/range/adaptor/transformed.hpp>
#include <BRepLib.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRepBuilderAPI_FindPlane.hxx>
#include <BRepLib_FindSurface.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepTools.hxx>
#include <BRepTools_WireExplorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <GeomAbs_JoinType.hxx>
#include <Geom_Circle.hxx>
#include <Geom_Ellipse.hxx>
#include <Geom_Line.hxx>
#include <Geom_Plane.hxx>
#include <Standard_Failure.hxx>
#include <gp_Circ.hxx>
#include <gp_GTrsf.hxx>
#include <Standard_Version.hxx>
#include <GCPnts_QuasiUniformDeflection.hxx>
#include <GCPnts_UniformAbscissa.hxx>
#include <BRepBndLib.hxx>
#include <BRepLib_MakeFace.hxx>
#include <Bnd_Box.hxx>
#include <BRepBuilderAPI_Copy.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <BRepExtrema_DistShapeShape.hxx>
#include <HLRBRep.hxx>
#include <HLRBRep_Algo.hxx>
#include <HLRBRep_HLRToShape.hxx>
#include <HLRAlgo_Projector.hxx>
#include <ShapeFix_ShapeTolerance.hxx>
#include <ShapeExtend_WireData.hxx>
#include <ShapeFix_Wire.hxx>
#include <ShapeAnalysis_FreeBounds.hxx>
#include <TopTools_HSequenceOfShape.hxx>
# include <BRepLib.hxx>
# include <BRep_Builder.hxx>
# include <BRep_Tool.hxx>
# include <BRepAdaptor_Curve.hxx>
# include <BRepAdaptor_Surface.hxx>
# include <BRepBuilderAPI_FindPlane.hxx>
# include <BRepLib_FindSurface.hxx>
# include <BRepBuilderAPI_MakeEdge.hxx>
# include <BRepBuilderAPI_MakeWire.hxx>
# include <BRepBuilderAPI_MakeFace.hxx>
# include <BRepTools.hxx>
# include <BRepTools_WireExplorer.hxx>
# include <TopoDS.hxx>
# include <TopoDS_Compound.hxx>
# include <TopoDS_Solid.hxx>
# include <TopoDS_Vertex.hxx>
# include <TopExp.hxx>
# include <TopExp_Explorer.hxx>
# include <GeomAbs_JoinType.hxx>
# include <Geom_Circle.hxx>
# include <Geom_Ellipse.hxx>
# include <Geom_Line.hxx>
# include <Geom_Plane.hxx>
# include <Standard_Failure.hxx>
# include <gp_Circ.hxx>
# include <gp_GTrsf.hxx>
# include <Standard_Version.hxx>
# include <GCPnts_QuasiUniformDeflection.hxx>
# include <GCPnts_UniformAbscissa.hxx>
# include <BRepBndLib.hxx>
# include <BRepLib_MakeFace.hxx>
# include <Bnd_Box.hxx>
# include <BRepBuilderAPI_Copy.hxx>
# include <BRepBuilderAPI_MakeVertex.hxx>
# include <BRepExtrema_DistShapeShape.hxx>
# include <HLRBRep.hxx>
# include <HLRBRep_Algo.hxx>
# include <HLRBRep_HLRToShape.hxx>
# include <HLRAlgo_Projector.hxx>
# include <ShapeFix_ShapeTolerance.hxx>
# include <ShapeExtend_WireData.hxx>
# include <ShapeFix_Wire.hxx>
# include <ShapeAnalysis_FreeBounds.hxx>
# include <TopTools_HSequenceOfShape.hxx>
#endif
#include <Base/Exception.h>
#include <Base/Tools.h>

View File

@@ -116,6 +116,13 @@ SOURCE_GROUP("Module" FILES ${Mod_SRCS})
add_library(Path SHARED ${Path_SRCS})
target_link_libraries(Path ${Path_LIBS})
if(FREECAD_USE_PCH)
add_definitions(-D_PreComp_)
GET_MSVC_PRECOMPILED_SOURCE("PreCompiled.cpp" Path_CPP_SRCS ${Path_SRCS})
ADD_MSVC_PRECOMPILED_HEADER(Path PreCompiled.h PreCompiled.cpp Path_CPP_SRCS)
endif(FREECAD_USE_PCH)
SET_BIN_DIR(Path Path /Mod/Path)
SET_PYTHON_PREFIX_SUFFIX(Path)

View File

@@ -24,12 +24,12 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <cinttypes>
# include <iomanip>
# include <boost/algorithm/string.hpp>
# include <boost/lexical_cast.hpp>
#endif
#include <cinttypes>
#include <iomanip>
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include <Base/Vector3D.h>
#include <Base/Rotation.h>
#include <Base/Writer.h>
@@ -103,7 +103,7 @@ std::string Command::toGCode (int precision, bool padzero) const
std::stringstream str;
str.fill('0');
str << Name;
if(precision<0)
if(precision<0)
precision = 0;
double scale = std::pow(10.0,precision+1);
std::int64_t iscale = static_cast<std::int64_t>(scale)/10;

View File

@@ -22,7 +22,10 @@
#include "PreCompiled.h"
#include <boost/algorithm/string.hpp>
#ifndef _PreComp_
# include <boost/algorithm/string.hpp>
#endif
#include <Base/Exception.h>
#include <Base/Vector3D.h>

View File

@@ -23,11 +23,10 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <BRep_Builder.hxx>
# include <TopoDS_Compound.hxx>
#endif
#include <BRep_Builder.hxx>
#include <TopoDS_Compound.hxx>
#include "FeatureArea.h"
#include "FeatureAreaPy.h"
#include <App/DocumentObjectPy.h>
@@ -106,7 +105,7 @@ App::DocumentObjectExecReturn *FeatureArea::execute(void)
}
myShapes.clear();
if(myArea.getSectionCount()==0)
if(myArea.getSectionCount()==0)
myShapes.push_back(myArea.getShape(-1));
else {
myShapes.reserve(myArea.getSectionCount());

View File

@@ -19,13 +19,20 @@
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
/*
* Copyright (c) 2017 Zheng, Lei <realthunder.dev@gmail.com>
/*
* Copyright (c) 2017 Zheng, Lei <realthunder.dev@gmail.com>
*/
#include "PreCompiled.h"
#ifndef _PreComp_
# include <TopoDS.hxx>
# include <TopoDS_Shape.hxx>
# include <TopoDS_Edge.hxx>
# include <TopExp_Explorer.hxx>
# include <Standard_Failure.hxx>
# include <Standard_Version.hxx>
# include <BRepBuilderAPI_MakeWire.hxx>
#endif
#include "FeaturePathShape.h"
@@ -36,14 +43,6 @@
#include <Mod/Part/App/TopoShape.h>
#include <Mod/Part/App/PartFeature.h>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Edge.hxx>
#include <TopExp_Explorer.hxx>
#include <Standard_Failure.hxx>
#include <Standard_Version.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include "FeatureArea.h"
using namespace Path;

View File

@@ -24,10 +24,9 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <boost/regex.hpp>
#endif
#include <boost/regex.hpp>
#include <Base/Writer.h>
#include <Base/Reader.h>
#include <Base/Stream.h>
@@ -79,7 +78,7 @@ Toolpath &Toolpath::operator=(const Toolpath& otherPath)
return *this;
}
void Toolpath::clear(void)
void Toolpath::clear(void)
{
for(std::vector<Command*>::iterator it = vpcCommands.begin();it!=vpcCommands.end();++it)
delete ( *it );
@@ -167,12 +166,12 @@ static void bulkAddCommand(const std::string &gcodestr, std::vector<Command*> &c
void Toolpath::setFromGCode(const std::string instr)
{
clear();
// remove comments
//boost::regex e("\\(.*?\\)");
//std::string str = boost::regex_replace(instr, e, "");
std::string str(instr);
// split input string by () or G or M commands
std::string mode = "command";
std::size_t found = str.find_first_of("(gGmM");
@@ -225,23 +224,23 @@ std::string Toolpath::toGCode(void) const
result += "\n";
}
return result;
}
}
void Toolpath::recalculate(void) // recalculates the path cache
{
if(vpcCommands.size()==0)
return;
// TODO recalculate the KDL stuff. At the moment, this is unused.
#if 0
// delete the old and create a new one
if(pcPath)
if(pcPath)
delete (pcPath);
pcPath = new KDL::Path_Composite();
KDL::Path *tempPath;
KDL::Frame Last;
@@ -350,7 +349,7 @@ void Toolpath::RestoreDocFile(Base::Reader &reader)
{
std::string gcode;
std::string line;
while (reader >> line) {
while (reader >> line) {
gcode += line;
gcode += " ";
}
@@ -361,4 +360,4 @@ void Toolpath::RestoreDocFile(Base::Reader &reader)

View File

@@ -53,8 +53,80 @@
#include <bitset>
#include <cctype>
#include <cinttypes>
#include <iomanip>
// Python
#include <Python.h>
// Boost
#include <boost/version.hpp>
#include <boost/config.hpp>
#if defined(BOOST_MSVC) && (BOOST_VERSION == 105500)
// for fixing issue https://svn.boost.org/trac/boost/ticket/9332
# include "boost_fix/intrusive/detail/memory_util.hpp"
# include "boost_fix/container/detail/memory_util.hpp"
#endif
#include <boost/geometry.hpp>
#include <boost/geometry/index/rtree.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/register/point.hpp>
#include <boost/range/adaptor/indexed.hpp>
#include <boost/range/adaptor/transformed.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/regex.hpp>
//OCC
#include <BRepLib.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRepBuilderAPI_FindPlane.hxx>
#include <BRepLib_FindSurface.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepTools.hxx>
#include <BRepTools_WireExplorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <GeomAbs_JoinType.hxx>
#include <Geom_Circle.hxx>
#include <Geom_Ellipse.hxx>
#include <Geom_Line.hxx>
#include <Geom_Plane.hxx>
#include <Standard_Failure.hxx>
#include <gp_Circ.hxx>
#include <gp_GTrsf.hxx>
#include <Standard_Version.hxx>
#include <GCPnts_QuasiUniformDeflection.hxx>
#include <GCPnts_UniformAbscissa.hxx>
#include <BRepBndLib.hxx>
#include <BRepLib_MakeFace.hxx>
#include <Bnd_Box.hxx>
#include <BRepBuilderAPI_Copy.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <BRepExtrema_DistShapeShape.hxx>
#include <HLRBRep.hxx>
#include <HLRBRep_Algo.hxx>
#include <HLRBRep_HLRToShape.hxx>
#include <HLRAlgo_Projector.hxx>
#include <ShapeFix_ShapeTolerance.hxx>
#include <ShapeExtend_WireData.hxx>
#include <ShapeFix_Wire.hxx>
#include <ShapeAnalysis_FreeBounds.hxx>
#include <TopTools_HSequenceOfShape.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Edge.hxx>
#endif // _PreComp_
#endif