ATC Project - Planning Advice Request

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

Re: ATC Project - Planning Advice Request

Postby lp_felix » Fri May 22, 2020 4:18 pm

Problem solved, I turned off soft limits on macro as turned back on when macro finish.

Now, how can you made uccnc remember last used?
I can't understand why uccnc don't store tool number between sessions.. :(
lp_felix
 
Posts: 13
Joined: Tue Sep 06, 2016 3:11 pm

Re: ATC Project - Planning Advice Request

Postby dezsoe » Fri May 22, 2020 5:50 pm

Save the tool number just after you change it in the M6 macro:

Code: Select all
    exec.Setcurrenttool(NewTool);
    exec.Writekey("LastTool", "ToolNumber", NewTool.ToString());

Save the following macro and start it as a macroloop:

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("LastTool", "ToolNumber", "0");
    int LastTool = Convert.ToInt32(LTstr);
    exec.Setcurrenttool(LastTool);
    // 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;

// ================================================================================================
dezsoe
 
Posts: 1085
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: ATC Project - Planning Advice Request

Postby lp_felix » Fri May 22, 2020 8:08 pm

PERFECT!!!!
tested and work perfectly
Super tanks @dezsoe
;) :D :D
lp_felix
 
Posts: 13
Joined: Tue Sep 06, 2016 3:11 pm

Previous

Return to General discussion about the UCCNC software

Who is online

Users browsing this forum: No registered users and 5 guests