Hopefully self-reply is permissible when not due to too-rapid pressing
of send, but a useful update of progress.

On 07.02.12 20:47, Erik Christiansen wrote:
> To allow us to program "G96 D3000 S500", this time not starting the
> spindle, we also need to support:
> 
> Spindle mode=CSS Revs<3000 Speed=500

While adding this syntax to the experimental grammar, it became clear
that there's not much to usefully swap the order of here, in practice.

After adding 12 lines to the grammar, and 4 or 5 to the lexer, plus some new
tokens, we now accept close to a full set of spindle commands, tolerating a
measure of input syntax variability. This as input:

»
       Spindle Mode=CSS Revs<3000 Speed=500      ; Just setting the mode here.
       Spindle On                                ; Defaults to CW.
       Spindle CCW Mode=CSS Speed=500
       Spindle ACW Mode=CSS Revs<3000 Speed = 500
       Spindle CW  Mode=CSS Speed = 500 Revs < 3000
N00006 Spindle Stop
       Spindle Off
       Spindle Mode = RPM                        ; Just setting the mode here.
       Spindle RPM                               ; This should error.
«

now generates the following output:

»
       G96 D3000 S500         ; Just setting the mode here.
       M3                     ; Defaults to CW.
       M4 G96 S500
       M4 G96 D3000 S500
       M3 G96 S500 D3000
N00006 M5
       M5
       G97                    ; Just setting the mode here.
      
Source line 9: syntax error
       Spindle RPM                               ; This should error.
             ###^
«

In addition to error messages with a pointer to the offending input
word¹, some tolerance of language variability can be seen:

+ "ACW" or "CCW"

+ "Speed=500" or "Speed = 500".  i.e. Spaces to suit the user.

+ "Off" or "Stop"

+ CSS accepts its D and S arguments in either order, so we don't have to
  fuss. I'll have to install a simulator on this machine, sooner or
  later, to check whether LinuxCNC is OK with the swap.

+ If present, spindle motion must appear before mode details, so the
  reader doesn't need to scan the whole line to find out whether the
  command sets the tool spinning, or is just setting the mode for later
  use.

What particularly appeals about your approach is that mentally we can
now handle all spindle control as both a conceptual and a syntactic
whole. Instead of hunting in the docs for G and M codes for the
primitives, then manually making up "what" we want to do, out of the
bits of "how", we just state what should happen. Just enough abstraction
to be useful, not enough to lose track.

If Gene had had a complete version of this the other day, then he
perhaps wouldn't have become embroiled in G92, when G10 L2 was what was
needed. (That's not to say that this "language for the occasional CNC
user" doesn't need documentation too.)

Now what other bits of gcode could usefully be handled as a conceptual
unit, based on a common verb?

¹ A compiler is not really a substitute for documentation, so a user
  should check the latter for what is permissible exactly where the tool
  is pointing.

  That said, we do go a bit further when it's easy to do:

Source line 27: Line number too long:
N000002        Rapid Z 50.00        ; Should detect line number length.
   ###^

  The pointer is intended to signify that there is breakage in getting
  to "^" from what closely precedes.

Erik

-- 
The reasonable man adapts himself to the world; the unreasonable
one persists in trying to adapt the world to himself.
Therefore all progress depends on the unreasonable man.
                                                   - George Bernard Shaw


------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to