Coder Social home page Coder Social logo

Macro Reserved Words for bCNC about bcnc HOT 9 CLOSED

vlachoudis avatar vlachoudis commented on August 28, 2024
Macro Reserved Words for bCNC

from bcnc.

Comments (9)

vlachoudis avatar vlachoudis commented on August 28, 2024

Thanks @1bigpig for the list. I have already started the implementation of the functions and it is helpful to see what I need. BTW are the AMxx variables somethink standard, otherwise I would prefer a bit more easier to remember names, like
"feed", "coolant", "plane",...
Also in my implementation since I am based on the python evaluation the variables will be case sensitive.

from bcnc.

1bigpig avatar 1bigpig commented on August 28, 2024

@vlachoudis First off, it is your program, you can call them whatever you would like. I am referencing the grbl wiki:
https://github.com/grbl/grbl/wiki/Configuring-Grbl-v0.9#g---view-gcode-parser-state

Sonny calls it the $G parser-state but the wiki uses the sentence: "These active modes determine how the next G-code block or command will be interpreted by Grbl's G-code parser."

I would like to be careful and generic enough that I could do things like store the state of the G-code parser. For example:

;Save the state of the G-code parser
< ;feed=[AMFR]>
< ;coolant=[AMCS]>
< ;plane=[AMWP]>
< ;unit=[AMMI]>
< ;absrel=[AMAR]>
< ;spindle=[AMSS]>

M5 ;turn off spindle
M9 ;turn off coolant
G91 ;switch to relative mode
G21 ;switch to metric

...do something cool like a tool change here...

;Restore the state of the G-code parser
G[plane]
G[unit]
G[absrel]
F[feed]
M[coolant]
M[spindle]

from bcnc.

HomineLudens avatar HomineLudens commented on August 28, 2024

There's an idea that I'd like to propose, that could be related to the coming scripting feature. it's about the possibilities to interact with the global flow of gcode.
It's consist to have bCNC react to some gcode events, for example when the program end or pause. This will allow bCNC to run external script or executable. So as example, it could be possible to automatically send a screenshot by email when work finish. Or may be an alert in case of errors. Or run a custom button code at specific line of gcode. Just an raw idea for now.

from bcnc.

vlachoudis avatar vlachoudis commented on August 28, 2024

@effer theoretically now with the function evaluation and python code execution you can execute any python command like
%import os; os.system("play ringtone.wav")
I didn't try it but it should work.
Otherwise I could introduce a
%system cmd
command to execute any system command

from bcnc.

HomineLudens avatar HomineLudens commented on August 28, 2024

Yes this works, but it is not sync with code execution.
It's executed as soon the line is buffered to grbl, this doesn't allow some useful application.

from bcnc.

vlachoudis avatar vlachoudis commented on August 28, 2024

If you want to have it in sync with the code.
You should use the command "%wait"
The sender thread will wait until Grbl reports "Idle" as state

from bcnc.

HomineLudens avatar HomineLudens commented on August 28, 2024

Ok.
Just as reference:
%wait must be int the line before. Commands in the same line of %wait seems ignored.
Also in the editor if you add new line, the python code is executed. This should be avoided IMO.

from bcnc.

vlachoudis avatar vlachoudis commented on August 28, 2024

Indeed wait should be on the line above.
Concerning the python code in the editor it is a tricky one! I need to execute them, because if they change the gcode, it has to plot it correctly. But how can it know if it is not indented to change the gcode? Maybe introduce another keyword to execute commands only during the running... hmmm...

from bcnc.

vlachoudis avatar vlachoudis commented on August 28, 2024

If you see in the code CNC.py method parseLine2 (I have to change the name not very nice), there are a few special commands
%wait (without any argument, wait for the idle state of grbl)
%pause (display a message on status and put machine on hold)
%update (update variable in the interface)
All other commands starting with % are send literally to python for execution

from bcnc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.