anoved.net: May 2008anoved.net logo

Posted on Tuesday, May 13, 2008:

Fuel Economy

In the sixteen years since it was manufactured, my truck has travelled some 190000 miles. Supposing an average fuel economy of 14 miles per gallon, the truck has burned about 13571 gallons of fuel. That’s a lot.

A Boeing 777-200, smallest of the 777s, has a maximum fuel capacity of 31000 gallons. That’s more than twice as much as a lot. The 777-200’s maximum range is listed as 5235 nautical miles, or some 6024 miles. Disregarding other factors, and the possible irrelevance of such limits to typical operation, these maximums suggest a fuel economy between 0.19 and 0.2 miles per gallon.

These calculations are contrived, but it should be clear that a transcontinental flight consumes more than peanuts.

Nevertheless, this comparison should not be construed as an indictment of air travel. There are millions of trucks like mine but only a handful of airliners. Furthermore, airplanes carry many passengers, and cars do not. Last but not least, cars cannot fly. Flight is intrinsically cool.

So, I leave it as an exercise for the reader to figure out how many people a 777-200 would have to carry from NY to LA to use less fuel than those people would use if they each drove a truck like mine the same distance.

7:20 PM Comment (1)

Posted on Monday, May 12, 2008:

Fox Kits

Here’s a video clip my mom took of some little foxes frolicking around their den.

8:47 PM Comment (0)

Posted on Sunday, May 11, 2008:

Note Poster

Here’s a script to create a new post in MarsEdit from a note selected in Yojimbo. Why use a script when it’s already as easy as copy and paste? Well, maybe your computer is running out of paste.

tell application "Yojimbo"
	set _items to selected items of browser window 1
	if (_items is {}) or (_items is missing value) then return
	set _note to item 1 of _items
	if class of _note is not note item then return
end tell

tell application "MarsEdit"
	set _post to make new document
	set body of _post to contents of contents of _note
	set title of _post to name of _note
	activate
end tell

Click here to open the script directly in Script Editor. Save it in ~/Library/Scripts/Applications/Yojimbo and you're ready to run.

2:51 PM Comment (0)

Posted on Saturday, May 10, 2008:

LDTrim

LDTrim is a simple program that condenses or formats LDraw code by trimming extraneous characters like spaces – or inserting them to align values in columns.

LDTrim was developed to help “pretty-print” examples for documentation or discussion, but it could also be used to reduce file size or to standardize the format of many models.

Much of what LDTrim does is already possible with LDraw Design Pad. For example, see “Trim Lines” and “Auto Round Selection” under the “Tools” menu.

You can print a brief overview of LDTrim's command-line syntax, including options not described here, with ldtrim -help.

Example

Suppose you have saved this LDraw code as sample.ldr:

1  0    20.000000     0.000000    20.000000     0.000000    -1.000000     0.000000     1.000000     0.000000     0.000000     0.000000     0.000000     1.000000 4085c.dat
1  1    28.000000     7.000000    27.000000     0.000000    -1.000000     0.000000     0.500000     0.000000    -0.866025     0.866025     0.000000     0.500000 3023.dat
1  25    36.000000    -5.000000    11.000000     0.000000    -1.000000     0.000000     0.707106     0.000000    -0.707106     0.707106     0.000000     0.707106 2412b.dat

Running ldtrim -in sample.ldr -out trimmed.ldr will save the following as trimmed.ldr:

1 0 20 0 20 0 -1 0 1 0 0 0 0 1 4085c.dat
1 1 28 7 27 0 -1 0 0.5 0 -0.866025 0.866025 0 0.5 3023.dat
1 25 36 -5 11 0 -1 0 0.707106 0 -0.707106 0.707106 0 0.707106 2412b.dat

The default behavior is to condense the code as much as possible without modifying the model. Alternatively, you can use LDTrim to reformat code. For instance, ldtrim -precision 2 -width 5 -1 1 -2 3 -in trimmed.ldr -out aligned.ldr outputs the following as aligned.ldr:

1   0 20.00  0.00 20.00  0.00 -1.00  0.00  1.00  0.00  0.00  0.00  0.00  1.00 4085c.dat
1   1 28.00  7.00 27.00  0.00 -1.00  0.00  0.50  0.00 -0.87  0.87  0.00  0.50  3023.dat
1  25 36.00 -5.00 11.00  0.00 -1.00  0.00  0.71  0.00 -0.71  0.71  0.00  0.71 2412b.dat

Giving a minimum field -width argument implies -justify right. Similarly, decimal -precision implies -trim none, leaving trailing zeros intact. The -1 and -2 options override the minimum width for the first two columns.

Batch Mode

If LDTrim is given multiple input files, it will process them all, saving the results to files of the same name in the directory given by -out or overwriting the input files if no output folder is given.

ldtrim -in $LDRAWDIR/parts/*.dat -out /trimmed/parts/

Note that with a single -in file, -out is interpreted as a single output file, but with multiple -in files, -out is interpreted as a directory to contain the results.

Web Interface

LDTrim has a rudimentary web interface built in. If the GATEWAY_INTERFACE environment variable is detected, LDTrim will behave like a CGI script. Specifically, it will print an HTML form with controls that roughly correspond to its command-line options. LDraw code posted via this form (to itself, as the action ldtrim) is processed according to the selected options. The results are returned in the same form.

For the time being, an instance of this interface is available at anoved.net/cgi-bin/ldtrim.

Download

LDTrim is also available as a platform-independent Starkit (50 KB) which requires an 8.5 Tclkit.

The current version of LDTrim is 1.1; it fixes a bug that caused malformed line endings to be output on Windows.

12:21 PM Comment (0)

Posted on Wednesday, May 7, 2008:

Candid Sketches

Drawing people in public is a fun challenge because you've only got a few seconds to nail their form before they walk past or shift position. I think the figures that result are more convincing than many I've drawn from photographs because they're based on natural poses rather than those affected for the camera or the studio.

It's refreshing to leave faces blank for a change.

Colorized Benchwarmers

I colored this picture on the computer. Give it a click to look at a few other recent sketches.

11:20 PM Comment (0)