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-12-2008, 02:28 PM
 
Join Date: Oct 2006
Location: USA
Posts: 46
Toymanf is on a distinguished road
Need to add a sub every 1000 lines or so.

Hello all. I am running engraving/carving codes of up to 500,000 lines. I need suggestions on how to modify the code(output by photovcarve) to cycle a pair of solenoids periodicly to give a blast of air, then coolant.
I am not setup for flood cooling. The jobs take 3-12 hours to complete.
I am hoping there is a simple software solution that will add a block of code every "X" number of lines. It would be even better if I could add this block every "X" number of times that the Z reaches 0.060"

Any suggestions for how I might accomplish this would be greatly appreciated. I am by no means a programmer, but I am willing to try if pointed in the right direction.
Thank you
Frank
Reply With Quote

  #2   Ban this user!
Old 01-12-2008, 03:28 PM
 
Join Date: Jul 2003
Location: New Zealand
Posts: 1,039
Kiwi is on a distinguished road

This should be able to be done with a 'MSWord' macro or a program called GWK.
Does the code you wish to add need a separate line or can it be added to the end of a existing line?
Also are the lines numbered?
Please post half a dozen lines of example code to examine.
Reply With Quote

  #3   Ban this user!
Old 01-12-2008, 03:40 PM
 
Join Date: Oct 2006
Location: USA
Posts: 46
Toymanf is on a distinguished road

This is the first few lines of the g-code.
I don't think it would cause a problem if it was tacked on to the end of the line. ie z0.060"relay on pause relay off(in proper syntax of course)
( PhotoVCarve )
( Mach2/3 Postprocessor )
N20G00G21G17G90G40G49G80
N30G70
N40T3M06
N50G00G43Z0.0600H3
N60S16000M03
N70G94
N80X0.0000Y0.0000F60.0
N90G00X2.9965Y-2.0009Z0.0600
N100G01Z-0.0774F60.0
N110Z0.0600
N120G00X2.9945Y-1.9990
N130G01Z-0.0771F60.0
N140Z0.0600
N150G00X2.9960Y-1.9935
N160G01Z-0.0773F60.0
N170X2.9891Y-2.0004Z-0.0767
N180Z0.0600
N190G00X2.9871Y-1.9985
N200G01Z-0.0765F60.0
N210X2.9975Y-1.9881Z-0.0770
N220Z0.0600
N230G00X2.9955Y-1.9861
N240G01Z-0.0770F60.0
N250X2.9817Y-2.0000Z-0.0764
N260Z0.0600
Reply With Quote

  #4   Ban this user!
Old 01-12-2008, 04:20 PM
 
Join Date: Jul 2003
Location: New Zealand
Posts: 1,039
Kiwi is on a distinguished road

Can you also supply the code you wish to add.
Reply With Quote

  #5   Ban this user!
Old 01-12-2008, 04:45 PM
 
Join Date: Jul 2003
Location: New Zealand
Posts: 1,039
Kiwi is on a distinguished road

I notice the code you supplied has no spaces at all in each line.
Will the machine run ok with a space before a axis character.
My thought is to run a Find and Replace 'Z' with ' Z' so the AWK macro will find the space if the code can be added onto the end of the line.

Last edited by Kiwi; 01-12-2008 at 04:49 PM. Reason: Program name to AWK
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 01-12-2008, 10:13 PM
 
Join Date: Oct 2006
Location: USA
Posts: 46
Toymanf is on a distinguished road

After playing with this for a while, I was able to set up a "brain" in mach 3 that effectively counts the number of times that the z reaches .060 then cycles the relays as needed.
Thank you for the input.
If my tests work out, I will share the info if wanted.

Frank
Reply With Quote

  #7   Ban this user!
Old 01-13-2008, 09:16 AM
 
Join Date: Nov 2005
Location: Alabama - USA
Posts: 252
Mike Nash is on a distinguished road

I would really like to see how you do this. I may never need it, but that kind of knowledge is worth having. Thanks.
Reply With Quote

  #8   Ban this user!
Old 01-14-2008, 01:51 AM
 
Join Date: Dec 2007
Location: Austria
Posts: 5
eauth is on a distinguished road

you can do that quite easy with mawk.

Code:
BEGIN{
  FS="Z"
  count=0
}

# print original record
{ print }

# check records that start with N and end with a Z field.
/^N/ && NF==2{
  z=$2
  # count lines with z>=0.06
  if (z>=0.06){
        count++
  }
  # add lines every 10 times
  if (count>=10){
    count=0
    print "your line 1"
    print "and a second line"
  }
}
There was a thread about mawk if you want to know how to use mawk in windows.
Reply With Quote

  #9   Ban this user!
Old 01-14-2008, 02:22 AM
 
Join Date: Jul 2003
Location: New Zealand
Posts: 1,039
Kiwi is on a distinguished road

Eauth... Thanks for your code.

I got some code to do what I required.

{
if ((x=index($2,"Z0.0600")) > 0) {
Appendix = "AirBlast";
}
print( $1,$2, Appendix);
Appendix = "";
}

N20G00G21G17G90G40G49G80
N30G70
N40T3M06
N50G00G43 Z0.0600H3 AirBlast
N60S16000M03
N70G94
N80X0.0000Y0.0000F60.0
N90G00X2.9965Y-2.0009 Z0.0600 AirBlast
N100G01 Z-0.0774F60.0
N110 Z0.0600 AirBlast
N120G00X2.9945Y-1.9990
N130G01 Z-0.0771F60.0
N140 Z0.0600 AirBlast
N150G00X2.9960Y-1.9935
N160G01 Z-0.0773F60.0
N170X2.9891Y-2.0004 Z-0.0767
N180 Z0.0600 AirBlast
N190G00X2.9871Y-1.9985
N200G01 Z-0.0765F60.0
N210X2.9975Y-1.9881 Z-0.0770
N220 Z0.0600 AirBlast
N230G00X2.9955Y-1.9861
N240G01 Z-0.0770F60.0
N250X2.9817Y-2.0000 Z-0.0764
N260 Z0.0600 AirBlast
Reply With Quote

  #10   Ban this user!
Old 01-14-2008, 02:55 PM
 
Join Date: Jul 2003
Location: New Zealand
Posts: 1,039
Kiwi is on a distinguished road

On re-reading the original post, I see my program doesn't quite do what was asked.

Eauth...Does your program need a space before the 'Z' to create the second field in the GCode?
Reply With Quote

Sponsored Links
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
PVC Compressed Air lines Five-10 CNCzone Club House 47 01-07-2011 07:51 AM
ReOrdering lines rherman BobCad-Cam 0 12-21-2006 11:34 AM
PRoblem seeing dxf lines Ed_R SheetCam 4 03-25-2006 03:32 PM
CAD HELP: 4 lines to 1 box/object how to? FireFghtr General CAM Discussion 7 02-24-2006 03:03 PM
Can't see lines Mr.Chips TurboCAD/CAM 4 04-03-2005 10:29 AM




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