Visual Studio gave me a warning about this line:
Code: Select all
Dim droType As CentroidAPI.CNCPipe.Dro.DroCoordinates = droObject.DroCoordinates.DRO_MACHINE
Because of the droObject reference but it ran fine for me. To avoid this warning, Import CentroidAPI.CNCPipe.Dro and then change the reference in your typing to:
Code: Select all
Dim droType As CentroidAPI.CNCPipe.Dro.DroCoordinates = DroCoordinates.DRO_MACHINE
Then you would call:
Code: Select all
droStrings(0).Item1 ' to get the first Axis Label
droStrings(0).Item2 ' to get the first Axis Machine Position
droStrings(0).Item3 ' to get the first Axis Load Meter readout.
I would put it all together as a function, like so:
Code: Select all
Imports CentroidAPI.CNCPipe.Dro
......
Function GetDroReadout(ByVal axis As Integer) as String
' reuse existing pipe to prevent using up all of CNC12's API Pipes
Dim droObject As New CentroidAPI.CNCPipe.Dro(m_pipe)
Dim droType As CentroidAPI.CNCPipe.Dro.DroCoordinates = DroCoordinates.DRO_MACHINE
Dim droStrings As Tuple(Of String, String, String)() = Nothing
Dim result As ReturnCode = droObject.GetDro(droType, droStrings)
Return droStrings(axis).Item2
End Function
Where axis is 0-7, Default Mill/Router config would be 0 = X, 1 = Y, 2 = Z but may vary depending on machine purpose and setup.