G43 Hxx with C Code?

Moderators: TomKerekes, dynomotion

Post Reply
Posts: 8
Joined: Sun Aug 26, 2018 10:13 pm

G43 Hxx with C Code?

Post by a_j_p » Fri Aug 31, 2018 2:29 am

Hi All,

Does anyone know how to execute a G43 Hxx command via C Code? Or get the equivalent result? I have been using a tool height offset sensor to set the tool length and store it in the table and it works just fine. The problem that I have is that when it sets the tool length it does not apply that offset without me going into the tool file and re-selecting that tool OR typing in G43 Hxx.

When running actual programs, the post-processor always includes Txx G43 Hxx and it's not a big deal in that situation. But when I want to go in and hand load a new tool and do some more manual operations (which is rather frequent for me) I find that I often forget this extra step and plunge into the part on accident.

I have looked around online to see if anyone else has an answer but have been unsuccessful... I have also tried the MDI command, but have yet to figure out how to pass the Hxx number into the MDI string... I was hoping I could do something like MDI("G43 H%d",TWORD); but that doesn't work.

Let me know if you have this same issue or a good work around.

User avatar
Posts: 332
Joined: Mon Dec 04, 2017 1:49 am

Re: G43 Hxx with C Code?

Post by TomKerekes » Fri Aug 31, 2018 7:21 pm

Hi Andrew,

You might try this:

Code: Select all

#include "KMotionDef.h"

#define TMP 10 // which spare persist to use to transfer data
#include "KflopToKMotionCNCFunctions.c"

	char s[40];
	int Units, TWORD, HWORD, DWORD;
	GetMiscSettings(&Units, &TWORD, &HWORD, &DWORD);
	sprintf(s,"G43 H%d",TWORD);

Tom Kerekes
Dynomotion, Inc.

Posts: 8
Joined: Sun Aug 26, 2018 10:13 pm

Re: G43 Hxx with C Code?

Post by a_j_p » Sat Sep 01, 2018 1:41 pm

Worked great! Thanks again!

Post Reply