Hi Balazs or anyone cranking out plugins that actually work!
,
I'm resurrecting this ancient question because I'm either screwing up something very simple, or something broke in recent test releases, or I'm losing my mind
I've built up a surface scanning routine as a Macro and got it working fairly well as a VB Macro... Now I'm trying to stuff that routine code into a Plugin so I can have an interface and plots to go with the routine to make it more user friendly. The plugin and testing is being done with UCCNC 2109, targeted for any cpu and DotNet 4.0, and is written in VB. I've tested on two computers, with both a UC300eth and a UC100 with same problems.
After struggling with the routine a bit as a plugin (as in, I can't get past the first move), I went back to a very simple button calling a single simple G31 move like this:
- Code: Select all
Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click
Dim x
Dim feed As Integer
Dim readX
x = UC.GetXpos
x = x + 1
feed = 10
MsgBox("GO TO X = " & x & " Feed = " & feed)
'Me.TrackBar1.Value = 200
delaytime = Convert.ToDouble(Me.TrackBar1.Value)
MsgBox("delay =" & delaytime)
UC.Code("G31 x" & x & " f" & feed) ' command a G31 probe move
' Delays and msgboxs commented out currently, un-commenting does not fix.
'MsgBox("before delay")
'UC.Wait(delaytime) ' THIS DELAY NO LONGER WORKING TO PREVENT PROGRAM FROM GETTING AHEAD OF MOVES. WHY?
'Thread.Sleep(delaytime) ' Thread sleep didn't work either...
'MsgBox("after delay")
While (UC.IsMoving())
MsgBox(" in loop") ' Added as test to see if this loop was skipped or not. This works if the move is a G1 instead of G31
End While
'UC.Wait(delaytime) ' Tried delays down here, no affect on problem
readX = UC.Getvar(5061)
MsgBox("X read= " & readX)
End Sub
No matter what I do with regards to adding a 'delay' after issuing the UC.Code("G31 .....") command, the routine runs to the end and shows the final dialog (which either spits out readX as 0, or as the value from the PRIOR G31 trip from pressing the button the last time...), then the G31 movement starts. No matter what, I cannot get the UC.Ismoving() to keep the routine from getting ahead of the move. I've used delays of 2000 msec, and it just sits there for 2 seconds, then shows the final msgbox, then movement starts. So, I'm baffled...
However, if I replace the UC.Code("G31 .....") command with a G1 move as UC.Code("G1 ....."), the Ismoving() loop triggers and things happen in the proper order.
Any ideas? I'm really at my wits end
I was going to start recompiling back to a DotNet 2.0 release and try to use an old 'release' version of UCCNC to test with, but was hopping someone can point out a stupid error I'm making....
regards
Eric Brust