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


G-Code Programing Discuss G-code programing and problems here!


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 01-13-2011, 08:55 AM
 
Join Date: Jan 2011
Location: usa
Posts: 1
B.D. is on a distinguished road
Macro for engraving

Fanuc 16i control Macro B
Hello all first post on here, and completely green on macro programming. I got something that should be easy for you macro gurus out there. I'm trying to set-up engraving parts with the shift letter on them. 12hr shifts currently...so shift "A" is between 5a.m. and 5p.m. and shift "B" 5p.m. to 5a.m.
I know that variable #3012 reads current time and 50000 is 5am and 170000 is 5pm. I'm having trouble at the beginning where the current time determines what program to run, I'm not sure what function to use (GE,LE,EQ,GT,LT,WHILE,OR)etc...etc..
Here's what i have so far, (try not to laugh)

%
O0006
G0 G17 G20 G40 G80 G90
G91 G28 Z0.


#501=#3012
IF[#501GE50000]GOTO100
N100
IF[#501LE170000]GOTO500
GOTO N1000
IF[#501GE170000]GOTO200
N200
IF[#501LE50000]GOTO600
GOTO1000



N500
(A-SHIFT)
/G0 G17 G90 G54 X-.4 Y.7451 S5000 M3
/G43 H1 Z.02
/Z.015
/G94 G1 Z-.01 F3.
/X-.6 Y.7949 F5.
/X-.4 Y.8451
/G0 Z.02
/X-.5 Y.82
/Z.015
/G1 Z-.01 F3.
/Y.7702 F5.
/G0 Z.02
GOTO1000

N600
(B-SHIFT)
/G0 G17 G90 G54 X-.4 Y.7451 S5000 M3
/G43 H1 Z.02
/Z.015
/G94 G1 Z0. F3.
/Y.7953 F5.
/X-.401 Y.8039
/X-.4038 Y.8122
/X-.4087 Y.82
/X-.4144 Y.8271
/X-.4221 Y.8333
/X-.4308 Y.8384
/X-.4404 Y.842
/X-.45 Y.8443
/X-.4615 Y.8451
/X-.4721 Y.8443
/X-.4817 Y.842
/X-.4913 Y.8384
/X-.5 Y.8333
/X-.5077 Y.8271
/X-.5135 Y.82
/X-.5183 Y.8122
/X-.5212 Y.8039
/X-.5221 Y.7949
/X-.524 Y.8047
/X-.5269 Y.8118
/X-.5308 Y.818
/X-.5356 Y.8235
/X-.5413 Y.8282
/X-.5481 Y.8314
/X-.5538 Y.8333
/X-.5615 Y.8341
/X-.5683 Y.8333
/X-.574 Y.8314
/X-.5808 Y.8282
/X-.5865 Y.8235
/X-.5913 Y.818
/X-.5952 Y.8118
/X-.5981 Y.8047
/X-.599 Y.7973
/X-.6 Y.7898
/Y.7451
/X-.4
/G0 Z.02
/X-.5221
/Z.015
/G1 Z0. F3.
/Y.7953 F5.
/G0 Z.02
GOTO1000

N700
(C-SHIFT)
/G0 G17 G90 G54 X-.5519 Y.8451 S5000 M3
/G43 H1 Z.02
/Z.015
/G94 G1 Z0. F3.
/X-.5644 Y.8404 F5.
/X-.5769 Y.8337
/X-.5865 Y.8263
/X-.5942 Y.8176
/X-.5981 Y.8086
/X-.6 Y.7992
/X-.5981 Y.7898
/X-.5942 Y.7808
/X-.5865 Y.7722
/X-.5769 Y.7643
/X-.5644 Y.7576
/X-.55 Y.7522
/X-.5346 Y.7482
/X-.5173 Y.7459
/X-.5 Y.7451
/X-.4827 Y.7459
/X-.4654 Y.7482
/X-.45 Y.7522
/X-.4356 Y.7576
/X-.4231 Y.7643
/X-.4135 Y.7722
/X-.4058 Y.7808
/X-.4019 Y.7898
/X-.4 Y.7992
/X-.4019 Y.8086
/X-.4058 Y.8176
/X-.4135 Y.8263
/X-.4231 Y.8337
/X-.4356 Y.8404
/X-.4481 Y.8451
/G0 Z.02
GOTO1000

N1000
M5
M9
G91G28Z0.
M30
%

Thanks,
Reply With Quote

  #2   Ban this user!
Old 01-13-2011, 03:22 PM
christinandavid's Avatar  
Join Date: Aug 2009
Location: New Zealand
Posts: 573
christinandavid is on a distinguished road

What about something along the lines of...


#501=#3012
IF [#501LT50000] GOTO600
IF [#501GT170000] GOTO600
GOTO500 (may/may not be required)

That would work alternating between A and B. What's shift C all about?

DP
Reply With Quote

  #3   Ban this user!
Old 05-07-2012, 08:08 PM
skm skm is offline
 
Join Date: Dec 2010
Location: us
Posts: 9
skm is on a distinguished road
labeling by shifts...

From what I see first glance, 3 things:
the tests are wrong
and the block skips are not needed, serve no function
the n100,etc. line numbers are in the wrong places.

To make the tests be right, there are 3 cases and you need to have each case accounted for in order. There are 3 cases because the clock is linear from 0 o'clock to midnight.
So the order of our cases needs to follow that (so we can fall thru to the next test correctly).

1st case, it is before 5am
2nd case, it is between 5am and 5pm
3rd case, it is after 5pm

Cases 1 and 3 go to the same code, for shift B
Case 2 goes to the code for shift A.

so, some pseudo-code:

if before 5am, goto shift B code
if before 5pm, goto shift A code
if after 5pm, goto shift B code

Shift A
code for shift A
goto 1000

Shift B
code for shift B
goto 1000

Shift C (or not, as your example has 3 shifts but description has 2)

N1000 (continue...)

I program it the way I did because it is nice and orderly, and easy to figure out next year when you modify it (grin).

It could be made shorter (though slightly less obvious what is going on) by reversing the order of the shift a and shift b code, which means it falls through for the third test and then the 3rd test is not needed. Like this:

if before 5am, goto shift B code
if before 5pm, goto shift A code
Shift B
code for shift B
goto 1000

Shift A
code for shift A

N1000 (continue...)

But that is less clear to me so I would program it the first way, so everybody reading it gets it clearly.

Hope that helps--you may have already solved this since the Orig. Post was a while ago.

Skm
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
Problem- Serialized Engraving Macro help Kennebec Fanuc 1 06-09-2010 12:36 PM
number engraving macro gravy Parametric Programing 2 02-22-2010 04:05 PM
Testing program for Macro (Fanuc Macro B) NickDP Fanuc 2 03-27-2009 03:15 PM
Convert Fanuc Macro to Fadal Macro bfoster59 Fadal 1 11-08-2007 11:41 PM
Engraving Macro MachineSMM General CNC (Mill and Lathe) Control Software (NC) 12 03-03-2005 05:32 AM




All times are GMT -5. The time now is 07:53 PM.





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