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:

Custom Macro help, please


ScottyB
 Share

Recommended Posts

I've been writing Macro B programs for years, but now I have to go back and make some of my programs idiot proof so our company can put a flunky on our router. (Against my advice. We all know what that's like.)

Anyway, In this program I have #100 as a variable for a profile. Basically depending on the number they enter, the machine will pick up one of 4 profile heads. The problem is that in the movement body of the program I need H and D to reference the correct tool. I got an error when I tried to attach a variable to H and D (as in #149=8; H#149 for tool 8). How can I get H and D pointed at the correct tool without adding 20 lines of IF THEN ELSE statements. Below is some of the program...

IF [#100EQ201] GOTO 100

IF [#100EQ202] GOTO 200

IF [#100EQ203] GOTO 300

IF [#100EQ207] GOTO 700

IF [#100GT400] GOTO 2000 (END)

#148=[#100-200]

#149=[#100-190]

N100 S8 M03

N101 M06T1

N102 GOTO 1000

N200 S8 M03

N201 M06T2

N202 GOTO 1000

N300 S8 M03

N301 M06T3

N302 GOTO 1000

N700 S8 M03

N701 M06T7

N702 GOTO 1000

N1000 #105=#101+3.00

G90 G0 X#105 Y#102

G90 G0 G61 G43 H#148 Z1.

G90 G1 Z-.400 F100.

G91 G0 G42 D#149 X-2.00

G91 G1 X-1.00 F200.

X-#101

Y-#102

X#101

Y#102

 

Thanks,

ScottyB.

Link to comment
Share on other sites

Try this

 

IF [#100GT400] GOTO 2000 (END)

#148=[#100-200]

#149=[#100-190]

N100 S8 M03

N101 M06T#148

N1000 #105=#101+3.00

G90 G0 X#105 Y#102

G90 G0 G61 G43 H#148 Z1.

G90 G1 Z-.400 F100.

G91 G0 G42 D#149 X-2.00

G91 G1 X-1.00 F200.

X-#101

Y-#102

X#101

Y#102

 

It looks like you were skipping

#148=[#100-200]

#149=[#100-190]

with your goto s'

Link to comment
Share on other sites

MY BAD!!!

You're right.

My GOTO's were jumping over my variables.

I made the changes and everything works.

 

ScottyB. grammin Gcode longhand for the next few days.

 

Ever try to figure out a program that you wrote 6 years ago? banghead.gif

 

WTF was I thinking?????????

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