Plugin settings values and event

If you have a question about the software please ask it here.

Plugin settings values and event

Postby odino87 » Thu May 11, 2023 8:28 am

As I mention in the other thread I'll open this one to ask for other code related info.

First one
in the plugin code I saw this code
public void Cyclethreadstart_event()
{
//MessageBox.Show("Cycle is starting...");
}

with this one I can intercept the cycle start event. Is there something similar to intercept the cycle stop event?

Second one:
in my software I usually save user preferences settings.
I use a settings file and I can save and load properties using a code like
Code: Select all
Properties.Settings1.Default.PROPERTY = VALUE;

I tried to write something like this but the value are not stored. I can load the default value I write in the settings file during the compilation, but I can't save the value at runtime (from UCCNC).
Is there anyway to use settings and properties in plugins? Am I missing somethings?
odino87
 
Posts: 16
Joined: Mon Mar 20, 2023 3:02 pm

Re: Plugin settings values and event

Postby eabrust » Thu May 11, 2023 11:09 am

Hi Odino,

I use the .net settings in my plugins just fine from UCCNC.

After you assign a value to a setting, are you doing a final settings.save before you exit the plugin?

Code: Select all
Properties.Settings1.Default.Save;


In my plugins, I usually just regularly monitor the LEDs for feedhold, cyclestop, and reset as trigger to stop/abort. There may be better ways, but it works for me:

Code: Select all
 If  UC.GetLED(25) Or UC.GetLED(36) Or UC.GetLED(217) Or abortflag Then ' Check for feedhold and cycle stop and reset

                Abort()
                Exit Sub

            End If


regards
Eric
CraftyCNC: Plugins for UCCNC (and other neat stuff): http://www.craftycnc.com/plugins-for-uccnc/
eabrust
 
Posts: 357
Joined: Fri Sep 16, 2016 2:32 am
Location: Near Shirland IL, USA

Re: Plugin settings values and event

Postby odino87 » Thu May 11, 2023 7:30 pm

ok so regarding the status of the software, like cycle stop and other status, I need to implement monitoring instead of event handling like I usually do.

Regardin the setting I noticed a strange behaviour.
If I had just a file, Settings.settings, if I try to save the value they will not be stored.
But if I had another settings file, for example Settings1.setting, I can save the value in this second file just fine.
Don't know if it's a bug or something else.

edit: It was my fault... I thought I had connected the event code and the UI event caller but it wasn't... now the settings file work properly...
my bad.
odino87
 
Posts: 16
Joined: Mon Mar 20, 2023 3:02 pm


Return to Ask a question from support here

Who is online

Users browsing this forum: Bing [Bot] and 46 guests