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 02-19-2011, 08:32 PM
 
Join Date: Jul 2010
Location: USA
Posts: 169
eliot15 is on a distinguished road
Circular Pocket Math Puzzle

Here's some psudo-code to cut a circular pocket:

%
O0001 (CIRCULAR_POCKET)
(2.500 DIA., 0.568 DEPTH)
G17 G40 G80

(1.0 INSERT CUTTER - ROUGHING)
G90 G54 G0 X-.45 Y0.
S1250 M3
G43 Z2. H1 T2
Z.1
G1 Z.1 F25.
M8

M98 P2

G0 X-.45 Y0.
Z-.0136
G1 Z-.0136 F25.
M98 P2

G0 X-.45 Y0.
Z-.1272
G1 Z-.1272 F25.
M98 P2

G0 X-.45 Y0.
Z-.2408
G1 Z-.2408 F25.
M982

G0 X-.45 Y0.
Z-.3544
G1 Z-.3544 F25.
M98 P2

M30

O0002 (1.0 INSERT CUTTER)
G91 G3 X.9 Y0. Z-.0136 I.45 J0. F20.
Z-.025 I-.45
Z-.025 I-.45
Z-.025 I-.45
Z-.025 I-.45
Z-.025 I-.45
Z-.025 I-.45
Z-.025 I-.45
Z-.025 I-.45
G90
M99

%

It generates this:



Here is what I can't figure out. The pocket is cut to 0.568 deep. The sub gets called 5 times, and .025 cuts are taken in incremental mode. The the last time the sub is called, the cutter is at 0.568.


I'm trying to figure out the math so I can write incremental subs that step down in constant increments like this.

The first time the sub is called, the first four blocks beginning with the G91 block just cut air. On the fifth block, cutting begins at -0.0136. In the remaining calls to the sub, the first four blocks beginning with the G91 block are overlap. Cutting resumes with the fifth block. For example, here are the values for the first pass through the sub:

0.0864
0.0614
0.0364
0.0114
-0.0136
-0.0386
-0.0636
-0.0886
-0.1136

Cutting begins at -0.0136. The value -0.0136 also appears in the main program as an absolute value, and in the sub as an incremental value.

The crux of the matter is: Where does this -0.0136 value come from????? I'm actually traveling .668 in Z (beginning at Z.1). So I've tried a variety of dividing .668 by .025, etc., etc.

I have noticed that .068/5 = .0136. Coincidence??? I can't figure out what to do with this information though, or how to write a similar sub for a depth of say .432, or how to factor in the overlapping blocks.

I want to be able to write a sub in incremntal mode for this type of scenario, and know how to handle the difference left over after dividing by my cutting increment (say .025).

I'm going to keep messing with this, but would love any suggestions.

Thanks.....................
Reply With Quote

  #2   Ban this user!
Old 02-19-2011, 09:54 PM
 
Join Date: Jul 2005
Location: Canada
Posts: 11,563
Geof will become famous soon enough

Did you write this or get it from somewhere? One error is at the beginning in these lines:

G43 Z2. H1 T2
Z.1
G1 Z.1 F25.
M8

M98 P2

When the sub is called the tool is at Z.1 above the work so of course it has to make four circuits going down Z-.025 before it reaches the top of the work.

Also some of the commands don't seem to make sense such as this:

G0 X-.45 Y0.
Z-.0136
G1 Z-.0136 F25.

The machine is in absolute and rapid mode from the G0X-.45 Y0. command so the next line Z-.0136 does a rapid move down to this position; the G1 Z-0.0136 does nothing because the tool is already at that position.


Regarding this question:
I want to be able to write a sub in incremntal mode for this type of scenario, and know how to handle the difference left over after dividing by my cutting increment (say .025).

One way to do this is to start slightly above the surface so the final incremental pass is at the correct depth. Actually your code does this but it starts way too high and has a lot of unnecessary stuff.


You want to go to a depth of 0.568 using 0.025 per pass. Diviiding 0.568 by 0.025 gives 22.72 passes. It is impossible to get .72 of a pass so you us 23 which would take you down to 0.575 which is 0.007 deeper than you want to go. So you start at Z+0.007 and go down 23 times 0.025 to finish at -0.568.

Then you would need to do a final circuit without an Z value to remove the helical ramp at the bottom.
__________________
An open mind is a virtue...so long as all the common sense has not leaked out.
Reply With Quote

  #3   Ban this user!
Old 02-19-2011, 10:15 PM
 
Join Date: Jul 2010
Location: USA
Posts: 169
eliot15 is on a distinguished road

Hey thanks for that suggestion. Simply starting the tool the remainder of the division above the part sounds like a good way to go.

The code is just a portion of a part program from work. Mostly computer generated I suspect. I noticed several oddities also, but am just focused on the helical interpolation part. It does include a finish end mill as well. The value .0136 is obviously caluculated, and I was just kinda' curious about how it it came to be.

Thanks for your suggestion, though.
Reply With Quote

  #4   Ban this user!
Old 02-19-2011, 10:26 PM
 
Join Date: Jul 2005
Location: Canada
Posts: 11,563
Geof will become famous soon enough

Here is where the 0.0136 comes from, at least the best I can figure it.

The final sub program call has Z-.3544 for the starting position.

The first line in the sub program does a half circuit moving down -0.0136 so now the tool is at Z-0.368 then it does 8 circuits at -.025 each for a final position of Z-0.568.

But there is a whole lot of redundant nonsense in the code.
__________________
An open mind is a virtue...so long as all the common sense has not leaked out.
Reply With Quote

  #5   Ban this user!
Old 02-20-2011, 06:06 AM
 
Join Date: Jul 2010
Location: USA
Posts: 169
eliot15 is on a distinguished road

Thanks for your time, Geof.
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 02-20-2011, 07:09 AM
 
Join Date: Jul 2010
Location: USA
Posts: 169
eliot15 is on a distinguished road

Amazing the difference sleeping on something can make.

Using your thinking, Geof, here's why the Z-0.136 word is used 5 times (once for each sub program call).

The code first makes 2 arbitrary decisions:

1. the sub program will cut .100 deep in .025 increments.

2. the sub program will be called 5 times.

Given these arbitrary parameters, 5 executions of the sub program will get us to .500.

That leaves us with .068 worth of depth unaccounted for.

So, instead of following your thinking and just swiping it all off the top, it gets cut in .068/5 = .0136 increments.

Each call to the sub program removes -.0136 + .100 = .1136 worth of material, x5 = .568.

Simple.

Thanks again for your time.
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
G12/G13 Circular pocket help needed NeoMoses G-Code Programing 8 09-27-2011 02:53 PM
Newbie- Need help programming a circular pocket Robert_Downs Bridgeport and Hardinge Mills 6 07-29-2010 06:13 AM
Circular Pocket Question JayKayEh CamWorks 4 05-03-2010 11:56 AM
Need Help!- circular pocket Darek833 Okuma 8 01-01-2010 04:42 AM
G77 Circular Pocket Big John T BobCad-Cam 3 02-27-2007 10:33 AM




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