Lathe Setting tool number on startup

Post anything you want to discuss with others about the software.

Lathe Setting tool number on startup

Postby Delco » Tue Nov 14, 2023 10:06 pm

Is there a setting for the .pro file so that on startup the lathe profile shows as tool 1 rather than tool 0 , I am fitting a auto turrent to my lathe and if I start with tool zero then when asked to change to tool from tool zero to tool # it will error as tool slot zero is not a possible on the lathe.


Also with regard to threading on the lathe - using a index pulse to measure actual rpm does the software use that for doing the pitch or does it use commanded as my rpm can drop slightly when it enters the cut.
Delco
 
Posts: 356
Joined: Tue Apr 02, 2019 4:23 am

Re: Lathe Setting tool number on startup

Postby Daywalker » Wed Nov 15, 2023 3:27 pm

Maybe you can Handle that with a Macroloop like that.

Code: Select all
// ================================================================================================
// Restore last tool number on startup
// ================================================================================================

bool ResetNow = exec.GetLED(ResetLED);

if (FirstRun && !ResetNow)
{
  while (!exec.GetLED(ResetLED))
    Thread.Sleep(10);
  ResetNow = exec.GetLED(ResetLED);
}

FirstRun = false;

if (NeedCheck && !ResetNow)
{
  Thread.Sleep(100);
  exec.Codesync("");
  if (!exec.Ismacrostopped())
  {
    string LTstr = exec.Readkey("MyValues", "ToolNumber", "0");
    int LastTool = Convert.ToInt32(LTstr);
    exec.Setcurrenttool(LastTool);
   exec.Code("F300"); // Sets Feedrate
   exec.Code("S10000"); // Sets RPM
    // Uncomment the next 3 lines to turn on tool length offset for the loaded tool
    // exec.Wait(100);
    // int Currenttool = exec.Getcurrenttool();
    // exec.Code("G43 H" + Currenttool.ToString());
    exec.AddStatusmessage("Tool number T" + LastTool.ToString() + " restored.");
    NeedCheck = false;
    loop = false;
  }
  else
  {
    exec.AddStatusmessage("Waiting stop to clear...");
    Thread.Sleep(1000);
  }
}

// ================================================================================================

#Events

// ================================================================================================

const int ResetLED = 25;

static bool FirstRun = true;
static bool NeedCheck = true;

// ================================================================================================



and that code in M99999.txt to Save the Last Tool by Closing UCCNC
Code: Select all
exec.Writekey("MyValues", "ToolNumber", AS3.Getfielddouble(897).ToString());            // Read & Save Last Tool


I Have write that Code in a M99995.txt an set a Macroloop. After hitting the Reset Button, the Last Tool while be writen in UCCNC.
Regards from Germany
Udo

(UC300ETH & UB1)
[Yeah, I use a Translator ;-) ]
Daywalker
 
Posts: 18
Joined: Sun Jul 29, 2018 8:11 am

Re: Lathe Setting tool number on startup

Postby Delco » Wed Nov 15, 2023 9:32 pm

Thanks will give it a try
Delco
 
Posts: 356
Joined: Tue Apr 02, 2019 4:23 am

Re: Lathe Setting tool number on startup

Postby dezsoe » Wed Nov 15, 2023 10:00 pm

I wrote this startup macro to run commands on the first release of the reset. However, since 1.2115 you can reload the tool number even in M99998 without turning off the reset:

Code: Select all
string LTstr = exec.Readkey("MyValues", "ToolNumber", "0");
int LastTool = Convert.ToInt32(LTstr);
exec.Setcurrenttool(LastTool);

But if you want to restore the G43 tool offset too then you'll need that macro with the G43 lines uncommented.
dezsoe
 
Posts: 2079
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary


Return to General discussion about the UCCNC software

Who is online

Users browsing this forum: No registered users and 7 guests