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! > MetalWorking > General Metalwork Discussion


General Metalwork Discussion Discuss everything relating to metal work.


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 08-30-2009, 07:02 AM
 
Join Date: Nov 2008
Location: USA
Posts: 397
MechanoMan is on a distinguished road
G-code step-and-repeat

OK, I have an L-shaped part which is just a load of G-code in a subroutine.

I will need to do a step-and-repeat where I rotate the part 180 deg and XY offset it enough to clear the previous part.

G68 rotates the coordinate system. But it also says it rotates the work offset, which would be horrible.
G10 can set the origin and G52 can do a temporary offset... but Mach3 says G92 offsets CANNOT be used with G52. Which would be a problem.

I'm really frustrated. I can't remake the G-code as relative moves or anything, it's CAM-generated. The idea was to do a M98 call of the routine, rotate the coordinate system 180 deg and XY offset, then call again (lather, rinse, repeat). But is this even possible??

Should I maybe try to get the work offsets from the parameter list, zero the actual offsets, rotate the system, then reassign the work offset along with the necessary XY stepping?
Reply With Quote

  #2   Ban this user!
Old 08-30-2009, 07:18 AM
Karl_T's Avatar  
Join Date: Mar 2004
Location: Dassel,MN,USA
Posts: 1,318
Karl_T is on a distinguished road

More than one solution here. On my control (not Mach), I'd set up work offsets for each part - G54 for part 1, G55 for part 2, and so on. Then just do your new offset and rotate before the routine call.

Karl
Reply With Quote

  #3   Ban this user!
Old 08-30-2009, 09:26 AM
 
Join Date: Dec 2004
Location: usa
Posts: 1,665
TOTALLYRC is on a distinguished road

Originally Posted by MechanoMan View Post
OK, I have an L-shaped part which is just a load of G-code in a subroutine.

I will need to do a step-and-repeat where I rotate the part 180 deg and XY offset it enough to clear the previous part.

G68 rotates the coordinate system. But it also says it rotates the work offset, which would be horrible.
G10 can set the origin and G52 can do a temporary offset... but Mach3 says G92 offsets CANNOT be used with G52. Which would be a problem.

I'm really frustrated. I can't remake the G-code as relative moves or anything, it's CAM-generated. The idea was to do a M98 call of the routine, rotate the coordinate system 180 deg and XY offset, then call again (lather, rinse, repeat). But is this even possible??

Should I maybe try to get the work offsets from the parameter list, zero the actual offsets, rotate the system, then reassign the work offset along with the necessary XY stepping?
If the part is relatively simple and you are trying to "nest" them to make better use of the available stock,then I would draw out the layout you need in the cad program and then run it through the CAM again.
__________________
Warning: DIY CNC may cause extreme hair loss due to you pulling your hair out.
Reply With Quote

  #4  
Old 08-30-2009, 10:16 AM
HuFlungDung's Avatar
Moderator
 
Join Date: Mar 2003
Location: Canada
Posts: 4,825
HuFlungDung is on a distinguished road

I' ve never used coordinate system rotation, but have you played with it to see if rotating the work offset is 'horrible' or not? It may be a matter of what you think is going on, and what really goes on are two different things.

In my mind, I can sort of visualize that not rotating the work offset could in fact, be a problem, depending on which coordinate systems are active.

I'd take the sure route and program a right and a left, and then repeat that, rather than dealing with a bunch of complexity.
__________________
First you get good, then you get fast. Then grouchiness sets in.

(Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)
Reply With Quote

  #5   Ban this user!
Old 08-30-2009, 04:17 PM
 
Join Date: Nov 2008
Location: USA
Posts: 397
MechanoMan is on a distinguished road

Originally Posted by TOTALLYRC View Post
If the part is relatively simple and you are trying to "nest" them to make better use of the available stock,then I would draw out the layout you need in the cad program and then run it through the CAM again.
Not gonna happen. CAM is a difficult process and requires some post-editing. Depending on what I have for stock, I may step-and-repeat different ways.

