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:

macro samples / explanations


specprogrammer
 Share

Recommended Posts

We just took delivery of a hurco VM1 graphite mill. It has a fixture on it with 12 positions for cutting electrodes. Its four rows in X three in Y. We usually cut three identical trodes. So I want to write a program that moves to the 1st position, calls the sub, moves back to the second position, calls the sub, moves back to the 3rd, calls the sub, then moves to the second row and calls the second sub program, and so on. I need to write a macro because the machine doesn't have enough work offsets (G54-G59). Its been about 12 years since I had any contact with a macro and it wasn't very much. Does anyone have a similar program? Or can anyone show me a sample program to get me started in the right direction? Heres what I'm using to get me through right now.

%

(CRAIGS MAIN PROGRAM)

G54

M98P1000

G52X0Y4.0

M98P1000

G52X0Y8.0

M98P1000

G55

M98P2000

G52X0.Y4.

M98P2000

G52X0.Y8.

M98P2000

G56

M98P3000

G52X0.Y4.

M98P3000

G52X0.Y8.

M98P3000

G57

M98P4000

G52X0.Y4.

M98P4000

G52X0.Y8.

M98P4000

M30

I'd love to replace those G52's with some variables. That way I could have several different variations of this program and a seperate place with all the locations.

Link to comment
Share on other sites

How about something like this? Haven't tested but use with caution!

 

%

#101=0 (X POSITION)

#102=0 (X COUNTER)

#103=4 (X SPACING)

#104=3 (X QTY)

 

#105=0 (Y POSITION)

#106=0 (Y COUNTER)

#107=4 (Y SPACING)

#108=4 (Y QTY)

 

G54

#106=0 (Y COUNTER SET)

N1 (RETURN FROM Y INCREMENT)

IF [#106 EQ #108] GOTO 20 (REACHED Y QTY - END LOOP)

#102=0 (X COUNTER SET)

N5 (RETURN FROM X INCREMENT)

IF [#102 EQ #104] GOTO 10 (REACHED X QTY - END LOOP)

G52X#101Y#105

M98P1000

#102=#102+1 (INCREMENT X COUNTER)

#101=#101+#103 (ADD X SPACING)

GOTO N5

N10 (END X LOOP)

#106=#106+1 (INCREMENT Y COUNTER)

#105=#105+#107 (ADD Y SPACING)

GOTO N1

N20 (END Y LOOP)

M30

%

Link to comment
Share on other sites

not trying to hijack the thread but trying to understand.. what do the variables allow u to do versus the main program with the G52's on it? Im curious because im getting ready to go to a similiar setup and situation with electrodes my self..currently have six 3R blocks but are going to add 3 more for a total of 12 as I only have 6 work offsets I can see this main program u have working really well for what I would need in my situation.. just curious what the varaibles can do or would allow me to do in my programs.. thanks..

Link to comment
Share on other sites

The variables allow you to have the output to dynamically change according to there values.

 

You could also assign this macro with addresses and call it out like this:

M98 P9999 A0 B0 C4 D3 L0 M0 N4 P3

 

Each value assigned to an address could be used in the macro.

 

Hope this helps!

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