Commit 15fec660 authored by lode_leroy's avatar lode_leroy

added unit option mm/in

git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@5 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent a8a1f8d3
Currently it is not necessary to install the software,
simply unpack the distribution archive, and run "python pycam.py"
from the archive directory
...@@ -31,8 +31,12 @@ class SimpleGCodeExporter: ...@@ -31,8 +31,12 @@ class SimpleGCodeExporter:
self.AddPath(path) self.AddPath(path)
def ExportPathList(filename, pathlist): def ExportPathList(filename, pathlist, unit):
exporter = SimpleGCodeExporter(filename) exporter = SimpleGCodeExporter(filename)
if unit == "mm":
exporter.file.write("G20\n")
else:
exporter.file.write("G21\n")
exporter.AddPathList(pathlist) exporter.AddPathList(pathlist)
exporter.close() exporter.close()
...@@ -22,7 +22,7 @@ class gcode: ...@@ -22,7 +22,7 @@ class gcode:
def begin(self): def begin(self):
return "G00 Z%.4f\n" % (self.safetyheight) + \ return "G00 Z%.4f\n" % (self.safetyheight) + \
"G17 G21 G40 G49\n" + "G54 G80 G90 G94\n" + \ "G17 G40 G49\n" + "G54 G80 G90 G94\n" + \
"S1000 M3\n" + "G04 P3" + \ "S1000 M3\n" + "G04 P3" + \
"T1 M6 F0.1\n" "T1 M6 F0.1\n"
......
...@@ -162,7 +162,7 @@ class SimpleGui(Frame): ...@@ -162,7 +162,7 @@ class SimpleGui(Frame):
if filename: if filename:
self.OutputFileName.set(filename) self.OutputFileName.set(filename)
if self.toolpath: if self.toolpath:
exporter = SimpleGCodeExporter.ExportPathList(filename, self.toolpath) exporter = SimpleGCodeExporter.ExportPathList(filename, self.toolpath, self.Unit)
def createWidgets(self): def createWidgets(self):
self.TopFrame = Frame(self).pack(side=TOP, expand=1, fill=X) self.TopFrame = Frame(self).pack(side=TOP, expand=1, fill=X)
...@@ -214,6 +214,12 @@ class SimpleGui(Frame): ...@@ -214,6 +214,12 @@ class SimpleGui(Frame):
s["textvariable"] = self.ToroidRadius s["textvariable"] = self.ToroidRadius
s.pack(side=LEFT) s.pack(side=LEFT)
Label(self.ConfigurationFrame, text="Unit: ").pack(side=LEFT)
self.Unit = StringVar()
self.Unit.set("mm")
Radiobutton(self.ConfigurationFrame, text="mm", variable=self.Unit, value="mm").pack(side=LEFT)
Radiobutton(self.ConfigurationFrame, text="in", variable=self.Unit, value="in").pack(side=LEFT)
self.MinX = StringVar() self.MinX = StringVar()
self.MinX.set("-7") self.MinX.set("-7")
self.MinY = StringVar() self.MinY = StringVar()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment