Skip to content

Commit

Permalink
Merge pull request #40 from AndyEveritt/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
AndyEveritt authored Sep 29, 2020
2 parents cde2110 + 8620ba8 commit 0158565
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 45 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
exe:
pyinstaller main.py --onefile --name ASMBL-dev
44 changes: 17 additions & 27 deletions src/ASMBL_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,41 +219,31 @@ def split_cam_operations(self, gcode_sub):

def assign_cam_layer_height(self, cam_layer, later_cam_layers, layer_overlap):
""" Calculate the additive layer height that should be printed to before the CAM layer happens """
if len(later_cam_layers) > 0:
next_cam_layer_height = min([layer.cutting_height for layer in later_cam_layers])
later_additive = [layer for layer in self.gcode_add_layers[:-1]
if layer.layer_height > next_cam_layer_height]
later_planar_layers = [layer for layer in later_cam_layers if layer.planar]

if layer_overlap == 0:
cam_layer.layer_height = next_cam_layer_height

elif len(later_additive) == 0:
cam_layer.layer_height = next_cam_layer_height

elif len(later_additive) >= layer_overlap:
cam_layer.layer_height = later_additive[layer_overlap - 1].layer_height

else:
cam_layer.layer_height = later_additive[-1].layer_height
if (not cam_layer.planar) or (len(later_planar_layers) == 0):
cutting_height = cam_layer.cutting_height
else:
cutting_height = min([layer.cutting_height for layer in later_planar_layers])

else: # no later ops
later_additive = [layer for layer in self.gcode_add_layers[:-1]
if layer.layer_height > cam_layer.cutting_height]
later_additive = [layer for layer in self.gcode_add_layers[:-1]
if layer.layer_height > cutting_height]

if len(later_additive) == 0: # no further printing
# add 10 since it is unlikely that the printed layer height will exceed 10 mm
# but still want to place cutting after a print at the same height
cam_layer.layer_height = cam_layer.cutting_height + 10
if (layer_overlap == 0) or (len(later_additive) == 0):
cam_layer_height = cutting_height

elif len(later_additive) >= layer_overlap:
cam_layer.layer_height = later_additive[layer_overlap - 1].layer_height
elif len(later_additive) >= layer_overlap:
cam_layer_height = later_additive[layer_overlap - 1].layer_height

else:
cam_layer.layer_height = later_additive[-1].layer_height
else:
cam_layer_height = later_additive[-1].layer_height

if cam_layer.layer_height == inf:
if cam_layer_height == inf:
raise ValueError("CAM op height can't be 'inf'")

cam_layer.layer_height = cam_layer_height
return

def order_cam_operations_by_layer(self, operations):
""" Takes a list of cam operations and calculates the layer that they should be executed """
unordered_cam_layers = []
Expand Down
16 changes: 10 additions & 6 deletions src/fusion_api/Handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import traceback
import time
import os
import sys
import subprocess

from ..ASMBL_parser import Parser

Expand Down Expand Up @@ -391,10 +393,11 @@ def notify(self, args):
outputFolder = os.path.expanduser('~/Asmbl/output/')
asmbl_parser.create_output_file(asmbl_parser.merged_gcode_script, outputFolder)

if (os.name == 'posix'):
os.system('open "%s"' % outputFolder)
elif (os.name == 'nt'):
if sys.platform == 'win32':
os.startfile(outputFolder)
else:
opener = 'open' if sys.platform == 'darwin' else 'xdg-open'
subprocess.call([opener, outputFolder])
except:
ui.messageBox('Failed combing gcode files:\n{}'.format(traceback.format_exc()))
return
Expand Down Expand Up @@ -484,9 +487,10 @@ def notify(self, args):
ui.messageBox('Failed posting toolpaths:\n{}'.format(traceback.format_exc()))
return

if (os.name == 'posix'):
os.system('open "%s"' % output_folder)
elif (os.name == 'nt'):
if sys.platform == 'win32':
os.startfile(output_folder)
else:
opener = 'open' if sys.platform == 'darwin' else 'xdg-open'
subprocess.call([opener, output_folder])

ui.messageBox('Milling Setup Post Processing Complete.\nFile saved in \'{}\''.format(output_folder))
12 changes: 0 additions & 12 deletions src/operations.py

This file was deleted.

0 comments on commit 0158565

Please sign in to comment.