CNCzone.com-The Largest Machinist Community on the net!



Home Page Mark Forums Read Today's Posts My Replies Classifieds Reviews Photo Gallery Web Links Share Files Advertise With Us Ad List
Go Back   CNCzone.com-The Largest Machinist Community on the net! > Machine Controllers Software and Solutions > G-Code Programing > Parametric Programing


Parametric Programing (custom macro b, fadal macro, okuma user task)


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 02-01-2012, 02:41 PM
 
Join Date: Feb 2011
Location: USA
Posts: 38
pwilson101 is on a distinguished road
automatic calculation of fixture offsets

I want the control to calculate fixture offsets for me by using macros (fanuc macro B). I'm not quite sure how to write the formula for this.

What I have is a horizontal machining center with a rotary B-axis. I want to manually enter the X-axis and Z-axis numbers (for the work offsets) at B0 (G54), then run the program and have the formula in the program enter in the rest of the work offsets at the other B-axis angles.

For instance, if I entered in ".0500" for X-axis and "9.0000" for Z-axis, the offsets at B180.000 would be just the opposite signs (-.0500 & -9.0000, respectively). That would be easy enough to write. But I need the formula to be able to calculate at "odd" B-axis angles, like say 103.250 (The answers would be X-8.7719, Z-2.0141), using trigonometry.

