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

Does anyone else out there have any cool macros they would like to share. I am always interested in new ideas.

Here's a "fixture tracking" macro that I use on horizontals in conjunction with MasterCam and explanation thereof. Also attached is a serial number macro for Fanuc that engraves sequential numbers or a fixed number and the size is scalable. Also a peck drilling macro that feeds down inside a pre-drilled hole prior to pecking and you can specify the first drill depth prior to pecking because many times you don't need to peck until you're 8-10xD deep or so. Also you can specify a pull-out point other than the initial R plane so not to pull all the way out of the hole with really long drills that will snap off when you come out of the hole with the spindle on. I have other ones similar to this that only have the spindle on while the drill is piloted inside the hole.

 

Cheers!

Len Dye

Fixture Tracking Macro.pdf

Fanuc Macros.zip

Link to comment
Share on other sites
  • 6 years later...

I just took a scroll through the whole topic... some good stuff in here. Some really good stuff from Tim Markoski (RIP brother...).

I captured some of his stuff a number of years back. I wasn't able to get it all.

https://www.dropbox.com/sh/kh7kswuqtgdtxv6/AACbR17-y0hbbUV0a0CbrOnka?dl=0

Using the wayback machine some stuff may still be able to be accessed.

https://web.archive.org/web/20130611010812/http://www.mtbtech.net/blog.html

  • Like 4
Link to comment
Share on other sites

For Haas NGC

I wrote this to pickup the center of X and Y and also pickup Z.  Either all, just one, and in any order.  There are user inputs that guide you through.  This is REALLY useful for parts that are irregular to pick up or just a block.  I use G154.01 G154.02 to place the X and Y values the in G154.03 the overall distance from pickup #1 to pickup #2.  I even included DPRNT is your using that also.  There is large spacing in the program to make it easier for the operator to to read the Asking Inputs.  ***NOTE: the first moves on the X or Y are in the positive direction.

 

 

#101= 54 (WORK OFFSET, 54-59 ONLY)

(PROGRAM WILL PICK UP MID POINT OF X OR Y AND Z)

(FIRST PICKUP, PROBE MOVES + POSITIVE, IN "X" OR "Y")
(SECOND PICKUP, PROBE MOVES - NEGATIVE, IN "X" OR "Y")


(1-JOG PROBE TO WITHIN .5 OF FIRST SURFACE) 
(2-CYCLE START/RUN PROGRAM - FOLLOW INSTRUCTIONS)
(3-AFTER PROGRAM ENDS, SELECT JOG)
(4-JOG PROBE TO WITHIN .5 OF OPPSOSITE SECOND SURFACE)
(5-SELECT MEMORY)
(6-CYCLE START/RUN PROGRAM - FOLLOW INSTRUCTIONS)

(IF YOU WANT TO PICK UP Z )
(1-JOG PROBE TO WITHIN .5 ABOUT SURFACE)
(2-CYCLE START/RUN PROGRAM - FOLLOW INSTRUCTIONS)


(MID POINT OF BOTH PICKUPS = OFFSET SELECTED)
(INDIVIUAL SURFACE PICKUPS ARE STORED IN G154P01 & G154P02)
(OVERALL DISTANCE BETWEEN THE PICKUPS ARE IN G154P03)

(FIRST X PICKUP=G154P01)
(SECOND X PICKUP-G154P02)
(OVERALL DISTANCE BETWEEN X PICKUP-G154P03)

(FIRST Y PICKUP=G154P01)
(SECOND Y PICKUP-G154P02)
(OVERALL DISTANCE BETWEEN Y PICKUP-G154P03)

