Hello Guest it is March 28, 2024, 02:13:34 PM

Author Topic: COM API  (Read 5135 times)

0 Members and 1 Guest are viewing this topic.

Offline TonyG

*
  •  12 12
    • View Profile
COM API
« on: November 13, 2009, 05:14:33 PM »
My company purchased a desktop CNC machine and a copy of Mach 3 to use for some automated testing.  I need to write a program that controls the stepper motor positions and captures some data from our sensor.  I'm a software programmer and don't know anything about CNC machines or G-Code (other than what little research I've done today).  I found one message one this forum where someone talked about using VB.NET to send commands via the "COM API", but I couldn't find any other references to the API or to controlling the unit with external software.

Can someone point to a reference manual, sample code, etc. that shows how I can interact with Mach 3 programmatically to do what I need?  I'm not really picky about how it gets done since this is for research use only, not production.  For example, I'd be OK with writing out a G-Code script file and then executing Mach 3 with a command call if that's possible.

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: COM API
« Reply #1 on: November 13, 2009, 05:39:04 PM »
There are many ways to do that kind of stuff, you need to state WHAT you want done, and where data captured to? etc.

scott
fun times

Offline TonyG

*
  •  12 12
    • View Profile
Re: COM API
« Reply #2 on: November 13, 2009, 05:47:04 PM »
Basically we need to move a stylus across a flat touch panel surface.  The stylus will be mounted to the Z axis arm with a spring-loaded mechanism so we can move it around easily.  The test program will move the stylus around in a general back-and-forth pattern.  For example:

1) Start at a particular X,Y location
2) Move 3in to the right
3) Move 0.5in down
4) Move 3in to the left
5) Move 0.5in down
.....

As the stylus moves across the surface, our test program will capture data from the touch panel.  We need one program to control both the stylus location and the touch panel so we can correlate specific X,Y locations with specific data.

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: COM API
« Reply #3 on: November 14, 2009, 11:02:36 AM »
what is your capture rate of the z probe?

mach will update at 10hrtz, so if you need faster data captures than that, you will have do something different, you could export out dro loactions
to your data capture app, but the poll rate from out  of mach would still be 10hrzt.

the new version 4 has a faster loop time but have heard numbers like 50 hrz.... 

In your case if you need fast capture rates faster than mach can provide, you may have to bite the bullet and do somthing like LabView.

scott
fun times

Offline TonyG

*
  •  12 12
    • View Profile
Re: COM API
« Reply #4 on: November 14, 2009, 12:55:45 PM »
"Something like LabView" is exactly what I want to do.  I don't want to use Mach unless I have to.  How do I send commands to the stepper motors  via LabView/C#/VB/etc.?

Offline KTM

*
  •  92 92
    • View Profile
Re: COM API
« Reply #5 on: November 15, 2009, 03:14:55 AM »
If you do not want to use Mach, you need to understand how to interface with a parallel port.

Anyway - Why do you want to capture the data from the touch screen?? You can use a program like copycat where you jog around and capture the points in g-code format, then you can convert it to DXF if you need to work with the drawing in CAD.

Regards

KTM

Offline TonyG

*
  •  12 12
    • View Profile
Re: COM API
« Reply #6 on: November 16, 2009, 02:44:26 PM »
Using the parallel port is not a problem.  I just don't know what to send to the parallel port to do what I want.  Essentially I need to write a function that works something like this:

void GoToPosition(int XCoord, int YCoord);

Given a specific X/Y location, what do I send to the parallel port to put the stylus at that position?  I also need to know how to raise and lower the stylus.