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-17-2007, 06:44 AM
derekj308's Avatar  
Join Date: Jun 2005
Location: Australia
Posts: 162
derekj308 is on a distinguished road
G52 Used For Patterning

Hi Guys

During my research of G and M codes I found a handy technique for patterning tool paths. By using a combination of sub routines and the function G52, which is basically a way of defining a temporary work co-ordinate system, you can pattern a toolpath which has been written based around a co-ordinate system of 0,0,0.

Once you have zeroed your work co-ordinates, G52 calls will reference from that 0,0,0 not your machine co-ordinates. Each G52 call you make 'fools' the controller into thinking that your work 0,0,0 is in a different place. If you want to pattern by +100mm in Y you would call G52 Y100. If you wanted to pattern by -200mm in X you would call G52 X-200. Once you understand the princliple of 'shifting' a co-ordinate system you can do any pattern you like based on a few simple toolpaths and subroutines. Cuts your line count down and troubleshooting becomes easier to manage since you are re-using the same code over and over. Once your patterning has been finished dont forget to call G52 X0Y0Z0 to make sure the work co-ordinate system is back to its original position otherwise you may end up with some unwanted tatttoes on your machine, fixture or workpiece.

An example is as follows which works in Mach2, maybe Mach3, I haven't tried.
This example will execute a toolpath at 0,0,0 then once it has finished that toolpath it will translate the co-ordinate system in Y by 100, execute the toolpath again and so on until it has executed the toolpath 5 times. The subprogram P1 is actually redundant but I left it in there to show that you can nest sub routines within G-code just like in other programming languages.

In the example below where it says "put your program in here", you could just put a movement in X to prove the subroutine O2 was executed and that the subprograms and G52 offsets work as you expect. Once you get confident start cutting. Good luck!

%
M98 P1 (this calls the sub routine P1, designated by label O1)
M30 (program end and rewind)

O1 (this is the sub routine label number)
M98 P2 (this calls the sub routine P2, designated by label O2)
G52 Y100. (this shifts the co-ordinate system to think Y0 is at Y100)
G0 Y0.Z10. (this sets the tool centre point 10 in Z above the point)
(at which the program is to be executed, checking only)
M98 P2
G52 Y200.
G0 Y0.Z10.
M98 P2
G52 Y300.
G0 Y0.Z10.
M98 P2
G52 Y400.
G0 Y0.Z10.
M98 P2

G52 X0Y0Z0 (this resets the co-ordinate system back to original Y0)
G0 X0.Y0.Z10. (move to a safe Z above the original 0,0)
M99 (return from subroutine P1)

O2

(put your program in here remembering)
(to bring Z to a safe height before translation in Y)
(and that your program should be referenced to 0,0,0)


M99 (return from subroutine P2)

M05 (stop spindle rotation)
%

Cheers
Derek

keywords; pattern, copy, translate, subroutine, routine, offset, repeat
__________________
<insert witty comment here>
derekj308
Reply With Quote

  #2  
Old 01-17-2007, 06:57 AM
Switcher's Avatar
Moderator
 
Join Date: Apr 2005
Location: Vectorink.com
Posts: 3,660
Switcher is on a distinguished road

How about G91 (instead of G52)?


.
Reply With Quote

  #3   Ban this user!
Old 01-17-2007, 07:17 AM
derekj308's Avatar  
Join Date: Jun 2005
Location: Australia
Posts: 162
derekj308 is on a distinguished road

Hi Switcher

I'm only new to this so I'm not fluent in G & M codes. I had a look at G91 which set the machine to incremental mode so I can see how you could move from one pattern position to another but I could only see that working for an operation that acts only in Z. I can't see how a subprogram toolpath could be run at each of the incremental points as the toolpath must reference a co-ordinate system. My understanding of G91 is that the work co-ordinate system does not change, only that the movements are incremental instead of absolute.

Cheers

Derek
__________________
<insert witty comment here>
derekj308
Reply With Quote

  #4  
Old 01-17-2007, 08:07 AM
Switcher's Avatar
Moderator
 
Join Date: Apr 2005
Location: Vectorink.com
Posts: 3,660
Switcher is on a distinguished road

You could do something like this (draws 4 offset squares):


%
G90
G00 Z1.0 F75
X0.000 Y0.000
X5.0 Y5.0 F75

G91
G01
Z-1.0 F50
X2.0
Y-2.0
X-2.0
Y2.0


G90
G00
Z1.0 F50
X10.0 Y10.0 F75


G91
G01
Z-1.0 F50
X2.0
Y-2.0
X-2.0
Y2.0


G90
G00
Z1.0 F50
X15.0 Y15.0 F75


G91
G01
Z-1.0 F50
X2.0
Y-2.0
X-2.0
Y2.0


G90
G00
Z1.0 F50
X20.0 Y20.0 F75


G91
G01
Z-1.0 F50
X2.0
Y-2.0
X-2.0
Y2.0


G90
G00
Z1.0 F55
X0.0 Y0.0 F150
M30
%
You could replace the "red G91" & "green G90" with calls to two seperate subs, this is just a quik example.


%
G90
G00 Z1.0 F75
X0.000 Y0.000
X5.0 Y5.0 F75

