As it turns out, there is a surprising amount of unwritten information in RS274 that can be synthesized via analysis. I've split this program into a CLI frontend and a library, and the library, named RS274, now supports doing some of this analysis. It now synthesizes the following meta-data from each file as it parses:
- Modality of lines
- This is used to tell whether a line is under a command that is in effect in the system. As it turns out, this is necessary for use later, so this datapoint is stored with each line.
- It enables lines like the following, where only one command is given for several lines.
G0 X0 Y0 Z0 X10 Y5 X5 Z2
- Command type
- Can be motion or non-motion, currently. Does not differentiate between linear/polar motion.
This information is useful for another project I'm working on, which is why I spent the time implementing it. The logic for doing so is very tricky when trying to use the least system resources possible, which is one of the goals of this project.
Lastly, ternary statements are awesome:
(isLineModal & isCommandMotion) ? isMotionBlock = true : (isLineModal | motionMatch[0] == "") ? isMotionBlock = true : isMotionBlock = false;
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.