- Posts: 19899
- Thank you received: 4655
Machine Coordinates from G-Code, #<_hal[]> support
- andypugh
- Offline
- Moderator
-
That is one way to do it. Many folk use a "reference tool" (often a touch probe) which is the nominal zero length.awetmore wrote: It assumes that tool heights are measured as tool stick out from the spindle to the surface (a zero tool height would mean the spindle nose touches the surface).
Please Log in or Create an account to join the conversation.
- spicer
- Offline
- Platinum Member
-
- Posts: 422
- Thank you received: 126
awetmore wrote: Thanks, that did the trick. I had missed that G28.1 worked that way.
Here is what I ended up with, maybe it'll be useful to someone else. It assumes that tool heights are measured as tool stick out from the spindle to the surface (a zero tool height would mean the spindle nose touches the surface).
Code:( measure the height of a tool using a probe plate ) o<measuretool> sub ; machine specific parameters #1000=-5.5 (max Z depth in absolute coordinates) ; setup G49 (cancel tool lengths) G91 (incremental mode) G28.1 (copy absolute coordinates into #5161-#5169) #1001=#5163 (current depth) #1002=[#1000-#5163] (probe depth) ; measure G38.3 Z#1002 F10 (probe fast down) G38.4 Z1 F1 (probe slow up) G43.1 Z#5422 (save current Z as tool height) ; cleanup G90 (return to absolute mode) G53 G0 Z#1001 (return to original Z) o<measuretool> endsub M2
We'll use this now to make it a lot easier to measure tool heights on a Bridgeport Boss (which has repeatable tool heights in it's quick change chuck).
Once the remap stuff becomes available in a tested release I'll be able to use this along with a remapped M6 to automatically measure tool heights on my Taig CNC mill (ER16) on every tool change.
I have modified your subroutine a little bit for my plasma cutter.
With this it gives no error when i move Z near 0 first.
Please Log in or Create an account to join the conversation.
- Richard J Kinch
- Offline
- Senior Member
-
- Posts: 61
- Thank you received: 4
awetmore wrote: I'm trying to read the raw machine coordinates from G-Code.
This simple idea should be plainly documented, but is not. It also needs a formal name, which I propound should be "the instant ordinate" of an axis (calling it "raw" or "machine" is not informative since the G-code machine model is a hairball of confusion). Here is an O-code subroutine gem to do it universally for any machine state and axis:
You can see there are only two lines of code required. This is clumsy and not obvious even to experts, but that's G-code.
Even this subroutine is not quite pure; it ought to push and pop the g28.1 conditions, such as with subroutine local variables, to guarantee no global side effects. Such purity requires it be done in a subroutine, which is itself an insoluble impurity; there's no proper way to do this in G-code that is both "flat" and not dependent on a language extension (such as a subroutine). This model deficiency explains the embarrassment of it not being documented. The ugliest measles always get documented last.
Please Log in or Create an account to join the conversation.
- spicer
- Offline
- Platinum Member
-
- Posts: 422
- Thank you received: 126
The most important lines in my subroutine are:
Please Log in or Create an account to join the conversation.
- tommylight
- Offline
- Moderator
-
- Posts: 22011
- Thank you received: 7491
Please Log in or Create an account to join the conversation.
- spicer
- Offline
- Platinum Member
-
- Posts: 422
- Thank you received: 126
Test video you see here:
www.xup.in/dl,15200380/plasma_kopf.MOV/
The hole on top is for the 12mm capacitive (or inductive) sensor.
I work with 2 dimensions ^^
This is very easy for the user.
It have 2 buttons. One for XY zeroing,
other for probing.
The solution of the problem "MDI mode" is here
forum.linuxcnc.org/24-hal-components/363...i-mdi-command#129952
Please Log in or Create an account to join the conversation.