Originally Posted by HuFlungDung
I' ve never used coordinate system rotation, but have you played with it to see if rotating the work offset is 'horrible' or not? It may be a matter of what you think is going on, and what really goes on are two different things.
Oh yeah it's horrible. See I've got a hole I align for the origin. So I run the machine over the stock where I need that to be, and use G92 to set that as origin, say it's actually X=5.123 in machine coords (I never use machine coords at all). Well, that moves the origin way the hell over in the wrong direction when the code tries to do a G68 rotation from part 1 to part 2. Basically the 180 deg rotation moves the ORIGIN to X=-5.123 on machine coords.

The G52 Temporary Offsets look like they have the same sort of problem, it clobbers the original work offset. So you try to step over 1" by saying G52 X1, but that clobbers the G92 offset, putting it at MACHINE coord X=1, meaning the G52 X1 resulted in a relative move by X-4.123, and it's unpredictable at that, since changing stock and resetting the work offsets will totally change what the G-code does.

Last edited by MechanoMan; 08-30-2009 at 04:33 PM.
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 08-31-2009, 03:42 AM
 
Join Date: Nov 2008
Location: USA
Posts: 397
MechanoMan is on a distinguished road

Ah-ha, it IS possible! I was a bit confused initially, betwen G92 offsets and WORK offsets. I didn't realize how they were different.

This allows me to start with a G92 offset and offset angle (used when the stock doesn't totally line up with the axis), and restores them when done.
The only thing is, if you see a problem in the run, pull a Stop, and then start again from the beginning, you will have corrupted offsets. If you didn't have any G92 or angular offset to begin with, then can just zero them and restart. As such I'd kinda recommend not setting up with stock with G92 offsets but by setting the Work offset, and avoiding using the angle if you can.

This took way too many hours to figure out...

Code:
#100=#5211 (initial G92/G52 x-offset, #5211 is a Mach3 system param)
#101=#5212 (initial G92/G52 y-offset, #5212 is a Mach3 system param)
#102=0  (incremental rotation, Mach3 will not provide the initial offset so there is no way to figure it out, but by doing incrementals and recording the change alone, that'll allow us to work off it and restore it)

#10=0        #11=0  #12=90  M98 P5 
M98 P2 (O2 is the part to be repeated)
#10=[#25]  #11=-50 #12=-90 M98 P5 
M98 P2
#10=[#50]  #11=0  #12=90  M98 P5
M98 P2

(cleanup at end)
G52 X[#100] Y[#101]      (restore original G92/G52 offsets)
G68  a0 b0 r[-1*#102] i0 (undo any previous inc rotation)
M30 (end of program)

O5 (Step, Rotate, and Repeat Offset)
(#10=x offset, #11=y offset, #12=angle)

G68 a0 b0 r[-1*#102] i0 (undo any previous inc rotation)
G52 X[#100+#10] Y[#101+#11] (XY stepping)
G68  a0 b0 r[#12] i0  (set inc rotation)
#102=[#12] (remember new inc rotation state)
M99
Reply With Quote

  #7   Ban this user!
Old 05-20-2012, 06:45 PM
 
Join Date: Aug 2011
Location: U.S.
Posts: 18
garym1957 is on a distinguished road

Well I'm not proud. I'm just gonna ask someone to show me how so I can get some actual cutting done.

(I'm trying to surface a spoilboard)

N0 G1 X20.0 F80 (Run 20 inches to the right)
N1 G1 Y+=0.0100 (Increment Y by some partucular amount?)
N2 G1 X0.000 (X back to zero)
N3 G1 Y+=0.0100 (Increment Y again)
N4 G? N0 L30 (repeat the whole mess 30 x)

Any takers?
Or point me in some direction, please.
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
whole G-Code REPEAT command ?? LockTech G-Code Programing 14 08-08-2010 10:21 AM
g code for repeat the previous move woffler G-Code Programing 6 03-26-2008 10:07 PM
Step by step 3d wireframe Stl. to G-code josh cbr900 Mastercam 7 11-12-2007 05:43 AM
AVR G Code Interpreter/ Step-Dir Macro Recorder bitmannz General Electronics Discussion 5 02-01-2007 12:07 AM
Repeat g-code with y offset tpaulson G-Code Programing 19 11-29-2004 01:36 PM




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