![]() | |
| Home Page | Mark Forums Read | Today's Posts | My Replies | Classifieds | Reviews | Photo Gallery | Web Links | Share Files | Advertise With Us | Ad List |
| |||||||
| G-Code Programing Discuss G-code programing and problems here! |
| This forum is sponsored by: |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
| |||
| |||
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 ? |
|
#2
| |||
| |||
| 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. |
|
#3
| |||
| |||
| 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. |
|
#4
| |||
| |||
| 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. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
| |
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 |