loading
 
Mach3
Wolfgang Günnewig from Germany  [8 posts]
9 year
Hi,
I am trying to get Roborealm  to communicate to Mach3  running on the same computer(passing x/y-coordinates).I tried around with VB and with modbus  without  success. But my programming skills are very basic.
Does anyone  have a solution?
Steven Gentner from United States  [1446 posts] 9 year
We don't have a 'ready to go module' for exactly that software (first we are encountering it ... sorry, no CNC guys here!).

Do you know what Mach3 has for integration with other applications? I.e. does it have a protocol or standard solution for receiving signals from an external application? I figured that you probably know that applications capabilities better than we do. Perhaps if you can steer us in the right direction we can better suggest how it may be possible.

STeven.
Wolfgang Günnewig from Germany  [8 posts] 9 year
Hello,
thanks for your reply.
Inside the software of Mach3 I can run a VB script, but I don`t know how to get the variables from Roborealm  inside the script.
It is also possible to get data from a modbus device, but I think that Mach3 suspects the data not coming  from the same computer, and I couldn`t establish any communication.

regards
Wolfgang
Steven Gentner from United States  [1446 posts] 9 year
Wolfgang,

In order to get the variables from RoboRealm you'd need to open up a socket connection from within Mach3 and send a <request><get_variable>var_name</get_variable></request> to RR. If you read more at

http://www.roborealm.com/help/API.php

or check the forums you can find this done with many other systems.

The issue is how rich the language that Mach3 provides and if it is even possible to open a socket connection from within their environment. I would expect that this is not possible ... but I don't know the Mach3 environment at all.

STeven.
Wolfgang Günnewig from Germany  [8 posts] 9 year
Hello Steven,

after I installed telnet I got RR communicating with the windows console.
Then I downloaded the RR API and copied and pasted the VB script into the script editor inside Mach3, and changed the path to C:\Program Files (x86)\RoboRealm\RR_COM_API.dll
what is the path in my system. The script did not work.
Here is a link to a PDF with all the VB commands inside of Mach3. http://www.machsupport.com/wp-content/uploads/2013/02/VBScript_Commands.pdf

Wolfgang
Steven Gentner from United States  [1446 posts] 9 year
Mach3 seems to have a comprehensive scripting support so it should be possible to create such a communication. I would refocus back on the dll to see if you can get that to work. Note, the syntax they have would imply that

set rr=CreateObject("RoboRealm.API.1")

rr.Connect("localhost", 6060)

MsgBox rr.GetVariable("IMAGE_COUNT")

*should* work ... but I'm only guessing since I don't have Mach3 to test.

Be SURE to enable to the API in RR as it is off by default and would not be listening to port 6060.

STeven.
Wolfgang Günnewig from Germany  [8 posts] 9 year
Hello Steven,
I tried it out, of course with the API in RR enabled, but I get an error in line 3 wrong parameter.
A full functional version of Mach3 ( just the kernel speed and the number of G codes lines are limited) you can download for free under  http://www.machsupport.com/software/downloads-updates/
Under operator there is the VB script editor.
Thanks
Wolfgang
Steven Gentner from United States  [1446 posts] 9 year
Line 3 would just be printing out the value ... I'm not sure what you wanted to do with the value so that would be up to you to decide. The MsgBox function in theory would just show you the value via a popup. You can just ignore that since you probably want to do something different with the value anyhow. From here on, it appears you have a connection to RR but need to deal with how the values are used in Mach3 in order to get what you want.

We can help further by downloading Mach3 but since that's an application we don't support you'd have to contract with us (or someone else) to do the work. You can use the contact us form to send us a message that we can reply back to via email to work out those details.

STeven.
Wolfgang Günnewig from Germany  [8 posts] 9 year
Hi Steven,
sorry to bother you again!
But the error is in the line -- rr.Connect("localhost", 6060)
Mach3 counts the empty lines too.

Greetings
Wolfgang
Steven Gentner from United States  [1446 posts] 9 year
Perhaps try that line without '(' and ')' as in

rr.Connect "localhost", 6060

since VB doesn't normally like parens when its a subroutine.

STeven.
Wolfgang Günnewig from Germany  [8 posts] 9 year
Sorry, but it still doesn`t work.
I got now ---Wrong number of arguments or invalid property assignment---in that line.
Greetings
Wolfgang
Steven Gentner from United States  [1446 posts] 9 year
Oh, well, you'll have to check with Mach3 or someone what knows that system well enough to get those statements to work. We can look into it too but since this is an application we've not worked with you'd be better off asking an expert on their site.

STeven.
Henrik  [2 posts] 9 year
Hi,
I've got RR talking to Mach3 using the API, both running on the same machine.

It's been a while since I worked on it so I can't remember the details but it was pretty straight forward. I started with the VB script example included in the API download and just went from there.

I don't have access to my code or notes at the moment but let me know if you can't get it working and I'll dig it out as soon as I get back.

/Henrik.
Wolfgang Günnewig from Germany  [8 posts] 9 year
Hi,

that was the first thing I tried, but I got nothing besides of syntax errors.
But my programming skills are not good enough to really understand  what  the script is doing and where the error could be.
The  code would be really helpful to me, so it would be great if you  find time to post it.
Thanks for your posting, I was already thinking there is no solution.
Wolfgang
Henrik  [2 posts] 9 year
Hi,
OK, then I hope this will get you going and serve as a startingpoint.
It sets up the connection with RR and gets the dimensions of the displayed image.

[i]
Option Explicit

Dim ImgWidth As Integer
Dim ImgHeight As Integer

Set rr = CreateObject("Roborealm.API.1")

rr.open"C:\Program Files (x86)\Roborealm\Roborealm.exe", 6060

If Not rr.connect("localhost") Then
  MsgBox("Could not connect to RoboRealm Server")
  rr.Close
  End
Else
  MsgBox("Connected")
End If

' Get the dimenstion of the image and display in message box
rr.GetDimension ImgWidth, ImgHeight
MsgBox("Image size: " & ImgWidth & " X " & ImgHeight)

' Disconnect from RR
rr.Disconnect
[/i]

I just verified the above to work fine using Mach3 3.043.066 and Roborealm 2.57.5.
Wolfgang Günnewig from Germany  [8 posts] 9 year
Thanks a lot!
It worked immediately.

Greetings
Wolfgang
Steven Gentner from United States  [1446 posts] 9 year
Thanks Henrik!

Wolfgang, if you update RR the new COM objects will require a second parameter as the port number in the Connect function. This was one of the reasons the Connect was failing as I assumed the port was also specified. After checking into this, it seems that while we updated the API dll we didn't update the dll distributed with the RoboRealm download which caused my confusion.

At any rate, if you update and you get a similar error to what you've seen before, just change

If Not rr.connect("localhost") Then

to

If Not rr.connect("localhost",6060) Then

and that should solve that problem.

STeven.

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index