Using the MMTDriver OLE Server
This page shows some of the basic interfaces that are available via the MMTDriver server.
This server can be used to communicate with a CMM machine.
Back to index
Creating a new MMTDriver object
The application of the MMT Driver is different to the main product OLE servers.
The MMT Driver is more like a typical control used in Visual Basic.
First, you need to add the MMTDriver OLE Control Module to your project.
In Visual Basic, open a project, and select from the menus, PROJECT, COMPONENTS.
Turn on the option for 'MMTDriver OLE Control Module' as shown below. Then Click OK.
If you
now look at the available controls, an additional icon will appear as shown below:
You can now add this control onto your form. Select the above icon, then indicate on your
form where to put the control.
It doesnt matter where on your form you put the control, as it is invisible when the form is loaded.
Give the control a name which you will then refer to when using the MMTDriver object (e.g. MMTDriver)
Connecting to a CMM machine
You need to connect the MMTDriver to your CMM machine.
Assuming you have an MMTDriver object on your form named 'MMTDriver', the command to connect to a CMM machine is:
MMTDriver.Connect
The object will now be connected to the CMM machine. However, just connecting to the CMM machine will have no immediate effect. Any points taken by the CMM machine will be ignored until you make the object ready to receive points (as explained below)
To disconnect the MMTDriver from the CMM machine, the command is:
MMTDriver. Disconnect
Setting the MMTDriver object ready to receive points
After connecting to a CMM machine, you next have to make the MMTDriver object ready to receive points. The command is:
MMTDriver. StartTransaction
The object will now accept points from the CMM machine.
To stop the MMTDriver receiving points, the command is:
MMTDriver. StopTransaction
Responding to point input from the CMM machine
When the MMTDriver is connected to a CMM machine, and made ready to receive points, you then need to set-up your Visual Basic program to respond to a point input.
If you double click on the MMTDriver object, a new sub routine will be automatically created:
Private Sub MMTDriver1_ReceivePoint(ByVal X As Double, ByVal Y As Double, ByVal Z As Double, ByVal vdegX As Double, ByVal vdegY As Double, ByVal vdegZ As Double)
End Sub
This sub routine will be called whenever the MMTDriver receives a point from the CMM machine. The variables defined in the routine are automatically filled with the point information.
e.g. X, Y and Z will contain the co-ordinate data for the point.
So you can enter the code required to process the point, into this sub routine. For example you may have a list control on your form, to hold the points you have taken:
e.g.
Private Sub MMTDriver1_ReceivePoint(ByVal X As Double, ByVal Y As Double, ByVal Z As Double, ByVal vdegX As Double, ByVal vdegY As Double, ByVal vdegZ As Double)
Listbox.AddItem (Str(X) + " " + Str(Y) + " " + Str(Z))
End Sub