Siemens Mixing G Code With Shopmill is Easy



Writing Siemens Work Offset From Your Program

Writing Siemens Work Offset From Your Program

Siemens Work Offset

On a Fanuc control it is quite common to use G10 to write your work offsets (G54 to G59) from your program. It has many advantages the main one being that no-one gets to mess with your precious work offset once its set.

CNC Training Call David: 07834 858 407

 

CNC Training Centre Reviews

30 five star ratings on Google (Just saying)

 

If some prick comes along and changes it, you don’t have to give a flying monkey shit. Your Siemens Work Offset is safely locked away in your CNC Program.

Oh and you get to do shit like this

Well if you ever lie awake at night thinking “how is that done on a Siemens control” I’m going to give you the answer. I often had these thoughts so you are not alone.

But then one day, not long back, someone asked me outright “How’s it done” once I got over the initial embarrassment of being asked such a direct question I told em.

Well first let’s say there is no such thing as G10 on a Siemens control.

You use this $P_UIFR[1] to write your Siemens Work Offset. The 1 being G54 and 2 G55 you can take this right up to G599.

Beware you are in the adult section now, messing with system variables.

Let me say “I fuckin love Siemens controls” there you go I’ve said it.

But, and a massive but it is, you get the syntax wrong on this and all hell will break loose. Not only will your CNC Machine explode in your face but when you get home your partner will be shagging the window cleaner in the remains of your burnt down house. So beware before you press that button to write your Siemens Work Offset.

You need loads of commas just put em everywhere and you wont go wrong.

This is how it looks:

$P_UIFR[1]=CTRANS(X,100.,Y,200.,Z,300.)

This will set X100. Y100. and Z300.

Great I Can Read and Write

While we are on the subject, you can also read the work offset figures back into R values. You can then keep these and do what you want with them. Maybe sell them to a friend for profit, the choice is yours.

Siemens Work Offset

The 1 just after the square bracket is for G54 (2 would be G55) then give the axis in our case X Y and then Z

R1=$P_UIFR[1,X,TR]

R2=$P_UIFR[1,Y,TR]

R3=$P_UIFR[1,Z,TR]

The video below shows R1 R2 and R3 set to zero, after reading the program it extracts the offset figures G54 X-100. Y-200. and Z-300. and puts em in R1 R2 and R3 variables.

So there you have it setting you Siemens Work Offset.

Easy isn’t it.

You’re a big boy now playing with system variables but just remember “with great power comes great responsibility”

 

 

 



Using R Parameters Siemens Sinumerik 828 840

R Parameters Siemens, on a Siemens control you can use R parameters to control a program externally.

“What’s he on about” I hear you say.

I’ll explain.

Imagine a sub program that has no value assigned to it’s feedrate. Well you could call the feedrate R1

G1 X50. F=R1

The program says to you “ok I’ll feed at R1” it thinks for a while then says

“what’s R1 David?” (Actually it wouldn’t know my name)

So you tell it.

R1=200.
G1 X50. F=R1 

So now it’s just like you wrote

G1 X50. F200.

Now I know what you are thinking saying, “just program that in the first place you prick.”

When you use this type of programming, known by posh people like me as parametric programming, you can program a shape then give it the dimensions externally.

You would usually have the shape in some kind of subprogram.

It’s All in The Pizza

It’s like ordering a pizza. They know you want a pizza but then they need to know all the other stuff like what size and what topping.

Anyway fuck the pizzas let’s talk about R values.

The difference is you can put whatever value you want in R1.

You could then use the same program to rough and finish the part. The first time you call it you put R1=100. the second time you put R1=200.

Fanuc uses a similar thing using # (sometimes called variable).

Instead of R1=6 it has #1=6. (you get loads of variables, #1 to #100 and more)

Heidenhain uses Q values Q1 = 6.

See how Fanuc do this.

See how Heidenhain do this.

Wait There’s More

You don’t just have to use R1 there are at least 99 of these bloody things.

You can use R2 R3 or R65 it’s entirely up to you, just don’t get confused that’s all.

Then comes the clever shit. You can actually do maths with them. You could put R1= R1 – 10.

This would take 10. off the feedrate.

You can even do things like cosines and sines and stuff like that. The mind boggles.

If you have a probing system then it will almost certainly be using R parameters in the background to grab data and the get the size information you want.

(Picture of my puppy for those who’d rather be on Facebook his name s Tallywacker)

You can program a shape and replace all the dimensions with R parameters. This is when it gets fuckin awesome.

The program below uses an R parameter for the corner rads and an R parameter for the width.

The left side is the main program. The right side is the sub program called each time.

R Parameters Siemens

Here is a video of the program in action.

Siemens Training 828 840D

These methods are all tools in your programming toolbox. One day you’ll see a use for one of them and you’ll think “I remember that grumpy old bastard wrote an article on that”.

Then I hope you’ll return to this article.

Thanks for watching and reading

If you have been affected by any of the issues in this post or need CNC Counselling then contact me.

Or call us

If you want to learn to program CNC Milling Machines

Look no further Contact CNC Training Centre

 


Careers in CNC

View all current vacancies in CNC

Click here

Call David: 07834 858 407