![]() | |
| Home Page | Mark Forums Read | Today's Posts | My Replies | Classifieds | Reviews | Photo Gallery | Web Links | Share Files | Advertise With Us | Ad List |
| |||||||
| Mach Software (ArtSoft software) Discuss Mach 1 , 2 and the new Mach3 here NC software here! |
| This forum is sponsored by: |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
| |||
| |||
Hi, I recently ordered a 4-axis Taig CNC machine. I want to use it, aside of standard metal working, to perform repeated trajectories in space. I'd need mach3 to output the current poistion (x,y,z,a), velocity components and acceleration components at every time step (say 10-1000Hz) I'd like some pointers on how to do that with mach3, I'm a software engineer, I'm not afraid of coding some plugin, macro, etc. Thank you |
|
#2
| ||||
| ||||
| I think you can use the macropump feature to read the DRO's. Not sure if it can write to a file fast enough, though?
__________________ Gerry Mach3 2010 Screenset http://home.comcast.net/~cncwoodworker/2010.html (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management) |
|
#3
| |||
| |||
Looks simple! I Should be ok with these, and CDate function. I don't how how precise it is though (I need at least milisecs, ideally usecs) Wiki "ZMachine" = Z Mach Positions (G53 Coordinates) "XMachine" = X Mach Positions (G53 Coordinates) "YMachine" = Y Mach Positions (G53 Coordinates) "Encoder1" = X Encoder Position "Encoder2" = Y Encoder Position "Encoder3" = Z Encoder Position "Encoder4" = A Encoder Position However, how can-I make sure that I don't over-stress mach3? Last edited by maxlem; 04-14-2009 at 11:32 AM. |
|
#4
| |||
| |||
| Hi, Reading DRO's and writing those values to a .txt file is easy to do (as you've discovered) but you'll NEVER get the update rate that you are looking for. The macro-pump runs at roughly 10Hz and AFAIK that is as fast as it gets without going to a custom plugin. Besides, the Mach3 application (which is what calculates and displays the info in the DROs) runs at 10Hz (again AFAIK) so even if you would find a way to read the DROs at 10kHz it wouldn't give you much. Writing a custom plugin might allow you to do it quicker but it's a much steeper learning curve. I see you are a software engineer so that'll help a lot but I'm pretty sure you'll never get uS or even mS timing resolution. To be sure though contact ArtSoft, post on the Machsupport forum or on Mach3 Yahoo's usergroup as the author(s) of Mach3 hangs around there and they'll give a correct answer for sure. /Henrik. |
|
#5
| |||
| |||
10Hz would be better than nothing. I found a way to get the kernel timer (see below). But now I want to slow it down with som sleeps, but it refuses with a "Type Mismatch" error. I'm getting a lot of "Type Mismatch" errors in the script engine For example Code from this guy : Henrik Code: '---=== M3 Macro ===--- Declare Sub Sleep Lib "Kernel32" (ByVal dwMilliseconds As Long) 'ActivateSignal(Output3) 'Release the break Sleep 200 'Wait 200mS 'DoSpinCW() 'Start spindle I tried with a custom type : Code: Type MyType low As Long high As long End Type Code: Type HighResTimer low As Long high As Long End Type Declare Function QueryPerformanceCounter Lib "Kernel32" (ByRef current As HighResTimer) As Boolean Edit : ok found this http://www.cnczone.com/forums/showthread.php?p=522304 Last edited by maxlem; 04-14-2009 at 03:46 PM. |
| Sponsored Links |
|
#6
| |||
| |||
| Hi, Yes, the Sleep command has now been "integrated" so you should no longer declare the Sleep as being in the Kernel32 library. I don't know if you realised but henriksplace.se is actually my site ;-) I'll have to update that section of the site to reflect this change as it's been like this for quite some time now...... Good luck! /Henrik. |
|
#7
| |||
| |||
no I didn't realize! Thanks for the ressource, it is what got me started! I finally managed to finish a first version of the script. It seems to work fine, but I wonder if it could affect Mach3's normal behaviour. What is this macro pump checkbox thing? Right now I run the script from the script editor start button. I suits my needs, but is there a cleaner way? Here it is Code: Type HighResTimer
low As Long
high As Long
End Type
Declare Function QueryPerformanceCounter Lib "Kernel32" (ByRef current As HighResTimer) As Boolean
Declare Function QueryPerformanceFrequency Lib "Kernel32" (ByRef current As HighResTimer) As Boolean
Const TimeSteps = 1000
Const Dimensions = 4
Dim positions(Dimensions,TimeSteps) As Double
Dim timestamps(TimeSteps) As Long
Dim timestamp As HighResTimer
Dim frequency As HighResTimer
Dim fileNumber As Integer
DoOEMButton(1000) 'Cycle Start
For timeStep = 0 To TimeSteps
For dimension = 0 To Dimensions
positions(dimension, timeStep) = GetDRO(dimension)
Next
If(QueryPerformanceCounter(timestamp)) Then
timestamps(timeStep) = Abs(timestamp.low)
Else
MsgBox("QueryPerformanceCounter returned false!")
End If
Sleep (10)
Next
DoOEMButton(1001) 'Cycle Pause
fileNumber = FreeFile
If Not Kill("C:\Mach3\log.txt") Then
End If
Open "C:\Mach3\log.txt" For Output As fileNumber
If QueryPerformanceFrequency(frequency) Then
Print #fileNumber, "Timer frequency: " & Abs(frequency.low) & "Hz"
End If
For timeStep = 0 To TimeSteps
For dimension = 0 To Dimensions
Print #fileNumber, positions(dimension, timeStep) & " " & timestamps(timeStep)
Next
Print #fileNumber, " "
Next
Close
MsgBox ("Succes!") |
|
#8
| |||
| |||
| Hi, A macropump is a script that is automatically called at rouhly 10Hz. You save the script with the name Macropump.m1s in your machine profiles Macros folder and then activate it with the checkbox. You may need to restart Mach3 as well. Now the script Macropump.m1s is called 10 times/second. Not sure it's the right aproach for your particualr code though. /Henrik. |
![]() |
| Tags |
| logging, mach3, position, programming, velocity |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Max Velocity and acceleration | Jamy | General CNC (Mill and Lathe) Control Software (NC) | 2 | 12-03-2008 11:35 PM |
| time logging | rgee | CNCzone Club House | 0 | 06-23-2008 06:42 AM |
| Taig velocity/acceleration | juzwuz | Taig Mills & Lathes | 5 | 02-12-2007 02:38 PM |
| Velocity/Acceleration question | studysession | Mach Software (ArtSoft software) | 2 | 01-09-2007 04:01 PM |
| Fine Tuning Velocity and Acceleration. | sunmix | Mach Software (ArtSoft software) | 6 | 09-30-2006 01:46 AM |