Path: Adaptive - prepping the PR

This commit is contained in:
kreso-t
2018-09-08 16:17:31 +02:00
committed by wmayer
parent 6db02838c3
commit 43ee740ef7
5 changed files with 102 additions and 6 deletions

View File

@@ -109,7 +109,7 @@ class PathWorkbench (Workbench):
projcmdlist = ["Path_Job", "Path_Post"]
toolcmdlist = ["Path_Inspect", "Path_Simulator", "Path_ToolLibraryEdit", "Path_SelectLoop"]
prepcmdlist = ["Path_Fixture", "Path_Comment", "Path_Stop", "Path_Custom"]
twodopcmdlist = ["Path_Contour", "Path_Profile_Faces", "Path_Profile_Edges", "Path_Pocket_Shape", "Path_Drilling", "Path_MillFace", "Path_Helix", "Path_Adaptive"]
twodopcmdlist = ["Path_Contour", "Path_Profile_Faces", "Path_Profile_Edges", "Path_Pocket_Shape", "Path_Drilling", "Path_MillFace", "Path_Helix" ]
threedopcmdlist = ["Path_Pocket_3D"]
engravecmdlist = ["Path_Engrave"]
modcmdlist = ["Path_OperationCopy", "Path_Array", "Path_SimpleCopy" ]
@@ -130,6 +130,8 @@ class PathWorkbench (Workbench):
threedopcmdlist.append("Path_Surface")
threedcmdgroup = ['Path_3dTools']
FreeCADGui.addCommand('Path_3dTools', PathCommandGroup(threedopcmdlist, QtCore.QT_TRANSLATE_NOOP("Path",'3D Operations')))
twodopcmdlist.append("Path_Adaptive")
else:
engravecmdgroup = engravecmdlist
threedcmdgroup = threedopcmdlist

View File

@@ -1,3 +1,26 @@
# /**************************************************************************
# * Copyright (c) Kresimir Tusek (kresimir.tusek@gmail.com) 2018 *
# * This file is part of the FreeCAD CAx development system. *
# * *
# * This library is free software; you can redistribute it and/or *
# * modify it under the terms of the GNU Library General Public *
# * License as published by the Free Software Foundation; either *
# * version 2 of the License, or (at your option) any later version. *
# * *
# * This library is distributed in the hope that it will be useful, *
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
# * GNU Library General Public License for more details. *
# * *
# * You should have received a copy of the GNU Library General Public *
# * License along with this library; see the file COPYING.LIB. If not, *
# * write to the Free Software Foundation, Inc., 59 Temple Place, *
# * Suite 330, Boston, MA 02111-1307, USA *
# * *
# ***************************************************************************/
import PathScripts.PathOp as PathOp
import Path
import FreeCAD
@@ -360,7 +383,7 @@ class PathAdaptive(PathOp.ObjectOp):
obj.addProperty("App::PropertyLength", "HelixDiameterLimit", "Adaptive", "Limit helix entry diameter, if limit larger than tool diameter or 0, tool diameter is used")
def opSetDefaultValues(self, obj):
def opSetDefaultValues(self, obj, job):
obj.Side="Inside"
obj.OperationType = "Clearing"
obj.Tolerance = 0.1

View File

@@ -1,3 +1,24 @@
# /**************************************************************************
# * Copyright (c) Kresimir Tusek (kresimir.tusek@gmail.com) 2018 *
# * This file is part of the FreeCAD CAx development system. *
# * *
# * This library is free software; you can redistribute it and/or *
# * modify it under the terms of the GNU Library General Public *
# * License as published by the Free Software Foundation; either *
# * version 2 of the License, or (at your option) any later version. *
# * *
# * This library is distributed in the hope that it will be useful, *
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
# * GNU Library General Public License for more details. *
# * *
# * You should have received a copy of the GNU Library General Public *
# * License along with this library; see the file COPYING.LIB. If not, *
# * write to the Free Software Foundation, Inc., 59 Temple Place, *
# * Suite 330, Boston, MA 02111-1307, USA *
# * *
# ***************************************************************************/
import FreeCAD
import FreeCADGui
import PathScripts.PathLog as PathLog

View File

@@ -1,3 +1,24 @@
/**************************************************************************
* Copyright (c) Kresimir Tusek (kresimir.tusek@gmail.com) 2018 *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "Adaptive.hpp"
#include <iostream>
#include <cmath>
@@ -15,7 +36,7 @@ namespace AdaptivePath {
using namespace ClipperLib;
using namespace std;
#define SAME_POINT_TOL_SQRD_SCALED 16.0
#define UNUSED(expr) (void)(expr)
/*********************************************
* Utils - inline
***********************************************/
@@ -1362,6 +1383,10 @@ namespace AdaptivePath {
Paths &cleared /*output-initial cleard area by helix*/,
IntPoint &entryPoint /*output*/,
IntPoint & toolPos, DoublePoint & toolDir) {
UNUSED(progressPaths); // to silence compiler warning
UNUSED(boundPaths); // to silence compiler warning
Clipper clip;
ClipperOffset clipof;
// check if boundary shape to cut is outside the stock
@@ -1452,6 +1477,9 @@ namespace AdaptivePath {
void Adaptive2d::AppendToolPath(TPaths &progressPaths,AdaptiveOutput & output,const Path & passToolPath,const Paths & cleared, const Paths & toolBoundPaths) {
if(passToolPath.size()<1) return;
UNUSED(progressPaths); // to silence compiler warning,var is occasionally used in dev. for debugging
IntPoint nextPoint(passToolPath[0]);
// if there is a previous path - need to resolve linking move to new path
@@ -1761,7 +1789,7 @@ namespace AdaptivePath {
entryPoint=toolPos;
}
cout << "Entry point:" << double(entryPoint.X)/scaleFactor << "," << double(entryPoint.Y)/scaleFactor << endl;
//cout << "Entry point:" << double(entryPoint.X)/scaleFactor << "," << double(entryPoint.Y)/scaleFactor << endl;
AdaptiveOutput output;
output.HelixCenterPoint.first = double(entryPoint.X)/scaleFactor;
@@ -2077,7 +2105,7 @@ namespace AdaptivePath {
Path finShiftedPath;
bool allCutsAllowed=true;
while(PopPathWithClosestPoint(finishingPaths,lastPoint,finShiftedPath)) {
while(!stopProcessing && PopPathWithClosestPoint(finishingPaths,lastPoint,finShiftedPath)) {
if(finShiftedPath.empty()) continue;
// skip finishing passes outside the stock boundary - make no sense to cut where is no material
bool allPointsOutside=true;
@@ -2167,7 +2195,6 @@ namespace AdaptivePath {
// make sure invalid paths are not used
if(!allCutsAllowed) {
cerr << "INVALID CUTS DETECTED! Please try to modify accuracy and/or step-over." << endl;
output.AdaptivePaths.clear();
}
results.push_back(output);

View File

@@ -1,3 +1,26 @@
/**************************************************************************
* Copyright (c) Kresimir Tusek (kresimir.tusek@gmail.com) 2018 *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "clipper.hpp"
#include <vector>
#include <list>