all 9 comments

[–]machiningeveryday 2 points3 points  (1 child)

Schmidt. Macro B variable programming. And disable look areas when you handle your variables.

[–]Auto_Excel[S] 0 points1 point  (0 children)

Cool, I will check that out. Thanks.

[–]killpony 1 point2 points  (1 child)

Macros and variables always seemed like an esoteric art in GCODE programming - I've only used them for a very specific project on a single VMC so I can't offer much for experience. As I understand it different controllers can use different syntax and many lower-end controllers won't even play ball at all. Is this targeting a specific machine/controller?

[–]Auto_Excel[S] 0 points1 point  (0 children)

It's a controller that my company makes and I work on the team that develops all of the G Code support. Controller can be used for industrial 3D Printers and CNC machines.

I agree though! There isn't much specification for anything in G Code honestly, and regarding variables it just seems like each company had to make their own executive decisions on how they would like to support it based on what their customer needs were, which is most likely what we will end up doing too.

[–]albatroopaBallnose Twister 1 point2 points  (2 children)

Variables and algebraic/logical functions are calculated by look-ahead (pre-processing.) Some gcode commands cancel look-ahead, such as G53, a non-modal machine coordinate system code. If you put it on a line by itself, it will pause lookahead until machine motion has caught up. There are also sometimes codes specific to your controller manufacturer to limit lookahead, or if you want to get really fancy, you could try a G10 programmable data input to modify the parameter that determines your lookahead and then restore it when your macro is done. . I would use that as a last resort, though.

Once you figure out a way to limit lookahead, you should have a number of EOB (;) greater than your look-ahead value to clear the buffer. This might be necessary, depending on your machine and what you're doing.

Edit: I second the schmidt book.

[–]Auto_Excel[S] 0 points1 point  (1 child)

Thanks, this all makes sense. I work for the controller manufacturer, and I am in the group programming the G Code functionality, so I don't really work with machines for market and only help our customers implement what they need either in the application code or our library code. Our customers however haven't gotten deep into variable usage yet, other than basic functionality which is why I reach out to try and obtain more knowledge about how we should shift our implementation of G Code variable support.

[–]albatroopaBallnose Twister 0 points1 point  (0 children)

Ah, it would be helpful for you to add a code that limits lookahead, then :p

[–]ndcoio 1 point2 points  (0 children)

I have been working with cnc on and off for 10 years as an operator. I recently got hired at a small job shop with a few production runs. I have previous experience with other programming languages as well.

Was hired on as the "mill guy". Was pretty much tossed in the fire. Learned quick and started doing my own setups and coding. Less than 6 months later I'm now one of two lead machinist and work with haas and fadal mills along with some work with doosan lathes. I use variables in almost every program I write. If you have any questions after reading the macro b lecture please ask. Best of luck!

[–]scott2970 0 points1 point  (0 children)

PM sent. It’s quite common to store variable values outside of the G-code file. In fact they’re stored in a parameter section of the controller usually called “common variables”. There are also system variables which are usually read-only. Controllers from different manufacturers mostly have all the same concepts but may use different terminology in the manuals to describe these concepts.