On Sat, Dec 18, 2010 at 07:41:16AM +0100, Michael Haberler wrote:
> I'm considering use of the Python gcode module as a backplot/sanity check for 
> a CAM plugin, unrelated to a running EMC instance.
> 
> To understand for myself what's going on, I've done an example and documented 
> its Canon methods (see http://git.mah.priv.at/gitweb/rs274-python.git)
> 
> There are three issues which I dont yet understand:
> 
> - intended use of gcode.parse(filename, canon, unitcode, initcode):
>   unitcode is always executed before initcode - I dont understand the 
> benefits of having two arguments then?

This is something I probably shouldn't have added.

We have had stubborn users who refused to put the proper modal code for
units in their gcode programs, and also didn't put it in the inifile
initcode.  So we added unitcode to make this modal setting.  Personally,
I now think that having either unitcode or initcode there are actually
misleading (because the actual modal codes in the interpreter in task
can be different than the ones you get by applying unitcode and initcode
to a newly-initialized interpreter) but that's the history anyway.

> - gcode.calc_extents() returns 9e+99 .. -9e+99 ranges - am I missing some 
> initialization?

(actually glcanon.calc_extents, right?) This code returns the
numbers used to draw the dimensions in axis, so I know it works when all
the stars are aligned.

This code assumes that like the glcanon class, you've put the gcode
program's traverses, feeds, and arcfeeds in the instance's self.feed,
self.arcfeed, self.traverse.  If all these lists are empty, then
min_extents and max_extents won't be updated by calling this method.

> - gcode.linecode.* members usage is unclear: is this the interpreter state? 
> how is it accessed?
>     I dont see any use of these members in emc2 - I'd appreciate usage hint. 

A gcode.linecode instance is passed to the next_line callback of the
canon object.  
    def next_line(self, st):
        self.state = st
        self.lineno = self.state.sequence_number
self.state is used later in various places, for instance to find the
active plane to draw a dwell symbol:
    def dwell(self, arg):
        if self.suppress > 0: return
        self.dwell_time += arg
        color = self.colors['dwell']
        self.dwells_append((self.lineno, color, self.lo[0], self.lo[1], 
self.lo[2], self.state.plane/10-17))

I don't know that there's a way to create a linecode instance with
specific values, but if you need to do this just use duck typing.

Jeff

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to