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


Fanuc Discuss Fanuc controllers here!


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 09-22-2009, 06:39 AM
 
Join Date: Feb 2006
Location: india
Posts: 1,187
sinha_nsit is on a distinguished road
WHILE loop inside G71

This is a brain twister (at least mine):
I was trying to write a macro for machining a parabolic reflector, out of a solid cylindrical workpiece.
The first step was to generate the parabolic profile using mathematical formulae, in a loop. I did it correctly, because when I execute this part of the program, it correctly traces a parabolic profile, exactly the way the points were generated. When I place the WHILE loop (which also has a G01 move to the calculated coordinates, corresponding to each execution of the loop) between block numbers N1 and N2, and command G70 P1 Q2, then also the curve is traced correctly. So far, so good!

Now the problem:

It is necessary to initially use G71 for stock removal. When I insert the same WHILE loop inside G71's P- and Q-blocks, it alarms out with "124 MISSING END STATEMENT" message. In other words, it detects an illegal WHILE loop. If anyone of you has ever used a loop with G71, please let me know the correct way.

A bit of brainstorming:
The G71 profile definition blocks are read and executed from bottom to top. So, do we have to write the WHILE loop in a reverse order?
Reply With Quote

  #2   Ban this user!
Old 09-22-2009, 09:26 AM
dcoupar's Avatar  
Join Date: Mar 2003
Location: USA
Posts: 2,312
dcoupar is on a distinguished road

The alarm description says:

DO - END does not correspond 1 : 1. Modify the program.

Does the END come after the Q block?

Why not post that section of the program so we can look it over?
Reply With Quote

  #3   Ban this user!
Old 09-22-2009, 10:45 PM
 
Join Date: Feb 2006
Location: india
Posts: 1,187
sinha_nsit is on a distinguished road

I will do some more experimentation today, and post the result.
As I said, G70 P1 Q2 runs correctly. So, WHILE loop must be OK.
The same blocks are placed in the G71 profile definition, between N1 and N2. It alarms out. The reason, as far as I can guess, is that G71 reads N1 to N2 blocks in the reverse sequence. So, It first sees END_ and then WHILE_DO_. Naturally, it would be illegal.

Have you ever used any kind of loop with G71?
Reply With Quote

  #4   Ban this user!
Old 09-23-2009, 05:54 AM
 
Join Date: Feb 2006
Location: india
Posts: 1,187
sinha_nsit is on a distinguished road

I did some experimentation today and came to the following conclusion:
You can use WHILE_DO_END loop between P-and Q-blocks of G71, but the loop cannot have any movement G-code inside it. The WHILE loop is written in the usual manner, not upside down, as I was previously guessing.
The program which I was trying to execute is given below. It alarms out.

...
G00 X0 Z2;
G65 P8018 M80 B10 D20 Q0.1 R0.5 F60;
...

