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 10-27-2004, 11:40 AM
 
Join Date: Sep 2004
Location: US
Posts: 13
tpaulson is on a distinguished road
Repeat g-code with y offset

I have some g-code to mill 2 pockets in a box. The final fixture will have 5 of these pocket pairs with a 2.5" Y offset. That way I can mill 5 boxes at a time. Is there a way to have the g-code I already have repeat 4 more times, offseting the Y 2.5" each time?

I have attached a zip file containing the g-code and the dxf showing all of the pockets.

Thanks
Tim
Attached Files
File Type: zip t-sockets.zip‎ (1.8 KB, 131 views)
Tweet this Post!Share on Facebook
Reply With Quote

  #2   Ban this user!
Old 10-27-2004, 01:27 PM
 
Join Date: Mar 2003
Location: United States
Posts: 106
E-Stop is on a distinguished road

There are several ways to do this but I think the simplest would be to save your existing program as a subroutine and then call it up after changing the "start" position. Your "start" position, or Y offset, can be changed in your program several ways also. You can use G10 to input the offsets, you can use G52 to shift the offsets or you can set the 5 positions with G54-G59 and call a new offset before running the subroutine. You didn't say what machine or control you are using so check your manuals for the proper way to use the G-codes and subroutines.
Tweet this Post!Share on Facebook
Reply With Quote

  #3   Ban this user!
Old 10-27-2004, 02:02 PM
 
Join Date: Sep 2004
Location: US
Posts: 13
tpaulson is on a distinguished road

E-stop
Thanks for the reply.

I am pretty new to g-code. Could give me a short snippet of code demonstrating one of the methods you suggest?

I am using a gantry style cnc router like this one.
http://cgi.ebay.com/ws/eBayISAPI.dll...847964271&rd=1

I use CNCZeus to control the router.

Thanks
Tim
Tweet this Post!Share on Facebook
Reply With Quote

  #4   Ban this user!
Old 10-27-2004, 04:05 PM
 
Join Date: Mar 2003
Location: United States
Posts: 106
E-Stop is on a distinguished road

I'm not at all familiar with the CNCZeus control but here's the way I would do it, if your control accepts the G10 command.

G10G90L2P2X0Y0 <---Sets G55 to X0 Y0
G10G90L2P3X0Y2.5 <---Sets G56 to X0 Y2.5
G10G90L2P4X0Y5.0 <---Sets G57 to X0 Y5.0
G10G90L2P5X0Y7.5 <---Sets G58 to X0 Y7.5
G10G90L2P6X0Y10. <---Sets G59 to X0 Y10.0

The G10 is a command to load or store the offsets
The G90 is for Absolute input.
The L2 designates a fixture offset (as opposed to tool offsets or something else)
The P# designates which fixture offset. P1=G54, P2=G55, ect.
Then the X and Y values are self explanitory.

