Create arcs of boxes with xfig

John Peck
Published , updated

I needed to add an array of 0603 LEDs to a loudspeaker drawing (shown below). Since I've done some scripting for xfig files before, I thought I'd try that again.

loudspeaker face

You can see the tiny green LEDs distributed over the big middle driver. You can find the script here. You'll need Tcl and Tcl's cmdline package to run it. Once you've got things set up, you can see the usage with

~/p/eventual/scripts/boxarc λ tclsh boxarc.tcl -h
boxarc usage: boxarc [options]
-l value             Box length (mils) <100>
-w value             Box width (mils) <100>
-d value             Minimum depth <50>
-r value             Arc radius (mils) <1000>
-s value             Start angle (degrees) <0>
-e value             End angle (degrees) <90>
-n value             Number of boxes <10>
-o value             Output file name <none>
--                   Forcibly stop option processing
-help                Print this message
-?                   Print this message

...and you can get the LEDs shown in the above image with

tclsh boxarc.tcl -l 63 -w 31 -r 2500 -s 30 -e 150 -n 32 -d 10

...which puts 32 0.063 x 0.031 inch boxes on a 2.5 inch radius between angles 30 and 150 degrees. The depth setting of 10 puts the LEDs "on top" and visible in the image.