O8018 (PARABOLIC TURNING);
G00 X#2 Z2;
#104 = #4109;
G71 U#18 R0.1;
G71 P1 Q2 U–0.1 W0.05 F#9;
N1 G00 X#13;
G01 Z0;
#100 = ABS [#17];
#101 = – #100;
WHILE [ABS [#101] LE ABS [#7]] DO 1;
#102 = [[#13 * #13 * ABS [#7]] / [#13 * #13 – #2 * #2]];
#102 = #101 + #102;
#102 = [[#13 * #13 – #2 * #2] / ABS [#7]] * #102;
#102 = SQRT [#102];
G01 X#102 Z#101;
#101 = #101 – #100;
N2 END 1;
(I also tried putting END1; and N2; in two separate blocks. It does not help)
#103 = #4119;
G70 P1 Q2 F [#9 / 2] S [#103 * 2];
S#103 F#104;
M99;

When I skip G71 blocks and jump directly to G70 block, by a GOTO statement, the toolpath is as expected (parabolic), without any error.

I finally gave up. I believe it is just not possible to use a loop with G01, for defining G71/G72 profiles. I am not sure about G73. I will have to check.

So, I wrote a macro using G94 (G90 also can be used) for parabolic roughing. It works without any problem.

Last edited by sinha_nsit; 09-23-2009 at 09:15 PM.
Reply With Quote

  #5   Ban this user!
Old 09-23-2009, 08:46 AM
 
Join Date: Jul 2005
Location: Canada
Posts: 11,564
Geof will become famous soon enough

By mistake I tried using a subroutine with a G71 loop and it did not work.

I think it is not surprising that it will not work because the G71 reads through the motion commands before starting its routine so it can calculate the roughing steps. This means that the coordinate values cannot change while it is doing that operation. The G70 command simply reads the coordinates and executes them in a normal manner.
__________________
An open mind is a virtue...so long as all the common sense has not leaked out.
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 09-23-2009, 09:15 AM
dcoupar's Avatar  
Join Date: Mar 2003
Location: USA
Posts: 2,312
dcoupar is on a distinguished road

Isn't N2 supposed to be the last block of the shape definition? How about this:

G01 X#102 Z#101;
#101 = #101 – #100;
END 1;
N2 X#2
Reply With Quote

  #7   Ban this user!
Old 09-23-2009, 09:28 PM
 
Join Date: Feb 2006
Location: india
Posts: 1,187
sinha_nsit is on a distinguished road

Originally Posted by Geof View Post
By mistake I tried using a subroutine with a G71 loop and it did not work.
I think it is not surprising that it will not work because the G71 reads through the motion commands before starting its routine so it can calculate the roughing steps. This means that the coordinate values cannot change while it is doing that operation. The G70 command simply reads the coordinates and executes them in a normal manner.
The manual does say that subprograms cannot be called from within P-, Q-blocks (I guess it applies to G65/G66 also). But it is silent about loops. Anyway, G90/G94 can be used to simulate the G71/G72 cycles, except that retraction at the end of a cutting pass would not be at 45 degree. But, this is hardly important.

G73 may not have this limitation, because it does not have to calculate the toolpath. It simply shifts the defined profile in subsequent passes. I will verify and post the result.
Reply With Quote

  #8   Ban this user!
Old 09-23-2009, 09:42 PM
 
Join Date: Sep 2004
Location: Canada
Posts: 204
ckirchen is on a distinguished road

I understand that you want to use a macro so that the profile is exactly parabolic. But roughing does not have to be exact; can you use a simple approximation with G71?
Reply With Quote

  #9   Ban this user!
Old 09-23-2009, 10:34 PM
 
Join Date: Jul 2005
Location: Canada
Posts: 11,564
Geof will become famous soon enough

I did some thinking, always a dangerous activity.

Have you considered a different approach?

An inefficient approach would be to perform the parabolic tool path many times and step the starting point forward using an incremental G52 Z command. This is inefficient because initially the machine will be cutting a lot of air.

One way to improve the efficiency would be to write another macro to calculate the parabola OD which would then enter the macro for the parabola as the end point. This would reduce the time spent cutting air.
__________________
An open mind is a virtue...so long as all the common sense has not leaked out.
Reply With Quote

  #10   Ban this user!
Old 09-24-2009, 01:06 AM
 
Join Date: Feb 2006
Location: india
Posts: 1,187
sinha_nsit is on a distinguished road

Originally Posted by dcoupar View Post
Isn't N2 supposed to be the last block of the shape definition? How about this:

G01 X#102 Z#101;
#101 = #101 – #100;
END 1;
N2 X#2
I have tried nearly everything, including some absurd ideas also (such as writing WHILE loop upside down). Nothing works.
Reply With Quote

Sponsored Links
  #11   Ban this user!
Old 09-24-2009, 01:10 AM
 
Join Date: Feb 2006
Location: india
Posts: 1,187
sinha_nsit is on a distinguished road

Originally Posted by ckirchen View Post
I understand that you want to use a macro so that the profile is exactly parabolic. But roughing does not have to be exact; can you use a simple approximation with G71?
You are right.
Initially, the parabola can be approximated by a few straight lines, and G71/G72 be used to machine it. But the end points of the lines will have to be calculated, and somehow the macro has to be made of general type, so that a parabola with a different dimensions also could be machined without changing the macro.
Reply With Quote

  #12   Ban this user!
Old 09-24-2009, 03:25 AM
 
Join Date: Feb 2006
Location: india
Posts: 1,187
sinha_nsit is on a distinguished road

Originally Posted by Geof View Post
I did some thinking, always a dangerous activity.

Have you considered a different approach?

An inefficient approach would be to perform the parabolic tool path many times and step the starting point forward using an incremental G52 Z command. This is inefficient because initially the machine will be cutting a lot of air.
Inefficient, but it will work. In fact there is no need to use G52. You can use G73, with U = 0, and W = depth of parabola (#7), in the first block. Specify R to have the desired axial shift in the profile in subsequent cutting passes. I have tested this. It works.

In fact, my experiment with G71/G72/G73 is now complete, with the following observations:
You cannot use a loop with G01 for defining the profiles for G71 or G72.
But this is permissible for G73.


However, the most efficient method for this kind of machining would be to use G90 or G94 (as appropriate) in a loop, to simulate the roughing passes of G71/G72. This would be followed by moving the tool along the defined profile, to remove the steps. I am assuming that there is an initial hole in the workpiece, which would avoid tool interference with the workpiece. The program is ready and it works. I will post it in a day or two. Of course, it does not have the finishing allowances feature of G71/ G72. The drawing of the parabola is attached here.
Attached Files
File Type: pdf Fig. 8.pdf‎ (22.6 KB, 51 views)
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
Open Loop to Closed Loop Stepper Conversion beamhome Stepper Motors and Drives 9 05-24-2012 02:46 AM
Need Help!- inside arcs with comp doing "loop de loops" Mikey69 Fanuc 11 06-01-2009 09:13 AM
question on closed loop vs open loop (servo systems) boonie Servo Motors and Drives 20 11-09-2007 12:30 PM
Closed loop vs. open loop pelesl Benchtop Machines 10 04-06-2007 04:56 PM
Lathe conversion - open loop vs closed loop bhowden General Metal Working Machines 7 03-21-2006 03:56 PM




All times are GMT -5. The time now is 09:59 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