Are the program's extents available to the g-code?

More
18 Apr 2025 12:24 #326595 by pgf
I'm working on carving a piece that's really a little too big for my mill.  It barely fits if I rotate it 45 degrees, and carve it that way.  But the size and rotation make it hard to be sure no movement will exceed the machine limits, and sure enough, about halfway through a carving (a draft practice run, happily), I tripped a limit switch.

(I should clarify that my machine is "homeless".  "home" is always relative to the piece, so there's no way for the interpreter to know in advance that I'll be exceeding a limit.)

Are the program's extents (min/max X, min/max Y) available in variables that could be used by a canned subroutine?  I did a quick skim of the source, but didn't find anything obvious.

Please Log in or Create an account to join the conversation.

  • tommylight
  • tommylight's Avatar
  • Away
  • Moderator
  • Moderator
More
18 Apr 2025 12:40 #326596 by tommylight
Not tested, but try:
-home the machine at MACHINE 0 limits with G53
-jog the machine to PART 0 and touch off with G54
If you have the machine limits set correctly in the ini file, if any move would exceed the machine limits, LinuxCNC will show a warning asking you if you want to continue, do not continue if this happens.

Please Log in or Create an account to join the conversation.

More
18 Apr 2025 13:16 #326601 by pgf
I see why that should work.

The problem is that, because the machine is homeless, I set the soft limits to about twice as much as I actually have. This means I can home wherever I like, then set up G54, and it just works, without ever having to move to an actual home position on startup. And I can usually tell if my carve will exceed limits, so it's usually not an issue.

I'll think about changing that workflow.

Please Log in or Create an account to join the conversation.

More
18 Apr 2025 16:11 #326606 by snowgoer540
Replied by snowgoer540 on topic Are the program's extents available to the g-code?
If you have limit switches, why not just home the machine, and set actual soft limits? Everything you are describing is the exact reason to do it that way...

Please Log in or Create an account to join the conversation.

  • tommylight
  • tommylight's Avatar
  • Away
  • Moderator
  • Moderator
More
18 Apr 2025 16:18 #326609 by tommylight
If i understood this correctly, the machine has no limit or home switches at all.
The following user(s) said Thank You: snowgoer540

Please Log in or Create an account to join the conversation.

More
18 Apr 2025 16:56 #326612 by snowgoer540
Replied by snowgoer540 on topic Are the program's extents available to the g-code?
Guess we need him to clarify ¯\_(ツ)_/¯

I was going from this:

I tripped a limit switch.

The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

  • tommylight
  • tommylight's Avatar
  • Away
  • Moderator
  • Moderator
More
18 Apr 2025 17:01 #326613 by tommylight

(I should clarify that my machine is "homeless".  "home" is always relative to the piece, so there's no way for the interpreter to know in advance that I'll be exceeding a limit.)

I was going from this! :)
I guess he does have limit switches, but not used as home switches.
Yeah, in that case, make a new config with home/limit switches and use "touch off" as we mortals do.
The following user(s) said Thank You: snowgoer540

Please Log in or Create an account to join the conversation.

More
18 Apr 2025 17:12 #326614 by snowgoer540
Replied by snowgoer540 on topic Are the program's extents available to the g-code?
Teamwork! _virtual high five_

:)
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

More
18 Apr 2025 18:30 #326619 by pgf
I wish y'all had been around when I first configured my machine... 20 years ago. :-)

After Tommy's first reply, I did some reading, and realized that since I have X and Y limits, configuring them as homing inputs as well would be trivial. And so it was, plus or minus a "+" or "-", here and there.

I think I never thought there was any point to having a true home, and really, I've gotten by without it until now. I hit the limit switches when jogging reasonably often, but they're soft-mounted, so it's not a big deal.

In any case, I'm fully configured with home+limits on X and Y now, and I have proper soft limits configured, so I'm all set. <Another high five!>

Secondary question: I don't have a Z+ limit switch. My mill is so slow I'd really have to not be paying attention for the carriage to get close to the stepper. A lower limit would be nice, but I really don't understand how that could work. My spindle is a router, so the bit length varies a lot. Is there any way to configure this to work? I see people say that they don't bother with a lower Z limit, and just rely on a soft limit there, but what would you set it to? Is there something about "real" spindles that I don't know? Are the bits always the same length?
The following user(s) said Thank You: tommylight, snowgoer540

Please Log in or Create an account to join the conversation.

  • tommylight
  • tommylight's Avatar
  • Away
  • Moderator
  • Moderator
More
19 Apr 2025 00:41 #326646 by tommylight

Secondary question: I don't have a Z+ limit switch. My mill is so slow I'd really have to not be paying attention for the carriage to get close to the stepper. A lower limit would be nice, but I really don't understand how that could work. My spindle is a router, so the bit length varies a lot. Is there any way to configure this to work? I see people say that they don't bother with a lower Z limit, and just rely on a soft limit there, but what would you set it to? Is there something about "real" spindles that I don't know? Are the bits always the same length?

No need for lower limit switch, LinuxCNC is very good at obeying soft limits, and you set it to the actual hardware limit, so if say Z is able to move 200mm it is set at -200mm in the ini file as the min_limit.
Upper limit switch is nice to have as it is also used as the home switch in LinuxCNC, so the top of the Z becomes 0 in G53 coordinates, then you put the tool in, jog till the tip of the tool touches the surface of the material and you do a touch off in G54, jog up a bit to avoid hitting something and press run.
All the usual CAM software outputs gcode where 0 it the top of the material and everything below it is negative values, hence the above -200 example.
As for tools, no they are not the same length, and above is how to deal with them.
The thing with hardware limits is, no matter what G54 is set to, LinuxCNC will not allow the machine to move beyond what limits are set in G53.
And then there is G55... :)

Please Log in or Create an account to join the conversation.

Time to create page: 0.070 seconds
Powered by Kunena Forum