Page 1 of 1

Run IDC_Thread1..2...3 with button and convert g code

Posted: Sun Dec 03, 2023 6:39 pm
by kizilkaya
Hello Dear Tom
I have few questions..

Question 1 :

I want to run g code files with the ReadBit command, for example;
if (ReadBit(30)) { "open IDC_Thread1" }
if (ReadBit(31)) { "open IDC_Thread2" } .... Is this possible?


Question 2 :

Addition, I want to write a command that will convert the X values in the g code selected in IDC_Thread4 from positive to negative.
for example, the data in the g code file If "G0 X100 Y20 Z50" this code will translate as "G0 X-100 Y20 Z50"
I searched the forums and couldn't find a solution or I missed it.

Re: Run IDC_Thread1..2...3 with button and convert g code

Posted: Sun Dec 03, 2023 10:22 pm
by TomKerekes
Here is an example to click a control,

Code: Select all

#include "KMotionDef.h"

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

void main()
{
	if (ScreenScript("WinMsg:DlgName;IDC_Thread2;BM_CLICK;"))
		printf("Screen Script Failed\n");
	else
		printf("Screen Script Success\n");
}
You might have a C Program that reverses the direction of an axis. ie reverses the Output Gain (and Input if necessary)

Re: Run IDC_Thread1..2...3 with button and convert g code

Posted: Mon Dec 04, 2023 1:32 am
by kizilkaya
Dear Tom

This code ;
#include "KMotionDef.h"

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

void main()
{
if (ScreenScript("WinMsg:DlgName;IDC_Thread2;BM_CLICK;"))
printf("Screen Script Failed\n");
else
printf("Screen Script Success\n");
}

Perfect working, thank you very much for fast response.

Regarding the second question;
There are 4 regions in CNC work areas and in some regions the x value needs to go in the opposite direction. Can we make a solution like this? for example ;
When IDC_Thread4 is turned on, it reads the g code, converts the x values from positive to negative and updates the g code file.

Re: Run IDC_Thread1..2...3 with button and convert g code

Posted: Mon Dec 04, 2023 7:04 pm
by TomKerekes
Regarding the second question;
There are 4 regions in CNC work areas and in some regions the x value needs to go in the opposite direction. Can we make a solution like this? for example ;
When IDC_Thread4 is turned on, it reads the g code, converts the x values from positive to negative and updates the g code file.
There isn't currently a means of reading which GCode Thread is selected.

It isn't clear what you are trying to achieve. Why not just load mirrored GCode into the appropriate GCode Threads?

Why not create a button or MCode to set the Mirror mode?

btw there is a simple Transform feature that can be used to scale x values by -1. But there is no programmable access to it.