Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

Recommended Posts

I recently designed a macro program to do face grooves in parts that require a circular finish. I have not yet been able to test it and will keep updating the code here. However, if anybody else ever has a need for it. Here it is.

If you do try this code, do so with extreme caution. This program could be incredibly dangerous if operated incorrectly, (think broken part, spindle, tool, etc.) If you do use it, let me know how it goes here.

Cheers,

Caleb

 

; PROGRAM DESIGNED TO CUT CIRCULAR FINISH GROOVES THAT ARE NOT ABOUT A ROTATION AXIS ON A PART
; WORK OFFSET SHOULD BE SET TO CENTER AND TOP OF FEATURE DESIRED
; THIS PROGRAM IS VERY DANGEROUS, DO NOT STOP MACHINE DURING CYCLE
; SINGLE BLOCK, FEED HOLD, CYCLE HOLD, FEED OVERRIDE, AND SPINDLE OVERRIDE OVER CAN CAUSE CATASTROPHIC FAILURE
; PROGRAM DESIGNED IN INCH MODE, MAY BE UNSTABLE IN MM
; PROGRAM IS DESIGNED TO CUT FEATURE TO SIZE WITH NO STEPOVER
; ACTUAL SPINDLE POSITION CLOCK POSITION MAY NEED ADJUSTMENT, SEE LINE 60

DEF REAL _F_DIA; FEATURE DIAMETER
DEF REAL _Z_DEPTH; DEPTH OF FEATURE
DEF REAL _Z_FEED; INFEED OF TOOL, AS LATHE
DEF REAL _T_TOOL_OFFSET; B DISTANCE OF TOOL IN SPINDLE, OFFSET OF TOOL FROM CENTER OF SPINDLE
DEF REAL _PI; PI CARRIED TO 5TH DECIMAL
DEF REAL _H_TRAVEL; ACTUAL DIAMETER TRAVEL, DIAMETER OF FEATURE - RADII OF TOOL*2
DEF REAL _F_RATE; FEEDRATE CALCULATION
DEF REAL _LOOP_CUT; CALCULATION FOR LOOP CUTTING
DEF REAL _FINAL_Z_CUT; FINAL CUT IN Z DEPTH
DEF INT _TOOL; TOOL NUMBER, OR NAME, BEING USED
DEF INT _T_HEIGHT; D VALUE BEING USED
DEF INT _RPM; RPM OF MILLING SPINDLE

; THESE VARIABLES REQUIRE INPUT BEFORE RUNNING; INPUT OF 0 WILL RESULT IN ALARM

; ***INPUT DATA DESIRED HERE***
_F_DIA=3
_RPM=1
_Z_DEPTH=.050
_Z_FEED=.003
_TOOL=16
_T_HEIGHT=1

STOPRE

T=_TOOL D=_T_HEIGHT; TOOL CALL, AND HEIGHT CALL
M6

STOPRE
_LOOP_CUT=(TRUNC(_Z_DEPTH/_Z_FEED))
_T_TOOL_OFFSET=($P_TOOLL[2])
_PI=(3.14159)
STOPRE
_H_TRAVEL=(_F_DIA-(_T_TOOL_OFFSET*2))
STOPRE
_F_RATE=(_H_TRAVEL*_RPM*_PI)
_FINAL_Z_CUT=((_LOOP_CUT*_Z_FEED)-_Z_DEPTH)

STOPRE
IF _F_RATE>500 GOTOF "MESSAGES_ALARMS_2"
IF _F_DIA<=.500 GOTOF "MESSAGES_ALARMS_1"
IF _RPM<=0 GOTOF "MESSAGES_ALARMS_1"
IF _RPM>=100 GOTOF "MESSAGES_ALARMS_2"
IF _Z_DEPTH<=0. GOTOF "MESSAGES_ALARMS_1"
IF _Z_FEED<=0. GOTOF "MESSAGES_ALARMS_1"
IF _Z_FEED>=.01 GOTOF "MESSAGES_ALARMS_2"
STOPRE
SUPA G00 G90 Z0.;
G17;
G54;
SPOS=AC(180.); ADJUST POSITION AS NECESSARY, INPUT IS DEGREES
G97;
X=(_H_TRAVEL*(1/2)) Y0.
Z1.;
Z.1;
G94 G01 Z.005 F25.;
G02 X=(_H_TRAVEL*(1/2)) Y0. Z0. I=-(_H_TRAVEL*(1/2)) J0. F=(_F_RATE) S=(_RPM) M3; SPINDLE ACTIVE, DO NOT FEED HOLD!!!
CUTTING_ACTION: X=(_H_TRAVEL*(1/2)) Y0. Z=IC(-(_Z_FEED)) I=-(_H_TRAVEL*(1/2)) J0.
REPEATB CUTTING_ACTION P=(_LOOP_CUT-1)
X=_H_TRAVEL*(1/2) Y0. Z=IC(_FINAL_Z_CUT) I=-_H_TRAVEL*(1/2) J0.; FINAL Z CUT
FINAL_DEPTH: X=(_H_TRAVEL*(1/2)) Y0. Z=-(_Z_DEPTH) I=-(_H_TRAVEL*(1/2)) J0.;CLEANUP PASS, REMOVES Z RAMP
REPEATB FINAL_DEPTH P=2; 2 SPRING PASSES AT DEPTH
X=(_H_TRAVEL*(1/2)) Y0. Z.005 I=-(_H_TRAVEL*(1/2)) J0.; BACK TO CLEARANCE HEIGHT
G01 Z.1 F25.;
SUPA G00 Z0. M05;
M30;

MESSAGES_ALARMS_1:
STOPRE
LOOP
MSG ("PARAMETER MISSET, LOW")
M00
ENDLOOP
MESSAGES_ALARMS_2:
STOPRE
LOOP
MSG ("PARAMETER MISSET, HIGH")
M00
ENDLOOP

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...