All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit 67e1d7b7 authored by Christopher Alfeld's avatar Christopher Alfeld

Label making tools. Run make to regenerate tb.ps and labelsf.ps

tb.ps is the labels for .5x1.75 Avery return address labels.
labelsf.ps is a chart for recording src and dst.

*.tcl and labels.cse are all support files for generating everything.

avery_.5x1.75.lbl is the definition of the avery return address labels.
parent 3c421312
all: testbed.tcl labels.cse
wish testbed.tcl | ./labels_form.tcl
cat tb[0-9].ps tb1[0-9].ps > tb.ps
./make_labels_sf
cat labelsf[0-9].cse.ps > labelsf.ps
LABEL::configure -startx 1.165 -starty .82 \
-deltax 2.06 -deltay .5 \
-columns 4 -rows 20
#!/usr/local/bin/wish
######################################################################
# csetool.tk
# Chris Alfeld - calfeld@math.utah.edu
# 5/18/99
######################################################################
wm title . "CseTool"
######################################################################
# Options
# Scale - scale sheet by factor
# NoText - don't print text
# NoColor - don't print color
# Print - print posscript and exit
######################################################################
set Scale 1.0
set NoText 0
set NoColor 0
set Print {}
set NoScroll 0
proc lpop {lv} {
upvar $lv l
set ret [lindex $l 0]
set l [lrange $l 1 1000]
return $ret
}
if {[llength $argv] == 0} {
puts stderr "Syntax: csetool [<options>] <file(s)>"
exit 1
}
set Files {}
while {$argv != {}} {
set arg [lpop argv]
switch -- $arg {
"-scale" {
set Scale [lpop argv]
}
"-notext" {
set NoText 1
}
"-nocolor" {
set NoColor 1
}
"-print" {
set Print [lpop argv]
}
"-noscroll" {
set NoScroll 1
}
default {
lappend Files $arg
}
}
}
if {$Print == 0} {
tkwait visibility .
}
set t "Courier 9"
set fontmap($t) {Courier 10}
set t "Courier 8"
set fontmap($t) {Courier 9}
canvas .c -width [expr 800 * $Scale] -height [expr 1035 * $Scale] \
-bg white
if {$NoScroll == 0} {
.c configure -scrollregion "0 0 [expr 800 * $Scale] [expr 1035 * $Scale]"
.c configure -confine true
.c configure -xscrollcommand ".x set" -yscrollcommand ".y set"
scrollbar .y -orient vertical -command ".c yview"
scrollbar .x -orient horizontal -command ".c xview"
pack .y -side right -fill y
pack .x -side bottom -fill x
}
pack .c -fill both -expand true
foreach file $Files {
if {[catch "open $file r" fp]} {
puts stderr "ERROR: $fp"
exit 1
}
while {[gets $fp line] >= 0} {
set type [lindex $line 0]
if {$type == "exec"} {
eval [lrange $line 1 end]
continue
}
if {[string index [lindex $line 3] 0] == "-"} {
set coords [lrange $line 1 2]
set options [lrange $line 3 end]
} else {
set coords [lrange $line 1 4]
set options [lrange $line 5 end]
}
if {$NoText && $type == "text"} {
continue
}
set skip 0
if {$NoColor || $Scale != 1} {
for {set i 0} "\$i < [llength $options]" {incr i} {
set op [lindex $options $i]
if {$NoColor && ($op == "-fill" || $op == "-outline")} {
incr i
set color [lindex $options $i]
if {$color != "black" && $color != "white"} {
set options [lreplace $options $i $i "white"]
}
}
if {$Scale != 1 && $op == "-font"} {
incr i
set font [lindex $options $i]
set size [lindex $font 1]
set font [lreplace $font 1 1 [lindex [split [expr $size * $Scale] .] 0]]
set options [lreplace $options $i $i $font]
}
}
}
set rcoords {}
foreach coord $coords {
lappend rcoords [expr $coord * $Scale]
}
eval .c create $type $rcoords $options
}
close $fp
}
if {$Print != {}} {
.c postscript -pagewidth 8i -height 1035 -width 800 -x 0 -y 0 \
-file $Print -fontmap fontmap
exit
}
This diff is collapsed.
namespace eval LABEL {
# configure [-<option> <value>]+
# <option> =
# startx
# starty
# deltax
# deltay
# columns
# rows
# font
# color
# currentlabel
# label <text> [<options>]
# print <fileprefix>
# clear
# widget
#
# Note: Currently limited to one page of labels at a time.
# Note: All coordinates are in inches
variable options
set options(startx) .5
set options(starty) .5
set options(deltax) 3
set options(deltay) .5
set options(columns) 3
set options(rows) 20
set options(font) "Courier 12"
set options(color) "black"
set options(currentlabel) 0
variable labels {}
proc lpop {listv} {
upvar $listv V
set ret [lindex $V 0]
set V [lrange $V 1 end]
return $ret
}
proc configure {args} {
variable options
while {$args != {}} {
set op [lpop args]
if {[string index $op 0] != "-"} {
error "Malformed option: $op"
}
set op [string range $op 1 end]
if {! [info exists options($op)]} {
error "No such option: -$op"
}
if {$args == {}} {
error "No value given for option: -$op"
}
set options($op) [lpop args]
}
}
proc label {text args} {
variable labels
lappend labels [list $text $args]
}
proc print {file} {
variable options
variable labels
set curpage 1
set numlabels [llength $labels]
set maxi [expr $numlabels + $options(currentlabel)]
set labelsperpage [expr $options(columns) * $options(rows)]
for {set i $options(currentlabel)} {$i < $maxi} {incr i} {
set label [lindex $labels $i]
set pagei [expr $i % $labelsperpage]
set col [expr $pagei / $options(rows)]
set row [expr $pagei % $options(rows)]
set x [expr $options(startx) + $options(deltax) * $col]
set y [expr $options(starty) + $options(deltay) * $row]
set text [lindex $label 0]
set ops [lindex $label 1]
eval ".label_canvas create text ${x}i ${y}i -text \"$text\" -anchor center -fill $options(color) -font \"$options(font)\" $ops"
if {[expr $pagei + 1] == $labelsperpage} {
.label_canvas postscript -file ${file}${curpage}.ps \
-height 11i -width 8.5i \
-x 0 -y 0
incr curpage
clear
}
}
.label_canvas postscript -file ${file}${curpage}.ps \
-height 11i -width 8.5i \
-x 0 -y 0
}
proc clear {} {
eval ".label_canvas delete [.label_canvas find all]"
}
proc widget {} {return .label_canvas}
canvas .label_canvas -bg white -height 11i -width 8.5i
}
\ No newline at end of file
#!/usr/local/bin/tclsh
set y 24
set yi 18
set filei 0
set fp [open labelsf${filei}.cse w]
while {[gets stdin line] >= 0} {
set id [lindex $line 0]
set length [lindex $line 1]
set type [lindex $line 2]
puts $fp "text 30 $y -text [format %06d $id] -font {Courier 12}"
puts $fp "text 78 $y -text [format %03d $length] -font {Courier 12}"
puts $fp "text 108 $y -text $type -font {Courier 12}"
if {$id % 56 == 0} {
set y 24
close $fp
incr filei
set fp [open labelsf${filei}.cse w]
} else {
incr y $yi
}
}
\ No newline at end of file
This diff is collapsed.
#!/bin/csh -f
foreach a (labelsf[0-9].cse labelsf1[0-9].cse)
./csetool.tk -print $a.ps labels.cse $a
end
This diff is collapsed.
source labels.tcl
source avery_.5x1.75.lbl
set wirefont "Courier 14 bold"
set pcfont "Courier 24 bold"
# 40 pcs
for {set i 1} {$i <= 40} {incr i} {
LABEL::label "pc$i" -font $pcfont
}
# 160 sharks
for {set i 1} {$i <= 160} {incr i} {
LABEL::label "sh$i" -font $pcfont
}
# 4 switches
foreach a {alpha beta gamma delta} {
LABEL::label "$a" -font $pcfont
}
# Yellow N PC Node to Switch
# Orange D Dnard to Switch
# White S Serial
# Green P Power
# Red C Control
set cables {
{D 16 3}
{D 18 5}
{D 20 7}
{D 22 7}
{D 24 5}
{D 26 3}
{D 30 10}
{N 16 17}
{N 18 35}
{N 20 50}
{N 22 50}
{N 24 35}
{N 26 17}
{P 18 4}
{P 20 4}
{P 22 4}
{P 24 4}
{C 16 5}
{C 18 10}
{C 20 13}
{C 22 13}
{C 24 10}
{C 26 5}
{S 10 5}
{S 14 5}
{S 16 12}
{S 18 23}
{S 20 32}
{S 22 32}
{S 24 23}
{S 26 12}
}
set cableindex 1
foreach cable $cables {
set type [lindex $cable 0]
set size [lindex $cable 1]
set num [lindex $cable 2]
for {set i 1} {$i <= $num} {incr i} {
LABEL::label [format "%06s-%03s-%s" $cableindex $size $type] \
-font $wirefont
LABEL::label [format "%06s-%03s-%s" $cableindex $size $type] \
-font $wirefont
puts "$cableindex $size $type"
incr cableindex
}
}
LABEL::print "tb"
exit
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment