This would also be a decent time to add some unit and regression tests 
with something like Nose:

http://nose.readthedocs.org/en/latest/

   EBo --

On Sep 3 2013 8:47 PM, Jeff Epler wrote:
> PrintCanon in interpret.py hasn't worked as written for quite some 
> time.
> It should either just be deleted, or somebody should rehabilitate it 
> and
> write a test to make sure it stays working.
>
> Here's a basic program that (in master branch of recent vintage)
> does the job:
>
> #!/usr/bin/python
> 
> #######################################################################
> import tempfile
> import gcode
> import sys
>
> def float_fmt(f):
>     if isinstance(f, float): return "% 5.1g" % f
>     return "%5s" % f
>
> class Canon:
>     def __getattr__(self, attr):
>         """Assume that any unknown attribute is a canon call; just 
> print
>         its args and return None"""
>
>         def inner(*args):
>             args = map(float_fmt, args)
>             print "%-17s %s" % (attr, " ".join(args))
>         return inner
>
>     # this is just noisy
>     def next_line(self, linecode): pass
>
>     # These can't just return None...
>     def get_external_length_units(self): return 1.0
>     def get_external_angular_units(self): return 1.0
>     def get_axis_mask(self): return 7 # (x y z)
>     def get_block_delete(self): return False
>     def get_tool(self, pocket):
>         return -1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 
> 0.0, 0.0, 0
>
> parameter = tempfile.NamedTemporaryFile()
> canon = Canon()
> canon.parameter_file = parameter.name
> gcode.parse(sys.argv[1], canon, '', '', '')
> 
> #######################################################################
>
> For the "3dtest.ngc" sample program, the methods that are called but 
> not
> directly specified are:
>         arc_feed comment next_line set_feed_rate set_g5x_offset 
> set_g92_offset
>         set_plane set_xy_rotation straight_feed straight_traverse
> but a more accurate list will come from grepping for callmethod in
> src/emc/rs274ngc/gcodemodule.cc:
>         callmethod(callback, "next_line", "O", new_line_code);
>         callmethod(callback, "arc_feed", "ffffifffffff",
>         callmethod(callback, "straight_feed", "fffffffff",
>         callmethod(callback, "straight_traverse", "fffffffff",
>         callmethod(callback, "set_g5x_offset", "ifffffffff",
>         callmethod(callback, "set_g92_offset", "fffffffff",
>         callmethod(callback, "set_xy_rotation", "f", t);
>         callmethod(callback, "set_plane", "i", pl);
>         callmethod(callback, "set_traverse_rate", "f", rate);
>         callmethod(callback, "set_feed_mode", "i", mode);
>         callmethod(callback, "change_tool", "i", pocket);
>         callmethod(callback, "set_feed_rate", "f", rate);
>         callmethod(callback, "dwell", "f", time);
>         callmethod(callback, "message", "s", comment);
>         callmethod(callback, "comment", "s", comment);
>     PyObject *result = callmethod(callback, "tool_offset",
> "ddddddddd", offset.tran.x, offset.tran.y, offset.tran.z,
>         callmethod(callback, "get_block_delete", "");
>         callmethod(callback, "straight_probe", "fffffffff",
>         callmethod(callback, "rigid_tap", "fff",
>         callmethod(callback, "get_tool", "i", pocket);
>         callmethod(callback, "user_defined_function",
>         callmethod(callback, "get_axis_mask", "");
>         callmethod(callback, "get_external_angular_units", "");
>         callmethod(callback, "get_external_length_units", "");
>         callmethod(callback, "check_abort", "");
>
> As usual there's no explicit documentation of this stuff.  :-/
>
> Jeff
>
> 
> ------------------------------------------------------------------------------
> Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, 
> more!
> Discover the easy way to master current and previous Microsoft 
> technologies
> and advance your career. Get an incredible 1,500+ hours of 
> step-by-step
> tutorial videos with LearnDevNow. Subscribe today and save!
> 
> http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
> _______________________________________________
> Emc-developers mailing list
> Emc-developers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-developers


------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to