Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

Subroutines in macro style

PJ007B

New member
Just wanted to see if anyone has tryed to
change their code output on subroutines to use macros.
We would like to change our 4 axis mill post to handle this.Thanks for looking

This is an example of what were looking for.
Drill 6 holes around od of part.
( 0.196 DRILL)
T5
M6
#100=6(NO HOLES)
#1=60(INDEX)
#2=1(COUNT)
#3=.0(START POS)
G90G0G98G56
X-.293Y0.A#3
S1200M3
G43Z1.H5T20M8
WHILE[#2LE#100]DO1
G73X-.293Y.0A#3Z-.6R0.1Q.06F3.
G80
#2=#2+1
#3=#3+#1
END1(END OF SUB)
G91G28Z0M9
G28Y0M5
M1
 
Hi PJ,
I do something similar with a regular lathe program. We also have many macros that we call that could be considered sub-programs or routines. This example does not have the DO loop, but could be written if we wanted to cut multiple spacers from a tube without bar pulling part everytime.


O3001( SPACER/WASHER )


( COLLET - " DIA, STICK BAR OUT " FROM COLLET )


( TOOL #1 OFFSET #1 BAR PULLER )
( TOOL #2 OFFSET #2, 80 DEG TOOL HOLDER MCLNR-164D, )
(* .030 RAD INSERT CNMG 432 )
( TOOL #3 OFFSET #3, 3/4" SPOT DRILL )
( TOOL #8 OFFSET #8, DRILL DIAM., DEPTH )
( TOOL #12 OFFSET #12, CUTOFF TOOL, ANY INSERT )


#501= .625 (MATERIAL DIAMETER)
#502= .14 (SPOT DRILL POINT DEPTH)
#503= 1.0 (DRILL POINT DEPTH)
#504= .375 (DRILL DIAMETER)
#505= .375 (LENGTH OF PART)


( FACE & TURN )
G0G20G40G97G99
T0202
G97S2268M3
/G1X8.0Z-0.05F0.1323
G0X8.0Z-0.05M8
G50S3500
G96S520
G0X[#501+.1]
G1X[#501+.002]F.007
G2U-.1W0.05R.05F.005
G1X-0.07F.007
G0Z0.1M9
G0X8.0Z8.0
/G28U0W0M9
M1
( 3/4" SPOT DRILL )
G65P9010A#502B.75F.003S700T0303
G0X0.0Z7.0M9
/G28U0W0M9
M1
( " DRILL " DIAM.)
G65P9010A#503B#504F.006S407T0808
G0X8.0Z5.0M9
/G28U0W0M9
M1
( CUTOFF & BAR PULLER )
G65P9030A#505B#501R.04S325X.3V1.0E.03U1.0
G0X10.0Z4.0M9
/G28U0W0M9
M1
M54
M99



Jay.
 

Sponsor

Articles From 3DCAD World

Back
Top