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

Like Tim says

 

How about using a G65 call and using the local variables #1 thru #33 set your values A,B,C,D ect...

then in your macro sub program

#510 EQ #1 (Value of A in the G65 Call)

#511 EQ #2 (Value of B in the G65 Call)

 

Then you get all your variables on one line and error checking like in the TerryT example.

  • Like 2
Link to comment
Share on other sites

If you're going to pass the values through for something else then you could just create a MACRO G/MCode. For example

 

G154 Xn Yn Zn An Bn Cn In Jn Kn

 

O9011(G154 Macro)

 

(SET PARAMETER #6051=154)

 

#501=#24

#502=#25

#503=#26

 

#504=#1

#505=#2

#506=#3

 

#507=#4

#508=#5

#509=#6

M99

 

HTH

Link to comment
Share on other sites

Guys,

Is there anyway to write multiple variables on one line?

 

Like:

 

#510=1 #515=0 #516=0 #517=1

 

I can't find a way and my macro b book doesn't say anywhere that I can find.

 

Thanks,

 

Josh-

Have you tried using a while/do?

 

Check out this example:

 

#100=532.

WHILE[#100LT899.]DO1

#[#100]=#0

#100=#100+1.

END1

 

Basically what happens here is that #100 is set to your first variable that you want to set and 899. is the last variable to set. All of the variables inbetween the two get set to #0 which is null. Of course this will only work for you if you are setting everything the same.

Link to comment
Share on other sites

We have subplates and charts that map out every location with a number. In the past we've typed in the values from the chart. Say X-12, Y-10, Z-21.1319. Now you can just type the vise location number. MasterCam outputs the incremental shifts from top of vise (Top WCS in MCX) to get to your toolplane.

 

Her'es what I got. The G65 calls are W=Work offset (G10 offset, 1=54), XYZ are incremental to toolplane.

 

%
O0123 (T)
(POST REV 1.1)
(DURACENTER 5 - VMC)
(MCX FILE   - T)
(DATE       - MAR-23-2015)
(TIME       - 7:57 AM)
(USER ID    - ***)
(OPERATIONS - 50/60/70)
 
 
#510=1(OPTIONAL N SEQ START)
 
IF[#510EQ1]GOTO3000
M0
(USING OPTIONAL N SEQ START)
M0
(YOU ARE STARTING PART WAY THROUGH)
N3000
 
(***  TOOL LIST  ***)
(T1   - 0.125 CHAMFER MILL   - D0.1250)
 
(***  OVERWRITE MACRO ADJUSTMENTS  ***)
 
G90 G52 X0. Y0. Z0.
 
(***  USER DEFINED WORK COORDINATES START  ***)
 
M01 (MAKE SURE YOU SET YOUR VISE LOCATIONS FROM THE CHART)
 
( G54 VISE LOCATION NUMBER )
#550=0. (NUMBER FROM CHART - THIS IS ALL YOU NEED)
 
#517=0. (X AXIS INCREMENTAL SHIFT)
#518=0. (Y AXIS INCREMENTAL SHIFT)
#519=0. (Z AXIS INCREMENTAL SHIFT)
 
( DONT TOUCH )
G65P9999W1.X2.Y-1.5Z1.
 
( G55 VISE LOCATION NUMBER )
#550=0. (NUMBER FROM CHART - THIS IS ALL YOU NEED)
 
#517=0. (X AXIS INCREMENTAL SHIFT)
#518=0. (Y AXIS INCREMENTAL SHIFT)
#519=0. (Z AXIS INCREMENTAL SHIFT)
 
( DONT TOUCH )
G65P9999W2.X2.Y-1.5Z1.
 
(***  WORK COORDINATES END  ***)
 
GOTO #510 (JUMP TO SEQ)
 
 
M01
N1(Sequence #1.)
(TOOL# 1 - 0.125 Chamfer Mill)
(OP  1 )
(MAX - Z0.)
T1 M06
G0 G17 G90 G54 X-2. Y1.5 S6000 M03
G43 H1 Z1. M8
 
 
Here's the Sub:
 
O9999(MACHINE ZERO SHIFT)
 
(N40 - DURACENTER 5 - VMC) 
 
#551=-21.3139(MACHINE Z-ZERO - SUBPLATE) 
#552=-9.9995(MACHINE Y-ZERO - SUBPLATE)
#554=-1. 
IF[#550EQ1.]THEN#553=1.
IF[#550GT1.]THEN#553=[#550*2]+#554 
IF[#550LT1.]GOTO1000 
IF[#550GT16.]GOTO1000
 
G90G10L2P#23X-#553Y#552Z#551
G91G10L2P#23X#24Y#25Z#26
G91G10L2P#23X#517Y#518Z#519 
 
 
M99
N1000#3000=10(INCORRECT VISE LOCATION NUMBER)
M30
%
Link to comment
Share on other sites

nice, I really like the creativity.  Here's my take on it.  About the same thing but written different just for kicks.  I normally use 8000 program numbers for in house macros, and leave 9000 for system/builder macros.  Unless I make my own G/M code like foghorn mentioned.  Used more local variables.  I also rolled in the #550 macro as variable V.  

 

O8050
#5=-9.9995 (MACHINE Y-ZERO - SUBPLATE)
#6=-21.3139(MACHINE Z-ZERO - SUBPLATE) 
IF[#23LT1]THEN#3000=1 (ERROR WORKOFFSET SET LOWER THAN 1 -G54)
IF[#23GT6]THEN#3000=2 (ERROR WORKOFFSET SET HIGHER THAN 6 -G59)
IF[#22LT1.]THEN#3000=3 ( ERROR PIN LOCATION LESS THAN 1 )
IF[#22GT16.]THEN#3000=4 ( ERROR PIN LOCATION MORE THAN 16 )
 
(SETS X WORK OFFSET)
#1= [#23*20]+5201 
#[1]=[[#22*2]-1]
#[1]=#[1]+#24
 
(SETS Y WORK OFFSET)
#2= [#23*20]+5202
#[2]=#5+#25   
 
(SETS Z WORK OFFSET)
#3= [#23*20]+5203 
#[3]=#6+#26   

M99

 

Another idea would be to have all the code you want the operator to edit in one spot.  That way they don't have to hunt around. 

 

O0123 (T)
(POST REV 1.1)
(DURACENTER 5 - VMC)
(MCX FILE   - T)
(DATE       - MAR-23-2015)
(TIME       - 7:57 AM)
(USER ID    - ***)
(OPERATIONS - 50/60/70)
 

(*******EDIT ONLY HERE ********)

(V = VISE POSTION)

(W = WORK OFFSET G54=1, G55=2, etc)

 

G65 P8050 V1 W1. X2 .Y-1.5 Z1. (G54)

G65 P8050 V2 W2. X2. Y-1.5 Z1. (G55)

(*******EDIT ONLY HERE ********)

  • Like 1
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...