"Scan" feature to move around maximum boundaries

18 Oct 2018 12:24 #118990 by lars

Nothing changes. When the component sees the "do your thing" trigger it then loads a copy of the current G-code fie into it's own parser and works out the extents.

Mmmh. Wouldn't that be dangerous in case of a user error? User changes ngc-file, forgets to reload in GUI and checks the boundaries with the component. Component would use the new file and the GUI would execute the old file. Or do the GUIs send the actual file and not the buffered/displayed version?

The module can either work in the current coordinate system, or get all clever and have the parser consider the offsets (read from linuxcnc.stat() and calculate absolute sizes.

I would think that using the current coordinate system may be problematic as the file may switch between coordinate systems. "Getting all clever" would work, of course.

Yes, including arcs. But I was imagining starting simple and then making the parser more sophisticated as required.

Yes. I was just thinking if this was worth all the effort. It's all implemented already at least in Axis. I guess other GUIs do the same. It would be a lot of duplicate work. Of course, I would not complain if there was a cleaner way to get the boundaries. Or even the actual outline while we are at it. :-)

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

17 Feb 2020 03:28 #157557 by jondale
This is a feature I use a lot on other lasercutters. I have implemented your solution here on our local hackerspaces laser that runs LinuxCNC. It has come in very handy but I've noticed that any time it is touched off on X and/or Y that the bottom left extent is still the bottom left corner. It still works properly for the top right extents.

The path in Axis shows a path from the homed 0,0 to the touch off point as the first move so I assume this is why. Is there something obvious I'm missing here that would make this feature work properly when touched off.

This is to check if the coordinates and the fixtures are all setup correctly before starting the actual job. It moves to the bounding box (XY only) of the loaded program, goes around once and then returns to its old position.

It was a feature I liked in bCNC which I used with GRML before switching to LinuxCNC on my new machine.

This is my .axisrc
if hal_present:
    boundcomp = hal.component("boundaries")
if vars.metric.get():
    conv = 1
    conv = 1/25.4

# this function is called at [DISPLAY]CYCLE_TIME interval
def user_live_update():
    min_extents = from_internal_units(o.canon.min_extents, conv)
    max_extents = from_internal_units(o.canon.max_extents, conv)
    boundcomp['xmin'] = min_extents[0]
    boundcomp['xmax'] = max_extents[0]
    boundcomp['ymin'] = min_extents[1]
    boundcomp['ymax'] = max_extents[1]
    boundcomp['zmin'] = min_extents[2]
    boundcomp['zmax'] = max_extents[2]

and this is goes in $SUBROUTINE_PATH/boundaries-scan.ngc
O<boundaries-scan> SUB

#<_UseInches> =           0     ( set to 1 to use inches here, or 0 to use millimeters )
#<_TravelFeed> =     3000.0     ( feedrate used to travel to and along the boundaries )

M70                   ( save current modal state )
G[21 - #<_UseInches>] ( use inches or millimeters as required here, units will be restored on return )
G30.1                 ( save current position in #5181-#5183... )
G90                   ( use absolute positioning here )
G40                   ( turn cutter radius compensation off here )
G94                   ( use feedrate in units/min )
G61                   ( follow exact path, don't round corners )

( Move to first corner of bounding box )
G53 G1 F#<_TravelFeed> X#<_hal[boundaries.xmin]> Y#<_hal[boundaries.ymin]>
( Drive around the block )
G53 G1 F#<_TravelFeed> X#<_hal[boundaries.xmin]> Y#<_hal[boundaries.ymax]>
G53 G1 F#<_TravelFeed> X#<_hal[boundaries.xmax]> Y#<_hal[boundaries.ymax]>
G53 G1 F#<_TravelFeed> X#<_hal[boundaries.xmax]> Y#<_hal[boundaries.ymin]>
G53 G1 F#<_TravelFeed> X#<_hal[boundaries.xmin]> Y#<_hal[boundaries.ymin]>

G53 G0 X[#5181] Y[#5182]  ( return to where we were in X Y)
M72                       ( restore modal state )

O<boundaries-scan> ENDSUB

Then I created a new line under [HALUI]
MDI_COMMAND = O<boundaries-scan> call
which I have mapped to a button on my pendent.

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

17 Feb 2020 11:24 #157584 by lars
Yeah. The boundaries are only calculated while loading file not when touching off. I guess this could somehow be implemented. But I have been getting used to just reload with Ctrl+R after touching off and it's not really bothering me anymore. :-)

Maybe you could automate the reload before the scan runs if you don't want to do a manual reload.

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

17 Feb 2020 16:48 #157637 by jondale
Ahh that put me on the right path it seems. We have a a button that does the touching off. I just changed it to point to a new mcode and all seems to work great.

axis-remote -m  G10L20P1X0Y0
axis-remote --reload

The reload also works but trying to keep it as dummy proof as possible as it's a bunch of people sharing it.

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

Time to create page: 0.537 seconds
Powered by Kunena Forum