ATC tool measurement

This is where you talk about Macros, show examples of your macro scripting and SHARE handy segments of script code as examples.

ATC tool measurement

Postby Igor_rus36 » Mon Dec 09, 2019 4:28 pm

Hello!
I ask you for help in setting up the dosing tool for a fixed height sensor for the ATC spindle.

I figured out a bit with the automatic replacement tool M6 macro, introduced some additional variables for opening a store,
blowing cone and additional coordinates for moving along the axes. It works without input signals, but needs to be supplemented.
It remains to configure the input signals and play a little with the coordinates of the tool mandrels.

Tool in chuck yes / no
Store open / closed


I enclose the M6 macro, if you have knowledge on how to make input signals, please help.

But the main question is precisely about the measurement of the M31 tool.
Is required
Measure the tool and enter the data with the height and tool number in the height table.

Excuse me for my English, I'm from Russia
Thanks!

Code: Select all
//Example linear toolchanger code

//Tool positions definition
int Chuckopenport = 3;// лепестки порт
int Chuckopenpin = 1; // лепестки пин

int Nodustport = 3;//продувка конуса порт
int Nodustpin = 2;//продувка конуса пин

int Magustport = 3;// магазин порт
int Magustpin = 9;// магазин пин

double[] ToolX = new double[11];
double[] ToolY = new double[11];
ToolX[0] = 0; // Tool0 X position
ToolY[0] = 0; // Tool0 Y position

ToolX[1] = 50; // Tool1 X position
ToolY[1] = 10; // Tool1 Y position
ToolX[2] = 100; // Tool2 X position
ToolY[2] = 10; // Tool2 Y position
ToolX[3] = 150; // Tool3 X position
ToolY[3] = 10; // Tool3 Y position
ToolX[4] = 200; // Tool4 X position
ToolY[4] = 10; // Tool4 Y position
ToolX[5] = 250; // Tool5 X position
ToolY[5] = 10; // Tool5 Y position
ToolX[6] = 300; // Tool6 X position
ToolY[6] = 10; // Tool6 Y position
ToolX[7] = 350; // Tool7 X position
ToolY[7] = 10; // Tool7 Y position
ToolX[8] = 400; // Tool8 X position
ToolY[8] = 10; // Tool8 Y position
ToolX[9] = 450; // Tool9 X position
ToolY[9] = 10; // Tool9 Y position
ToolX[10] = 500; // Tool10 X position
ToolY[10] = 10; // Tool10 Y position

double SafeZ = 150;//безопасня высота
double Ztoolrelease = 30;//высота при которой откр лепестки
double Ztoolpickup = 50;// высота перед предварительная Ztoolmin
double Ztoolmin = 32;// высота забора инструмента
double Ztoolmid = 50;//высота вкл продувки конуса
double SafeY = 0;// дополнительный подход

int Newtool = exec.Getnewtool();
int Currenttool = exec.Getcurrenttool();

if(Newtool == -1) // If new tool number is -1 means a missing T code, so we need to stop here...
return;

if(Newtool <1 || Newtool >10) // Tool number is out of range, so we need to stop here...
return;

if(Newtool == Currenttool) // Same tool was selected, so do nothing, stop here...
return;

if(!exec.GetLED(56)||!exec.GetLED(57)||!exec.GetLED(58)) // If machine was not homed then it is unsafe to move in machine coordinates, stop here...
{
  MessageBox.Show("The machine was not yet homed, do homeing before executing a tool change!");
  exec.Stop();
  return;
}

while(exec.IsMoving()){}

// Get current XY machine coordinates to return to this position at the end of the macro

double Xoriginalpos = exec.GetXmachpos();
double Yoriginalpos = exec.GetYmachpos();

// Stop spindle if running and Move Z up

exec.Stopspin();
exec.Code("G00 G53 Z"+ SafeZ); // Move Z up
while(exec.IsMoving()){}

//  открытие магазина
exec.Setoutpin(Magustport, Magustpin);
exec.Wait(2000); // Wait one 1000msec

if(Currenttool!=0) // No need to drop down tool if current tool number is zero
{

//  !КЛАДЁМ ИНСТРУМЕНТ!
  exec.Code("G00 G53 X" + ToolX[Currenttool] + " Y" + ToolY[Currenttool]);
  while(exec.IsMoving()){}

//exec.Code("G01 F800 G53 Y"+ SafeY); // тестовый код на подъезд к ячейке магазина
  //while(exec.IsMoving()){}

  exec.Code("G00 G53 Z"+ Ztoolrelease); // Move Z axis down to tool holder position
  while(exec.IsMoving()){}
  exec.Setoutpin(Chuckopenport, Chuckopenpin); // открываем лепестки
  exec.Wait(500); //ждем 500 мс
  exec.Setoutpin(Nodustport, Nodustpin); // вкл продувку
  exec.Code("G01 F1500 G53 Z"+ Ztoolmid); // опускаемся до Ztoolmid
  //exec.Wait(1000); // ждем 1000 мс
  exec.Clroutpin(Nodustport, Nodustpin); // выкл продувку
  exec.Clroutpin(Chuckopenport, Chuckopenpin); // закрываем лепестки
  exec.Wait(1000); // ждем 1000 мс
  exec.Code("G00 G53 Z"+ SafeZ); // поднимаемся до SafeZ
  while(exec.IsMoving()){}
}

  // !БЕРЁМ ИНСТРУМЕНТ!
  exec.Code("G00 G53 X" + ToolX[Newtool] + " Y" + ToolY[Newtool]);
  while(exec.IsMoving()){}

//exec.Code("G01 F800  G53 Y"+ SafeY); // тестовый код на подъезд к ячейке магазина
  //while(exec.IsMoving()){}

  exec.Code("G00 G53 Z"+ Ztoolpickup); // Move Z axis down to tool holder position
  while(exec.IsMoving()){}
  exec.Setoutpin(Chuckopenport, Chuckopenpin); // открываем лепестки
  exec.Wait(1000);  // ждем 1000 мс
  exec.Setoutpin(Nodustport, Nodustpin); // вкл продувку
  //exec.Wait(1000);  ждем 1000 мс
  exec.Code("G01 F800 G53 Z"+ Ztoolmin); // опускаемся до Ztoolmin
  exec.Clroutpin(Nodustport, Nodustpin); // выкл продувку
  exec.Wait(500);  // ждем 500 мс
  exec.Clroutpin(Chuckopenport, Chuckopenpin);  // закрываем лепестки
  exec.Wait(1000); // ждем 1000 мс
  exec.Code("G00 G53 Z"+ SafeZ); // поднимаемся до SafeZ
  while(exec.IsMoving()){}


// Move back to start point

exec.Code("G00 G53 X" + Xoriginalpos + " Y" + Yoriginalpos);
while(exec.IsMoving()){}

//  закрытие магазина
exec.Clroutpin(Magustport, Magustpin);


// Measure new tool will go here....
exec.Code("G43 H"+Newtool); // Load new tool offset

exec.Wait(200);
while(exec.IsMoving()){}
if(!exec.Ismacrostopped()) // If tool change was not interrupted with a stop only then validate new tool number
{
  exec.Setcurrenttool(Newtool); //Set the current tool -> the new tool
 // MessageBox.Show("Tool change done.");
}
else
{
  exec.StopWithDeccel();
  MessageBox.Show("Tool change was interrupted by user!");
}


Igor_rus36
 
Posts: 6
Joined: Sat Nov 09, 2019 1:32 pm

Return to Macros

Who is online

Users browsing this forum: No registered users and 6 guests