Skip to main content
Submitted by a7777777113 on Thu, 08/24/2017 - 18:14

Hello Guys!

We now have three motion controllers

DMC type as follows:

1.DMC-42x0
2.DMC-21x2
3.DMC-21x2

There three motion controllers all into the computer.

How to do control three motion controllers for VB.net

I refer to the documentation VB.net&API and DMC 21x2&42x0

Now I have a problem,i using this command

Public dmc As New Galil.DMCAPI
dmc.apiOpen(1, System.IntPtr.Zero)

Which motion controller starts? 1.or 2. or 3.?

And which motion controller move ,when i input command

dmc.sCommand("JG 50000")
dmc.sCommand("BGX")

I think there should be other ways.
How should i edit code?
I hope you help me ,THANKS!!

Comments 1

AndrewS on 08/25/2017 - 08:45

Hi a7777777113,
The library you are using is legacy and isn't supported on current Windows operating systems, so first, you are going to want to use gclib, our current generation API.
Following the steps from the section "Create Project from scratch with MSVC 2013" found here: http://www.galil.com/sw/pub/all/doc/gclib/html/vb.html.
You can modify the code like this to talk to two different connections.
Public Class Form1
Dim gclib1 As New Gclib()
Dim gclib2 As New Gclib()
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.Text = "gclib simple example"
Dim tb As New TextBox
With tb
.Multiline = True
.Dock = DockStyle.Fill
.Parent = Me
Try
'calls to gclib should be in a try-catch
.AppendText("GVersion: " & gclib1.GVersion() & vbCrLf & vbCrLf)
'open connections to both controllers
gclib1.GOpen("192.168.1.23") 'Set an appropriate IP address here
gclib2.GOpen("192.168.1.43") 'Set an appropriate IP address here
'controller 1
.AppendText("Controller 1:" & vbCrLf)
.AppendText("GInfo: " & gclib1.GInfo() & vbCrLf)
.AppendText("GCommand: " & gclib1.GCommand("MG TIME") & vbCrLf)
'controller 2
.AppendText(vbCrLf & "Controller 2:" & vbCrLf)
.AppendText("GInfo: " & gclib2.GInfo() & vbCrLf)
.AppendText("GCommand: " & gclib2.GCommand("MG TIME") & vbCrLf)
Catch ex As Exception
.AppendText("ERROR: " & ex.Message)
Finally
gclib1.GClose() ' Don't forget to close!
gclib2.GClose()
End Try

End With
End Sub
End Class

If you need more specific help, please email support@galil.com

Regards,
Andrew