v2116 plugin interface issues

If you think you've found a bug post it here.

v2116 plugin interface issues

Postby eabrust » Fri Nov 03, 2023 11:19 pm

Hi Balzas, Dezsoe,



I'm trying to get some of my plugins that broke w/ v2116 working again :D , and It appears that the plugin interface has broken or something changed. can you check on this:

Currently UC.getfield( ) won't return values into a plugin. To verify it wasn't just my plugin, I compiled the example plugin included with the last build, and it is broke to. This isn't working:
Code: Select all
        Try
            MyForm.Label1.Text = "X: " + UC.Getfield(True, 226)

        Catch ex As Exception

        End Try


It just shows zero all the time, no matter the value of x axis position. My plugins are also not performing a 'setfield' either.


To anyone that uses UCamCopy and/or ProbeIt, note that they will not currently open w/ version 2116. I'm working on it, appears to be related to the version of OpenTK changing.

Thanks!
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: v2116 plugin interface issues

Postby cncdrive » Sat Nov 04, 2023 9:28 am

Yes, we changed OpenTK version to 3.3.2.0 because I found a bug in the previous version.
I'm not sure if your issue is related to that, but will test your code, bug report soon.
cncdrive
Site Admin
 
Posts: 4887
Joined: Tue Aug 12, 2014 11:17 pm

Re: v2116 plugin interface issues

Postby dezsoe » Sat Nov 04, 2023 10:13 am

Eric, I send you a mail. I could not reproduce the issue, so I'll have questions.
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: v2116 plugin interface issues

Postby eabrust » Sat Nov 04, 2023 11:55 am

Thanks both for getting back to me, email is sent to Dezsoe with some info and a link to the sample project I compiled.

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: v2116 plugin interface issues

Postby dezsoe » Sat Nov 04, 2023 10:54 pm

Well, I've already wrote you a mail telling you that your plugin works fine. Then I decided to test it once more on a fresh install and it didn't work. I had to think a little before I got it. :)

If you test your plugin using the old screenset then it will work, but not using the 2019. It is because the old screenset uses the field 226, but the new doesn't. Fields 226 to 231 hold the work or the machine coords depending on the state of the machine coords switch. It is OK on the old screenset but on the new there are both coords, so changing the "work coords" column with the mach. coords switch would be bad. This is why there are new fields for the work coords (2897..2902) that are always the work coords.

However, reading the coords from the fields is not a good practice, because they may update a bit later then you read them while the machine is moving or it has just stopped. Always use the function calls to get current coords.
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: v2116 plugin interface issues

Postby eabrust » Sun Nov 05, 2023 12:25 pm

Thanks again Dezsoe for clear explaining. It hadn't occurred to me that field labels for things like axis position might change in future versions, or that they would fail to provide data if not used on the screenset. Good to know for future updating.


I hear you on good practice and using the getfield() function, but mainly I was using those functions to 'duplicate' the dros on the UCCNC screen to my screen.

So here is a question I hope you can give some guidance.

I used to use UC.getfield( true, label#) and UC.setfield( true, value, label#) for reading and setting axis positions on my plugin.
Its easy to replace uc.getfield() w/ uc.getXpos() to read a position, but there is not equivalent function such as uc.setXpos()... what is the proper thing to do for setting a new axis position with a user defined value, if there is chance label numbers may change or may not be there in the screenset? Should I just replace field 226 with field 2897 (and so on) and keep using uc.setfield(), or is there a better method not susceptible to the screenset possibly changing label numbers again in future?

thanks again! :)

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: v2116 plugin interface issues

Postby dezsoe » Sun Nov 05, 2023 1:10 pm

Well, it's a good question.

The most important is that the function of the coord fields did not change. The problem is that if a field is not on the screen then it has no value.

There's no easy way to find out which fields are displayed. However, I've never had this problem, because I never write the coord fields. If I want to change coords then I calculate the offsets and call G10 L2 to set them. Here is a piece of code from the probing plugin:

Code: Select all
    Friend Const _G92OffsetFields As Integer = 500                                                  ' 500..505 XYZABC
    Friend Const _ToolOffsetZField As Integer = 169                                                 ' Tool length offset
    Friend Const _ToolOffsetXField As Integer = 2763                                                ' Tool X offset

    Private Function ZeroAxis(Axis As Integer, Mach As Double) As Boolean
        If FixtureNo < 1 Or FixtureNo > MaxFixtureNo Then
            DebugInfoStat("Invalid fixture number: " + FixtureNo.ToString)
            Return False
        End If
        Dim codelist As New List(Of String)
        Dim sAxis As String = AxisName(Axis)
        Dim G92Offset As Double = UC.Getfielddouble(AS3, _G92OffsetFields + Axis - 1)               ' G92 offset
        Dim ToolOffset As Double = 0.0                                                              ' Tool offset
        If Axis = 1 And IsOffsetX Then ToolOffset = UC.Getfielddouble(AS3, _ToolOffsetXField) ' X offset
        If Axis = 3 Then ToolOffset = UC.Getfielddouble(AS3, _ToolOffsetZField) ' Z offset
        Dim ProbeAxisOffset As Double = 0.0
        If OffsetProbe Then
            ProbeAxisOffset = ProbeOffset.Coord(Axis)
            DebugInfo("Probe offset: " + sAxis + ProbeOffset.Coord(Axis).ToString("F6"))
        End If
        Dim G10Coord As Double = (Mach - G92Offset - ToolOffset - ProbeAxisOffset)
        If ZeroOnAllOffsets Then
            For ii As Integer = 1 To MaxFixtureNo
                codelist.Add("G10 L2 P" + ii.ToString + " " + sAxis + G10Coord.ToString("F6"))
            Next
        Else
            codelist.Add("G10 L2 P" + FixtureNo.ToString + " " + sAxis + G10Coord.ToString("F6"))
        End If
        Dim ret As Boolean = CodeListSync(codelist)
        Results.Update()
        Return ret
    End Function

ZeroAxis sets the axis offset so that the work coord to be zero at the given machine coord. It calculates also with the G52/G92 and tool length offset. FixtureNo is 1..6, Axis is 1..6. IsOffsetX is true when UCCNC version >= 1.2116.
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary


Return to Report a bug

Who is online

Users browsing this forum: No registered users and 7 guests