UCCNC on Gcode file load

Here is where you can request new features or special features.

Re: UCCNC on Gcode file load

Postby Dan911 » Tue Jan 30, 2018 6:26 am

Hi Terry,
This can be done simply in a macro I'm sure but I find writing anything outside of VS annoying. I written something similar to find G20 or G21 in Gcode. I used that plugin to edit quickly with all M codes listed for UCCNC up to M215. When loaded and enabled it will read Gcode when loading and if there's a M code not supported you will get a window with no match and with the M code not matched. I was having trouble making messagebox Topmost so make sure it's not buried behind UCCNC. Long day and after 1am and didn't have the patience.

Terry.zip
Dan911
 
Posts: 613
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Re: UCCNC on Gcode file load

Postby shad » Tue Jan 30, 2018 8:19 am

Hello Dan!
Balazs offer to open Form from plugin like this:
Code: Select all
using (var DummyForm = new Form() { TopMost = true, TopLevel = true })
{
MyForm.ShowDialog(DummyForm);
}

It's work perfect in my plugin and Frame always TopMost.
-- Andrew
UC400ETH
UC300ETH-5LPT
NEURON Lite THC
http://neuroncnc.com/
shad
 
Posts: 332
Joined: Thu Sep 15, 2016 5:23 pm

Re: UCCNC on Gcode file load

Postby Dan911 » Tue Jan 30, 2018 1:59 pm

shad wrote:Hello Dan!
Balazs offer to open Form from plugin like this:
Code: Select all
using (var DummyForm = new Form() { TopMost = true, TopLevel = true })
{
MyForm.ShowDialog(DummyForm);
}

It's work perfect in my plugin and Frame always TopMost.



Thank you Andrew, I was writing it like this..

{ MessageBox.Show(new Form() { TopMost = true }, "No Match= " + Value); }

I will have to try the way you show, I thought the problem was because the window was popping up while Gcode was loading.
Dan911
 
Posts: 613
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Re: UCCNC on Gcode file load

Postby Dan911 » Tue Jan 30, 2018 2:10 pm

Vmax549 wrote:I think yall missed the point on this one. The idea is for UCCNC to check teh gcode for missing Mcodes.
If I sent you a Gcode file and the Mcodes that go with it and you installed teh Mcode in the wrog folder. When you ran teh Gcode program you would not know teh Mcode was missing until you ran teh program and then it might be to late as damage could have occured.

Yes I could write a macro and before I run each program I could parse teh Gcode and then check if each Mcode exists in it proper folder BUT that would be ME working for teh machine. I would rather the machine work for me.

(;-) TP


Yes I did, it was late when I read/replied. Reading the macro folder first to compare to Gcode loading also seems doable within a macro.

Dan
Dan911
 
Posts: 613
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Re: UCCNC on Gcode file load

Postby cncdrive » Tue Jan 30, 2018 2:14 pm

One thing when you make a Form to appear in plugin then the same rule applies, that the Form should be Shown from the UI thread, just like I described it has to from macros!
If you show the form from a separate thread, e.g. from the loop_event which is a background thread then that can cause the same conflict as I described in my previous post.
It is a basic rule in Windows Forms programming that Forms in an application has to be seated to the same thread and also that Form controls should not be accessed from other than the thread it was created on.

You could place this variable into the Watch when developing an app: SynchronizationContext.Current
if you have concerns about if you are in the UI or in other threads.
The value of this variable will be null if you are in any other threads than the UI thread and it will have a different value from null if you are in the UI thread.
In plugin development since there is no Watch available for debugging you could for example print the value to a label to see if you are in the UI thread or not.
cncdrive
Site Admin
 
Posts: 4887
Joined: Tue Aug 12, 2014 11:17 pm

Re: UCCNC on Gcode file load

Postby Dan911 » Tue Jan 30, 2018 2:58 pm

Hi Balazs

The Gcode is read from the loop than passed to a method in UI thread where messagebox is created.

public void Read(string Gcode)

Thanks for valuable info!!

Dan
Dan911
 
Posts: 613
Joined: Mon Oct 31, 2016 1:22 am
Location: USA


Return to Feature Request

Who is online

Users browsing this forum: No registered users and 4 guests