# Thread: i can't work out the logic for this type of program, any suggestions?

1. ## i can't work out the logic for this type of program, any suggestions?

I'm sure this is quite basic to people who use parametric programming alot, I just can't quite figure it out.
I'm trying to do it similar to below.

#1=20.2 (Large Ř)
#2=2.7 (Small Ř)
#3=0.6 (Cut Size)
#4=[[#1-#2]/2] (8.75)

G01 Y#4 rounded up to the nearest multiple of #3

I want it to be able to move Y axis to the nearest multiple above #4 which would be 9.00.
Any one got any ideas?

Thanks

2. I dont know what control you have, but most with parametric take a RND or in the case of Fanuc take ROUND.
If so #5= ROUND #4
GO1 Y#5
Should work.
Al

3. Thanks Al The Man I should have specified it is a Fanuc, is it possible to round it up?
Its tricky because I want to round it up to the value of #3=0.6 (Cut Size)

4. I assume you want to round it up only? in other words did you want to round up to a whole number above #4 + #3?
Al

5. If possible I would like to round to a multiple of the cut size (0.6mm), so then it can calculate the amount of cuts needed. So if the cut size is changed it will round to suit the new cut size.

6. What if you do the round off like I showed and then compared the rounded # with #4 and if less than #4 add #3?
A
No wait that won't work, I have to go over that again but I think we are on the right track, unless someone else can jump in.
l

7. The problem for me is that I need it to start at the large Ř come in the value of #4 (8.75) but if someone specifies a cut size that is not a multiple of the different Ř's it can't come in to the correct size, I think.

8. I belive there is a Fix function available this will
simply remove the fractional part of a number
and return the next lower integer.
Just use this on the return of your devision.
A bit rusty on Fanuc but check the manual for
the proper syntax.
Good Luck

9. Are #1 & #2 going to change or just #3?
Al

10. Unfortunately all the parameters may change, I wish the manual had a bit on parametric programming in it, it doesn't have much at all.

11. I think at this point we need to get a clearer understanding of what you want to do, as the way I read your first post is a round up to 9.00, but that does not round up to an increment of 0.6? Which is the impression I get in the later post.
Al

12. Sorry for the confusion, you're right I would of liked it to round to 9.00, only because the cut size is 0.6, which would equal 15 cuts (15 x 0.6) to achieve 9.00.
I think I have worked out what to do, I just can't get the ROUND function to work.
I thought if I could have it round out the difference between total depth divided by cut depth as per below:

#1=20.2 (Large Ř)
#2=2.7 (Small Ř)
#3=0.6 (Cut Size)
#4=[[#1-#2]/2] (8.75 depth per side)
#5=[#4/#3] (14.58333 Depth divided by depth of cut)
#6=[ROUND#5] This formula doesn't work though.

If possible I would like it to round the value of #5 up to 15.00.
I think because I don't fully understand it, I'm having trouble explaining the scenario.
Thanks for your patience Al The Man.

Page 1 of 2 12 Last