Sequential Serial Numbers
- biqut2
- Offline
- Premium Member
Less
More
- Posts: 97
- Thank you received: 5
08 Oct 2021 17:14 #222564
by biqut2
Sequential Serial Numbers was created by biqut2
I recently had a job that required sequential serial numbers on each part. I made a half hearted attempt to find an existing solution ready to run and came up empty handed. I did come across
andypugh's work
which was close but not quite what I needed. Basing my solution of his work I came up with the following solution for my needs and wanted to share it in case it could be of use to anyone else. I know its not the most efficient or well polished but it works.
; engrave numeric serial numbers up to 10 digits long
; assumes machine in lower left hand corner of number and spindle on
; numbers will be engraved left to right on the xy plane
#<_depth> = -0.005 ; depth to engrave from current position
#<_scale> = 1.0 ; 1 = .1875"
#<_width> = .2 ; charatcer width spacing, .2" normal
#<_feed_rate> = 3 ; feed rate
#<_digits> = 10 ; number of digits, max of 10, min of 1
#<_digit_0> = #4000 ; read in digits
#<_digit_1> = #4001 ; read in digits
#<_digit_2> = #4002 ; read in digits
#<_digit_3> = #4003 ; read in digits
#<_digit_4> = #4004 ; read in digits
#<_digit_5> = #4005 ; read in digits
#<_digit_6> = #4006 ; read in digits
#<_digit_7> = #4007 ; read in digits
#<_digit_8> = #4008 ; read in digits
#<_digit_9> = #4009 ; read in digits
#<_x_start> = #<_x> ; read in origin
#<_y_start> = #<_y> ; read in origin
#<_digits_counter> = 0 ; counter for printing digits
; update serial number
#<_digit_0> = [#<_digit_0> + 1]
o120 if [#<_digit_0> GE 10]
#<_digit_0> = 0
#<_digit_1> = [#<_digit_1> + 1]
o120 endif
o121 if [#<_digit_1> GE 10]
#<_digit_1> = 0
#<_digit_2> = [#<_digit_2> + 1]
o121 endif
o122 if [#<_digit_2> GE 10]
#<_digit_2> = 0
#<_digit_3> = [#<_digit_3> + 1]
o122 endif
o123 if [#<_digit_3> GE 10]
#<_digit_3> = 0
#<_digit_4> = [#<_digit_4> + 1]
o123 endif
o124 if [#<_digit_4> GE 10]
#<_digit_4> = 0
#<_digit_5> = [#<_digit_5> + 1]
o124 endif
o125 if [#<_digit_5> GE 10]
#<_digit_5> = 0
#<_digit_6> = [#<_digit_6> + 1]
o125 endif
o126 if [#<_digit_6> GE 10]
#<_digit_6> = 0
#<_digit_7> = [#<_digit_7> + 1]
o126 endif
o127 if [#<_digit_7> GE 10]
#<_digit_7> = 0
#<_digit_8> = [#<_digit_8> + 1]
o127 endif
o128 if [#<_digit_8> GE 10]
#<_digit_8> = 0
#<_digit_9> = [#<_digit_9> + 1]
o128 endif
o129 if [#<_digit_9> GE 10]
(abort, max serial number exceeded)
o129 endif
; store digits
#4000 = #<_digit_0>
#4001 = #<_digit_1>
#4002 = #<_digit_2>
#4003 = #<_digit_3>
#4004 = #<_digit_4>
#4005 = #<_digit_5>
#4006 = #<_digit_6>
#4007 = #<_digit_7>
#4008 = #<_digit_8>
#4009 = #<_digit_9>
; iterate through digits
o110 if [#<_digits> GE 10]
o32 call
o[48 + #<_digit_9>] call
#<_digits_counter> = [#<_digits_counter> + 1]
o110 endif
o109 if [#<_digits> GE 9]
o32 call
o[48 + #<_digit_8>] call
#<_digits_counter> =[ #<_digits_counter> + 1]
o109 endif
o108 if [#<_digits> GE 8]
o32 call
o[48 + #<_digit_7>] call
#<_digits_counter> = [#<_digits_counter> + 1]
o108 endif
o107 if [#<_digits> GE 7]
o32 call
o[48 + #<_digit_6>] call
#<_digits_counter> = [#<_digits_counter> + 1]
o107 endif
o106 if [#<_digits> GE 6]
o32 call
o[48 + #<_digit_5>] call
#<_digits_counter> = [#<_digits_counter> + 1]
o106 endif
o105 if [#<_digits> GE 5]
o32 call
o[48 + #<_digit_4>] call
#<_digits_counter> = [#<_digits_counter> + 1]
o105 endif
o104 if [#<_digits> GE 4]
o32 call
o[48 + #<_digit_3>] call
#<_digits_counter> = [#<_digits_counter> + 1]
o104 endif
o103 if [#<_digits> GE 3]
o32 call
o[48 + #<_digit_2>] call
#<_digits_counter> = [#<_digits_counter> + 1]
o103 endif
o102 if [#<_digits> GE 2]
o32 call
o[48 + #<_digit_1>] call
#<_digits_counter> = [#<_digits_counter> + 1]
o102 endif
o101 if [#<_digits> GE 1]
o32 call
o[48 + #<_digit_0>] call
#<_digits_counter> = [#<_digits_counter> + 1]
o101 endif
M02
; spacing for digit width
o32 sub
G00 G90 X[#<_x_start> + [#<_width> * #<_digits_counter> * #<_scale>]] Y#<_y_start> ; position to corner of next digit
#<_x_new> = #<_x> ; update character position
#<_y_new> = #<_y> ; update character position
o32 endsub
; 0
o48 sub
X[#<_x_new> + [0.0804 * #<_scale>]] Y[#<_y_new> + [0.1875 * #<_scale>]]
G01 G91 Z#<_depth> F#<_feed_rate>
G90 X[#<_x_new> + [0.0536 * #<_scale>]] Y[#<_y_new> + [0.1786 * #<_scale>]]
X[#<_x_new> + [0.0357 * #<_scale>]] Y[#<_y_new> + [0.1518 * #<_scale>]]
X[#<_x_new> + [0.0268 * #<_scale>]] Y[#<_y_new> + [0.1071 * #<_scale>]]
X[#<_x_new> + [0.0268 * #<_scale>]] Y[#<_y_new> + [0.0804 * #<_scale>]]
X[#<_x_new> + [0.0357 * #<_scale>]] Y[#<_y_new> + [0.0357 * #<_scale>]]
X[#<_x_new> + [0.0536 * #<_scale>]] Y[#<_y_new> + [0.0089 * #<_scale>]]
X[#<_x_new> + [0.0804 * #<_scale>]] Y[#<_y_new> + [0.0000 * #<_scale>]]
X[#<_x_new> + [0.0982 * #<_scale>]] Y[#<_y_new> + [0.0000 * #<_scale>]]
X[#<_x_new> + [0.1250 * #<_scale>]] Y[#<_y_new> + [0.0089 * #<_scale>]]
X[#<_x_new> + [0.1429 * #<_scale>]] Y[#<_y_new> + [0.0357 * #<_scale>]]
X[#<_x_new> + [0.1518 * #<_scale>]] Y[#<_y_new> + [0.0804 * #<_scale>]]
X[#<_x_new> + [0.1518 * #<_scale>]] Y[#<_y_new> + [0.1071 * #<_scale>]]
X[#<_x_new> + [0.1429 * #<_scale>]] Y[#<_y_new> + [0.1518 * #<_scale>]]
X[#<_x_new> + [0.1250 * #<_scale>]] Y[#<_y_new> + [0.1786 * #<_scale>]]
X[#<_x_new> + [0.0982 * #<_scale>]] Y[#<_y_new> + [0.1875 * #<_scale>]]
X[#<_x_new> + [0.0804 * #<_scale>]] Y[#<_y_new> + [0.1875 * #<_scale>]]
G00 G91 Z[#<_depth> * -1]
o48 endsub
; 1
o49 sub
X[#<_x_new> + [0.0536 * #<_scale>]] Y[#<_y_new> + [0.1518 * #<_scale>]]
G01 G91 Z#<_depth> F#<_feed_rate>
G90 X[#<_x_new> + [0.0714 * #<_scale>]] Y[#<_y_new> + [0.1607 * #<_scale>]]
X[#<_x_new> + [0.0982 * #<_scale>]] Y[#<_y_new> + [0.1875 * #<_scale>]]
X[#<_x_new> + [0.0982 * #<_scale>]] Y[#<_y_new> + [0.0000 * #<_scale>]]
G00 G91 Z[#<_depth> * -1]
o49 endsub
; 2
o50 sub
X[#<_x_new> + [0.0357 * #<_scale>]] Y[#<_y_new> + [0.1429 * #<_scale>]]
G01 G91 Z#<_depth> F#<_feed_rate>
G90 X[#<_x_new> + [0.0357 * #<_scale>]] Y[#<_y_new> + [0.1518 * #<_scale>]]
X[#<_x_new> + [0.0446 * #<_scale>]] Y[#<_y_new> + [0.1696 * #<_scale>]]
X[#<_x_new> + [0.0536 * #<_scale>]] Y[#<_y_new> + [0.1786 * #<_scale>]]
X[#<_x_new> + [0.0714 * #<_scale>]] Y[#<_y_new> + [0.1875 * #<_scale>]]
X[#<_x_new> + [0.1071 * #<_scale>]] Y[#<_y_new> + [0.1875 * #<_scale>]]
X[#<_x_new> + [0.1250 * #<_scale>]] Y[#<_y_new> + [0.1786 * #<_scale>]]
X[#<_x_new> + [0.1339 * #<_scale>]] Y[#<_y_new> + [0.1696 * #<_scale>]]
X[#<_x_new> + [0.1429 * #<_scale>]] Y[#<_y_new> + [0.1518 * #<_scale>]]
X[#<_x_new> + [0.1429 * #<_scale>]] Y[#<_y_new> + [0.1339 * #<_scale>]]
X[#<_x_new> + [0.1339 * #<_scale>]] Y[#<_y_new> + [0.1161 * #<_scale>]]
X[#<_x_new> + [0.1161 * #<_scale>]] Y[#<_y_new> + [0.0893 * #<_scale>]]
X[#<_x_new> + [0.0268 * #<_scale>]] Y[#<_y_new> + [0.0000 * #<_scale>]]
X[#<_x_new> + [0.1518 * #<_scale>]] Y[#<_y_new> + [0.0000 * #<_scale>]]
G00 G91 Z[#<_depth> * -1]
o50 endsub
; 3
o51 sub
X[#<_x_new> + [0.0446 * #<_scale>]] Y[#<_y_new> + [0.1875 * #<_scale>]]
G01 G91 Z#<_depth> F#<_feed_rate>
G90 X[#<_x_new> + [0.1429 * #<_scale>]] Y[#<_y_new> + [0.1875 * #<_scale>]]
X[#<_x_new> + [0.0893 * #<_scale>]] Y[#<_y_new> + [0.1161 * #<_scale>]]
X[#<_x_new> + [0.1161 * #<_scale>]] Y[#<_y_new> + [0.1161 * #<_scale>]]
X[#<_x_new> + [0.1339 * #<_scale>]] Y[#<_y_new> + [0.1071 * #<_scale>]]
X[#<_x_new> + [0.1429 * #<_scale>]] Y[#<_y_new> + [0.0982 * #<_scale>]]
X[#<_x_new> + [0.1518 * #<_scale>]] Y[#<_y_new> + [0.0714 * #<_scale>]]
X[#<_x_new> + [0.1518 * #<_scale>]] Y[#<_y_new> + [0.0536 * #<_scale>]]
X[#<_x_new> + [0.1429 * #<_scale>]] Y[#<_y_new> + [0.0268 * #<_scale>]]
X[#<_x_new> + [0.1250 * #<_scale>]] Y[#<_y_new> + [0.0089 * #<_scale>]]
X[#<_x_new> + [0.0982 * #<_scale>]] Y[#<_y_new> + [0.0000 * #<_scale>]]
X[#<_x_new> + [0.0714 * #<_scale>]] Y[#<_y_new> + [0.0000 * #<_scale>]]
X[#<_x_new> + [0.0446 * #<_scale>]] Y[#<_y_new> + [0.0089 * #<_scale>]]
X[#<_x_new> + [0.0357 * #<_scale>]] Y[#<_y_new> + [0.0179 * #<_scale>]]
X[#<_x_new> + [0.0268 * #<_scale>]] Y[#<_y_new> + [0.0357 * #<_scale>]]
G00 G91 Z[#<_depth> * -1]
o51 endsu
; 4
o52 sub
X[#<_x_new> + [0.1161 * #<_scale>]] Y[#<_y_new> + [0.0000 * #<_scale>]]
G01 G91 Z#<_depth> F#<_feed_rate>
G90 X[#<_x_new> + [0.1161 * #<_scale>]] Y[#<_y_new> + [0.1875 * #<_scale>]]
X[#<_x_new> + [0.0268 * #<_scale>]] Y[#<_y_new> + [0.0625 * #<_scale>]]
X[#<_x_new> + [0.1607 * #<_scale>]] Y[#<_y_new> + [0.0625 * #<_scale>]]
G00 G91 Z[#<_depth> * -1]
o52 endsub
; 5
o53 sub
X[#<_x_new> + [0.1339 * #<_scale>]] Y[#<_y_new> + [0.1875 * #<_scale>]]
G01 G91Z#<_depth> F#<_feed_rate>
G90 X[#<_x_new> + [0.0446 * #<_scale>]] Y[#<_y_new> + [0.1875 * #<_scale>]]
X[#<_x_new> + [0.0357 * #<_scale>]] Y[#<_y_new> + [0.1071 * #<_scale>]]
X[#<_x_new> + [0.0446 * #<_scale>]] Y[#<_y_new> + [0.1161 * #<_scale>]]
X[#<_x_new> + [0.0714 * #<_scale>]] Y[#<_y_new> + [0.1250 * #<_scale>]]
X[#<_x_new> + [0.0982 * #<_scale>]] Y[#<_y_new> + [0.1250 * #<_scale>]]
X[#<_x_new> + [0.1250 * #<_scale>]] Y[#<_y_new> + [0.1161 * #<_scale>]]
X[#<_x_new> + [0.1429 * #<_scale>]] Y[#<_y_new> + [0.0982 * #<_scale>]]
X[#<_x_new> + [0.1518 * #<_scale>]] Y[#<_y_new> + [0.0714 * #<_scale>]]
X[#<_x_new> + [0.1518 * #<_scale>]] Y[#<_y_new> + [0.0536 * #<_scale>]]
X[#<_x_new> + [0.1429 * #<_scale>]] Y[#<_y_new> + [0.0268 * #<_scale>]]
X[#<_x_new> + [0.1250 * #<_scale>]] Y[#<_y_new> + [0.0089 * #<_scale>]]
X[#<_x_new> + [0.0982 * #<_scale>]] Y[#<_y_new> + [0.0000 * #<_scale>]]
X[#<_x_new> + [0.0714 * #<_scale>]] Y[#<_y_new> + [0.0000 * #<_scale>]]
X[#<_x_new> + [0.0446 * #<_scale>]] Y[#<_y_new> + [0.0089 * #<_scale>]]
X[#<_x_new> + [0.0357 * #<_scale>]] Y[#<_y_new> + [0.0179 * #<_scale>]]
X[#<_x_new> + [0.0268 * #<_scale>]] Y[#<_y_new> + [0.0357 * #<_scale>]]
G00 G91 Z[#<_depth> * -1]
o53 endsub
; 6
o54 sub
X[#<_x_new> + [0.1429 * #<_scale>]] Y[#<_y_new> + [0.1607 * #<_scale>]]
G01 G91 Z#<_depth> F#<_feed_rate>
G90 X[#<_x_new> + [0.1339 * #<_scale>]] Y[#<_y_new> + [0.1786 * #<_scale>]]
X[#<_x_new> + [0.1071 * #<_scale>]] Y[#<_y_new> + [0.1875 * #<_scale>]]
X[#<_x_new> + [0.0893 * #<_scale>]] Y[#<_y_new> + [0.1875 * #<_scale>]]
X[#<_x_new> + [0.0625 * #<_scale>]] Y[#<_y_new> + [0.1786 * #<_scale>]]
X[#<_x_new> + [0.0446 * #<_scale>]] Y[#<_y_new> + [0.1518 * #<_scale>]]
X[#<_x_new> + [0.0357 * #<_scale>]] Y[#<_y_new> + [0.1071 * #<_scale>]]
X[#<_x_new> + [0.0357 * #<_scale>]] Y[#<_y_new> + [0.0625 * #<_scale>]]
X[#<_x_new> + [0.0446 * #<_scale>]] Y[#<_y_new> + [0.0268 * #<_scale>]]
X[#<_x_new> + [0.0625 * #<_scale>]] Y[#<_y_new> + [0.0089 * #<_scale>]]
X[#<_x_new> + [0.0893 * #<_scale>]] Y[#<_y_new> + [0.0000 * #<_scale>]]
X[#<_x_new> + [0.0982 * #<_scale>]] Y[#<_y_new> + [0.0000 * #<_scale>]]
X[#<_x_new> + [0.1250 * #<_scale>]] Y[#<_y_new> + [0.0089 * #<_scale>]]
X[#<_x_new> + [0.1429 * #<_scale>]] Y[#<_y_new> + [0.0268 * #<_scale>]]
X[#<_x_new> + [0.1518 * #<_scale>]] Y[#<_y_new> + [0.0536 * #<_scale>]]
X[#<_x_new> + [0.1518 * #<_scale>]] Y[#<_y_new> + [0.0625 * #<_scale>]]
X[#<_x_new> + [0.1429 * #<_scale>]] Y[#<_y_new> + [0.0893 * #<_scale>]]
X[#<_x_new> + [0.1250 * #<_scale>]] Y[#<_y_new> + [0.1071 * #<_scale>]]
X[#<_x_new> + [0.0982 * #<_scale>]] Y[#<_y_new> + [0.1161 * #<_scale>]]
X[#<_x_new> + [0.0893 * #<_scale>]] Y[#<_y_new> + [0.1161 * #<_scale>]]
X[#<_x_new> + [0.0625 * #<_scale>]] Y[#<_y_new> + [0.1071 * #<_scale>]]
X[#<_x_new> + [0.0446 * #<_scale>]] Y[#<_y_new> + [0.0893 * #<_scale>]]
X[#<_x_new> + [0.0357 * #<_scale>]] Y[#<_y_new> + [0.0625 * #<_scale>]]
G00 G91 Z[#<_depth> * -1]
o54 endsub
; 7
o55 sub
X[#<_x_new> + [0.0625 * #<_scale>]] Y[#<_y_new> + [0.0000 * #<_scale>]]
G01 G91 Z#<_depth> F#<_feed_rate>
G90 X[#<_x_new> + [0.1518 * #<_scale>]] Y[#<_y_new> + [0.1875 * #<_scale>]]
X[#<_x_new> + [0.0268 * #<_scale>]] Y[#<_y_new> + [0.1875 * #<_scale>]]
G00 G91 Z[#<_depth> * -1]
o55 endsub
; 8
o56 sub
X[#<_x_new> + [0.0714 * #<_scale>]] Y[#<_y_new> + [0.1875 * #<_scale>]]
G01 G91 Z#<_depth> F#<_feed_rate>
G90 X[#<_x_new> + [0.0446 * #<_scale>]] Y[#<_y_new> + [0.1786 * #<_scale>]]
X[#<_x_new> + [0.0357 * #<_scale>]] Y[#<_y_new> + [0.1607 * #<_scale>]]
X[#<_x_new> + [0.0357 * #<_scale>]] Y[#<_y_new> + [0.1429 * #<_scale>]]
X[#<_x_new> + [0.0446 * #<_scale>]] Y[#<_y_new> + [0.1250 * #<_scale>]]
X[#<_x_new> + [0.0625 * #<_scale>]] Y[#<_y_new> + [0.1161 * #<_scale>]]
X[#<_x_new> + [0.0982 * #<_scale>]] Y[#<_y_new> + [0.1071 * #<_scale>]]
X[#<_x_new> + [0.1250 * #<_scale>]] Y[#<_y_new> + [0.0982 * #<_scale>]]
X[#<_x_new> + [0.1429 * #<_scale>]] Y[#<_y_new> + [0.0804 * #<_scale>]]
X[#<_x_new> + [0.1518 * #<_scale>]] Y[#<_y_new> + [0.0625 * #<_scale>]]
X[#<_x_new> + [0.1518 * #<_scale>]] Y[#<_y_new> + [0.0357 * #<_scale>]]
X[#<_x_new> + [0.1429 * #<_scale>]] Y[#<_y_new> + [0.0179 * #<_scale>]]
X[#<_x_new> + [0.1339 * #<_scale>]] Y[#<_y_new> + [0.0089 * #<_scale>]]
X[#<_x_new> + [0.1071 * #<_scale>]] Y[#<_y_new> + [0.0000 * #<_scale>]]
X[#<_x_new> + [0.0714 * #<_scale>]] Y[#<_y_new> + [0.0000 * #<_scale>]]
X[#<_x_new> + [0.0446 * #<_scale>]] Y[#<_y_new> + [0.0089 * #<_scale>]]
X[#<_x_new> + [0.0357 * #<_scale>]] Y[#<_y_new> + [0.0179 * #<_scale>]]
X[#<_x_new> + [0.0268 * #<_scale>]] Y[#<_y_new> + [0.0357 * #<_scale>]]
X[#<_x_new> + [0.0268 * #<_scale>]] Y[#<_y_new> + [0.0625 * #<_scale>]]
X[#<_x_new> + [0.0357 * #<_scale>]] Y[#<_y_new> + [0.0804 * #<_scale>]]
X[#<_x_new> + [0.0536 * #<_scale>]] Y[#<_y_new> + [0.0982 * #<_scale>]]
X[#<_x_new> + [0.0804 * #<_scale>]] Y[#<_y_new> + [0.1071 * #<_scale>]]
X[#<_x_new> + [0.1161 * #<_scale>]] Y[#<_y_new> + [0.1161 * #<_scale>]]
X[#<_x_new> + [0.1339 * #<_scale>]] Y[#<_y_new> + [0.1250 * #<_scale>]]
X[#<_x_new> + [0.1429 * #<_scale>]] Y[#<_y_new> + [0.1429 * #<_scale>]]
X[#<_x_new> + [0.1429 * #<_scale>]] Y[#<_y_new> + [0.1607 * #<_scale>]]
X[#<_x_new> + [0.1339 * #<_scale>]] Y[#<_y_new> + [0.1786 * #<_scale>]]
X[#<_x_new> + [0.1071 * #<_scale>]] Y[#<_y_new> + [0.1875 * #<_scale>]]
X[#<_x_new> + [0.0714 * #<_scale>]] Y[#<_y_new> + [0.1875 * #<_scale>]]
G00 G91 Z[#<_depth> * -1]
o56 endsub
; 9
o57 sub
X[#<_x_new> + [0.1429 * #<_scale>]] Y[#<_y_new> + [0.1250 * #<_scale>]]
G01 G91 Z#<_depth> F#<_feed_rate>
G90 X[#<_x_new> + [0.1339 * #<_scale>]] Y[#<_y_new> + [0.0982 * #<_scale>]]
X[#<_x_new> + [0.1161 * #<_scale>]] Y[#<_y_new> + [0.0804 * #<_scale>]]
X[#<_x_new> + [0.0893 * #<_scale>]] Y[#<_y_new> + [0.0714 * #<_scale>]]
X[#<_x_new> + [0.0804 * #<_scale>]] Y[#<_y_new> + [0.0714 * #<_scale>]]
X[#<_x_new> + [0.0536 * #<_scale>]] Y[#<_y_new> + [0.0804 * #<_scale>]]
X[#<_x_new> + [0.0357 * #<_scale>]] Y[#<_y_new> + [0.0982 * #<_scale>]]
X[#<_x_new> + [0.0268 * #<_scale>]] Y[#<_y_new> + [0.1250 * #<_scale>]]
X[#<_x_new> + [0.0268 * #<_scale>]] Y[#<_y_new> + [0.1339 * #<_scale>]]
X[#<_x_new> + [0.0357 * #<_scale>]] Y[#<_y_new> + [0.1607 * #<_scale>]]
X[#<_x_new> + [0.0536 * #<_scale>]] Y[#<_y_new> + [0.1786 * #<_scale>]]
X[#<_x_new> + [0.0804 * #<_scale>]] Y[#<_y_new> + [0.1875 * #<_scale>]]
X[#<_x_new> + [0.0893 * #<_scale>]] Y[#<_y_new> + [0.1875 * #<_scale>]]
X[#<_x_new> + [0.1161 * #<_scale>]] Y[#<_y_new> + [0.1786 * #<_scale>]]
X[#<_x_new> + [0.1339 * #<_scale>]] Y[#<_y_new> + [0.1607 * #<_scale>]]
X[#<_x_new> + [0.1429 * #<_scale>]] Y[#<_y_new> + [0.1250 * #<_scale>]]
X[#<_x_new> + [0.1429 * #<_scale>]] Y[#<_y_new> + [0.0804 * #<_scale>]]
X[#<_x_new> + [0.1339 * #<_scale>]] Y[#<_y_new> + [0.0357 * #<_scale>]]
X[#<_x_new> + [0.1161 * #<_scale>]] Y[#<_y_new> + [0.0089 * #<_scale>]]
X[#<_x_new> + [0.0893 * #<_scale>]] Y[#<_y_new> + [0.0000 * #<_scale>]]
X[#<_x_new> + [0.0714 * #<_scale>]] Y[#<_y_new> + [0.0000 * #<_scale>]]
X[#<_x_new> + [0.0446 * #<_scale>]] Y[#<_y_new> + [0.0089 * #<_scale>]]
X[#<_x_new> + [0.0357 * #<_scale>]] Y[#<_y_new> + [0.0268 * #<_scale>]]
G00 G91 Z[#<_depth> * -1]
o57 endsub
The following user(s) said Thank You: tommylight, 0x2102
Please Log in or Create an account to join the conversation.
- andypugh
- Away
- Moderator
Less
More
- Posts: 23558
- Thank you received: 4858
08 Oct 2021 22:54 #222604
by andypugh
Replied by andypugh on topic Sequential Serial Numbers
It might have been simpler to just store a single decimal number and increment that.
Then iterate through it one digit at a time. Starting with the rightmost digit you can get that with the MOD function. Then divide (a copy of) the number by 10, and repeat the MOD operation for as many digits as you need.
Parameters are saved as type double, so around 15 digits of precision.
(I imagine that you did it the way that you did because you were concerned about rounding errors and finite float precision?)
Then iterate through it one digit at a time. Starting with the rightmost digit you can get that with the MOD function. Then divide (a copy of) the number by 10, and repeat the MOD operation for as many digits as you need.
Parameters are saved as type double, so around 15 digits of precision.
(I imagine that you did it the way that you did because you were concerned about rounding errors and finite float precision?)
Please Log in or Create an account to join the conversation.
- biqut2
- Offline
- Premium Member
Less
More
- Posts: 97
- Thank you received: 5
08 Oct 2021 23:17 - 09 Oct 2021 12:14 #222608
by biqut2
Replied by biqut2 on topic Sequential Serial Numbers
I did it that way for two reasons: Firstly, yes I've had bad encounters with rounding errors in the past and try to avoid that at all cost, Secondly, I threw this together in between running other jobs and was a bit scatter brained and overwhelmed at the time.
I stopped as I was writing and started to do it the other way but I had already started down this route and just needed it to work.
As a side note, I did use ASCII codes for the numbers with the intent of coming back and including the alphabet, making it a base 36 number system.
EDIT: For what its worth, I've never had rounding issues with LinuxCNC. I do run a Fanuc though where sometimes 1 - 1 does not equal 0!
I stopped as I was writing and started to do it the other way but I had already started down this route and just needed it to work.
As a side note, I did use ASCII codes for the numbers with the intent of coming back and including the alphabet, making it a base 36 number system.
EDIT: For what its worth, I've never had rounding issues with LinuxCNC. I do run a Fanuc though where sometimes 1 - 1 does not equal 0!
Last edit: 09 Oct 2021 12:14 by biqut2.
Please Log in or Create an account to join the conversation.
Time to create page: 0.077 seconds