Hi,
I work with Mach3 and KFLOP and I want to implement a additional routine in my KFLOP init file. I want to use the content of the DRO for the Z Axis (work coordinates). I want to determine then if the Z Pos is smaller or greater than zero and dependent on that, fork into different commands.
As I understood, the content of Mach X,Y,Z DROs are passed to KFLOP as standard and therefore there should be no need to pass it separately. Is this true? If so, how can I make use of this value in my init file?
Any help would be apreciated.
est regards
Thomas
Mach: Passing DRO
Moderators: TomKerekes, dynomotion
- TomKerekes
- Posts: 2868
- Joined: Mon Dec 04, 2017 1:49 am
Re: Mach: Passing DRO
Hi Thomas,
Could you be more specific? What kind of real-time response would you need?
KFLOP has direct real-time access to the current Z axis machine position simply as ch3->Dest.
But this would be different from the DRO if GCode Offsets are involved. If you know what the offsets are the DRO could be easily computed from the machine position.
Otherwise you would need to retrieve the offsets and send them to KFLOP with a Mach3 VB Script. Here is a ChatGTP regarding it.
How to pass parameters from Mach3 to KFLOP using notification messages?
Could you be more specific? What kind of real-time response would you need?
KFLOP has direct real-time access to the current Z axis machine position simply as ch3->Dest.
But this would be different from the DRO if GCode Offsets are involved. If you know what the offsets are the DRO could be easily computed from the machine position.
Otherwise you would need to retrieve the offsets and send them to KFLOP with a Mach3 VB Script. Here is a ChatGTP regarding it.
How to pass parameters from Mach3 to KFLOP using notification messages?
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
Re: Mach: Passing DRO
Hi Tom,
thank for the Chat GPT Link. It is really amazing, what KI can do. You are right, Ch2 Dest was in fact what I asked for. I´m not at all a programmer and maybe I should explain, what I´m thinking of and try to implement: I have a Z-axis with a DC servo motor and a glass scale as an encoder in a closed-loop system on my milling machine. I also have a probe concentric with the spindle or milling cutter that measures the distance of the tool from the machine bed or the workpiece. When the Z-axis moves downwards, the Z-tracing encoder touches the workpiece some millimetres before the milling cutter touches. I also have a handwheel with an encoder. The exact data is:
Z-axis: Channel 2, Encoder on Input 2
Z-tracing: Channel 6, Encoder Input 6
MPG: Channel 7, Encoder Input 7
I'm thinking of a special 2.5D mode with additional Z-tracing for a constant distance to the workpiece or constant milling depht. I asked you about this a while ago, and you suggested a solution with two macros to switch between the two modes. This solution requires a customized POST and two macros on the KFLOP side and on the Mach3 side. Until now, I was not able to get this solution to work.
What I´m thinking of is an universal solution that allows me to use existing G-code without requiring a separate POST and without additional M-Codes. Here's an idea: The special 2.5D Mode is announced to KFLOP by a manual switch. The Z-axis then still operates normally in closed loop via encoder 2 as long as the Z-Dest is greater than 0. As soon as the Z-Dest is less than 0, the Z-loop is closed via channel 6 (previously channel 6 = 0), and the milling cutter (or plasma cutter, or engraving tool, e.g.) follows the surface of the workpiece. The actual milling depth is not determined via the G-code, but is set via the MPG (channel 7).
As soon as a Z value greater than 0 comes from the G-code, the regular Z-loop is activated again and the axis goes up. Would this work, or do I think the wrong way?
Thank you for your support,
Thomas
thank for the Chat GPT Link. It is really amazing, what KI can do. You are right, Ch2 Dest was in fact what I asked for. I´m not at all a programmer and maybe I should explain, what I´m thinking of and try to implement: I have a Z-axis with a DC servo motor and a glass scale as an encoder in a closed-loop system on my milling machine. I also have a probe concentric with the spindle or milling cutter that measures the distance of the tool from the machine bed or the workpiece. When the Z-axis moves downwards, the Z-tracing encoder touches the workpiece some millimetres before the milling cutter touches. I also have a handwheel with an encoder. The exact data is:
Z-axis: Channel 2, Encoder on Input 2
Z-tracing: Channel 6, Encoder Input 6
MPG: Channel 7, Encoder Input 7
I'm thinking of a special 2.5D mode with additional Z-tracing for a constant distance to the workpiece or constant milling depht. I asked you about this a while ago, and you suggested a solution with two macros to switch between the two modes. This solution requires a customized POST and two macros on the KFLOP side and on the Mach3 side. Until now, I was not able to get this solution to work.
What I´m thinking of is an universal solution that allows me to use existing G-code without requiring a separate POST and without additional M-Codes. Here's an idea: The special 2.5D Mode is announced to KFLOP by a manual switch. The Z-axis then still operates normally in closed loop via encoder 2 as long as the Z-Dest is greater than 0. As soon as the Z-Dest is less than 0, the Z-loop is closed via channel 6 (previously channel 6 = 0), and the milling cutter (or plasma cutter, or engraving tool, e.g.) follows the surface of the workpiece. The actual milling depth is not determined via the G-code, but is set via the MPG (channel 7).
As soon as a Z value greater than 0 comes from the G-code, the regular Z-loop is activated again and the axis goes up. Would this work, or do I think the wrong way?
Thank you for your support,
Thomas
- TomKerekes
- Posts: 2868
- Joined: Mon Dec 04, 2017 1:49 am
Re: Mach: Passing DRO
Hi Thomas,
In that case you should be able to us the Z axis Dest as the absolute Z machine position assuming you don't have any GCode offsets for Z.
Its not exactly clear how you wish to transition between modes or use the MPG. Possibly when reaching 0, stop, switch to relative probe mode and maintain that height, then turning the MPG would drive deeper? How would it transition back?
Do you have both modes working. For the relative mode it is usually best to have a dual loop mode where the absolute linear encoder servo remains active but it is then driven by relative servo loop. The two loops are tied together with C Code eg.
You might make the actual GCode Z axis a dummy Axis with no output. Then in absolute mode copy the dummy axis's Dest to the real absolute position motor axis. Otherwise use the relative axis output to drive real axis.
Let us know what you have working and if this makes sense.
In that case you should be able to us the Z axis Dest as the absolute Z machine position assuming you don't have any GCode offsets for Z.
Code: Select all
if (ch2->Dest <= 0.0) ...Do you have both modes working. For the relative mode it is usually best to have a dual loop mode where the absolute linear encoder servo remains active but it is then driven by relative servo loop. The two loops are tied together with C Code eg.
Code: Select all
for (;;)
{
ch2->Dest += ch3->Output; // axis 3's output as a velocity command to ch2
}You might make the actual GCode Z axis a dummy Axis with no output. Then in absolute mode copy the dummy axis's Dest to the real absolute position motor axis. Otherwise use the relative axis output to drive real axis.
Let us know what you have working and if this makes sense.
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.