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

Moderators: TomKerekes, dynomotion

Post Reply
kizilkaya
Posts: 2
Joined: Mon Sep 25, 2023 6:01 pm

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

Post by kizilkaya » Sun Dec 03, 2023 6:39 pm

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.

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

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

Post by TomKerekes » Sun Dec 03, 2023 10:22 pm

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)
Regards,

Tom Kerekes
Dynomotion, Inc.

kizilkaya
Posts: 2
Joined: Mon Sep 25, 2023 6:01 pm

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

Post by kizilkaya » Mon Dec 04, 2023 1:32 am

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.

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

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

Post by TomKerekes » Mon Dec 04, 2023 7:04 pm

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.
Regards,

Tom Kerekes
Dynomotion, Inc.

Post Reply