So for an example, if I had a G54 (B0) offset with the X & Z-axis numbers given (I enter and these numbers represent distance from c/l of index), I would want to calculate for the X & Z-axis numbers for G55 (@B103.250). I would want the formula to consider what is in the G54 X & Z work offsets (#5221 & #5224), then calculate for the new X & Z work offsets based on what's in the B-axis offset for G55 (#5246), and automatically enter in the table.

I hope I explained that well enough.

Any help is appreciated....
Reply With Quote

  #2   Ban this user!
Old 02-01-2012, 03:34 PM
fordav11's Avatar  
Join Date: Aug 2011
Location: Fordaville
Posts: 940
fordav11 is on a distinguished road

not really enough info. It can get quite complex.
However you seem to have worked out most of it yourself.
you can use SIN/COS/TAN in macros.
#1 = SIN[103.123]
#5221 = 945.567 - #1

(or whatever you want to calculate)
Reply With Quote

  #3   Ban this user!
Old 02-01-2012, 06:27 PM
 
Join Date: Feb 2011
Location: USA
Posts: 38
pwilson101 is on a distinguished road

This is what I have so far:

for the X-axis offset:
#5241=[COS[42]*[#5221]-[#5224*SIN[42]]] (Answer is -5.9850)

and for Z-axis:
#5244=[#5221*SIN[42]+[#5224]*COS[42]] (Answer is 6.7218)

The only thing is the order of operations - I'm not sure how to write it so it does what I want to do in order. Can anyone give me a brief explanation of use of the brackets??

Thanks....
Reply With Quote

  #4   Ban this user!
Old 02-01-2012, 07:06 PM
 
Join Date: Jul 2003
Location: New Zealand
Posts: 1,042
Kiwi is on a distinguished road

See Post #6

Last edited by Kiwi; 02-02-2012 at 04:40 AM.
Reply With Quote

  #5   Ban this user!
Old 02-02-2012, 02:11 AM
fordav11's Avatar  
Join Date: Aug 2011
Location: Fordaville
Posts: 940
fordav11 is on a distinguished road

in general programming terms calculate the inner brackets first then move out to the next bracket pair and do that calculation. you may need to remember some numbers then apply them at the end. when using brackets there must be a pair of brackets for each calculation.

example....
a = (1+(2*3))*4

the answer is calculated as
2*3 = 6
then 1+6 = 7
then 7 *4
so a = 28

you really should google for an explanation on this. it's basic maths.
'Order Of Operations'
here's one example....
Order of Operations
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 02-02-2012, 04:37 AM
 
Join Date: Jul 2003
Location: New Zealand
Posts: 1,042
Kiwi is on a distinguished road

#5241 = [#5221 * Cos[42]] - [#5224 * Sin[42]]
#5244 = [#5221 * Sin[42]] + [#5224 * Cos[42]]

Last edited by Kiwi; 02-02-2012 at 02:12 PM. Reason: Variables labeled incorrectly
Reply With Quote

  #7   Ban this user!
Old 02-02-2012, 05:34 PM
 
Join Date: Feb 2011
Location: USA
Posts: 38
pwilson101 is on a distinguished road

Thanks your your help...much appreciated.
Reply With Quote

  #8   Ban this user!
Old 02-02-2012, 07:24 PM
christinandavid's Avatar  
Join Date: Aug 2009
Location: New Zealand
Posts: 573
christinandavid is on a distinguished road

If you have many work offsets per operation, and a limited amount of work offsets, you may want to consider making your macro an integral part of your standard programming format.

For example, you put your original origin in G54 and your macro calculates each new position as the B-axis indexes in the main program, overwriting the 'temporary' offset position (eg G59) with every process.

Keeps things tidier, especially when running multiple pallets and/or if offsets need to be re-established for each part.

DP
Reply With Quote

  #9   Ban this user!
Old 02-03-2012, 02:09 PM
 
Join Date: Feb 2011
Location: USA
Posts: 38
pwilson101 is on a distinguished road

Sounds interesting but I'm not getting it completely. Could you elaborate?

Thanks
Reply With Quote

  #10   Ban this user!
Old 02-03-2012, 03:52 PM
christinandavid's Avatar  
Join Date: Aug 2009
Location: New Zealand
Posts: 573
christinandavid is on a distinguished road

Once you have your macro program formulae working correctly, assign a G-code to it and use it in your program instead of work offset calls. The B-AXIS ROTATION, work offset overwrite, and subsequent work offset call (G59 say), will always be in the macro program. This method means you only need to store one offset for each job and leave the G59 as your 'running' offset.

All the sequences in my main programs look like this: -

N5 (Operation)
G123 D1 R0 <------------- Call setup macro, defining the Datum to rotate by R
T# M6
S# M3
blah
blah
blah
M1

I use the extended work offsets (G54.1 P1 - P47) to define my original datum and P48 is the ALWAYS the offset that is written to (and called) by G123 BEFORE returning to the main program.

This means I can tweak my original offset if required and start without fear from any sequence number in the program.

Now that this format is standard, I have built so much more into G123 than simply offset calcs; eg safety retract based on workpiece/tool length, pallet load based on offset number, even skipping the current sequence entirely if required (eg multiple part fixture without a full complement of parts..).

DP

Last edited by christinandavid; 02-03-2012 at 04:10 PM.
Reply With Quote

Sponsored Links
  #11   Ban this user!
Old 02-03-2012, 07:27 PM
 
Join Date: Feb 2011
Location: USA
Posts: 38
pwilson101 is on a distinguished road

That is definitely cool and some very good ideas. Would you be willing to share seem "complete" examples? (Willing to share the entire code of something so I can wrap my head around it)
Reply With Quote

  #12   Ban this user!
Old 02-04-2012, 07:46 PM
christinandavid's Avatar  
Join Date: Aug 2009
Location: New Zealand
Posts: 573
christinandavid is on a distinguished road

Have attached a flowchart showing all the tasks my setup macro is responsible for. We can discuss any particular function you are interested in, in more detail if you wish.

How much of that lot you would want to adopt would depend on your control and your needs (unnecessary automation can be bad), as well as how much discipline you want to impose on your programming format.

My suggestion is to integrate one thing at a time, once you have decided it is necessary and have a fairly fool-proof way of working it in to your method. That is how my macro evolved, always taking into account that others will have to follow what you have done and must also reap the benefits - otherwise there may be some justified resistance...

DP
Attached Thumbnails
Click image for larger version

Name:	G123.jpg‎
Views:	35
Size:	84.0 KB
ID:	151953  
Reply With Quote

Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help!- Fixture Offsets Jerseycnc Fanuc 12 01-23-2012 11:49 AM
FIXTURE OFFSETS 1234567 Cincinnati CNC 2 11-18-2011 09:15 AM
Newbie- Fixture offsets, X3 KevinV_MEI Mastercam 2 02-06-2011 10:04 AM
Newbie- Z Fixture offsets gbpacker Fadal 13 09-02-2009 03:41 PM
fixture offsets beartrax G-Code Programing 1 11-14-2008 06:19 PM




All times are GMT -5. The time now is 01:05 AM.





Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO
Template-Modifications by TMS

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361