Sub_1

Sub_2

Sub_1

Sub_2

Sub_1

Sub_2

Sub_1

G90
G00
Z1.0 F55
X0.0 Y0.0 F150
M30
%


.
Attached Thumbnails
Click image for larger version

Name:	1.JPG‎
Views:	48
Size:	15.8 KB
ID:	29779   Click image for larger version

Name:	2.JPG‎
Views:	44
Size:	9.6 KB
ID:	29780  

Last edited by Switcher; 01-17-2007 at 09:30 AM.
Reply With Quote

  #5   Ban this user!
Old 01-17-2007, 08:13 AM
 
Join Date: Jul 2005
Location: Canada
Posts: 11,563
Geof will become famous soon enough

Originally Posted by Switcher View Post
How about G91 (instead of G52)?


.
G91 does not give you the same thing as G52. Using G52 you reposition your work zero and then work using absolute within the new work zero. This means you can repeat the same shape easily at different locations.

With G91 you have to program in incremental which is much more awkward than absolute in many cases.

A search of the zone for references to G52 should pull up several threads where it has been discussed along with G92.
Reply With Quote

Sponsored Links
  #6  
Old 01-17-2007, 08:19 AM
Switcher's Avatar
Moderator
 
Join Date: Apr 2005
Location: Vectorink.com
Posts: 3,660
Switcher is on a distinguished road

Originally Posted by Geof View Post
G91 does not give you the same thing as G52. Using G52 you reposition your work zero and then work using absolute within the new work zero. This means you can repeat the same shape easily at different locations.

With G91 you have to program in incremental which is much more awkward than absolute in many cases.

A search of the zone for references to G52 should pull up several threads where it has been discussed along with G92.
I never said G52 was the same as G91.

Does the example I posted look "awkward".

The only possible way G91 is "awkward" is If a person doesn't understand how to use G91.

Just trying to help derekj308.


.








.
Reply With Quote

  #7  
Old 01-17-2007, 10:00 AM
Switcher's Avatar
Moderator
 
Join Date: Apr 2005
Location: Vectorink.com
Posts: 3,660
Switcher is on a distinguished road

derekj308,

The thing I was trying to point out is, you could program the same part a hundred different ways.

G90 & G91 can be switched back & forth as many times as you want.




.
Reply With Quote

  #8   Ban this user!
Old 01-17-2007, 05:00 PM
derekj308's Avatar  
Join Date: Jun 2005
Location: Australia
Posts: 162
derekj308 is on a distinguished road

Hi Guys

Switcher I did have a think about programming in incremental moves before reading post#4 and did see how (in my minds eye) it could be done. Thanks for the example now I have an alternate method if required.

Geof I did do a search of "G52" on the 'zone and it returned no results so its why I posted in the first place. I wanted to share my findings with the 'zone community so others could use what I had found.

Now the zone has a post which shows two methods for patterning. My work here is done (whooshing sound as I fly back to my sanctuary of solitude or maybe I'll just walk to the garage which is basically the same except for the flying bit ).

Cheers

Derek
__________________
<insert witty comment here>
derekj308

Last edited by derekj308; 01-17-2007 at 09:08 PM.
Reply With Quote

  #9   Ban this user!
Old 01-17-2007, 05:03 PM
derekj308's Avatar  
Join Date: Jun 2005
Location: Australia
Posts: 162
derekj308 is on a distinguished road

Yes I did make a whooshing sound as I walked to the garage lol.

Cheers

Derek
__________________
<insert witty comment here>
derekj308
Reply With Quote

  #10  
Old 01-17-2007, 06:13 PM
HuFlungDung's Avatar
Moderator
 
Join Date: Mar 2003
Location: Canada
Posts: 4,825
HuFlungDung is on a distinguished road

I've never used G52 yet, I've always programmed subs in incremental. This gets annoying to deal with though, if you have to translate Z moves, it can get quite confusing as to what level you are currently at with the tool.

I have a hunch though, that creating subroutines with the assistance of cadcam would benefit greatly from using G52. This is because it is likely not possible to switch a post from absolute to incremental and back again, within one posting. So by using G52, you should avoid that necessity altogether, yet could still benefit from using subs. Anybody done this within CAM yet? Does it work as I've theorized?
__________________
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

Sponsored Links
  #11   Ban this user!
Old 01-17-2007, 06:22 PM
 
Join Date: Jul 2005
Location: Canada
Posts: 11,563
Geof will become famous soon enough

Originally Posted by derekj308 View Post
Hi Guys...Geof I did do a search of "G52" on the 'zone and it returned no results so its why I posted in the first place. I wanted to share my findings with the 'zone community so others could use what I had found....Derek
I also did a search just now and it did not even find the posts in this thread!

Hu we have both posted in the past on G52 yes? Or is my ancient memory failing me?


edit: 'annoying' Hu's synonym for 'awkward'
Reply With Quote

  #12  
Old 01-18-2007, 07:14 AM
Switcher's Avatar
Moderator
 
Join Date: Apr 2005
Location: Vectorink.com
Posts: 3,660
Switcher is on a distinguished road

I had over 200 hits (G52) with Google:

http://www.google.com/search?sourcei...ecnczone%2ecom



.
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





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