I don't know for sure, but I would say no. It's not possible to add a custom g or m code. I think they are hard coded into the software. 99.99%sure..![]()
I've created a functioning custom macro to use for the rotary axis , this is something that I've used on professional machines with great success . I have a macro sub routine that calculates xyz g52 work shifts for any new angle positions based on calculations from the center of rotation to the actual xyz zero positions of the part at A zero, which is to say that I only need to pick up one single work shift from the A axis zero point and the machine calculates the rest for any given angle of rotation , so it gives me a g52 shift for xyz , anyhow it appears that with a few mods it will work well with mach .
now to get to my question , is it possible in mach to create a custom g or m code , I'd rather edit in a simple g code than to add a sub routine call for every rotation , point is to minimize the amount of editing that i need to do to the program and to build the routine into mach rather than it always be at the bottom of the program
this way my program will look like this before the rotation
#1=45.(rotation variable)
g555(*********custom g code with the calculations)
g52x#2y#3z#4
g0 a#1
x***y***
rather than it looking like this
#1= 90.
m98 P8989 (does the calculations in the sub routine which is at the bottom of the program)
G52 X#2 Y#3 Z#4
g0 a#1
x***y***
its always necessary to have the variables in the program header but it would be nice to hide the calculations in the custom g or m code
.
A poet knows no boundary yet he is bound to the boundaries of ones own mind !! ........
http://microcarve.microcarve.biz/
I don't know for sure, but I would say no. It's not possible to add a custom g or m code. I think they are hard coded into the software. 99.99%sure..![]()
http://www.cnczone.com/forums/cnc_wood_router_project_log/125895-my_diy_cnc_cnc2011_%3B.html
i kinda figured so , I cant find any info on it , so if its not possible then its a bit of an inconvenience but not the end of the world , it would be a nice option to have
A poet knows no boundary yet he is bound to the boundaries of ones own mind !! ........
http://microcarve.microcarve.biz/
Mach describes 'Customizable M codes through VB script'.
M codes are usually for external control (PLC like) feature.
But I get the impression that Mach does not use a FIN signal feature, IOW wait until a M code complete signal if needed.
I have not done that much with Mach so I could be wrong.
Al.
CNC, Mechatronics Integration and Custom Machine Design (Skype Avail).
“Logic will get you from A to B. Imagination will take you everywhere.”
Albert E.
i agree that m codes are normally used for external control but hope that i can make something work , this tends to be more for my twisted curiosity and convenience than necessity .
I've played a bit in the macro folder for mach 3 and it seems that i can take the code from the m3 macro , and create a new m code m9797 which runs the same code as the m3 and it works , so hopefully with a bit more research I'll figure out how to (if i can) do my calculations within the m code , then have the calculated variables input into the local variables in mach .
its a nice day , I'm going fishing so it will go on the back burner![]()
A poet knows no boundary yet he is bound to the boundaries of ones own mind !! ........
http://microcarve.microcarve.biz/
got it , its simply a matter of putting SetVar(1, 9.) into the new M9797.M1S file that i created in the macro folder
1 is the variable to modify and 9 is the value to set
so now as a test with an m9797 before g0g90 x#1 , then x will travel 9"
so with it being able to do that then what i want to do will be pretty much a breeze .
Last edited by dertsap; 09-13-2011 at 01:45 AM.
A poet knows no boundary yet he is bound to the boundaries of ones own mind !! ........
http://microcarve.microcarve.biz/
ok so the basics of this macro is coming together , the calculations are done but need to be modified some for mach to understand what i'm telling it to do , I'm trying to minimize the amount of code that i need to edit into my programs so the g52 shift will be within the custom m code , this way I'll only need to edit in the m code after every rotation , A axis rotations will no longer need to be a variable number in the program as i had it before because i can get the dro value within the macro after the A axis rotation (if if any of this makes sense to anyone) , now for the trouble that I'm having in order to complete this task , i need to edit the m1 and m30 so that i can cancel the g52 shift by adding g52x0y0z0 .
where is the coding for the m30 and m1 , these m codes are not in the macro folder and i can't seem to find them anywhere ? is it possible to modify these two m codes ?
so far the custom header will look similar to this
%
O8000
#1= 1.025 (Y DEV from center of rotation at A0)
#2= -0.529 (ZDEV from center of rotation at A0)
#3= 0 (ANGLE )
#4= -2.525 (SHIFT FROM TOOLPROBE T0 part Z0 AT A0)
g0g90 x blah y whatever A0
m9797
g43 blah
blah
a90.
m9797(custom m code after rotation which trigs g52 shift based from g54 position and all variables)
g0x@$y^@
;
;
;
.
Last edited by dertsap; 11-13-2011 at 02:41 AM.
A poet knows no boundary yet he is bound to the boundaries of ones own mind !! ........
http://microcarve.microcarve.biz/
No, those two are hard coded.
What I'd do is make two custom M codes and have them tag along with M1 and M30, say M901 and M930.
Have your post put them in your code something like this.
M1
M901
....
....
....
....
M930
M30
So, after your M1 stop, the M901 can do what you want to do with M1.
Then at the end of your code, the M930 can do what you need before the M30 rewinds to the beginning.
I missed this thread earlier. let me know if you get stuck, and I'll try to help if I can.
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)
thanks Ger
That's what I sort of figured I'd have to do , what I think I'll do is create a couple m codes to replace the m1 and m30 ,
this way a couple of simple program edits will suffice and I should be able to modify my post to do it for me .
So far I've got all the basics down and will finish it at some point soon , right now much of my focus is on completing my mill conversion , and today getting some fish smoked![]()
A poet knows no boundary yet he is bound to the boundaries of ones own mind !! ........
http://microcarve.microcarve.biz/