diff --git a/pygcode/block.py b/pygcode/block.py index 5a9fdf2..bb8b716 100644 --- a/pygcode/block.py +++ b/pygcode/block.py @@ -76,5 +76,10 @@ class Block(object): key=k )) + def __bool__(self): + return bool(self.words) + + __nonzero__ = __bool__ # python < 3 compatability + def __str__(self): return ' '.join(str(x) for x in (self.gcodes + self.modal_params)) diff --git a/pygcode/transform.py b/pygcode/transform.py index b3343a6..18250a2 100644 --- a/pygcode/transform.py +++ b/pygcode/transform.py @@ -244,25 +244,6 @@ def linearize_arc(arc_gcode, start_pos, plane=None, method_class=None, # - helical_start distance along plane.normal of arc start # - helical_disp distance along plane.normal of arc end - #print(( - # "linearize_arc params\n" - # " - arc_p_start {arc_p_start}\n" - # " - arc_p_end {arc_p_end}\n" - # " - arc_p_center {arc_p_center}\n" - # " - arc_radius {arc_radius}\n" - # " - arc_angle {arc_angle:.4f} ({arc_angle_deg:.3f} deg)\n" - # " - helical_start {helical_start}\n" - # " - helical_end {helical_end}\n" - #).format( - # arc_p_start=arc_p_start, - # arc_p_end=arc_p_end, - # arc_p_center=arc_p_center, - # arc_radius=arc_radius, - # arc_angle=arc_angle, arc_angle_deg=arc_angle * (180/pi), - # helical_start=helical_start, - # helical_end=helical_end, - #)) - method_class_params = { 'max_error': max_error, 'plane_normal': plane.normal, diff --git a/scripts/pygcode-normalize.py b/scripts/pygcode-normalize.py index 8d3e534..2e8bb56 100755 --- a/scripts/pygcode-normalize.py +++ b/scripts/pygcode-normalize.py @@ -157,7 +157,3 @@ for line_str in args.infile[0].readlines(): else: print(str(line)) machine.process_block(line.block) - - - - #print("%r, %s" % (sorted(line.block.gcodes), line.block.modal_params))