Hello Guest it is October 16, 2019, 01:41:09 PM

Author Topic: Mach3 MDI Controlled by other Programs?  (Read 13798 times)

0 Members and 1 Guest are viewing this topic.

Mach3 MDI Controlled by other Programs?
« on: June 09, 2015, 02:52:39 PM »
I am new here and not having much knowledge of Mach and CNC in general, so maybe my question is silly.

I have a Mach3-controlled CNC. What I want to is simply to move CNC to a certain position using G0 command. After this I would do some measurements and calculations from other program like Matlab. The program then could gives the next positon based on the calculations from Matlab, which position is not known beforehand. And then I need to give Mach3 another G0 command and repeat the process again and again. For now, I could type in such G0 command from MDI to do this, but I want to make this an automation process.

Instead of typing the command by hand, could I send in such command from other software like Matlab or C program? So is there a way that I could have access to the MDI via macro, plugin or other means?

I noticed there are SDK for download which is said to be able to interface others programmers code to Mach3’s interface. I wonder if this could possibly do the job.


Anyone has any ideas or any suggestions?

Thank you very much.

FQ
Mach3 MDI Controlled by other Programs?
« Reply #1 on: June 09, 2015, 04:18:21 PM »
VB macros are one way to go.


Sent from my iPad using Tapatalk
Re: Mach3 MDI Controlled by other Programs?
« Reply #2 on: June 09, 2015, 05:38:29 PM »
VB macros are one way to go.


Sent from my iPad using Tapatalk

I don't quite know much about macros for now. Do you mean by using macros, I could set the position values obtained from other programs like Matlab in real-time and execute G0 commands?

My problem is that I need to execute one G0 command to move CNC to a new positon and do some calculations using matlab which would then gives a next position for my next G0 command. So my question is how to set up the communications using macros.

Many Thanks
Mach3 MDI Controlled by other Programs?
« Reply #3 on: June 29, 2015, 07:51:27 AM »
Why do you want to do the calculations as you go?  Can you not do them all in advance?  For example, if you can write the x y and z moves you want to make into an Excel spreadsheet in a suitable tabular format it is very easy to use standard Excel functions to automatically generate G code.


Sent from my iPad using Tapatalk
Re: Mach3 MDI Controlled by other Programs?
« Reply #4 on: August 24, 2016, 03:15:37 AM »
Hi statfq,
is there a particular reason you wish to use Matlab? The VB scripting language built into
M3 has all the usual maths functions. Would they suffice for your calculation?

Craig
My wife left with my best friend...
     and I miss him!
Re: Mach3 MDI Controlled by other Programs?
« Reply #5 on: August 24, 2016, 12:25:42 PM »
A couple of observations here:

1.  G0 vs. G1.  G0 is used for rapid positioning of the cutting tool (Router, Plasma, Laser, etc.) and G1 is usually moved for a programmed cutting move at set feed rate.
2.  G-Code file.  This automation is the whole basis of a G-code file.  You would use whatever CAM software you have available (I'm not familiar with Matlab, but it sounds like it could work) to generate the output into a g-code file (.NC, .TAP, etc.) and then use Mach3 to load the file and run it.

Bear in mind a complete g-code file will have additional commands and should be run through a Post-processor to format it correctly for Mach3 as well as ensure the proper sequence of commands are added/followed.  Other methods _could_ be used to automate the output from your  programs, but this is what Mach3/4 are designed for - proceessing G-code files!

Stephen "Highspeed" Kruse
Re: Mach3 MDI Controlled by other Programs?
« Reply #6 on: August 25, 2016, 03:19:22 AM »
Hi Highspeed1964,
I have used MATLAB fairly recently. I was astounded by how powerful it is.

I used it (demo version only) to simulate a control system I am building for a servo.
You can graphically introduce integrators, differentiators, gains, delays, non linearites
and all sorts of other stuff. It can simulate the system and display it like an oscilloscope
or step response or a Bode plot and more other ways than I can describe. AND this was
only the 'control' module, there are a hundred or so other modules you can add including
symbolic maths equations and another code generator where you tell MATLAB what CPU
youre using and it programs in C your system. If you want technical or scientific computing
MATLAB is the way to go.

From what I could see however it would suck at CNC.

I imagine MATLAB 'objects' could be incorporated into Mach3 but I still have to ask why. If you
require the advanced mathematical simulation and/or matrix manipulation that MATLAB offers
well it could be done. The most mathematics I've had to indulge in CNCwise is trigonometry and
basic arithmetic which can be handled perfectly well by Visual Basic built into Mach3.

Craig
My wife left with my best friend...
     and I miss him!