Error deleting tool.

This section is for general discussion about Gadgets
Post Reply
dyn0bill
Vectric Apprentice
Posts: 62
Joined: Sun Feb 21, 2021 8:10 am
Model of CNC Machine: EZ Route 4x8/WinCNC
Location: Williamstown, WV

Error deleting tool.

Post by dyn0bill »

I receive an error when I try to delete a tool I believe.

Thanks!
Attachments
EasyError.png

User avatar
jimandi5000
Vectric Wizard
Posts: 1094
Joined: Wed Mar 11, 2015 6:50 pm
Model of CNC Machine: Home Made 60 x 120
Location: North Houston Tx.
Contact:

Re: Error deleting tool.

Post by jimandi5000 »

dyn0bill wrote:
Thu Jun 13, 2024 11:28 pm
I receive an error when I try to delete a tool I believe.

Thanks!
Hi Bill,

I will look into this and see if I can reproduce the issue and add an error trap to manage the issue.

Can you send me the EXPORT file for this drawing?
Jim@JimAndI.com
Thanks,
Jim

User avatar
sharkcutup
Vectric Wizard
Posts: 3437
Joined: Sat Mar 26, 2016 3:48 pm
Model of CNC Machine: Shark HD3 Pro Extended Bed with Spindle
Location: U.S.A.

Re: Error deleting tool.

Post by sharkcutup »

Tool Clear3 seems to be working okay on my copy of the code BUT

I am finding that the Last Tool Clear Button (7th Tool) posts an error message similar to the OP's post.

Jim you may want to add this below to the Dialog File. It is not there ---

Function OnLuaButton_FunctionClear7(Pdialog) -- Tool clear 7
Pdialog:UpdateLabelField("DialogWindow.Alert", "")
MillTool7.Name = "No Tool Selected"
Pdialog:UpdateLabelField("ToolNameLabel7", MillTool7.Name)
RegistryWrite()
return true
end -- function end

Added the above to my copy and now that clear button woks fine.

Sharkcutup
V-Carve Pro Tips, Gadget Tips & Videos
YouTube Channel - Sharkcutup CNC
V-Carve Pro 12.013

User avatar
jimandi5000
Vectric Wizard
Posts: 1094
Joined: Wed Mar 11, 2015 6:50 pm
Model of CNC Machine: Home Made 60 x 120
Location: North Houston Tx.
Contact:

Re: Error deleting tool.

Post by jimandi5000 »

sharkcutup wrote:
Fri Jun 14, 2024 4:07 am
Tool Clear3 seems to be working okay on my copy of the code BUT

I am finding that the Last Tool Clear Button (7th Tool) posts an error message similar to the OP's post.

Jim you may want to add this below to the Dialog File. It is not there ---

Function OnLuaButton_FunctionClear7(Pdialog) -- Tool clear 7
Pdialog:UpdateLabelField("DialogWindow.Alert", "")
MillTool7.Name = "No Tool Selected"
Pdialog:UpdateLabelField("ToolNameLabel7", MillTool7.Name)
RegistryWrite()
return true
end -- function end

Added the above to my copy and now that clear button woks fine.

Sharkcutup
Thanks.
Thanks,
Jim

User avatar
sharkcutup
Vectric Wizard
Posts: 3437
Joined: Sat Mar 26, 2016 3:48 pm
Model of CNC Machine: Shark HD3 Pro Extended Bed with Spindle
Location: U.S.A.

Re: Error deleting tool.

Post by sharkcutup »

Same Dialog File ---

line 3160 --- </tr> from

remove the word -- from

Not exactly sure why that is there but I believe it is not needed.

Sharkcutup
V-Carve Pro Tips, Gadget Tips & Videos
YouTube Channel - Sharkcutup CNC
V-Carve Pro 12.013

User avatar
adze_cnc
Vectric Wizard
Posts: 5109
Joined: Sat Jul 27, 2013 10:08 pm
Model of CNC Machine: AXYZ 4008 (VCarve Pro v9.519)
Location: Vancouver, BC, Canada

Re: Error deleting tool.

Post by adze_cnc »

Jim:

function InquiryWallOrBase at line 94 needs changing to the following as it refers to both tool 7 and tool 6:

Code: Select all

    if dialog:GetTool("ToolChooseButton7") then
      MillTool7 = dialog:GetTool("ToolChooseButton7")  -- ???? comment wrong but I don't know what is right ???
    end

User avatar
adze_cnc
Vectric Wizard
Posts: 5109
Joined: Sat Jul 27, 2013 10:08 pm
Model of CNC Machine: AXYZ 4008 (VCarve Pro v9.519)
Location: Vancouver, BC, Canada

Re: Error deleting tool.

Post by adze_cnc »

I wonder if those seven OnLuaButton_FunctionClear<n> functions could be replaced with:

Code: Select all

function clearMillToolFromDialog(Pdialog, toolNumber)
  local function createToolArray()
    local MillTools= {MillTool1, MillTool2, MillTool3,
                      MillTool4, MillTool5, MillTool6, MillTool7
    }
    return MillTools
  end

  local function updateDialogAndRegistry(toolNumber, toolName)
    Pdialog:UpdateLabelField("ToolNameLabel" .. tostring(toolNumber), toolName)
    RegistryWrite()
  end

  if toolNumber == nil then return false end

  local MillTools = createToolArray()
  local millTool = MillTools[toolNumber]
  millTool.Name = "No Tool Selected"
  updateDialogAndRegistry(toolNumber, millTool.Name)
end

function OnLuaButton_FunctionClear1(Pdialog)
  clearMillToolFromDialog(Pdialog, 1)
  return true
end
-- =====================================================]]
function OnLuaButton_FunctionClear2(Pdialog)
  clearMillToolFromDialog(Pdialog, 2)
  return true
end
-- =====================================================]]
function OnLuaButton_FunctionClear3(Pdialog)
  clearMillToolFromDialog(Pdialog, 3)
  return true
end
-- =====================================================]]
function OnLuaButton_FunctionClear4(Pdialog)
  clearMillToolFromDialog(Pdialog, 4)
  return true
end
-- =====================================================]]
function OnLuaButton_FunctionClear5(Pdialog)
  clearMillToolFromDialog(Pdialog, 5)
  return true
end
-- =====================================================]]
function OnLuaButton_FunctionClear6(Pdialog)
  clearMillToolFromDialog(Pdialog, 6)
  return true
end
-- =====================================================]]
function OnLuaButton_FunctionClear7(Pdialog)
  clearMillToolFromDialog(Pdialog, 7)
  return true
end
Note: I haven't actually tested the code but it should work (famous last words).

User avatar
jimandi5000
Vectric Wizard
Posts: 1094
Joined: Wed Mar 11, 2015 6:50 pm
Model of CNC Machine: Home Made 60 x 120
Location: North Houston Tx.
Contact:

Re: Error deleting tool.

Post by jimandi5000 »

Yep, that would reduce the code stack.
Thanks,
Jim

Post Reply