Then for your program you would call the G55 and run the subprogram (which is the G-code program that you already have. When the first part is done then call G56 and run the subprogram again. And repeat.

%
G0G40G90G17
G10G90L2P2X0Y0
G10G90L2P3X0Y2.5
G10G90L2P4X0Y5.0
G10G90L2P5X0Y7.5
G10G90L2P6X0Y10.0
G0G40G90G55
M98P1234 <<<<<M98 CALLS THE SUBROUTINE; P IS THE PROGRAM NUMBER OF THE SUB.
G0G40G90G56
M98P1234
G0G40G90G57
M98P1234
G0G40G90G58
M98P1234
G0G40G90G59
M98P1234
M30
%

Something like that. You'll have to check you manuals for the correct usage of offsets and subprograms but that's the basic idea behind it. Hope this helps.

Last edited by E-Stop; 10-28-2004 at 06:49 AM.
Tweet this Post!Share on Facebook
Reply With Quote

  #5   Ban this user!
Old 10-28-2004, 08:30 AM
 
Join Date: Sep 2004
Location: US
Posts: 13
tpaulson is on a distinguished road

E-stop
Thanks!!!!
Your code helped a great deal, I think I understand now.
I didn't get a chance to try it last night. I will let you know if I have any problems.

Tim
Tweet this Post!Share on Facebook
Reply With Quote

Sponsored Links
  #6  
Old 10-28-2004, 09:43 AM
Gold Member
 
Join Date: Apr 2003
Location: Ohio, USA
Posts: 1,734
Ken_Shea is on a distinguished road

I thank you as well E-Stop, very informative.

Ken
Tweet this Post!Share on Facebook
Reply With Quote

  #7   Ban this user!
Old 10-28-2004, 11:04 AM
 
Join Date: Sep 2004
Location: USA
Posts: 77
Swami is on a distinguished road

I am new to G-Code programming too, and I solved this problem using one of the other techniques E-Stop recommended. "Changing the Start Position" I do this a lot with my code.

Maybe this would help someone, so here is an example of that:

G0 X0 Y0
M98P1000
G0 X0 Y2.5
M98P1000
G0 X0 Y5
M98P1000
G0 X0 Y7.5
M98P1000

Another Possibility would be to put the Y-Offset in the subroutines first line using G91 relative coordinates. (G0 G91 Y2.5) Then you could LOOP the M98 command like this:

M98P1000 L5 -- (Where L10 means loop 5 times)
Tweet this Post!Share on Facebook
Reply With Quote

  #8   Ban this user!
Old 10-29-2004, 09:07 AM
 
Join Date: Sep 2004
Location: US
Posts: 13
tpaulson is on a distinguished road

E-stop
I tried the code you suggested, but it did not offset the X Y locations. It just repeated the subrouting in the same 0, 0 location.

I have not tried Swami suggestion yet.

Is there something I need to change in the sub program to get it to use the offsets?

Here are the first few lines of my subroutines code:

O1234
(Created 8:32:10 AM 10/27/2004 from thum-bl-5fixture-y-rev.dxf)
(Post = ISO G-Code - Non Modal)
(Tool 1 = .125 End)
N0001 T1 M03 S30000
N0003 G00 X3.1125 Y1.3325 Z1.0000
N0005 G00 X3.1125 Y1.3325 Z1.0000
N0007 G01 X3.1125 Y1.3325 Z-0.0600 F20.00
N0009 G01 X3.3375 Y1.3325 Z-0.0600 F15.00
N0011 G01 X3.3375 Y1.7075 Z-0.0600
Tweet this Post!Share on Facebook
Reply With Quote

  #9   Ban this user!
Old 11-19-2004, 11:29 AM
 
Join Date: Mar 2003
Location: United States
Posts: 106
E-Stop is on a distinguished road

Sorry so long answering. I've been out and busy for awhile.

Your code for the subroutine looks fine. It's what comes before the subroutine that will change the start position of your pocket. The fixture offsets need to be "loaded" into the G54-G59 fixture offsets and then one of the offsets needs to be "called" before the subroutine is run. When the subroutine is done, call another fixture offset and run the subroutine again.
Tweet this Post!Share on Facebook
Reply With Quote

  #10   Ban this user!
Old 11-19-2004, 01:29 PM
 
Join Date: Sep 2004
Location: US
Posts: 13
tpaulson is on a distinguished road

E-stop
I have the code you suggested beform the start of my subroutine(see below).
I think it my be a problem with CNCZeus not handling the offsets via code correctly.


G10 G90 L2 P2 X0 Y0 (<---Sets G55 to X0 Y0)
G10 G90 L2 P3 X0 Y3 (<---Sets G56 to X0 Y3)
G10 G90 L2 P4 X0 Y5.5
G10 G90 L2 P5 X0 Y8
G10 G90 L2 P6 X0 Y10.5
G0 G40 G90 G55
M98 P1234 (<<<<<M98 CALLS THE SUBROUTINE P IS THE PROGRAM NUMBER OF THE SUB.)
G0 G40 G90 G56
M98 P1234
G0 G40 G90 G57
M98 P1234
G0 G40 G90 G58
M98 P1234
G0 G40 G90 G59
M98 P1234
M30

O1234
(Created 8:32:10 AM 10/27/2004 from thum-bl-5fixture-y-rev.dxf)
(Post = ISO G-Code - Non Modal)
(Tool 1 = .125 End)
N0001 T1 M03 S30000
N0003 G00 X3.1125 Y1.3325 Z1.0100
N0005 G00 X3.1125 Y1.3325 Z1.0100
N0007 G01 X3.1125 Y1.3325 Z-0.0600 F20.00
N0009 G01 X3.3375 Y1.3325 Z-0.0600 F15.00
N0011 G01 X3.3375 Y1.7075 Z-0.0600
N0013 G01 X3.1125 Y1.7075 Z-0.0600
N0015 G01 X3.1125 Y1.3325 Z-0.0600
.....other code
N0045 M5
N0045 M99
Tweet this Post!Share on Facebook
Reply With Quote

Sponsored Links
  #11   Ban this user!
Old 11-19-2004, 07:34 PM
 
Join Date: Jan 2004
Location: Gardnerville,Nevada
Posts: 256
cncwhiz is on a distinguished road

Try removing the "G90" this could be causing the problem. You do not need this to input "G10's" into the work offsets.
Tweet this Post!Share on Facebook
Reply With Quote

  #12   Ban this user!
Old 11-20-2004, 11:05 AM
 
Join Date: Mar 2003
Location: United States
Posts: 106
E-Stop is on a distinguished road

Leave the G90. It may be redundant but it is safe. The G90 inputs an absolute value into the offset, G91 an incremental value. So if for some reason the control was in incremental mode as it reads the G10 lines, those values will be added to the values already in the offset. It is correct that the G90 is not needed to input the offsets with G10, I just always feel safer with it there. Operators have a way of making things happen that aren't supposed to so any additional safegaurds in place are a plus.

tpaulson... Do you have an offset page where you can verify that the offsets have loaded correctly? I still can't see any problems with the code itself. Does your control support parametric programming? If so, you could do it with variables. It's not as easy but it works.
Tweet this Post!Share on Facebook
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
looking for g code 3d from bobcadcam or simmilar for indexer lpt v5 with g code soft troyswood Ability Systems - LPT Indexer and G-Code 2 12-24-2006 10:21 PM
parametric programming Karl_T CamSoft Products 21 05-24-2005 03:58 PM
How to set up Tool Offset in MACH2? High Seas Mach Software (ArtSoft software) 7 09-09-2004 01:54 PM
I need sample G code program bunalmis G-Code Programing 1 08-24-2004 04:50 AM
Getting The Most Out of CNCzone's Posting Features CNCadmin CNCzone.com FAQ 0 03-02-2003 12:08 AM




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