Page 1 of 1

block a load g code for non compatable file.

PostPosted: Sat Apr 20, 2024 2:08 pm
by Battwell
id like to be able to block load g code if for example customer loads a .crv file instead of g code.
.crv is a vectric project file that often gets saved in the same folder as g code with the same name.

load a .crv file and uccnc cannot open it.. so freezes.
have to totally restart which is a pain..

few of my customers have done this recently..
i have done it myself numerous times over the years too.

maybe have limitation to .txt .nc and few other common suffixes?

Re: block a load g code for non compatable file.

PostPosted: Sat Apr 20, 2024 3:15 pm
by dezsoe
Redirect the Load button to the following macro:

Code: Select all
// ================================================================================================
// Open g-code file
// ================================================================================================

try
{
  OpenFileDialog ofd = new OpenFileDialog();
  ofd.RestoreDirectory = true;
  ofd.Filter = "G-code files|*.txt;*.nc;*.tap";   // List the allowed extensions here
  ofd.Title = "UCCNC - Open g-code file";
  if (ofd.ShowDialog(exec.mainform) == DialogResult.OK)
    exec.Loadfile(ofd.FileName);
}
catch (Exception ex)
{
}

Re: block a load g code for non compatable file.

PostPosted: Sun Apr 21, 2024 4:08 pm
by Battwell
That works really well. thank you.
might be worth adding to the main installer.