Skip to content

Commit

Permalink
Merge branch '2.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
petterreinholdtsen committed Sep 9, 2023
2 parents aa6625a + 5d6e5ea commit da770bd
Show file tree
Hide file tree
Showing 7 changed files with 117 additions and 5 deletions.
1 change: 0 additions & 1 deletion configs/sim/axis/sim_mm.tbl

This file was deleted.

24 changes: 24 additions & 0 deletions configs/sim/axis/sim_mm.tbl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
T1 P1 Z0.511 D3 ;3mm end mill
T2 P4 Z0.1 D1.5 ;1.5mm end mill
T3 P3 Z1.273 D5 ;5mm tap drill
T4 P2 Z10 D16 ;16 mm schaftfräser
T5 P5 Z25 D25 ;25'er fräser
T6 P6 Z6 D6 ;tool 6
T7 P7 Z7 D7 ;7
T8 P8 Z8 D8 ;8
T9 P9 Z9 D9 ;9
T10 P10 Z10 D10 ;10
T11 P11 Z11 D11 ;11
T12 P12 Z12 D12 ;12
T13 P13 Z13 D13 ;13
T14 P14 Z14 D14 ;14
T15 P15 Z15 D15 ;15
T16 P16 Z16 D16 ;16
T17 P17 Z17 D17 ;17
T18 P18 Z18 D18 ;18
T19 P19 Z19 D19 ;19
T20 P20 Z20 D20 ;20
T21 P21 Z21 D21 ;21
T22 P22 Z22 D22 ;22
T23 P23 Z23 D23 ;23
T24 P24 Z24 D24 ;24
1 change: 1 addition & 0 deletions debian/control.top.in
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Build-Depends:
tcl@TCLTK_VERSION@-dev,
tclx,
tk@TCLTK_VERSION@-dev,
xvfb,
yapps2
Build-Depends-Indep:
@DOC_DEPENDS@,
Expand Down
11 changes: 7 additions & 4 deletions tcl/tooledit.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,17 @@ if [catch {package require Linuxcnc} msg] {
# since "_" is not defined for standalone usage, make a proc named "_"
if {"" == [info command "_"]} {
package require msgcat
proc _ {s} {return [::msgcat::mc $s]}
proc _ {s} {
return [::msgcat::mc $s]
}
}
#-----------------------------------------------------------------------


proc ::tooledit::init { {columns ""} } {
if [file readable ~/.tooleditrc] {
if [catch {source ~/.tooleditrc} msg] {
puts stderr "[_ "Problem reading ~/.tooleditrc"]:"\n$msg"
puts stderr "[_ "Problem reading ~/.tooleditrc"]:\n$msg"
}
if [info exists geometry] {
set ::te(top,restore,geometry) $geometry
Expand Down Expand Up @@ -96,7 +98,7 @@ proc ::tooledit::init { {columns ""} } {

set ::te(filemod) 0
set ::te(fmt,int) %d
set ::te(fmt,real) %g
set ::te(fmt,real) %.9g
set ::te(fmt,angle) %f
set ::te(msg,last) ""
set ::te(pollms) 2000
Expand Down Expand Up @@ -311,7 +313,7 @@ proc ::tooledit::readfile {filename} {
foreach item {t p x y z a b c u v w d i j q comment} {
set u($item) ""
}
set newline [string tolower $newline]
# extract the comment as is (without converting it to lower case)
set i1 [string first \; $newline]
if {$i1 >= 0} {
set u(comment) [string range $newline [expr $i1 +1] end]
Expand All @@ -320,6 +322,7 @@ proc ::tooledit::readfile {filename} {
set newline [string trim $newline]
}

set newline [string tolower $newline]
if {"$newline" == ""} {
lappend ::te(global,comments) $u(comment)
continue
Expand Down
21 changes: 21 additions & 0 deletions tests/tooledit/expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
T1 P1 Z123 D3 ;3mm end mill
T2 P4 Z123 D1.5 ;1.5mm end mill
T3 P3 Z123 D5 ;5mm tap drill
T4 P2 Z123.456 D16 ;16 mm Schaftfräser
T5 P5 Z0.1 D25 ;25'er Fräser
T6 P6 Z0.001 D6 ;tool 6
T7 P7 Z0.0001 D7 ;7
T8 P8 Z12345.6789 D8 ;8
T9 P9 Z12345 D9 ;9
T10 P10 Z1234.12346 D10 ;10
T11 P11 Z12345.1235 D11 ;11
T12 P12 Z123456.123 D12 ;12
T13 P13 Z1234567.12 D13 ;13
T14 P14 Z12345678.1 D14 ;14
T15 P15 Z123456789 D15 ;15
T16 P16 Z1.01 D16 ;16
T17 P17 Z1.001 D17 ;17
T18 P18 Z1.0001 D18 ;18
T19 P19 Z1.00001 D19 ;19
T20 P20 Z1.000001 D20 ;20
T21 P21 Z1.0000001 D21 ;21
30 changes: 30 additions & 0 deletions tests/tooledit/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
# test if floating point numbers are formatted correctly

if ! command -v xvfb-run &> /dev/null; then
echo "xvfb-run could not be found, we assume everything works" > /dev/stderr
cat expected
exit 0
fi


#create temporary files so we don't write into write access problems
infile=$(mktemp)
outfile=$(mktemp)
cat test.tbl > $infile

# run the test
xvfb-run ${LINUXCNC_EMCSH/wish/tclsh} test.tcl $infile $outfile 2> tclerror.log;

if [ $(cat tclerror.log | wc -l) -ne 0 ]; then
cat tclerror.log
exit 1
fi

# write the resulting tool table to stdout so the test framework can evaluate it
cat $outfile

# remove the temporary files
rm $infile $outfile $outfile".bak"

exit 0
21 changes: 21 additions & 0 deletions tests/tooledit/test.tbl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
T1 P1 Z123 D3 ;3mm end mill
T2 P4 Z123.0 D1.5 ;1.5mm end mill
T3 P3 Z123.000 D5 ;5mm tap drill
T4 P2 Z123.456 D16 ;16 mm Schaftfräser
T5 P5 Z0.1 D25 ;25'er Fräser
T6 P6 Z0.001 D6 ;tool 6
T7 P7 Z0.0001 D7 ;7
T8 P8 Z12345.6789 D8 ;8
T9 P9 Z12345.0 D9 ;9
T10 P10 Z1234.123456 D10 ;10
T11 P11 Z12345.123456 D11 ;11
T12 P12 Z123456.123456 D12 ;12
T13 P13 Z1234567.123456 D13 ;13
T14 P14 Z12345678.123456 D14 ;14
T15 P15 Z123456789.123456 D15 ;15
T16 P16 Z1.01 D16 ;16
T17 P17 Z1.001 D17 ;17
T18 P18 Z1.0001 D18 ;18
T19 P19 Z1.00001 D19 ;19
T20 P20 Z1.000001 D20 ;20
T21 P21 Z1.0000001 D21 ;21
13 changes: 13 additions & 0 deletions tests/tooledit/test.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
source ../../tcl/tooledit.tcl

set infile [lindex $argv 0]
set outfile [lindex $argv 1]

# get rid of the default window
wm withdraw .
# run tooledit using the test.tbl
tooledit::tooledit $infile {x y z a b c u v w diam front back orien}
# write the test.tbl to result.tbl
tooledit::writefile $outfile
# finish up
exit 0

0 comments on commit da770bd

Please sign in to comment.