Machsupport Forum
G-Code, CAD, and CAM => G-Code, CAD, and CAM discussions => Topic started by: jgsturbo on November 03, 2012, 03:00:13 PM
-
Is there a macro/command to output the current XYZ and A/4th encoder DROs to a txt file?
Built a large digitizing machine and want to update a file to read into ACAD.
If not can somebody post an example macro?
-
From a CB script use
OpenDigFile()
CloseDigFIle()
From a G code file use
M40
M41
(;-) TP
-
Ok, that opens a file... but what do I use to write the current encoder position DROs to a line in the file?
-
Those processes are for using the G31 probe routine and they record the Trip position of the probe tip. IF you are going to use a probe to gather the data then when you open the file MACH3 writes to that file automatically on each probe trip Until you close the file.
IF you are going to gather data any other way you will have to write your OWN script(plugin or CB macro) to record the data to a file.
Hope that helps, TP
-
If I manually "trip" the probe input via hotkey, it should record the current position... right?
What makes the choice to record the Encoder DRO or the Machine postion DRO ?
-
If I manually "trip" the probe input via hotkey, it should record the current position... right?
Only if your in the middle of a G31 move.
What makes the choice to record the Encoder DRO or the Machine postion DRO ?
There is no choice. It will only write the coordinates from the position DRO's.
As Terry said, you're probably going to need to write your own macro to do what you want.
-
Exactly HOW do you plan to use your machine to digitize a part. Maybe we can help.
(;-) TP
-
I've written some macros but I have no clue what the command to write the Encoder DROs to a file would look like.
I have a visual laser probe and once I have it aligned I would like to push a button or hotkey to write the cords.
Anybody care to post what the write command would look like>?
-
N/M
With some hacking and the power of google I've answered my own issue.
M103
Open "M:\digitize\currentproject.txt" For Append As #1
X = GetDRO(170)
Y = GetDRO(171)
Z = GetDRO(172)
Print #1, X,",",Y,",", Z
Close #1
Now all I need to do is make an M103 button.
I do have one more question tho, can I hook this M-code to an input?
-
SUre,
If Isactive(input1) then
Open "M:\digitize\currentproject.txt" For Append As #1
X = GetDRO(170)
Y = GetDRO(171)
Z = GetDRO(172)
Print #1, X,",",Y,",", Z
Close #1
End If
End
But there MAY be an easier way, Let me check back through some notes when I was working on a MACH3 CMM Machine. What I did was use the M40 function to open the Points FIle and then use a G31 call to nowhere to force MAch3 to write the point values to the file for me. Then move to where ever is next and make the call again. It worked well back then just not sure of the call I created .
(;-) TP
-
This piece of script will cause MAch3 to write the trip values each time it is activated AND the points file is OPEN. NOW this works on older version of MACH3 NEWER versions ????
Call the M40, assign a file name
Create a button script with this:
Code"G91 G31A0.1 F1000"
Code"G00 A-0.1"
Code"G90"
End
MOVE to a pos and push the button MAch3 will write the triplet fileXYZ to the file
MOVE and press button ,etc,etc,etc
(;-) TP
-
Seems simple enough to me, thanks a bunch!
Slowly learning VB script, very different from my usual bash script writing.
Anyway to get this to loop until say I call up an M30?
-
Not sure exactly what you need . If you explain your process maybe I can help.
(;-) TP
-
With some testing and such I think I like my original script/M-code.
I hooked it to a button in screen designer and the button is hooked to a hot-key.
Done, except I'm getting weird results but I have yet to actually wire in and setup the encoders so we'll see if that changes.