I have been setting up a BP knee mill manual tool change,
and need some Ideas on modifying the post to M0 for the high / low speed switch
I have been setting up a BP knee mill manual tool change,
and need some Ideas on modifying the post to M0 for the high / low speed switch
IF ITS NOT BROKE YOUR NOT TRYING HARD ENOUGH
Ashes to ashes , dust to dust , If it wasnt for Harleys the fast lane would rust.
(Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)
You could set a switch to test for certain speed limits, and if it changes between the two, have it output the M00 codes.
Another way would be to use Misc Values, if you know what operations you'll be changing gears in.
You could also use Manual Entry toolpaths, with the 1005 setting to output code, then type in the code you want, (or select a text file that contains it).
Lot's of options. It depends on preference and necessity.
Matt
San Diego, Ca
___ o o o_
[l_,[_____],
l---L - □lllllll□-
( )_) ( )_)--)_)
(Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)
Rekd
Thanks for the info , what i would like to do is, set up a statement that reads the upcoming s value and then write an statement in the code that states M0 (CHANGE TO HIGH OR LOW GEAR) depending on the up coming s value, but do not know how to do it.
thanks Brad
IF ITS NOT BROKE YOUR NOT TRYING HARD ENOUGH
Ashes to ashes , dust to dust , If it wasnt for Harleys the fast lane would rust.
(Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)
It will be real easy to do it without testing for the previous value. In other words, it will read each RPM, and output an M00 with the proper gear setting. Problem with this is that it will repeat even if the values haven't changed.
For example, in your post, look for
and add these lines to the function, before the coolant or Z move down to the part.Code:ptlchg_com #Tool change common blocks ()
This will give you:Code:if speed <= 2000, n, "M00 (Low Gear)", E if speed >= 2001, n, "M00 (High Gear)", E
(This is for a HAAS post, so it may look different.)Code:... N23 ( OPERATION: 2 DRILL ) N24 ( OP 3 90 ) N25 ( DRILL 6-32 ) N26 T5 M06 N27(T5: 1/8 DRILL) N28(MAX-DEPTH | Z-.5376) N29(OP ID: 2) N30 M03 S6500 N31 M00 (HIGH GEAR) <------------------------------------------- N32 G00 G56 X-1.08 Y-1.2463 N33 G43 H5 Z1. / N34 M08 N35 Z.1 N36 G98 G83 X-1.08 Y-1.2463 Z-.5376 R.1 I.25 J.0625 K.0625 F12. N37 X-.17 Y-.164 N38 G80 N39 Z1. N40 M09 N41 G90 N42 M01 N43 ( OPERATION: 3 DRILL ) N44 ( OP 3 90 ) N45 ( TAP 6-32 ) N46 T6 M06 N47(T6: #6-32 ROLL TAP H3 BOTTOM) N48(MAX-DEPTH | Z-.35) N49(OP ID: 3) N50 M03 S500 N51 M00 (LOW GEAR) <------------------------------------------- N52 G00 G56 X-1.08 Y-1.2463 N53 G43 H6 Z1. / N54 M08 N55 Z.1 N56 G98 G84 X-1.08 Y-1.2463 Z-.35 R.1 F15.63 N57 X-.17 Y-.164
In order to only post the M00 when the gear needs to be changed, you'd need to create some logic to:
a. store current speed of the first operation in newly declared variable
b. test for a different speed. If different speed, is it also a different gear? Which gear?
c. post M00 codes if gear is > or < than previous gear
Matt
San Diego, Ca
___ o o o_
[l_,[_____],
l---L - □lllllll□-
( )_) ( )_)--)_)
(Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)
BTW, if you don't mind editing your posts, AFTER you back it up, you can modify this portion to tell you in the posted NC file WHERE in the post that particular line was generated..
For example, when setting fastmode to 0, you'll get:Code:# -------------------------------------------------------------------------- # Debugging and Factory Set Program Switches # -------------------------------------------------------------------------- fastmode : 1 #Posting speed optimizition bug1 : 2 #0=No display, 1=Generic list box, 2=Editor bug2 : 40 #Append postline labels, non-zero is column position? bug3 : 0 #Append whatline no. to each NC line? 0 bug4 : 0 #Append NCI line no. to each NC line? 0 whatno : yes #Do not perform whatline branches? leave as yes
HTHCode:N2 M01 psof ptlchg_com N3 ( OPERATION: 1 DRILL ) psof popnumber N4 ( OP 3 90 ) psof pcomment N5 ( SPOT 6-32 ) psof pcomment N6 T2 M06 psof p__8:1113 N7(T2: 1/4 CHAMFER MILL) psof ptoolcomm N8(MAX-DEPTH | Z-.07) psof ptlchg_com N9(OP ID: 1) psof pstock N10 M03 S7000 psof ptlchg_com N11 M00 (HIGH GEAR) psof ptlchg_com N12 G00 G56 X-1.08 Y-1.2463 psof ptlchg_com N13 G43 H2 Z1. psof ptlchg_com / N14 M08 psof ptlchg_com N15 Z.1 pzrapid prapidout N16 G98 G82 X-1.08 Y-1.2463 Z-.07 R.1 P.3 F50. pdrill N17 X-.17 Y-.164 P.3 pdrill_2 N18 G80 pcanceldc N19 Z1. pzrapid prapidout N20 M09 ptlchg1002 pretract N21 G90 ptlchg1002 pretract N22 M01 ptlchg ptlchg_com N23 ( OPERATION: 2 DRILL ) ptlchg popnumber
Matt
San Diego, Ca
___ o o o_
[l_,[_____],
l---L - □lllllll□-
( )_) ( )_)--)_)
(Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)
Almost forgot; formatting in the .pst file is important. In the example in my previous post, put the "if speed" lines AWAY from the left margin. If it's against the left margin, you'll get an undeclared variable error.
In the following code, I created 2 new functions that are triggered either automatically or by setting a switch in the Misc Value's Misc Integer section.
Note that the function name is all the way against the left margin, and the function itself is away from the margin.
Now, any time I want to call the pcorner_round function, I call it like this:Code:popnumber #Count Operations, add op type () op_number = op_number + 1 # = op_number n, "(", stopno, op_number, " ", stoper, ")", e pcorner_round #corner rounding () if mi5 = 1 & mr5 > 0 & flg_mi5 = 0, [ sav_mr5 = mr5, pbld, n, "G187", *sav_mr5, e flg_mi5 = 1 ] if mi5 = 1 & mr5 = 0, [ "( WARNING!! CORNER ROUNDING CONTROL HAS )", e "( BEEN ENABLED WITHOUT A VALUE SET! USE )", e "( MISC VALUES-MISC REALS TO SET A VALUE )", e "( CORNER ROUNDING CONTROL IS DISABLED )", e ] if mi5 = 0 & flg_mi5 = 1, [ n, "G187", e flg_mi5 = 0 ]
Hope I'm not confusing you..Code:ptlchg0 #Call from NCI null tool change (tool number repeats) pcorner_round <----------call this function pcuttype<----------------then call this one toolcount = toolcount + 1<------do some stuff here if toolcountn <= tooltotal, nexttool = rbuf(4,toolcountn)<-----do some if then statements here else, nexttool = first_tool if mi10=one & op_id<>last_op_id, pstop <---- test an if then statement and call another function if true
Matt
San Diego, Ca
___ o o o_
[l_,[_____],
l---L - □lllllll□-
( )_) ( )_)--)_)
(Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)
Rekd :cheers:
thanks that works great, will work on some logic can you give me any advice ,were how, but I can not figure out how to remove op comment see below
here is what i have so far
% pheader
O0100 pheader
(PROGRAM NAME - LONGHORN2 ) pheader
(DATE=DD-MM-YY - 23-12-04 TIME=HH:MM - 16:55 ) pheader
N100 ; TOOL - 01 DIA. - .2500 pwrtt
N102 ; TOOL - 02 DIA. - .0625 pwrtt
( rough profile ) pcomment want to remove comment
N104 G17 G40 ; Setup for XY plane, no cutter comp, psof
N106 G20 ; inch measurements psof
N108 G80 ; cancel canned cycles, psof
N110 G90 ; absolute positioning, psof
N112 M25 G49 ; Goto Z home, cancel tool length offset psof
N114 G91 G28 X0. Y0. psof
N116 T1 (CHANGE TOOL) psof
N118 S3000 psof
N120 M00 (High Gear) psof
N122 ( 1/4 FLAT ENDMILL TOOL - 01 ) psof ptoolcomment
N124 ( ) psof pcomment
N126 S3000 M3 psof
N128 G00 G90 G54 X-.2955 Y1.5862 psof
N130 G43 H1 Z.25 psof
N132 M07 ;Mist on psof
N134 Z.1 pzrapid
source________________________________________
psof0 # Start of file for tool zero
psof
psof # Start of file for non-zero tool number
pinit
!opcode
n, "G17 G40 ; Setup for XY plane, no cutter comp,"
n, "G20 ; inch measurements"
n, "G80 ; cancel canned cycles,"
n, "G90 ; absolute positioning,"
n, "M25 G49 ; Goto Z home, cancel tool length offset"
n, pinc , *sg28ref, "X0.", "Y0.", e
n, *t, "(CHANGE TOOL)"
n, speed
if speed <= 2000, n, "M00 (Low Gear)", E
if speed >= 2001, n, "M00 (High Gear)", E
n, ptoolcomment
n, pcomment
n, *speed, *spdlon
pcan
pcan1, n, "G00", pabs, pwcs, *xr, *yr, strcantext
pcan2
n, ptllncomp, *zr
pcoolon
IF ITS NOT BROKE YOUR NOT TRYING HARD ENOUGH
Ashes to ashes , dust to dust , If it wasnt for Harleys the fast lane would rust.
(Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)
its a little confusing ,but will try to modify what u sent and see what happens , got to learn some how!
Brad
IF ITS NOT BROKE YOUR NOT TRYING HARD ENOUGH
Ashes to ashes , dust to dust , If it wasnt for Harleys the fast lane would rust.
(Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)
Like I said, make a copy of your original post before you go too far.
The comment is comming from the "pcomment" function
Change this line:
to this:Code:n, pcomment
The "#" prevents MP from reading that line during posting. It's for comments or skipping blocks that you dont want to delete from the post.Code:#n, pcomment
Are you familiar with any other types of programming/coding? Like Visual Basic, C, C++, Java, PHP, batch, etc? If not, that's gonna be your roughest learning curve.
The MP (Mastercam Post) language is just that; a complete programming language for post processors in Mastercam. (Like html is to web pages.) The possibilities are literally unlimited.
Also, I just guessed at what RPM your machine shifts gears at, so you'll want to change that to the real values.
:cheers:
Matt
San Diego, Ca
___ o o o_
[l_,[_____],
l---L - □lllllll□-
( )_) ( )_)--)_)
(Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)
Rekd
thanks for you help.
the post looks pretty much like i need it,
really dont need any logic ,sence I have to M0 between tools any how
I just remove pcomment from the source, being that i am limited to 9999 in a post to the control and wasted info is bad for me.
Again thanks
Brad :banana: :banana: :banana:
IF ITS NOT BROKE YOUR NOT TRYING HARD ENOUGH
Ashes to ashes , dust to dust , If it wasnt for Harleys the fast lane would rust.
(Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)