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:

BASIC programming help needed


hordur
 Share

Recommended Posts

My machine (Okuma Multus B400) reads BASIC code within the NC-file and i would like to add some if/else features to a program in order to make the same program fit multiple similar details

 

i want it to skip a part of the nc-file if i specify it in the beginning of the file, aswell as setting a variable for detail thickness (for program origo correction)

 

i can use the below mentioned code to automaticly set the origo, and i can add a function to it too (as illustrated), but is the below code correct?

 

NUM=45

VZOFZ=25209.767+NUM

result:

VZOFZ=25209.767+45

 

 

i have done some basic scripting previously and im completely lost when it comes to code, so i would greatly apreciate any help on the topic smile.gif

Link to comment
Share on other sites

to clarify,

at the end of the "generic" program there is drilling and threading thats used on some of the pieces, and on some there´s none.

So i would like to add something like:

Drill yes/no= YES (not skip block N1650 and forward)

at the start of the program, aswell as setting the above mentioned thickness of the detail.

 

I figure i could add a function something like:

N001 DRILL=YES

....

N1649 IF Drill=yes goto N1651

N1650 ELSE M02 (program end)

N1651 DRILL program

....

 

All other parameters and functions are the same for numerous programs, and instead of tweaking 10 almost identical programs, it would ease my day ALOT if i could only do it once smile.gif

Link to comment
Share on other sites

quote:

My machine (Okuma Multus B400) reads BASIC code within the NC-file and i would like to add some if/else features to a program in order to make the same program fit multiple similar details

Okuma's read Okuma User Task II not basic.

 

quote:

NUM=45

VZOFZ=25209.767+NUM

result:

VZOFZ=25209.767+45


Yes that will work.

 

You can also use mathematical functions as well

 

O1

RA=18 (PART CORNER RADIUS)

RB=8 (CUTTER NOSE RADIUS)

RC=RA+RB (CUTTER PATH RADIUS)

LEN=200 (PART LENGTH)

ANG=5 (INCREMENTAL ANGLE)

REND=90 (RADIUS END)

VC100=ANG

N1

G0 X500 Y500 Z500

T1 M6

S3000 M3

G56 H1

F3000

G00 X=RB+2 Y0 Z0

NLOOP G01 X=-LEN-RB F3000

G00 Z=0+2

X=RB+2

IF [VC100 GT REND ]NEND

Y=[sIN[VC100]*RC] Z=[-RC+[COS[VC100]*RC]]

VC100=VC100+ANG

GOTO NLOOP

NEND

G00 Z500

M2

 

 

quote:

I figure i could add a function something like:

N001 DRILL=YES

....

N1649 IF Drill=yes goto N1651

N1650 ELSE M02 (program end)

N1651 DRILL program


I would use,

 

DRLL=1

.....

N1649 IF [DRLL EQ 1] N1651

N1650 M02 (program end)

 

 

N1651 (SUB PROGRAM)

....

....

Link to comment
Share on other sites

Greg. Very nice! biggrin.gif

 

We have one Okuma in the shop, and it is a lathe. Other lathe programmer does the programming for it, but I was able to follow your code. I do get to play with it once in a blue moon. smile.gif

 

Been teaching myself Macro B programming (Fanuc controls). I didn't think MC could handle this type of programming, but I'm not so sure now after reading this thread.

 

Looks like it could be done. How do I go about modifying my post for this type of programming? Should I even give it a try? Is it already possible, and I just don't know how to use it? I've done some post modifying, but am not anywhere close to being in the same league as most of the guys posting here.

 

I think one of the things holding me back from learning more is that I only program for lathes. Plus I don't have much time at work for playing with MC. Always plenty of other work that needs doing.

 

Also, I would love to learn how to use cantext like I see it being used here.

Link to comment
Share on other sites

I am not so sure a Mastercam post can output this style of code.

 

Here is a simple macro I use all of the time. It will machine the code in this case every 45 degrees

 

( TOOL - 10 OFFSET - 10 )

( CROSS CONTOUR 3.5 X R0.5 SLOT DRILL )

( ROUGH SLOTS )

N56 G0 X500. Z500.

N57 M110

N58 G138

N59 T101010 SB=2500 M13

N60 V1=0

N61 M15

N62 M08

N63 G00 Z7.371 C0

N64 X22.

NLOOP

N65 C=V1

N66 X20.05

N67 G94 G1 X19.05 F100.

N68 Z-1.079

N69 X18.8 Z-6.35

 

 

Blah Blah

 

 

N86 Z1.021

N87 G0 X22.

N88 V1=V1+45

N89 IF [V1 LT 360] NLOOP

N90 M02

 

 

And another to rotate a shape around a shaft as a sub program

 

OEND1

( LB4000-EX-M-ISSA .MIN )

( TOOL - 10 OFFSET - 10 )

( 12. BALL ENDMILL )

( CUT END FORM )

 

NAT2

M110

G0 X800. Z300. T1010

SB=4200 M13

M8

VZSHC=0

V10=0

 

NHERE

VZSHC=VZSHC+36

V10=V10+1

G0 X120 Z6.

C100. M16

G18

G94 G1 X63.5 C100. F2000.

Z-55.25 C10. M16 F1200.

G0 X73.

X120.

Z6. C80.

X73.

G1 X63.5 F2000.

Z-55.25 C170. M15 F1200.

G0 X73.

X120.

Z6. C100.

IF [V10 LT 10] NHERE

M12

M9

G95

M109

G0 X800.

Z300.

VZSHC=0

T1000

RTS

Link to comment
Share on other sites

Thank you guys for that VERY helpful examples!

 

I would very much like to study up on the topic, but google only returns crap.. does anyone know any online guides/faq´s/reference libraries for me to read up on?

 

 

i will probably implement thease functions as stand alone textfiles and manual input, read from file thru mastercam, as i do now with machine origo and so on, and i might be able to modify the post to use misc ops to output correct "flags" for exclude-able operations.

 

I will need to investigate this further tho, dont want to do boo-boo.. smile.gif

Link to comment
Share on other sites

You have many choices for varialble use on an okuma, Greg gave you some great examples.

 

The RA and RB he is using are local variables they are in the program itself, the V1 variable he is using is a variable outside the program that any program can use you can mix and match

Like RA EQ V1 so you can adjust from outside the main program so many choices with user task 2

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