Skip to content

Commit

Permalink
Merge remote-tracking branch 'sliptonic/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed Jun 13, 2016
2 parents dea884a + 451355e commit 24c279f
Show file tree
Hide file tree
Showing 30 changed files with 2,110 additions and 573 deletions.
2 changes: 1 addition & 1 deletion src/Mod/Path/PathScripts/PathAreaUtils.py
Expand Up @@ -375,7 +375,7 @@ def pocket(a,tool_radius, extra_offset, stepover, depthparams, from_center, keep
area_for_feed_possible = area.Area(a)
area_for_feed_possible.Offset(extra_offset - 0.01)

use_internal_function = (area.holes_linked() == False) # use internal function, if area module is the Clipper library
use_internal_function = False #(area.holes_linked() == False) # use internal function, if area module is the Clipper library

if use_internal_function:
curve_list = a.MakePocketToolpath(tool_radius, extra_offset, stepover, from_center, use_zig_zag, zig_angle)
Expand Down
25 changes: 20 additions & 5 deletions src/Mod/Path/PathScripts/PathDrilling.py
Expand Up @@ -79,10 +79,13 @@ def __setstate__(self, state):

def onChanged(self, obj, prop):
if prop == "UserLabel":
obj.Label = obj.UserLabel + " (" + obj.ToolDescription + ")"
obj.Label = obj.UserLabel + " :" + obj.ToolDescription

def execute(self, obj):
output = ""
if obj.Comment != "":
output += '(' + str(obj.Comment)+')\n'

toolLoad = PathUtils.getLastToolLoad(obj)
if toolLoad is None or toolLoad.ToolNumber == 0:
self.vertFeed = 100
Expand All @@ -100,9 +103,9 @@ def execute(self, obj):
obj.ToolDescription = toolLoad.Name

if obj.UserLabel == "":
obj.Label = obj.Name + " (" + obj.ToolDescription + ")"
obj.Label = obj.Name + " :" + obj.ToolDescription
else:
obj.Label = obj.UserLabel + " (" + obj.ToolDescription + ")"
obj.Label = obj.UserLabel + " :" + obj.ToolDescription

locations = []
output = "(Begin Drilling)\n"
Expand Down Expand Up @@ -155,8 +158,20 @@ def execute(self, obj):

output += "G80\n"

path = Path.Path(output)
obj.Path = path
# path = Path.Path(output)
# obj.Path = path

if obj.Active:
path = Path.Path(output)
obj.Path = path
obj.ViewObject.Visibility = True

else:
path = Path.Path("(inactive operation)")
obj.Path = path
obj.ViewObject.Visibility = False



def checkdrillable(self, obj, sub):
print "in checkdrillable"
Expand Down
22 changes: 17 additions & 5 deletions src/Mod/Path/PathScripts/PathEngrave.py
Expand Up @@ -81,10 +81,12 @@ def __setstate__(self, state):

def onChanged(self, obj, prop):
if prop == "UserLabel":
obj.Label = obj.UserLabel + " (" + obj.ToolDescription + ")"
obj.Label = obj.UserLabel + " :" + obj.ToolDescription

def execute(self, obj):
output = ""
if obj.Comment != "":
output += '(' + str(obj.Comment)+')\n'

toolLoad = PathUtils.getLastToolLoad(obj)
if toolLoad is None or toolLoad.ToolNumber == 0:
Expand All @@ -102,9 +104,9 @@ def execute(self, obj):
obj.ToolDescription = toolLoad.Name

if obj.UserLabel == "":
obj.Label = obj.Name + " (" + obj.ToolDescription + ")"
obj.Label = obj.Name + " :" + obj.ToolDescription
else:
obj.Label = obj.UserLabel + " (" + obj.ToolDescription + ")"
obj.Label = obj.UserLabel + " :" + obj.ToolDescription

if obj.Base:
for o in obj.Base:
Expand All @@ -118,8 +120,18 @@ def execute(self, obj):
# print output
if output == "":
output += "G0"
path = Path.Path(output)
obj.Path = path

if obj.Active:
path = Path.Path(output)
obj.Path = path
obj.ViewObject.Visibility = True

else:
path = Path.Path("(inactive operation)")
obj.Path = path
obj.ViewObject.Visibility = False
# path = Path.Path(output)
# obj.Path = path

def buildpathocc(self, obj, wires):
import Part
Expand Down
5 changes: 3 additions & 2 deletions src/Mod/Path/PathScripts/PathMachine.py
Expand Up @@ -73,8 +73,9 @@ def __init__(self, obj):
def execute(self, obj):
obj.Label = "Machine_" + str(obj.MachineName)
# need to filter this path out in post- only for visualization
gcode = 'G0 X' + str(obj.X.Value) + ' Y' + \
str(obj.Y.Value) + ' Z' + str(obj.Z.Value)
#gcode = 'G0 X' + str(obj.X.Value) + ' Y' + \
# str(obj.Y.Value) + ' Z' + str(obj.Z.Value)
gcode = '(' + str(obj.Label) + ')'
obj.Path = Path.Path(gcode)

def onChanged(self, obj, prop):
Expand Down
9 changes: 6 additions & 3 deletions src/Mod/Path/PathScripts/PathPocket.py
Expand Up @@ -111,7 +111,7 @@ def onChanged(self, obj, prop):
obj.setEditorMode('RampSize', 2) # make this hidden

if prop == "UserLabel":
obj.Label = obj.UserLabel + " (" + obj.ToolDescription + ")"
obj.Label = obj.UserLabel + " :" + obj.ToolDescription


def __getstate__(self):
Expand Down Expand Up @@ -233,6 +233,9 @@ def buildpathocc(self, obj, shape):

# Build up the offset loops
output = ""
if obj.Comment != "":
output += '(' + str(obj.Comment)+')\n'

offsets = []
nextradius = (self.radius * 2) * (float(obj.StepOver)/100)
result = DraftGeomUtils.pocket2d(shape, nextradius)
Expand Down Expand Up @@ -374,9 +377,9 @@ def execute(self, obj):
obj.ToolDescription = toolLoad.Name

if obj.UserLabel == "":
obj.Label = obj.Name + " (" + obj.ToolDescription + ")"
obj.Label = obj.Name + " :" + obj.ToolDescription
else:
obj.Label = obj.UserLabel + " (" + obj.ToolDescription + ")"
obj.Label = obj.UserLabel + " :" + obj.ToolDescription

if obj.Base:
for b in obj.Base:
Expand Down
11 changes: 7 additions & 4 deletions src/Mod/Path/PathScripts/PathProfile.py
Expand Up @@ -126,7 +126,7 @@ def __setstate__(self, state):

def onChanged(self, obj, prop):
if prop == "UserLabel":
obj.Label = obj.UserLabel + " (" + obj.ToolDescription + ")"
obj.Label = obj.UserLabel + " :" + obj.ToolDescription

def addprofilebase(self, obj, ss, sub=""):
baselist = obj.Base
Expand Down Expand Up @@ -170,7 +170,8 @@ def addprofilebase(self, obj, ss, sub=""):
def _buildPathOCC(self, obj, wire):
import DraftGeomUtils
output = ""
output += '(' + str(obj.Comment)+')\n'
if obj.Comment != "":
output += '(' + str(obj.Comment)+')\n'

if obj.Direction == 'CCW':
clockwise = False
Expand All @@ -193,6 +194,8 @@ def _buildPathLibarea(self, obj, edgelist):
import math
import area
output = ""
if obj.Comment != "":
output += '(' + str(obj.Comment)+')\n'

if obj.StartPoint and obj.UseStartPoint:
startpoint = obj.StartPoint
Expand Down Expand Up @@ -279,9 +282,9 @@ def execute(self, obj):
obj.ToolDescription = toolLoad.Name

if obj.UserLabel == "":
obj.Label = obj.Name + " (" + obj.ToolDescription + ")"
obj.Label = obj.Name + " :" + obj.ToolDescription
else:
obj.Label = obj.UserLabel + " (" + obj.ToolDescription + ")"
obj.Label = obj.UserLabel + " :" + obj.ToolDescription


if obj.Base:
Expand Down
20 changes: 15 additions & 5 deletions src/Mod/Path/PathScripts/PathRemote.py
Expand Up @@ -157,10 +157,12 @@ def onChanged(self, obj, prop):
obj.proplist = pl

if prop == "UserLabel":
obj.Label = obj.UserLabel + " (" + obj.ToolDescription + ")"
obj.Label = obj.UserLabel + " :" + obj.ToolDescription

def execute(self, obj):
output = ""
if obj.Comment != "":
output += '(' + str(obj.Comment)+')\n'

toolLoad = PathUtils.getLastToolLoad(obj)
if toolLoad is None or toolLoad.ToolNumber == 0:
Expand All @@ -178,13 +180,21 @@ def execute(self, obj):
obj.ToolDescription = toolLoad.Name

if obj.UserLabel == "":
obj.Label = obj.Name + " (" + obj.ToolDescription + ")"
obj.Label = obj.Name + " :" + obj.ToolDescription
else:
obj.Label = obj.UserLabel + " (" + obj.ToolDescription + ")"
obj.Label = obj.UserLabel + " :" + obj.ToolDescription

output += "(remote gcode goes here)"
path = Path.Path(output)
obj.Path = path

if obj.Active:
path = Path.Path(output)
obj.Path = path
obj.ViewObject.Visibility = True

else:
path = Path.Path("(inactive operation)")
obj.Path = path
obj.ViewObject.Visibility = False


class ViewProviderRemote:
Expand Down
18 changes: 13 additions & 5 deletions src/Mod/Path/PathScripts/PathSurface.py
Expand Up @@ -121,7 +121,7 @@ def __setstate__(self, state):

def onChanged(self, obj, prop):
if prop == "UserLabel":
obj.Label = obj.UserLabel + " (" + obj.ToolDescription + ")"
obj.Label = obj.UserLabel + " :" + obj.ToolDescription

def _waterline(self, obj, s, bb):
import ocl
Expand Down Expand Up @@ -258,6 +258,8 @@ def execute(self, obj):
FreeCAD.Console.PrintWarning(
translate("PathSurface", "Hold on. This might take a minute.\n"))
output = ""
if obj.Comment != "":
output += '(' + str(obj.Comment)+')\n'

toolLoad = PathUtils.getLastToolLoad(obj)
if toolLoad is None or toolLoad.ToolNumber == 0:
Expand All @@ -275,9 +277,9 @@ def execute(self, obj):
obj.ToolDescription = toolLoad.Name

if obj.UserLabel == "":
obj.Label = obj.Name + " (" + obj.ToolDescription + ")"
obj.Label = obj.Name + " :" + obj.ToolDescription
else:
obj.Label = obj.UserLabel + " (" + obj.ToolDescription + ")"
obj.Label = obj.UserLabel + " :" + obj.ToolDescription

if obj.Base:
for b in obj.Base:
Expand Down Expand Up @@ -312,9 +314,15 @@ def execute(self, obj):
elif obj.Algorithm == 'OCL Waterline':
output = self._waterline(obj, s, bb)

path = Path.Path(output)
obj.Path = path
if obj.Active:
path = Path.Path(output)
obj.Path = path
obj.ViewObject.Visibility = True

else:
path = Path.Path("(inactive operation)")
obj.Path = path
obj.ViewObject.Visibility = False

class ViewProviderSurface:

Expand Down
31 changes: 3 additions & 28 deletions src/Mod/Path/libarea/Arc.cpp
@@ -1,32 +1,7 @@
// Arc.cpp

/*==============================
Copyright (c) 2011-2015 Dan Heeks
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
==============================*/


// Copyright 2011, Dan Heeks
// This program is released under the BSD license. See the file COPYING for details.

#include "Arc.h"
#include "Curve.h"
Expand Down Expand Up @@ -91,7 +66,7 @@ Point CArc::MidParam(double param)const {

//segments - number of segments per full revolution!
//d_angle - determines the direction and the ammount of the arc to draw
void CArc::GetSegments(void(*callbackfunc)(const double *p), double pixels_per_mm, bool want_start_point)const
void CArc::GetSegments(void(*callbackfunc)(const double *p), double pixels_per_mm)const
{
if(m_s == m_e)
return;
Expand Down
29 changes: 3 additions & 26 deletions src/Mod/Path/libarea/Arc.h
@@ -1,29 +1,6 @@
// Arc.h
/*==============================
Copyright (c) 2011-2015 Dan Heeks
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
==============================*/
// Copyright 2011, Dan Heeks
// This program is released under the BSD license. See the file COPYING for details.

#pragma once

Expand All @@ -44,5 +21,5 @@ class CArc{
double IncludedAngle()const; // always > 0
bool AlmostALine()const;
Point MidParam(double param)const;
void GetSegments(void(*callbackfunc)(const double *p), double pixels_per_mm, bool want_start_point = true)const;
void GetSegments(void(*callbackfunc)(const double *p), double pixels_per_mm)const;
};

0 comments on commit 24c279f

Please sign in to comment.