Skip to content

Commit

Permalink
- Added adaptive laser cutting option
Browse files Browse the repository at this point in the history
- Recent menu, justified with directory entries
  • Loading branch information
vlachoudis committed Aug 3, 2017
1 parent 06b7883 commit 3aa2536
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 deletions.
8 changes: 7 additions & 1 deletion CNC.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@ def save(self, filename=None):
class CNC:
inch = False
lasercutter = False
laseradaptive = False
acceleration_x = 25.0 # mm/s^2
acceleration_y = 25.0 # mm/s^2
acceleration_z = 25.0 # mm/s^2
Expand Down Expand Up @@ -770,6 +771,8 @@ def loadConfig(config):
except: pass
try: CNC.lasercutter = bool(int(config.get(section, "lasercutter")))
except: pass
try: CNC.laseradaptive = bool(int(config.get(section, "laseradaptive")))
except: pass
try: CNC.doublesizeicon = bool(int(config.get(section, "doublesizeicon")))
except: pass
try: CNC.acceleration_x = float(config.get(section, "acceleration_x"))
Expand Down Expand Up @@ -967,7 +970,10 @@ def garc(g, x=None, y=None, z=None, i=None, j=None, k=None, **args):
@staticmethod
def zenter(z):
if CNC.lasercutter:
return "m3"
if CNC.laseradaptive:
return "m4"
else:
return "m3"
else:
return "g1 %s %s"%(CNC.fmt("z",z), CNC.fmt("f",CNC.vars["cutfeedz"]))

Expand Down
4 changes: 3 additions & 1 deletion FilePage.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ def createMenu(self):
for i in range(Utils._maxRecent):
filename = Utils.getRecent(i)
if filename is None: break
fn = os.path.basename(filename)
path = os.path.dirname(filename)
fn = os.path.basename(filename)
menu.add_command(label="%d %s"%(i+1, fn),
compound=LEFT,
image=Utils.icons["new"],
accelerator=path, # Show as accelerator in order to be aligned
command=lambda s=self,i=i: s.event_generate("<<Recent%d>>"%(i)))
if i==0: # no entry
self.event_generate("<<Open>>")
Expand Down
3 changes: 2 additions & 1 deletion ToolsPage.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,8 @@ def __init__(self, master):
self.name = "CNC"
self.variables = [
("units" , "bool", 0 , _("Units (inches)")) ,
("lasercutter" , "bool", 0 , _("Lasercutter")) ,
("lasercutter" , "bool", 0 , _("Laser Cutter")) ,
("laseradaptive" , "bool", 0 , _("Laser Adaptive Power")) ,
("doublesizeicon", "bool", 0 , _("Double Size Icon")) ,
("acceleration_x", "mm" , 25.0 , _("Acceleration x")) ,
("acceleration_y", "mm" , 25.0 , _("Acceleration y")) ,
Expand Down
1 change: 1 addition & 0 deletions bCNC.ini
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ command.2 = G53 G0 X[prbx] Y[prby] Z[prbz]
[CNC]
units = 0
lasercutter = 0
laseradaptive = 0
doublesizeicon = 0
acceleration_x = 25
acceleration_y = 25
Expand Down
12 changes: 9 additions & 3 deletions bCNC.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# Author: [email protected]
# Date: 24-Aug-2014

__version__ = "0.9.9"
__date__ = "24 Mar 2017"
__version__ = "0.9.10"
__date__ = "3 Aug 2017"
__author__ = "Vasilis Vlachoudis"
__email__ = "[email protected]"

Expand Down Expand Up @@ -2477,13 +2477,19 @@ def usage(rc):
r = 0
if r<0:
# display list of recent files
maxlen = 10
for i in range(Utils._maxRecent):
try: filename = Utils.getRecent(i)
except: continue
maxlen = max(maxlen, len(os.path.basename(filename)))

sys.stdout.write("Recent files:\n")
for i in range(Utils._maxRecent):
filename = Utils.getRecent(i)
if filename is None: break
d = os.path.dirname(filename)
fn = os.path.basename(filename)
sys.stdout.write(" %2d: %-10s\t%s\n"%(i+1,fn,d))
sys.stdout.write(" %2d: %-*s %s\n"%(i+1,maxlen,fn,d))

try:
sys.stdout.write("Select one: ")
Expand Down

0 comments on commit 3aa2536

Please sign in to comment.