#120=0
IF [#101 EQ 54] GOTO1 (WORK OFFSET MUST BE 54-59)
IF [#101 EQ 55] GOTO1 (WORK OFFSET MUST BE 54-59)
IF [#101 EQ 56] GOTO1 (WORK OFFSET MUST BE 54-59)
IF [#101 EQ 57] GOTO1 (WORK OFFSET MUST BE 54-59)
IF [#101 EQ 58] GOTO1 (WORK OFFSET MUST BE 54-59)
IF [#101 EQ 59] GOTO1 (WORK OFFSET MUST BE 54-59)
#3000=21 (WORK OFFSET MUST BE 54-59)

N1 #10501=0 
N2 M109 P10501(ASKING IF THIS IS FIRST PICKUP)

    (WHICH PICK UP?)
     
 (1st, SELECT "1" ON KEYBOARD)
     
 (2nd, SELECT "2" ON KEYBOARD)
     
 ( Z,  SELECT "Z" ON KEYBOARD)

 

 

 


IF[#10501EQ0.]GOTO1
IF[#10501EQ49.]GOTO4 (FIRST PICKUP - "1")
IF[#10501EQ50.]GOTO5 (SECOND PICKUP - "2")
IF[#10501EQ90.]GOTO220 ( Z  PICKUP - "Z")
GOTO1

N4 
#10501=0 

N5 
IF[#10501EQ50.]#120 = 22222.
M109 P10501(USER INPUT FOR AXIS TO PICKUP)

   (WHICH AXIS ARE YOU PICKING UP?)
   (SELECT "X" OR "Y" ON KEYBOARD)

 

 

 

 


IF[#10501EQ0.]GOTO5


IF[#10501EQ88.]GOTO100 (GOTO "X" PICKUP)
IF[#10501EQ89.]GOTO200 (GOTO "Y" PICKUP)
GOTO1

(BEGINING OF X PICKUP)

N100
IF[#120EQ22222.] GOTO101
(1ST X PICKUP IN + DIRECTION)
G65 P9995 W154.01 A20. D.5
#110=#14001
GOTO 110

N101
(2ND X PICKUP IN DIRECTION)
G65 P9995 W154.02 A20. D-.5
#111=#14021

(AVERAGE FOR BOTH PICKUPS IN X)
#115=[[#110+#111]/2]
#7041=#7021-#7001

(SETTING WORK OFFSET FOR X)
IF[#101EQ54] #5221=#115
IF[#101EQ55] #5241=#115
IF[#101EQ56] #5261=#115
IF[#101EQ57] #5281=#115
IF[#101EQ58] #5301=#115
IF[#101EQ59] #5321=#115
GOTO 120

N110
M00

(AFTER PRESSING START)
(THE PROGRAM WILL END)
(JOG TO OPPOSITE SIDE OF PART)
(START PROGRAM AND FOLLOW THE QUESTIONS)

 

 

 

 

 

 


M30

N120
#10188=#14041
DPRNT[]
DPRNT[]
DPRNT[FIXTURE*OFFSET*#101[40]]
DPRNT[X*WIDTH*#14041[24]]
GOTO 250
(END OF X PICKUP)


(BEGINING OF Y PICKUP)
N200
IF[#120EQ22222.] GOTO201
(1ST Y PICKUP IN + DIRECTION)
G65 P9995 W154.01 A20. E.5
#112=#14002
GOTO 110

N201
(2ND Y PICKUP IN -DIRECTION)
G65 P9995 W154.02 A20. E-.5
#113=#14022


(AVERAGE FOR BOTH PICKUPS IN Y)
#115=[[#112+#113]/2]
#7042=#7022-#7002


(SETTING WORK OFFSET FOR Y)
#10188=#14042
IF[#101EQ54] #5222=#115
IF[#101EQ55] #5242=#115
IF[#101EQ56] #5262=#115
IF[#101EQ57] #5282=#115
IF[#101EQ58] #5302=#115
IF[#101EQ59] #5322=#115
DPRNT[]
DPRNT[]
DPRNT[FIXTURE*OFFSET*#101[40]]
DPRNT[Y*WIDTH*#14042[24]]
GOTO 250

N210
M30

N220

(Y=YES/N=NO, ARE YOU PICKING UP Z)
#10502=0
N222 M109 P10502(USER INPUT FOR AXIS TO PICKUP)


(ARE YOU PICKING UP "Z" AND ARE)
(YOU IN POSITION <.500 ABOVE?)

(SELECT "Y" ON KEYBOARD =YES)
(SELECT "N" ON KEYBOARD =NO)

 

 

 

 


IF[#10502EQ0.]GOTO222
IF[#10502NE89.] XOR IF[#10502NE78.] GOTO 222
IF[#10502EQ89.]GOTO240 (GOTO "Z" PICKUP)
IF[#10502EQ78.]GOTO250 (GOTO END OF PROGRAM)


N240
G65 P9995 W#101 A20. H-.5 (SINGLE SURFACE Z)
G103P1


N250
M30

 

  • Like 1
Link to comment
Share on other sites

This is another Haas NGC probing program I wrote which is great for checking a distance between two surfaces in the same axis.  In the X/Y from the same direction( "+" to "+", "-" to "-") or opposing directions  ("+" to "-", "-" to "+").  Obviously Z is "-" to "-".

This does use offsets G154P01. G154P02, G154P03 and G154P4

You can check in X, Y or Z directions and is all done with user inputs.  The only variable that might have to be changed is #100, the probing safe distance.  It's set to .500 which should be good for most applications.

Just place the probe within .500 of the 1sr surface, Cycle Start, and you will be asked if this is the 1st pickup or 2nd.  Simply select 1 or 2 on the keyboard. 

 (IF PROBE W/IN "#100" OF SURFACE)
 (WHICH PICK UP ARE YOU PERFORMING?)
	 
 (1st, SELECT "1" ON KEYBOARD)
	 
 (2nd, SELECT "2" ON KEYBOARD)
 
 (NO = "N", PROBE IS NOT IN POSITION)

 

Then you be asked which axis and direction.  Simple select the appropriate number on the controller keyboard .

     (WHICH DIRECTION ARE YOU PICKING UP?)
   

           (+X= 1 )  (-X= 2 )

           (+Y= 3 )  (-Y= 4 )

           (-Z= 5 )
		   
		   

Jog to the 2nd surface and repeat the process.  In the offset page the values are placed in: 

G154P01 = 1st pickup
G154P02 = 2nd pickup
G154P03 = distance between 1 & 2.

X pickup in the X column, Y in the Y column and Z in the Z column. 

CODE BELOW and large spacing is intentional for clarity for user prompts.

 

(DISTANCE CHECK PROGRAM)

(!!!PROGRAM CLEARS/USES OFFSETS G154P01-G154P4!!!)

(SURFACE TO SURFACE IN THE SAME AXIS)

(X/Y checks can be in any order, ie:)
(1st "+" or "-",2nd "+" or "-")
(1st "+",2nd "+" and vise versa) 
(Z can be Low or High first) 

 
(!!!PROGRAM CLEARS/USES OFFSETS G154P01-G154P04!!!)

#100= .5 (MAX PROBE DISTANCE)

(1ST PICKUP WILL BE PUT IN G154P01)
(2ND PICKUP WILL BE PUT IN G154P02)
(DISTANCE FROM 1 TO 2 = G154P03) 

(PLACE PROBE NEAR FIRST SURFACE W/IN #100)

(CYCLE START THE PROGRAM, FOLLOW PROMPTS)


N1 #10502=0 
N2 M109 P10502(ASKING IF THIS IS FIRST PICKUP)


 (IF PROBE W/IN "#100" OF SURFACE)
 (WHICH PICK UP ARE YOU PERFORMING?)
     
 (1st, SELECT "1" ON KEYBOARD)
     
 (2nd, SELECT "2" ON KEYBOARD)
 
 (NO = "N", PROBE IS NOT IN POSITION)
     

IF[#10502EQ0.]GOTO1
IF[#10502EQ49.]GOTO2 (FIRST PICKUP - "1")
IF[#10502EQ50.]GOTO3 (SECOND PICKUP - "2")
IF[#10502EQ78.]GOTO112 (NO GOTO MESSAGE/RESET)
GOTO1


N2
G103 P1
#20=0
M97 P150 L4
#20=0
M97 P151 L4
#20=0
M97 P152 L4

N3 #10501=0 
N5 M109 P10501(USER INPUT FOR 1st PICKUP)


         ( 1st SURFACE PICKUP )

     (WHICH DIRECTION ARE YOU PICKING UP?)
   

           (+X= 1 )  (-X= 2 )

           (+Y= 3 )  (-Y= 4 )

           (-Z= 5 )
           
           
           
           
           
    
    
    
    
    
           

IF[#10501EQ0.]GOTO3

IF[#10501EQ49.] #1=1
IF[#10501EQ49.]GOTO10 (GOTO "+X" PICKUP)

IF[#10501EQ50.] #1=2
IF[#10501EQ50.]GOTO20 (GOTO "+X" PICKUP)

IF[#10501EQ51.] #1=3
IF[#10501EQ51.]GOTO30 (GOTO "+Y" PICKUP)

IF[#10501EQ52.] #1=4
IF[#10501EQ52.]GOTO40 (GOTO "-Y" PICKUP)

IF[#10501EQ53.]GOTO50 (GOTO "-Z" PICKUP)
GOTO1


N8 #10501=0 
N9 M109 P10501(USER INPUT FOR 2nd PICKUP)


     ( 2nd, OPPOSITE, SURFACE PICKUP )

     (WHICH DIRECTION ARE YOU PICKING UP?)
    

           (+X= 1 )  (-X= 2 )

           (+Y= 3 )  (-Y= 4 )

           (-Z= 5 )


IF[#10501EQ0.]GOTO9

IF[#10501EQ49.] #1=1
IF[#10501EQ49.]GOTO10 (GOTO "+X" PICKUP)

IF[#10501EQ50.] #1=2
IF[#10501EQ50.]GOTO20 (GOTO "-X" PICKUP)

IF[#10501EQ51.] #1=3
IF[#10501EQ51.]GOTO30 (GOTO "+Y" PICKUP)

IF[#10501EQ52.] #1=4
IF[#10501EQ52.]GOTO40 (GOTO "-Y" PICKUP)

IF[#10501EQ53.]GOTO50 (GOTO "-Z" PICKUP)

GOTO8

G103P1


(______________+X PICKUP___________________)
N10 
G65 P9995 W154.04 A20. D#100
G103P1
IF[#10502 EQ 50.] GOTO11
#7001= #7061
GOTO110
N11
#7021= #7061

GOTO 101
(______________+X PICKUP___________________)


(______________-X PICKUP___________________)
N20
G65 P9995 W154.04 A20. D-#100
G103P1
IF[#10502 EQ 50.] GOTO21
#7001= #7061
GOTO110
N21
#7021= #7061

GOTO 101
(______________-X PICKUP___________________)

(_______________+Y PICKUP___________________)
N30 
G65 P9995 W154.04 A20. E#100
G103P1
IF[#3032 EQ 1]GOTO31
IF[#10502 EQ 50.] GOTO31
#7002= #7062
GOTO110
N31
#7022= #7062

GOTO 102
(_______________+Y PICKUP___________________)

(_______________-Y PICKUP___________________)
N40 
G65 P9995 W154.04 A20. E-#100
G103P1
IF[#3032 EQ 1]GOTO41
IF[#10502 EQ 50.] GOTO41
#7002= #7062
GOTO110
N41
#7022= #7062

GOTO 102
(_______________-Y PICKUP___________________)


(_______________-Z PICKUP___________________)
N50
G65 P9995 W154.04 A20. H-[#100] (SINGLE SURFACE -Z)
G103P1
IF[#10502 EQ 50.] GOTO51
#7003= #7063
GOTO110
N51
#7023= #7063

GOTO103
(_______________-Z PICKUP___________________)


N101  (X DIFFEENTIAL)
#7041=ABS[#7001-#7021]
#10188=#7041
GOTO110

N102  (Y DIFFEENTIAL)
#7042=ABS[#7002-#7022]
#10188=#7042
GOTO110

N103  (Z DIFFEENTIAL)
#7043=ABS[#7003-#7023]
#10188=#7043
GOTO110

N110
(ZERO G154P04 X, Y, Z)
#7061=0
#7062=0
#7063=0
GOTO115

N112
#3000= 1 (RESET machine and RE-POSITION probe)


N115
M30


(CLEAR OFFSETS G154P01-G154P04)
(SUB PROGRAM)
N150
G103 P1
#[7001+#20]=#0
#20=#20+20
M99

G103 P1
N151
#[7002+#20]=#0
#20=#20+20
M99

G103 P1
N152
#[7003+#20]=#0
#20=#20+20
M99

 

  • Like 2
Link to comment
Share on other sites
  • 3 weeks later...

We use this macro on our Fanuc controls before our tool setters do their thing. If an non-setup tool gets called accidentally it will over travel away from the fixture saving the spindle.

%
O9026(M501 -- TOOL OFFSET REPLACEMENT PROGRAM)
(PARAMETER 6086)

(A = FIRST TOOL OFFSET TO REMOVE, DEFAULTS TO 6)
(B = LAST TOOL OFFSET TO REMOVE, DEFAULTS TO 200)

IF[#1EQ#0]THEN#1=6
IF[#2EQ#0]THEN#2=200

WHILE[#1LE#2]DO1
#3=10000+#1
#4=11000+#1
#5=12000+#1
#6=13000+#1
IF[#1EQ4]GOTO1
#[#3]=88.8888
#[#4]=0
#[#5]=0
#[#6]=0
N1
#1=#1+1
END1
M99
%

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...