exec.actualmodal

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

Re: exec.actualmodal

Postby Dan911 » Wed Nov 21, 2018 4:08 am

Hi Dezsoe, I find it extremely annoying of someone complaining that something is not working and it turns out to be there error.
Reason why I have to fess up...

Had the Getcurrentgcodelinenumber() before the Stop() :oops: :oops: :oops:

Getcurrentgcodelinenumber() works perfectly!

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

Re: exec.actualmodal

Postby dezsoe » Wed Nov 21, 2018 7:33 am

Hi Dan,

Never mind! Some days ago I spent a half day to find out why I cannot press a button. It was disabled 3 lines before the Callbutton... :D
dezsoe
 
Posts: 2049
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: exec.actualmodal

Postby dezsoe » Wed Nov 21, 2018 7:46 am

I have seen timing issues in plugins where some function are rocket fast and others are turtle slow and I had to use Waits to slow down teh rockets to keep from overrunning teh slow ones OR I would see one line (function) actually RUN after the next 3 lines were already done and THEN teh first line would run. THAT totally messed up teh function I was worked with as it depended on teh first line running to completion to provide accurate data for teh next 3.

Hi Terry,

It is not the first time you write about this "timing issue". I searched all of my source codes (macros and plugins) for sleep() or wait() and found only a few. There are some sleep()s in while (exec.IsMoving()) (or UC.IsMoving()) not to hang the threads and some wait()s only in one project where some outputs have a setable delay. I've never seen or heard about any problem with timing, just from you. I don't understand what's going on by you, but there must be some reason... :shock:
dezsoe
 
Posts: 2049
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: exec.actualmodal

Postby Robertspark » Wed Nov 21, 2018 1:20 pm

Robertspark wrote:Dan

suggestion.... as you're a plugin man.

instead of trying
int originalmodalmode = exec.actualmodal;
int originaldistancemode = exec.actualdistmode;


how about trying

int originalmodalmode = UC.actualmodal;
int originaldistancemode = UC.actualdistmode;


:oops: :oops: I've tried everything.... I know where the variables are I just cant get access to them {my knowledge of c# is too little and what little I had gleaned is rusty....}
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

Re: exec.actualmodal

Postby dezsoe » Wed Nov 21, 2018 5:16 pm

BUT if you think it is just me then I will never mention it again,Not a problem for me I am just trying to help out. Even though you too have mentioned having to use wait to make a plugin function work properly.

My problem is not that you mention it, but that I can't understand why do you have these problems. No, I use wait() only in some macros where a delay must be after an output change. In plugins I use Thread.Sleep() not to load the CPU useless when it is just in a while loop waiting for an other thread to finish. The plugin would work fine without it, but there's no reason to load the CPU. Example from a new plugin:

Code: Select all
    Private Function ReferenceProbe() As Boolean
        Dim thrStartProbe As New Thread(Sub() ReferenceProbeThreadFrame())
        thrStartProbe.CurrentCulture = Thread.CurrentThread.CurrentCulture
        ReferenceProbeResult = False
        thrStartProbe.Start()
        While thrStartProbe.IsAlive
            Thread.Sleep(50)                           ' <--- This sleep is just for not to load the CPU while the thread is working
        End While
        Return ReferenceProbeResult
    End Function

Edit: I'll check your code maybe in the evening.
dezsoe
 
Posts: 2049
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: exec.actualmodal

Postby dezsoe » Wed Nov 21, 2018 9:04 pm

I see. If it has to finish then you just have to call UC.Codesync().
dezsoe
 
Posts: 2049
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Previous

Return to Ask a question from support here

Who is online

Users browsing this forum: Google [Bot] and 29 guests

cron