Tool Correction
Posted: Mon Aug 15, 2022 11:56 am
Hello Tom,
With a spec screen I want to be able to make tools correction as available on commercial lathes, spec screen is ready but I have issues (as usual) with the C program, reading the content of the Edit button works perfectly. But I do not manage to get the tool length or offsets. Rigth under the code with some lines in comments for simpler trials :
#include "KMotionDef.h"
#define TMP 50 // which spare persist to use to transfer data
#include "KflopToKMotionCNCFunctions.c"
main()
{
int FixtureIndex,Units, TWORD, HWORD, DWORD;
double NewToolLength,Length,OriginOffsetZ,AxisOffsetZ,XRes,YRes,ZRes;
double Machinex,Machiney,Machinez,Machinea,Machineb,Machinec;
double NewToolDiameter,ToolDiameter,NewToolOffsetX,ToolOffsetX,NewToolOffsetZ,ToolOffsetZ;
double Xcorrection, Zcorrection, Tool;
GetEditControlDouble(&Tool, 150, 1000);
GetEditControlDouble(&Xcorrection, 151, 1000);
GetEditControlDouble(&Zcorrection, 152, 1000);
TWORD = (int)Tool;
printf("TOOL ID %i \n", TWORD);
printf("X correction %f \n", Xcorrection);
printf("Z correction %f \n", Zcorrection);
//GetToolOffsetX(TWORD, &ToolOffsetX);
//NewToolOffsetX = &ToolOffsetX + Xcorrection;
//SetToolOffsetX(TWORD,NewToolOffsetX);
//printf("NewToolOffsetX %f \n", NewToolOffsetX);
GetToolLength(TWORD, &Length);
printf("ToolLength %g \n",Length);
//NewToolOffsetZ = &Length + Zcorrection;
//printf("NewToolOffsetZ %f \n", NewToolOffsetZ);
//SetToolLength(TWORD,NewToolOffsetZ);
}
Cordially,
Francois
With a spec screen I want to be able to make tools correction as available on commercial lathes, spec screen is ready but I have issues (as usual) with the C program, reading the content of the Edit button works perfectly. But I do not manage to get the tool length or offsets. Rigth under the code with some lines in comments for simpler trials :
#include "KMotionDef.h"
#define TMP 50 // which spare persist to use to transfer data
#include "KflopToKMotionCNCFunctions.c"
main()
{
int FixtureIndex,Units, TWORD, HWORD, DWORD;
double NewToolLength,Length,OriginOffsetZ,AxisOffsetZ,XRes,YRes,ZRes;
double Machinex,Machiney,Machinez,Machinea,Machineb,Machinec;
double NewToolDiameter,ToolDiameter,NewToolOffsetX,ToolOffsetX,NewToolOffsetZ,ToolOffsetZ;
double Xcorrection, Zcorrection, Tool;
GetEditControlDouble(&Tool, 150, 1000);
GetEditControlDouble(&Xcorrection, 151, 1000);
GetEditControlDouble(&Zcorrection, 152, 1000);
TWORD = (int)Tool;
printf("TOOL ID %i \n", TWORD);
printf("X correction %f \n", Xcorrection);
printf("Z correction %f \n", Zcorrection);
//GetToolOffsetX(TWORD, &ToolOffsetX);
//NewToolOffsetX = &ToolOffsetX + Xcorrection;
//SetToolOffsetX(TWORD,NewToolOffsetX);
//printf("NewToolOffsetX %f \n", NewToolOffsetX);
GetToolLength(TWORD, &Length);
printf("ToolLength %g \n",Length);
//NewToolOffsetZ = &Length + Zcorrection;
//printf("NewToolOffsetZ %f \n", NewToolOffsetZ);
//SetToolLength(TWORD,NewToolOffsetZ);
}
Cordially,
Francois