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 Facing program


lnoble
 Share

Recommended Posts

Hi,

 

I Have been starting to learn some macro programming but I have hit a snag with a format error.  Could anyone help me out?

Here is the basic facing program that I have started.

 

%
O0001( PROGRAM: FACING PROGRAM )
( 11/15/2015 AT 10:11 AM )
(MACRO FACING PROGRAM)
 
#500=1 (TOOL NUMBER)
#501=3 (TOOL DIA)
#502=9000 (SPINDLE SPEED)
#503=90. (FEED RATE)
#504=.05 (DEPTH OF CUT)
#505=.1 (TOTAL AMOUT TO BE REMOVED)
#506=59 (WORK OFFSET)
#507=2 (LENGTH OF PART)
#508=2 (WIDTH OF PART)
#509=1 (OUT OF VICE, PHYSICALLY MEASURE!)
#510=0 (NUMBER OF Y PASSES)
#511=0.0(DO NOT CHANGE)
 
N1G0G20G40G80G49G17G94G98
G90
T#500M6
G0G90G#506X[#507/2+#501]Y0
S#502M3
M8
G43Z4.H#500
Z1.
N2WHILE[-#505LE#511]DO1
#511=[#511-#504]
IF[#511GE#509*-1]THEN#3000=1
IF[-#505GT#511]GOTO20 (this is where it seems to be hanging up)
G1Z#511F[#503/4]
X-[#507/2-#501]F#503
G0Z.1
X[#507/2+#501]
END1
N20#511=-#505
IF[#511GE#509*-1]THEN#3000=1
G1Z#511F[#503/4]
X-[#507/2-#501]F#503
G0Z.1
M9
G49G53Z0
M5
G91G28X0.Y0.
M30
%
 
any input would be greatly appreciated , Thanks
 
Link to comment
Share on other sites

Thanks for the link! Still having issues with a format error but its been a long day.  time to call it a night.

here is my latest attempt

 

%
O0001( PROGRAM: NEW FACING PROGRAM )
 
(MACRO FACING PROGRAM)
(******SETUP Z @ NEGATIVE #505 FROM TOP FACE)
#100=1 (TOOL NUMBER)
#101=3 (TOOL DIA)
#102=9000 (SPINDLE SPEED)
#103=90. (X AND Y FEED RATE)
#104=.05 (DEPTH OF CUT)
#105=.1 (TOTAL AMOUT TO BE REMOVED)
#106=55 (WORK OFFSET)
#107=5 (LENGTH OF PART)
#108=2 (WIDTH OF PART)
#109=1 (OUT OF VICE, PHYSICALLY MEASURE!)
#110=0 (NUMBER OF Y PASSES)
#111=0.0(DO NOT CHANGE)
#112=2(NUMBER OF Z PASSES)
#113=10.(Z FEEDS)
#114=1(DO NOT CHANGE)
N1G0G20G40G80G49G17G94G98
G90
T#100M6
G0G90G#506X[#107/2+#101]Y0
S#102M3
M8
G43Z4.H#100
Z#105
WHILE[#114LE#112]DO1(gets hung up here)
#114=[#114+1]
G1G91Z[#104*-1]F#113
G90X[[#107/2-#101]*-1]F#103
G0Z#105
X[#107/2+#101]
END1
G0Z.1
M9
G49G53Z0
M5
G91G28X0.Y0.
M30
%
 
Thanks for the input
Link to comment
Share on other sites

Can you post a picture of the screen? Most of the time the line you see on the hmi is not where the error is. Don't forget about look ahead, it could be several lines down that you have the error.

 

 

I have better luck with IF statements utilizing GOTO. Never fails.

 

 

G90X[[#107/2-#101]*-1]F#103 《---this

To G90X[-1[[#107/2]-#101]]F#103

 

X[#107/2+#101] 《--- this

To X[[#107/2]+#101]

 

Don't forget, the nesting is just like 8th grade algebra. You can't divide and add in the same set of brackets.

 

Also, if I want to make something negative, mazak doesn't like *-1 so I always use -1* and it works. If you want to do -1* try [-1]*

 

Not sure about that Haas but in a mazak, if in doubt use brackets.

Link to comment
Share on other sites

Can you post a picture of the screen? Most of the time the line you see on the hmi is not where the error is. Don't forget about look ahead, it could be several lines down that you have the error.

 

 

I have better luck with IF statements utilizing GOTO. Never fails.

 

 

G90X[[#107/2-#101]*-1]F#103 《---this

To G90X[-1[[#107/2]-#101]]F#103

 

X[#107/2+#101] 《--- this

To X[[#107/2]+#101]

 

Don't forget, the nesting is just like 8th grade algebra. You can't divide and add in the same set of brackets.

 

Also, if I want to make something negative, mazak doesn't like *-1 so I always use -1* and it works. If you want to do -1* try [-1]*

 

Not sure about that Haas but in a mazak, if in doubt use brackets.

Good to know.  I'll have to try this out when I get back into work.

Link to comment
Share on other sites

You can't do -#505. You must make the value of #505 negative.

 

You can do this by [-1.*#505] or by assigning it:

#505=-.1 (TOTAL AMOUT TO BE REMOVED)

O4022
 (4" LONG OMP400 PROBE -- FORCED OFFSET 2)
IF[#153EQ#0]GOTO1
N0520 G00 G90 X-.25 Y-16.1989 (B0.) M19
N0530 G43 H04 Z3.55
N0540 G65 P9810 Z2.05 F200.
N0550 G65 P9811 X.25
N0560 #5301=[[#135+#[[[#4130*20]-20]+7001]]+[-.0067]] <<<<< enclose it in brackets
N0570 G65 P9810 Z3.55 F200.
N0580 X1. Y.25
N0590 G65 P9810 Z2.05 F200.
N0600 G65 P9811 Y-.25
N0610 #5302=[[#136+#[[[#4130*20]-20]+7002]]+[.0067]]
N0620 G65 P9810 Z3.55 F200.
N0630 X.1639 Y-16.6711
N0640 G65 P9810 Z2.8 F200.
N0650 G65 P9811 Z2.3
N0660 #5303=[[#137+#[[[#4130*20]-20]+7003]]+[-2.55]] <<<<<<<<<<<<<
N0670 G65 P9810 Z3.55 F200.
N0680 #[6981+[[#181+1.]*20]]=#5301
N0690 #[6982+[[#181+1.]*20]]=#5302
N0700 #[6983+[[#181+1.]*20]]=#5303
N0710 #[6984+[[#181+1.]*20]]=#[6984+[#181*20]]
 (OFFSET 4)

  • Like 1
Link to comment
Share on other sites

N0560 #5301=[[#135+#[[[#4130*20]-20]+7001]]+[-.0067]] <<<<< enclose it in brackets

 

[-.0067]

True, that's what I meant by when in doubt use brackets.

 

However I was referring to variables specifically. You can't negate a variable by throwing a "-" in front of it. You must give it a negative value.

 

Also, as you said about brackets in certain situations this will work:

-[#500]

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