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 08-26-2007, 11:26 AM
 
Join Date: May 2005
Location: ISRAEL
Posts: 1
CI_182 is on a distinguished road
Number Counter

Hi guys
i need your assistance in solving the next issue
i have to engrave numbers from 1 to 150
while every part will have the next following number
i have 10 subroutines witch are the numbers it self
for example subroutine
o2500 is for "0"
o2501 for "1"
o2502 for "2"
and so on
what kind of logical macro should i use to build the
counter and move in the place of the written number,
while the right routine number is cold for every place ?
Reply With Quote

  #2   Ban this user!
Old 08-26-2007, 01:29 PM
 
Join Date: Dec 2005
Location: USA
Posts: 3,319
NC Cams is on a distinguished road

A variation of the IF/THEN/NEXT should do it.

100 Xold=02500, Yold=0, (set start of count and relationship of X to Y)
200 Xnew=Xold+1 and Ynew=Yold+1 (update X & Y)
300 IF Xnew< or = desired count, go to Line 500, else go to Line 200
500 End

It might not be exactly what you want but it should turn on the lightbulb.
Reply With Quote

  #3   Ban this user!
Old 08-26-2007, 03:13 PM
 
Join Date: Feb 2007
Location: usa
Posts: 115
davek is on a distinguished road

http://www.cncci.com/resources/tips/serial%20macro.htm


If you want to use your own numbers and they are programmed in absolute, use g52 to shift zero instead of locating at the number center and using incremental numbers as this macro does.

If you want to make it all one self contained program, use GOTO's to go to the number geometry's and increment a counter within each number to decide where to jump back to.
Reply With Quote

  #4   Ban this user!
Old 09-01-2007, 03:41 PM
gar gar is offline
 
Join Date: Mar 2005
Location: USA
Posts: 1,498
gar is on a distinguished road

070901-1523 EST USA

The following should work on a HAAS but I have not tried it. It would be nice if you could make Z absolute and independently X and Y incremental.

Create a group of local subroutines that are programmed in incremental within an external subroutine. One internal subroutine for each of the ten digits. Incremental programming for each character starts at the lower left corner of the rectangle allocated for the character. You can make the characters mono-spaced or proportional as you choose by the way you write the incremental code. The ending position of your character is the lower right corner of the above said rectangle.

Note the ending position of a character is the beginning position of the next character.

Assumed range is 1 thru 999.

Let #500 be your serial number counter, initialize this to 1 when you start your serial numbering. This loaded outside of your part program O0700 .

#500 = 1


%
O0700 (your part program)

(startup stuff)


#110 = -0.01 ( the absolute depth of engraving cut relative to G5x using G90)
(assume Z 0 relative to G90 G5x is the surface of your material where engraving is performed)
#111 = 0.05 (clearance in Z between characters or non-connected strokes)



(To engrave a serial number

G5x (G54 thru your maximum --- your choice)
G90
G00 X nn.nnnn Y mm.mmmm Z clearance (lower left start position of number)

#100 = #500/100
#108 = FIX [#100] (gets the integer value of the hundreds position)
G65 I#108 P1000 (do 100s digit)

#101 = #500 - #108*100 (remove the 100s digit)
#102 = #101/10 (extract the 10s digit)
#108 = FIX [#102] (")
G65 I#108 P1000 (do tens digit)

#103 = #101 - #108*10 (hundreds already removed, remove 10's digit)
#108 = FIX [#103]
G65 I#108 P1000 (do units digit)

(remainder of your program)
M30

%


In your subroutine. You will need to switch between G90 and G91 as required to handle the Z motion.

%
O1000 (serial number external subroutine)
(digit number passed in via I address in G65 of the calling program)
(#111 and #110 pass in the clearance and depth of cut)

G90
G00 Z#111
G01 Z#110
G91 (probably put this in the subroutoines instead of here)
G97 P[100 + #4] (address I in G65 maps to #4 in the called routine)
G90
G00 Z#111
M99 (at X, Y start position of next character because this is end of this character)

N100
(incremental code for space)
M99

N101
(incremental code for character 1)
M99

(etc)

%


See if I made any mistakes. Note: there are many variations on this method. Also you can add tests for bad data but I have not to make the code simple.

.

Last edited by gar; 09-01-2007 at 10:31 PM.
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 the the material number details lly1001 Bending, Forging,Extrusion... 1 06-28-2008 03:26 AM
Number of characters in Tooltip sanddrag Suggestions for the CNCzone.com site. 1 05-24-2006 03:46 PM
counter cncsdr Haas Mills 2 11-08-2005 07:56 AM
Dx-32 auto N number for you jtree83 Bridgeport and Hardinge Mills 4 09-26-2005 01:28 PM
THK model number question Darren_T DIY-CNC Router Table Machines 3 10-15-2003 07:33 PM




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