Merge pull request #357 from mlampert/PathGeom

Path: Path->Wire transformation and other goemetry helpers.
This commit is contained in:
wwmayer 2016-12-01 12:48:03 +01:00 committed by GitHub
commit 01fd5ce6f3
17 changed files with 833 additions and 148 deletions

View File

@ -1662,12 +1662,15 @@ TopoDS_Shape TopoShape::makeHelix(Standard_Real pitch, Standard_Real height,
Standard_Boolean leftHanded,
Standard_Boolean newStyle) const
{
if (pitch < Precision::Confusion())
if (fabs(pitch) < Precision::Confusion())
Standard_Failure::Raise("Pitch of helix too small");
if (height < Precision::Confusion())
if (fabs(height) < Precision::Confusion())
Standard_Failure::Raise("Height of helix too small");
if ((height > 0 && pitch < 0) || (height < 0 && pitch > 0))
Standard_Failure::Raise("Pitch and height of helix not compatible");
gp_Ax2 cylAx2(gp_Pnt(0.0,0.0,0.0) , gp::DZ());
Handle_Geom_Surface surf;
if (angle < Precision::Confusion()) {

View File

@ -16,61 +16,68 @@ INSTALL(
SET(PathScripts_SRCS
PathCommands.py
PathScripts/__init__.py
PathScripts/PostUtils.py
PathScripts/example_pre.py
PathScripts/opensbp_pre.py
PathScripts/opensbp_post.py
PathScripts/example_post.py
PathScripts/linuxcnc_post.py
PathScripts/centroid_post.py
PathScripts/comparams_post.py
PathScripts/dynapath_post.py
PathScripts/generic_post.py
PathScripts/dumper_post.py
PathScripts/rml_post.py
PathScripts/TooltableEditor.py
PathScripts/PathProfile.py
PathScripts/PathProfileEdges.py
PathScripts/PathContour.py
PathScripts/PathMillFace.py
PathScripts/PathPocket.py
PathScripts/PathDrilling.py
PathScripts/PathDressup.py
PathScripts/DogboneDressup.py
PathScripts/DragknifeDressup.py
PathScripts/PathHop.py
PathScripts/PathUtils.py
PathScripts/PathSelection.py
PathScripts/PathFixture.py
PathScripts/PathCopy.py
PathScripts/PathAreaUtils.py
PathScripts/PathArray.py
PathScripts/PathComment.py
PathScripts/PathCompoundExtended.py
PathScripts/PathContour.py
PathScripts/PathCopy.py
PathScripts/PathCustom.py
PathScripts/PathDressup.py
PathScripts/PathDrilling.py
PathScripts/PathEngrave.py
PathScripts/PathFacePocket.py
PathScripts/PathFaceProfile.py
PathScripts/PathFixture.py
PathScripts/PathFromShape.py
PathScripts/PathGeom.py
PathScripts/PathHop.py
PathScripts/PathInspect.py
PathScripts/PathJob.py
PathScripts/PathStock.py
PathScripts/PathKurveUtils.py
PathScripts/PathLoadTool.py
PathScripts/PathMillFace.py
PathScripts/PathPlane.py
PathScripts/PathPocket.py
PathScripts/PathPost.py
PathScripts/PathPostProcessor.py
PathScripts/PathLoadTool.py
PathScripts/PathToolLenOffset.py
PathScripts/PathComment.py
PathScripts/PathStop.py
PathScripts/PathFromShape.py
PathScripts/PathKurveUtils.py
PathScripts/PathAreaUtils.py
PathScripts/slic3r_pre.py
PathScripts/PathFaceProfile.py
PathScripts/PathFacePocket.py
PathScripts/PathArray.py
PathScripts/PathCustom.py
PathScripts/PathInspect.py
PathScripts/PathSimpleCopy.py
PathScripts/PathEngrave.py
PathScripts/PathSurface.py
PathScripts/PathPreferences.py
PathScripts/PathPreferencesPathJob.py
PathScripts/PathProfile.py
PathScripts/PathProfileEdges.py
PathScripts/PathRemote.py
PathScripts/PathSanity.py
PathScripts/PathSelection.py
PathScripts/PathSimpleCopy.py
PathScripts/PathStock.py
PathScripts/PathStop.py
PathScripts/PathSurface.py
PathScripts/PathToolLenOffset.py
PathScripts/PathToolLibraryManager.py
PathScripts/DogboneDressup.py
PathScripts/PathPreferencesPathJob.py
PathScripts/PathPreferences.py
PathScripts/PathUtils.py
PathScripts/PostUtils.py
PathScripts/TooltableEditor.py
PathScripts/__init__.py
PathScripts/centroid_post.py
PathScripts/comparams_post.py
PathScripts/dumper_post.py
PathScripts/dynapath_post.py
PathScripts/example_post.py
PathScripts/example_pre.py
PathScripts/generic_post.py
PathScripts/linuxcnc_post.py
PathScripts/opensbp_post.py
PathScripts/opensbp_pre.py
PathScripts/rml_post.py
PathScripts/slic3r_pre.py
PathTests/PathTestUtils.py
PathTests/TestPathGeom.py
PathTests/TestPathPost.py
PathTests/__init__.py
PathTests/test_linuxcnc_00.ngc
TestPathApp.py
)
SET(PathScripts_NC_SRCS

View File

@ -1,94 +1,94 @@
<RCC>
<qresource>
<file>icons/preferences-path.svg</file>
<file>icons/Path-Toolpath.svg</file>
<file>icons/Path-Compound.svg</file>
<file>icons/Path-Shape.svg</file>
<file>icons/Path-Profile.svg</file>
<file>icons/Path-Contour.svg</file>
<file>icons/Path-Pocket.svg</file>
<file>icons/Path-Drilling.svg</file>
<file>icons/Path-Job.svg</file>
<file>icons/Path-Dressup.svg</file>
<file>icons/Path-Hop.svg</file>
<file>icons/Path-Datums.svg</file>
<file>icons/Path-Copy.svg</file>
<file>icons/Path-ToolTable.svg</file>
<file>icons/Path-LengthOffset.svg</file>
<file>icons/Path-Axis.svg</file>
<file>icons/Path-Stock.svg</file>
<file>icons/Path-Plane.svg</file>
<file>icons/Path-Post.svg</file>
<file>icons/Path-LoadTool.svg</file>
<file>icons/Path-Comment.svg</file>
<file>icons/Path-Stop.svg</file>
<file>icons/Path-Machine.svg</file>
<file>icons/Path-Kurve.svg</file>
<file>icons/Path-FaceProfile.svg</file>
<file>icons/Path-FacePocket.svg</file>
<file>icons/Path-Array.svg</file>
<file>icons/Path-Custom.svg</file>
<file>icons/Path-Inspect.svg</file>
<file>icons/Path-ToolChange.svg</file>
<file>icons/Path-SimpleCopy.svg</file>
<file>icons/Path-Engrave.svg</file>
<file>icons/Path-Sanity.svg</file>
<file>icons/Path-3DSurface.svg</file>
<file>icons/Path-Speed.svg</file>
<file>icons/Path-Array.svg</file>
<file>icons/Path-Axis.svg</file>
<file>icons/Path-BaseGeometry.svg</file>
<file>icons/Path-Comment.svg</file>
<file>icons/Path-Compound.svg</file>
<file>icons/Path-Contour.svg</file>
<file>icons/Path-Copy.svg</file>
<file>icons/Path-Custom.svg</file>
<file>icons/Path-Datums.svg</file>
<file>icons/Path-Depths.svg</file>
<file>icons/Path-Dressup.svg</file>
<file>icons/Path-Drilling.svg</file>
<file>icons/Path-Engrave.svg</file>
<file>icons/Path-FacePocket.svg</file>
<file>icons/Path-FaceProfile.svg</file>
<file>icons/Path-Face.svg</file>
<file>icons/Path-Heights.svg</file>
<file>icons/Path-Hop.svg</file>
<file>icons/Path-Inspect.svg</file>
<file>icons/Path-Job.svg</file>
<file>icons/Path-Kurve.svg</file>
<file>icons/Path-LengthOffset.svg</file>
<file>icons/Path-LoadTool.svg</file>
<file>icons/Path-MachineLathe.svg</file>
<file>icons/Path-MachineMill.svg</file>
<file>icons/Path-Machine.svg</file>
<file>icons/Path-OperationA.svg</file>
<file>icons/Path-OperationB.svg</file>
<file>icons/Path-Plane.svg</file>
<file>icons/Path-Pocket.svg</file>
<file>icons/Path-Post.svg</file>
<file>icons/Path-Profile-Edges.svg</file>
<file>icons/Path-Profile-Face.svg</file>
<file>icons/Path-Profile.svg</file>
<file>icons/Path-Sanity.svg</file>
<file>icons/Path-SelectLoop.svg</file>
<file>icons/Path-Face.svg</file>
<file>translations/Path_de.qm</file>
<file>icons/Path-Shape.svg</file>
<file>icons/Path-SimpleCopy.svg</file>
<file>icons/Path-Speed.svg</file>
<file>icons/Path-Stock.svg</file>
<file>icons/Path-Stop.svg</file>
<file>icons/Path-ToolChange.svg</file>
<file>icons/Path-Toolpath.svg</file>
<file>icons/Path-ToolTable.svg</file>
<file>icons/preferences-path.svg</file>
<file>panels/ContourEdit.ui</file>
<file>panels/DlgJobChooser.ui</file>
<file>panels/DlgSelectPostProcessor.ui</file>
<file>panels/DlgToolCopy.ui</file>
<file>panels/DogboneEdit.ui</file>
<file>panels/DrillingEdit.ui</file>
<file>panels/EngraveEdit.ui</file>
<file>panels/JobEdit.ui</file>
<file>panels/MillFaceEdit.ui</file>
<file>panels/PocketEdit.ui</file>
<file>panels/ProfileEdgesEdit.ui</file>
<file>panels/ProfileEdit.ui</file>
<file>panels/RemoteEdit.ui</file>
<file>panels/SurfaceEdit.ui</file>
<file>panels/ToolControl.ui</file>
<file>panels/ToolEdit.ui</file>
<file>panels/ToolLibraryEditor.ui</file>
<file>preferences/PathJob.ui</file>
<file>translations/Path_af.qm</file>
<file>translations/Path_zh-CN.qm</file>
<file>translations/Path_zh-TW.qm</file>
<file>translations/Path_hr.qm</file>
<file>translations/Path_cs.qm</file>
<file>translations/Path_nl.qm</file>
<file>translations/Path_de.qm</file>
<file>translations/Path_el.qm</file>
<file>translations/Path_es-ES.qm</file>
<file>translations/Path_fi.qm</file>
<file>translations/Path_fr.qm</file>
<file>translations/Path_hr.qm</file>
<file>translations/Path_hu.qm</file>
<file>translations/Path_it.qm</file>
<file>translations/Path_ja.qm</file>
<file>translations/Path_nl.qm</file>
<file>translations/Path_no.qm</file>
<file>translations/Path_pl.qm</file>
<file>translations/Path_pt-BR.qm</file>
<file>translations/Path_pt-PT.qm</file>
<file>translations/Path_ro.qm</file>
<file>translations/Path_ru.qm</file>
<file>translations/Path_sr.qm</file>
<file>translations/Path_es-ES.qm</file>
<file>translations/Path_sv-SE.qm</file>
<file>translations/Path_uk.qm</file>
<file>translations/Path_it.qm</file>
<file>translations/Path_pt-BR.qm</file>
<file>translations/Path_el.qm</file>
<file>translations/Path_sk.qm</file>
<file>translations/Path_tr.qm</file>
<file>translations/Path_sl.qm</file>
<file>panels/EngraveEdit.ui</file>
<file>panels/DrillingEdit.ui</file>
<file>panels/PocketEdit.ui</file>
<file>panels/ProfileEdit.ui</file>
<file>panels/SurfaceEdit.ui</file>
<file>panels/RemoteEdit.ui</file>
<file>panels/ToolControl.ui</file>
<file>panels/ToolLibraryEditor.ui</file>
<file>panels/JobEdit.ui</file>
<file>panels/DlgToolCopy.ui</file>
<file>panels/ToolEdit.ui</file>
<file>panels/DlgJobChooser.ui</file>
<file>panels/ContourEdit.ui</file>
<file>panels/MillFaceEdit.ui</file>
<file>panels/ProfileEdgesEdit.ui</file>
<file>panels/DogboneEdit.ui</file>
<file>panels/DlgSelectPostProcessor.ui</file>
<file>preferences/PathJob.ui</file>
<file>translations/Path_sr.qm</file>
<file>translations/Path_sv-SE.qm</file>
<file>translations/Path_tr.qm</file>
<file>translations/Path_uk.qm</file>
<file>translations/Path_zh-CN.qm</file>
<file>translations/Path_zh-TW.qm</file>
</qresource>
</RCC>

View File

@ -25,8 +25,7 @@ class PathWorkbench (Workbench):
"Path workbench"
def __init__(self):
self.__class__.Icon = FreeCAD.getResourceDir(
) + "Mod/Path/Resources/icons/PathWorkbench.svg"
self.__class__.Icon = FreeCAD.getResourceDir() + "Mod/Path/Resources/icons/PathWorkbench.svg"
self.__class__.MenuText = "Path"
self.__class__.ToolTip = "Path workbench"

View File

@ -28,10 +28,11 @@ from FreeCAD import Vector
import TechDraw
from PathScripts import PathUtils
from PathScripts.PathUtils import depth_params
from PySide import QtCore
if FreeCAD.GuiUp:
import FreeCADGui
from PySide import QtCore, QtGui
from PySide import QtGui
# Qt tanslation handling
try:
_encoding = QtGui.QApplication.UnicodeUTF8
@ -258,7 +259,8 @@ class ObjectContour:
if obj.Active:
path = Path.Path(output)
obj.Path = path
obj.ViewObject.Visibility = True
if obj.ViewObject:
obj.ViewObject.Visibility = True
else:
path = Path.Path("(inactive operation)")

View File

@ -0,0 +1,195 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2016 sliptonic <shopinthewoods@gmail.com> *
# * *
# * This program is free software; you can redistribute it and/or modify *
# * it under the terms of the GNU Lesser General Public License (LGPL) *
# * as published by the Free Software Foundation; either version 2 of *
# * the License, or (at your option) any later version. *
# * for detail see the LICENCE text file. *
# * *
# * This program 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 program; if not, write to the Free Software *
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
# * USA *
# * *
# ***************************************************************************
import FreeCAD
import math
import Part
import Path
from FreeCAD import Vector
class Side:
"""Class to determine and define the side a Path is on, or Vectors are in relation to each other."""
Left = +1
Right = -1
Straight = 0
On = 0
@classmethod
def toString(cls, side):
"""(side)
Returns a string representation of the enum value."""
if side == cls.Left:
return 'Left'
if side == cls.Right:
return 'Right'
return 'On'
@classmethod
def of(cls, ptRef, pt):
"""(ptRef, pt)
Determine the side of pt in relation to ptRef.
If both Points are viewed as vectors with their origin in (0,0,0)
then the two vectors are either form a straigt line (On) or pt
lies in the left or right hemishpere in regards to ptRef."""
d = -ptRef.x*pt.y + ptRef.y*pt.x
if d < 0:
return cls.Left
if d > 0:
return cls.Right
return cls.Straight
class PathGeom:
"""Class to transform Path Commands into Edges and Wire and back again.
The interface might eventuallly become part of Path itself."""
CmdMoveFast = ['G0', 'G00']
CmdMoveStraight = ['G1', 'G01']
CmdMoveCW = ['G2', 'G02']
CmdMoveCCW = ['G3', 'G03']
CmdMoveArc = CmdMoveCW + CmdMoveCCW
CmdMove = CmdMoveStraight + CmdMoveArc
@classmethod
def getAngle(cls, vertex):
"""(vertex)
Returns the angle [-pi,pi] of a vertex using the X-axis as the reference.
Positive angles for vertexes in the upper hemishpere (positive y values)
and negative angles for the lower hemishpere."""
a = vertex.getAngle(FreeCAD.Vector(1,0,0))
if vertex.y < 0:
return -a
return a
@classmethod
def diffAngle(cls, a1, a2, direction = 'CW'):
"""(a1, a2, [direction='CW'])
Returns the difference between two angles (a1 -> a2) into a given direction."""
if direction == 'CW':
while a1 < a2:
a1 += 2*math.pi
a = a1 - a2
else:
while a2 < a1:
a2 += 2*math.pi
a = a2 - a1
return a
@classmethod
def commandEndPoint(cls, cmd, defaultPoint = Vector(), X='X', Y='Y', Z='Z'):
"""(cmd, [defaultPoint=Vector()], [X='X'], [Y='Y'], [Z='Z'])
Extracts the end point from a Path Command."""
x = cmd.Parameters.get(X, defaultPoint.x)
y = cmd.Parameters.get(Y, defaultPoint.y)
z = cmd.Parameters.get(Z, defaultPoint.z)
return FreeCAD.Vector(x, y, z)
@classmethod
def xy(cls, point):
"""(point)
Convenience function to return the projection of the Vector in the XY-plane."""
return Vector(point.x, point.y, 0)
@classmethod
def edgeForCmd(cls, cmd, startPoint):
"""(cmd, startPoint).
Returns an Edge representing the given command, assuming a given startPoint."""
endPoint = cls.commandEndPoint(cmd, startPoint)
if (cmd.Name in cls.CmdMoveStraight) or (cmd.Name in cls.CmdMoveFast):
return Part.Edge(Part.Line(startPoint, endPoint))
if cmd.Name in cls.CmdMoveArc:
center = startPoint + cls.commandEndPoint(cmd, Vector(0,0,0), 'I', 'J', 'K')
A = cls.xy(startPoint - center)
B = cls.xy(endPoint - center)
d = -B.x * A.y + B.y * A.x
if d == 0:
# we're dealing with half a circle here
angle = cls.getAngle(A) + math.pi/2
if cmd.Name in cls.CmdMoveCW:
angle -= math.pi
else:
C = A + B
angle = cls.getAngle(C)
R = A.Length
#print("arc: p1=(%.2f, %.2f) p2=(%.2f, %.2f) -> center=(%.2f, %.2f)" % (startPoint.x, startPoint.y, endPoint.x, endPoint.y, center.x, center.y))
#print("arc: A=(%.2f, %.2f) B=(%.2f, %.2f) -> d=%.2f" % (A.x, A.y, B.x, B.y, d))
#print("arc: R=%.2f angle=%.2f" % (R, angle/math.pi))
if startPoint.z == endPoint.z:
midPoint = center + FreeCAD.Vector(math.cos(angle), math.sin(angle), 0) * R
return Part.Edge(Part.Arc(startPoint, midPoint, endPoint))
# It's a Helix
#print('angle: A=%.2f B=%.2f' % (cls.getAngle(A)/math.pi, cls.getAngle(B)/math.pi))
if cmd.Name in cls.CmdMoveCW:
cw = True
else:
cw = False
angle = cls.diffAngle(cls.getAngle(A), cls.getAngle(B), 'CW' if cw else 'CCW')
height = endPoint.z - startPoint.z
pitch = height * math.fabs(2 * math.pi / angle)
if angle > 0:
cw = not cw
#print("Helix: R=%.2f h=%.2f angle=%.2f pitch=%.2f" % (R, height, angle/math.pi, pitch))
helix = Part.makeHelix(pitch, height, R, 0, not cw)
helix.rotate(Vector(), Vector(0,0,1), 180 * cls.getAngle(A) / math.pi)
e = helix.Edges[0]
helix.translate(startPoint - e.valueAt(e.FirstParameter))
return helix.Edges[0]
return None
@classmethod
def wireForPath(cls, path, startPoint = FreeCAD.Vector(0, 0, 0)):
"""(path, [startPoint=Vector(0,0,0)])
Returns a wire representing all move commands found in the given path."""
edges = []
if hasattr(path, "Commands"):
for cmd in path.Commands:
edge = cls.edgeForCmd(cmd, startPoint)
if edge:
edges.append(edge)
startPoint = cls.commandEndPoint(cmd, startPoint)
return Part.Wire(edges)
@classmethod
def wiresForPath(cls, path, startPoint = FreeCAD.Vector(0, 0, 0)):
"""(path, [startPoint=Vector(0,0,0)])
Returns a collection of wires, each representing a continuous cutting Path in path."""
wires = []
if hasattr(path, "Commands"):
edges = []
for cmd in path.Commands:
if cmd.Name in cls.CmdMove:
edges.append(cls.edgeForCmd(cmd, startPoint))
startPoint = cls.commandEndPoint(cmd, startPoint)
elif cmd.Name in cls.CmdMoveFast:
wires.append(Part.Wire(edges))
edges = []
startPoint = cls.commandEndPoint(cmd, startPoint)
if edges:
wires.append(Part.Wire(edges))
return wires

View File

@ -82,7 +82,8 @@ class LoadTool():
path = Path.Path(commands)
obj.Path = path
obj.ViewObject.Visibility = True
if obj.ViewObject:
obj.ViewObject.Visibility = True
def onChanged(self, obj, prop):
mode = 2
@ -181,13 +182,14 @@ PathUtils.addToJob(obj)
FreeCAD.ActiveDocument.recompute()
@staticmethod
def Create(jobname = None):
def Create(jobname = None, assignViewProvider = True):
import PathScripts
import PathUtils
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", "TC")
PathScripts.PathLoadTool.LoadTool(obj)
PathScripts.PathLoadTool._ViewProviderLoadTool(obj.ViewObject)
if assignViewProvider:
PathScripts.PathLoadTool._ViewProviderLoadTool(obj.ViewObject)
PathUtils.addToJob(obj, jobname)

View File

@ -79,7 +79,7 @@ class DlgSelectPostProcessor:
class CommandPathPost:
def resolveFileName(self, job):
print("resolveFileName(%s)" % job.Label)
#print("resolveFileName(%s)" % job.Label)
path = PathPreferences.defaultOutputFile()
if job.OutputFile:
path = job.OutputFile
@ -134,7 +134,7 @@ class CommandPathPost:
else:
filename = None
print("resolveFileName(%s, %s) -> '%s'" % (path, policy, filename))
#print("resolveFileName(%s, %s) -> '%s'" % (path, policy, filename))
return filename
def resolvePostProcessor(self, job):
@ -179,35 +179,44 @@ class CommandPathPost:
job = PathUtils.findParentJob(obj)
if job:
jobs.add(job)
fail = True
rc = ''
if len(jobs) != 1:
FreeCAD.Console.PrintError("Please select a single job or other path object\n")
FreeCAD.ActiveDocument.abortTransaction()
else:
job = jobs.pop()
print("Job for selected objects = %s" % job.Name)
(fail, rc) = exportObjectsWith(selected, job)
# check if the user has a project and has set the default post and
# output filename
postArgs = PathPreferences.defaultPostProcessorArgs()
if hasattr(job, "PostProcessorArgs") and job.PostProcessorArgs:
postArgs = job.PostProcessorArgs
elif hasattr(job, "PostProcessor") and job.PostProcessor:
postArgs = ''
postname = self.resolvePostProcessor(job)
if postname:
filename = self.resolveFileName(job)
if postname and filename:
print("post: %s(%s, %s)" % (postname, filename, postArgs))
processor = PostProcessor.load(postname)
processor.export(selected, filename, postArgs)
FreeCAD.ActiveDocument.commitTransaction()
else:
FreeCAD.ActiveDocument.abortTransaction()
if fail:
FreeCAD.ActiveDocument.abortTransaction()
else:
FreeCAD.ActiveDocument.commitTransaction()
FreeCAD.ActiveDocument.recompute()
def exportObjectsWith(self, objs, job, needFilename = True):
# check if the user has a project and has set the default post and
# output filename
postArgs = PathPreferences.defaultPostProcessorArgs()
if hasattr(job, "PostProcessorArgs") and job.PostProcessorArgs:
postArgs = job.PostProcessorArgs
elif hasattr(job, "PostProcessor") and job.PostProcessor:
postArgs = ''
postname = self.resolvePostProcessor(job)
filename = '-'
if postname and needFilename:
filename = self.resolveFileName(job)
if postname and filename:
print("post: %s(%s, %s)" % (postname, filename, postArgs))
processor = PostProcessor.load(postname)
gcode = processor.export(objs, filename, postArgs)
return (False, gcode)
else:
return (True, '')
if FreeCAD.GuiUp:
# register the FreeCAD command
FreeCADGui.addCommand('Path_Post', CommandPathPost())

View File

@ -78,4 +78,4 @@ class PostProcessor:
self.script = script
def export(self, obj, filename, args):
self.script.export(obj, filename, args)
return self.script.export(obj, filename, args)

View File

@ -38,6 +38,7 @@ Arguments for linuxcnc:
--header,--no-header ... output headers (--header)
--comments,--no-comments ... output comments (--comments)
--line-numbers,--no-line-numbers ... prefix with line numbers (--no-lin-numbers)
--show-editor, --no-show-editor ... pop up editor before writing output(--show-editor)
'''
import datetime
@ -90,6 +91,7 @@ def processArguments(argstring):
global OUTPUT_HEADER
global OUTPUT_COMMENTS
global OUTPUT_LINE_NUMBERS
global SHOW_EDITOR
for arg in argstring.split():
if arg == '--header':
OUTPUT_HEADER = True
@ -103,6 +105,10 @@ def processArguments(argstring):
OUTPUT_LINE_NUMBERS = True
elif arg == '--no-line-numbers':
OUTPUT_LINE_NUMBERS = False
elif arg == '--show-editor':
SHOW_EDITOR = True
elif arg == '--no-show-editor':
SHOW_EDITOR = False
def export(objectslist, filename, argstring):
processArguments(argstring)
@ -179,9 +185,12 @@ def export(objectslist, filename, argstring):
print "done postprocessing."
gfile = pythonopen(filename, "wb")
gfile.write(gcode)
gfile.close()
if not filename == '-':
gfile = pythonopen(filename, "wb")
gfile.write(final)
gfile.close()
return final
def linenumber():

View File

@ -0,0 +1,75 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2016 sliptonic <shopinthewoods@gmail.com> *
# * *
# * This program is free software; you can redistribute it and/or modify *
# * it under the terms of the GNU Lesser General Public License (LGPL) *
# * as published by the Free Software Foundation; either version 2 of *
# * the License, or (at your option) any later version. *
# * for detail see the LICENCE text file. *
# * *
# * This program 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 program; if not, write to the Free Software *
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
# * USA *
# * *
# ***************************************************************************
import FreeCAD
import Part
import math
import unittest
from PathScripts.PathGeom import Side
class PathTestBase(unittest.TestCase):
"""Base test class with some addtional asserts."""
def assertRoughly(self, f1, f2):
"""Verify that two float values are approximately the same."""
self.assertTrue(math.fabs(f1 - f2) < 0.00001, "%f != %f" % (f1, f2))
def assertCoincide(self, pt1, pt2):
"""Verify that two points coincide - roughly speaking."""
self.assertRoughly(pt1.x, pt2.x)
self.assertRoughly(pt1.y, pt2.y)
self.assertRoughly(pt1.z, pt2.z)
def assertLine(self, edge, pt1, pt2):
"""Verify that edge is a line from pt1 to pt2."""
self.assertIs(type(edge.Curve), Part.Line)
self.assertCoincide(edge.Curve.StartPoint, pt1)
self.assertCoincide(edge.Curve.EndPoint, pt2)
def assertArc(self, edge, pt1, pt2, direction = 'CW'):
"""Verify that edge is an arc between pt1 and pt2 with the given direction."""
# If an Arc is wrapped into edge, then it's curve is represented as a circle
# and not as an Arc (GeomTrimmedCurve)
#self.assertIs(type(edge.Curve), Part.Arc)
self.assertIs(type(edge.Curve), Part.Circle)
self.assertCoincide(edge.valueAt(edge.FirstParameter), pt1)
self.assertCoincide(edge.valueAt(edge.LastParameter), pt2)
ptm = edge.valueAt((edge.LastParameter + edge.FirstParameter)/2)
side = Side.of(pt2 - pt1, ptm - pt1)
#print("(%.2f, %.2f) (%.2f, %.2f) (%.2f, %.2f)" % (pt1.x, pt1.y, ptm.x, ptm.y, pt2.x, pt2.y))
#print(" (%.2f, %.2f) (%.2f, %.2f) -> %s" % ((pt2-pt1).x, (pt2-pt1).y, (ptm-pt1).x, (ptm-pt1).y, Side.toString(side)))
#print(" (%.2f, %.2f) (%.2f, %.2f) -> (%.2f, %.2f)" % (pf.x,pf.y, pl.x,pl.y, pm.x, pmy))
if 'CW' == direction:
self.assertEqual(side, Side.Left)
else:
self.assertEqual(side, Side.Right)
def assertCurve(self, edge, p1, p2, p3):
"""Verify that the edge goes through the given 3 points, representing start, mid and end point respectively."""
self.assertCoincide(edge.valueAt(edge.FirstParameter), p1)
self.assertCoincide(edge.valueAt(edge.LastParameter), p3)
self.assertCoincide(edge.valueAt((edge.FirstParameter + edge.LastParameter)/2), p2)

View File

@ -0,0 +1,147 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2016 sliptonic <shopinthewoods@gmail.com> *
# * *
# * This program is free software; you can redistribute it and/or modify *
# * it under the terms of the GNU Lesser General Public License (LGPL) *
# * as published by the Free Software Foundation; either version 2 of *
# * the License, or (at your option) any later version. *
# * for detail see the LICENCE text file. *
# * *
# * This program 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 program; if not, write to the Free Software *
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
# * USA *
# * *
# ***************************************************************************
import FreeCAD
import Part
import Path
import PathScripts
import math
import unittest
from FreeCAD import Vector
from PathScripts.PathDressupHoldingTags import *
from PathScripts.PathGeom import PathGeom
from PathTests.PathTestUtils import PathTestBase
class TestPathGeom(PathTestBase):
"""Test Path <-> Wire conversion."""
def test00(self):
"""Verify getAngle functionality."""
self.assertRoughly(PathGeom.getAngle(Vector(1, 0, 0)), 0)
self.assertRoughly(PathGeom.getAngle(Vector(1, 1, 0)), math.pi/4)
self.assertRoughly(PathGeom.getAngle(Vector(0, 1, 0)), math.pi/2)
self.assertRoughly(PathGeom.getAngle(Vector(-1, 1, 0)), 3*math.pi/4)
self.assertRoughly(PathGeom.getAngle(Vector(-1, 0, 0)), math.pi)
self.assertRoughly(PathGeom.getAngle(Vector(-1, -1, 0)), -3*math.pi/4)
self.assertRoughly(PathGeom.getAngle(Vector(0, -1, 0)), -math.pi/2)
self.assertRoughly(PathGeom.getAngle(Vector(1, -1, 0)), -math.pi/4)
def test01(self):
"""Verify diffAngle functionality."""
self.assertRoughly(PathGeom.diffAngle(0, +0*math.pi/4, 'CW') / math.pi, 0/4.)
self.assertRoughly(PathGeom.diffAngle(0, +3*math.pi/4, 'CW') / math.pi, 5/4.)
self.assertRoughly(PathGeom.diffAngle(0, -3*math.pi/4, 'CW') / math.pi, 3/4.)
self.assertRoughly(PathGeom.diffAngle(0, +4*math.pi/4, 'CW') / math.pi, 4/4.)
self.assertRoughly(PathGeom.diffAngle(0, +0*math.pi/4, 'CCW')/ math.pi, 0/4.)
self.assertRoughly(PathGeom.diffAngle(0, +3*math.pi/4, 'CCW')/ math.pi, 3/4.)
self.assertRoughly(PathGeom.diffAngle(0, -3*math.pi/4, 'CCW')/ math.pi, 5/4.)
self.assertRoughly(PathGeom.diffAngle(0, +4*math.pi/4, 'CCW')/ math.pi, 4/4.)
self.assertRoughly(PathGeom.diffAngle(+math.pi/4, +0*math.pi/4, 'CW') / math.pi, 1/4.)
self.assertRoughly(PathGeom.diffAngle(+math.pi/4, +3*math.pi/4, 'CW') / math.pi, 6/4.)
self.assertRoughly(PathGeom.diffAngle(+math.pi/4, -1*math.pi/4, 'CW') / math.pi, 2/4.)
self.assertRoughly(PathGeom.diffAngle(-math.pi/4, +0*math.pi/4, 'CW') / math.pi, 7/4.)
self.assertRoughly(PathGeom.diffAngle(-math.pi/4, +3*math.pi/4, 'CW') / math.pi, 4/4.)
self.assertRoughly(PathGeom.diffAngle(-math.pi/4, -1*math.pi/4, 'CW') / math.pi, 0/4.)
self.assertRoughly(PathGeom.diffAngle(+math.pi/4, +0*math.pi/4, 'CCW') / math.pi, 7/4.)
self.assertRoughly(PathGeom.diffAngle(+math.pi/4, +3*math.pi/4, 'CCW') / math.pi, 2/4.)
self.assertRoughly(PathGeom.diffAngle(+math.pi/4, -1*math.pi/4, 'CCW') / math.pi, 6/4.)
self.assertRoughly(PathGeom.diffAngle(-math.pi/4, +0*math.pi/4, 'CCW') / math.pi, 1/4.)
self.assertRoughly(PathGeom.diffAngle(-math.pi/4, +3*math.pi/4, 'CCW') / math.pi, 4/4.)
self.assertRoughly(PathGeom.diffAngle(-math.pi/4, -1*math.pi/4, 'CCW') / math.pi, 0/4.)
def test10(self):
"""Verify proper geometry objects for G1 and G01 commands are created."""
spt = Vector(1,2,3)
self.assertLine(PathGeom.edgeForCmd(Path.Command('G1', {'X': 7, 'Y': 2, 'Z': 3}), spt), spt, Vector(7, 2, 3))
self.assertLine(PathGeom.edgeForCmd(Path.Command('G01', {'X': 1, 'Y': 3, 'Z': 5}), spt), spt, Vector(1, 3, 5))
def test20(self):
"""Verfiy proper geometry for arcs in the XY-plane are created."""
p1 = Vector(0, -1, 2)
p2 = Vector(-1, 0, 2)
self.assertArc(
PathGeom.edgeForCmd(
Path.Command('G2', {'X': p2.x, 'Y': p2.y, 'Z': p2.z, 'I': 0, 'J': 1, 'K': 0}), p1),
p1, p2, 'CW')
self.assertArc(
PathGeom.edgeForCmd(
Path.Command('G3', {'X': p1.x, 'Y': p1.y, 'z': p1.z, 'I': -1, 'J': 0, 'K': 0}), p2),
p2, p1, 'CCW')
def test30(self):
"""Verify proper geometry for arcs with rising and fall ing Z-axis are created."""
#print("------ rising helix -------")
p1 = Vector(0, 1, 0)
p2 = Vector(1, 0, 2)
self.assertCurve(
PathGeom.edgeForCmd(
Path.Command('G2', {'X': p2.x, 'Y': p2.y, 'Z': p2.z, 'I': 0, 'J': -1, 'K': 1}), p1),
p1, Vector(1/math.sqrt(2), 1/math.sqrt(2), 1), p2)
p1 = Vector(-1, 0, 0)
p2 = Vector(0, -1, 2)
self.assertCurve(
PathGeom.edgeForCmd(
Path.Command('G3', {'X': p2.x, 'Y': p2.y, 'Z': p2.z, 'I': 1, 'J': 0, 'K': 1}), p1),
p1, Vector(-1/math.sqrt(2), -1/math.sqrt(2), 1), p2)
#print("------ falling helix -------")
p1 = Vector(0, -1, 2)
p2 = Vector(-1, 0, 0)
self.assertCurve(
PathGeom.edgeForCmd(
Path.Command('G2', {'X': p2.x, 'Y': p2.y, 'Z': p2.z, 'I': 0, 'J': 1, 'K': -1}), p1),
p1, Vector(-1/math.sqrt(2), -1/math.sqrt(2), 1), p2)
p1 = Vector(-1, 0, 2)
p2 = Vector(0, -1, 0)
self.assertCurve(
PathGeom.edgeForCmd(
Path.Command('G3', {'X': p2.x, 'Y': p2.y, 'Z': p2.z, 'I': 1, 'J': 0, 'K': -1}), p1),
p1, Vector(-1/math.sqrt(2), -1/math.sqrt(2), 1), p2)
def test50(self):
"""Verify proper wire(s) aggregation from a Path."""
commands = []
commands.append(Path.Command('G1', {'X': 1}))
commands.append(Path.Command('G1', {'Y': 1}))
commands.append(Path.Command('G0', {'X': 0}))
commands.append(Path.Command('G1', {'Y': 0}))
wire = PathGeom.wireForPath(Path.Path(commands))
self.assertEqual(len(wire.Edges), 4)
self.assertLine(wire.Edges[0], Vector(0,0,0), Vector(1,0,0))
self.assertLine(wire.Edges[1], Vector(1,0,0), Vector(1,1,0))
self.assertLine(wire.Edges[2], Vector(1,1,0), Vector(0,1,0))
self.assertLine(wire.Edges[3], Vector(0,1,0), Vector(0,0,0))
wires = PathGeom.wiresForPath(Path.Path(commands))
self.assertEqual(len(wires), 2)
self.assertEqual(len(wires[0].Edges), 2)
self.assertLine(wires[0].Edges[0], Vector(0,0,0), Vector(1,0,0))
self.assertLine(wires[0].Edges[1], Vector(1,0,0), Vector(1,1,0))
self.assertEqual(len(wires[1].Edges), 1)
self.assertLine(wires[1].Edges[0], Vector(0,1,0), Vector(0,0,0))

View File

@ -0,0 +1,102 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2016 sliptonic <shopinthewoods@gmail.com> *
# * *
# * This program is free software; you can redistribute it and/or modify *
# * it under the terms of the GNU Lesser General Public License (LGPL) *
# * as published by the Free Software Foundation; either version 2 of *
# * the License, or (at your option) any later version. *
# * for detail see the LICENCE text file. *
# * *
# * This program 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 program; if not, write to the Free Software *
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
# * USA *
# * *
# ***************************************************************************
import FreeCAD
import Path
import PathScripts
import PathScripts.PathContour
import PathScripts.PathJob
import PathScripts.PathLoadTool
import PathScripts.PathPost
import PathScripts.PathUtils
import difflib
import unittest
class PathPostTestCases(unittest.TestCase):
def setUp(self):
self.doc = FreeCAD.newDocument("PathPostTest")
def tearDown(self):
FreeCAD.closeDocument("PathPostTest")
def testLinuxCNC(self):
# first create something to generate a path for
box = self.doc.addObject("Part::Box", "Box")
# Create job and setup tool library + default tool
job = self.doc.addObject("Path::FeatureCompoundPython", "Job")
PathScripts.PathJob.ObjectPathJob(job)
job.Base = self.doc.Box
PathScripts.PathLoadTool.CommandPathLoadTool.Create(job.Name, False)
toolLib = job.Group[0]
tool1 = Path.Tool()
tool1.Diameter = 5.0
tool1.Name = "Default Tool"
tool1.CuttingEdgeHeight = 15.0
tool1.ToolType = "EndMill"
tool1.Material = "HighSpeedSteel"
job.Tooltable.addTools(tool1)
toolLib.ToolNumber = 1
self.failUnless(True)
self.doc.getObject("TC").ToolNumber = 2
self.doc.recompute()
contour = self.doc.addObject("Path::FeaturePython", "Contour")
PathScripts.PathContour.ObjectContour(contour)
contour.Active = True
contour.ClearanceHeight = 20.0
contour.StepDown = 1.0
contour.StartDepth= 10.0
contour.FinalDepth=0.0
contour.SafeHeight = 12.0
contour.OffsetExtra = 0.0
contour.Direction = 'CW'
contour.UseComp = True
contour.PlungeAngle = 90.0
PathScripts.PathUtils.addToJob(contour)
PathScripts.PathContour.ObjectContour.setDepths(contour.Proxy, contour)
self.doc.recompute()
job.PostProcessor = 'linuxcnc'
job.PostProcessorArgs = '--no-header --no-line-numbers --no-comments --no-show-editor'
post = PathScripts.PathPost.CommandPathPost()
(fail, gcode) = post.exportObjectsWith([job], job, False)
self.assertFalse(fail)
referenceFile = FreeCAD.getHomePath() + 'Mod/Path/PathTests/test_linuxcnc_00.ngc'
with open(referenceFile, 'r') as fp:
refGCode = fp.read()
# Use if this test fails in order to have a real good look at the changes
if False:
with open('tab.tmp', 'w') as fp:
fp.write(gcode)
if gcode != refGCode:
msg = ''.join(difflib.ndiff(gcode.splitlines(True), refGCode.splitlines(True)))
self.fail("linuxcnc output doesn't match: " + msg)

View File

View File

@ -0,0 +1,105 @@
G17 G90
G21
(TC: UNDEFINED TOOL)
M6 T2.0
M3 S0.0000
(Contour :TC)
(Uncompensated Tool Path)
G0 Z15.0000
G00 X-0.2500 Y0.0000
G00 Z23.0000
G01 X-0.2500 Y0.0000 Z9.0000 F0.00
G01 X-0.2500 Y10.0000 Z9.0000 F0.00
G02 X0.0000 Y10.2500 Z9.0000 I0.2500 J0.0000 F0.00
G01 X10.0000 Y10.2500 Z9.0000 F0.00
G02 X10.2500 Y10.0000 Z9.0000 I0.0000 J-0.2500 F0.00
G01 X10.2500 Y0.0000 Z9.0000 F0.00
G02 X10.0000 Y-0.2500 Z9.0000 I-0.2500 J0.0000 F0.00
G01 X0.0000 Y-0.2500 Z9.0000 F0.00
G02 X-0.2500 Y0.0000 Z9.0000 I0.0000 J0.2500 F0.00
G01 X-0.2500 Y0.0000 Z8.0000 F0.00
G01 X-0.2500 Y10.0000 Z8.0000 F0.00
G02 X0.0000 Y10.2500 Z8.0000 I0.2500 J0.0000 F0.00
G01 X10.0000 Y10.2500 Z8.0000 F0.00
G02 X10.2500 Y10.0000 Z8.0000 I0.0000 J-0.2500 F0.00
G01 X10.2500 Y0.0000 Z8.0000 F0.00
G02 X10.0000 Y-0.2500 Z8.0000 I-0.2500 J0.0000 F0.00
G01 X0.0000 Y-0.2500 Z8.0000 F0.00
G02 X-0.2500 Y0.0000 Z8.0000 I0.0000 J0.2500 F0.00
G01 X-0.2500 Y0.0000 Z7.0000 F0.00
G01 X-0.2500 Y10.0000 Z7.0000 F0.00
G02 X0.0000 Y10.2500 Z7.0000 I0.2500 J0.0000 F0.00
G01 X10.0000 Y10.2500 Z7.0000 F0.00
G02 X10.2500 Y10.0000 Z7.0000 I0.0000 J-0.2500 F0.00
G01 X10.2500 Y0.0000 Z7.0000 F0.00
G02 X10.0000 Y-0.2500 Z7.0000 I-0.2500 J0.0000 F0.00
G01 X0.0000 Y-0.2500 Z7.0000 F0.00
G02 X-0.2500 Y0.0000 Z7.0000 I0.0000 J0.2500 F0.00
G01 X-0.2500 Y0.0000 Z6.0000 F0.00
G01 X-0.2500 Y10.0000 Z6.0000 F0.00
G02 X0.0000 Y10.2500 Z6.0000 I0.2500 J0.0000 F0.00
G01 X10.0000 Y10.2500 Z6.0000 F0.00
G02 X10.2500 Y10.0000 Z6.0000 I0.0000 J-0.2500 F0.00
G01 X10.2500 Y0.0000 Z6.0000 F0.00
G02 X10.0000 Y-0.2500 Z6.0000 I-0.2500 J0.0000 F0.00
G01 X0.0000 Y-0.2500 Z6.0000 F0.00
G02 X-0.2500 Y0.0000 Z6.0000 I0.0000 J0.2500 F0.00
G01 X-0.2500 Y0.0000 Z5.0000 F0.00
G01 X-0.2500 Y10.0000 Z5.0000 F0.00
G02 X0.0000 Y10.2500 Z5.0000 I0.2500 J0.0000 F0.00
G01 X10.0000 Y10.2500 Z5.0000 F0.00
G02 X10.2500 Y10.0000 Z5.0000 I0.0000 J-0.2500 F0.00
G01 X10.2500 Y0.0000 Z5.0000 F0.00
G02 X10.0000 Y-0.2500 Z5.0000 I-0.2500 J0.0000 F0.00
G01 X0.0000 Y-0.2500 Z5.0000 F0.00
G02 X-0.2500 Y0.0000 Z5.0000 I0.0000 J0.2500 F0.00
G01 X-0.2500 Y0.0000 Z4.0000 F0.00
G01 X-0.2500 Y10.0000 Z4.0000 F0.00
G02 X0.0000 Y10.2500 Z4.0000 I0.2500 J0.0000 F0.00
G01 X10.0000 Y10.2500 Z4.0000 F0.00
G02 X10.2500 Y10.0000 Z4.0000 I0.0000 J-0.2500 F0.00
G01 X10.2500 Y0.0000 Z4.0000 F0.00
G02 X10.0000 Y-0.2500 Z4.0000 I-0.2500 J0.0000 F0.00
G01 X0.0000 Y-0.2500 Z4.0000 F0.00
G02 X-0.2500 Y0.0000 Z4.0000 I0.0000 J0.2500 F0.00
G01 X-0.2500 Y0.0000 Z3.0000 F0.00
G01 X-0.2500 Y10.0000 Z3.0000 F0.00
G02 X0.0000 Y10.2500 Z3.0000 I0.2500 J0.0000 F0.00
G01 X10.0000 Y10.2500 Z3.0000 F0.00
G02 X10.2500 Y10.0000 Z3.0000 I0.0000 J-0.2500 F0.00
G01 X10.2500 Y0.0000 Z3.0000 F0.00
G02 X10.0000 Y-0.2500 Z3.0000 I-0.2500 J0.0000 F0.00
G01 X0.0000 Y-0.2500 Z3.0000 F0.00
G02 X-0.2500 Y0.0000 Z3.0000 I0.0000 J0.2500 F0.00
G01 X-0.2500 Y0.0000 Z2.0000 F0.00
G01 X-0.2500 Y10.0000 Z2.0000 F0.00
G02 X0.0000 Y10.2500 Z2.0000 I0.2500 J0.0000 F0.00
G01 X10.0000 Y10.2500 Z2.0000 F0.00
G02 X10.2500 Y10.0000 Z2.0000 I0.0000 J-0.2500 F0.00
G01 X10.2500 Y0.0000 Z2.0000 F0.00
G02 X10.0000 Y-0.2500 Z2.0000 I-0.2500 J0.0000 F0.00
G01 X0.0000 Y-0.2500 Z2.0000 F0.00
G02 X-0.2500 Y0.0000 Z2.0000 I0.0000 J0.2500 F0.00
G01 X-0.2500 Y0.0000 Z1.0000 F0.00
G01 X-0.2500 Y10.0000 Z1.0000 F0.00
G02 X0.0000 Y10.2500 Z1.0000 I0.2500 J0.0000 F0.00
G01 X10.0000 Y10.2500 Z1.0000 F0.00
G02 X10.2500 Y10.0000 Z1.0000 I0.0000 J-0.2500 F0.00
G01 X10.2500 Y0.0000 Z1.0000 F0.00
G02 X10.0000 Y-0.2500 Z1.0000 I-0.2500 J0.0000 F0.00
G01 X0.0000 Y-0.2500 Z1.0000 F0.00
G02 X-0.2500 Y0.0000 Z1.0000 I0.0000 J0.2500 F0.00
G01 X-0.2500 Y0.0000 Z0.0000 F0.00
G01 X-0.2500 Y10.0000 Z0.0000 F0.00
G02 X0.0000 Y10.2500 Z0.0000 I0.2500 J0.0000 F0.00
G01 X10.0000 Y10.2500 Z0.0000 F0.00
G02 X10.2500 Y10.0000 Z0.0000 I0.0000 J-0.2500 F0.00
G01 X10.2500 Y0.0000 Z0.0000 F0.00
G02 X10.0000 Y-0.2500 Z0.0000 I-0.2500 J0.0000 F0.00
G01 X0.0000 Y-0.2500 Z0.0000 F0.00
G02 X-0.2500 Y0.0000 Z0.0000 I0.0000 J0.2500 F0.00
G00 Z15.0000
M05
G00 X-1.0 Y1.0
G17 G90
M2

View File

@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2016 sliptonic <shopinthewoods@gmail.com> *
# * *
# * This program is free software; you can redistribute it and/or modify *
# * it under the terms of the GNU Lesser General Public License (LGPL) *
# * as published by the Free Software Foundation; either version 2 of *
# * the License, or (at your option) any later version. *
# * for detail see the LICENCE text file. *
# * *
# * This program 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 program; if not, write to the Free Software *
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
# * USA *
# * *
# ***************************************************************************
import TestApp
from PathTests.TestPathPost import PathPostTestCases
from PathTests.TestPathGeom import TestPathGeom

View File

@ -52,6 +52,7 @@ class TestCmd:
QtUnitGui.addTest("TestPartApp")
QtUnitGui.addTest("TestPartDesignApp")
QtUnitGui.addTest("TestPartDesignGui")
QtUnitGui.addTest("TestPathApp")
QtUnitGui.addTest("TestSpreadsheet")
QtUnitGui.addTest("TestDraft")
QtUnitGui.addTest("TestArch")