LSynth Service

I’ve fiddled with the 2.0 source code to produce a variant that adds some minor features (and probably breaks some others). Most notably, I’ve also packaged this version as a Mac OS X Service, a text-processing filter you can use to run LSynth anywhere you can edit text.

Install the service in ~/Library/Services/ and double-click it to register its availability. To run LSynth, select some LDraw text and select “LSynth” from the “Services” submenu of your current application:

The selected text will be replaced with LSynth’s output. You can use Service Scrubber to add a global keyboard shortcut or to weed out any services you don’t use.

Editor Compatibility

The LSynth Service works great with any conventional Mac OS X text fields. However, some popular editors implement their own text fields that interact with services a little differently. Ideally, the service would recognize these cases and cater to them accordingly, but for the time being workarounds are needed.

Towards that end, I’ve added an LSynth.tcl filter to my TextWrangler LDraw Kit (adaptable for BBEdit users, too) that acts as a compatibility wrapper for the LSynth Service. TextMate users may need to use the Text bundle’s “Remove Unprintable Characters from Selection” command to clean up misinterpreted line endings after running the service.

LSynth Service Tool

I call my modified version of the LSynth program lsynthst (for “LSynth Service Tool”) to avoid confusion with the official version. It builds on Mac OS X and Linux, but I haven’t tested it with any other platforms.

The primary difference between lsynthst and LSynth 2.0 is the addition of a “filter” mode. Run with no arguments, lsynthst reads standard input and writes to standard output. Other changes include:

Case is preserved

Whitespace insensitive keyphrase recognition

Unrecognized lines in SYNTH blocks are preserved

n as well as rn line endings can be read

Support for whitespace in constraint part names (silly)

Wee bit more error handling

Some things have surely been broken

For more detailed information about the changes made, see my comments in the main.c source code file. No additions or functional modifications to the actual part synthesis code have been made. The program is packaged as a system service with ThisService.

Development

I cannot support this version of LSynth, nor can the original author. However, I would be glad to receive your feedback, and the source code is, of course, available for your perusal or repair. Eventually, service integration with the next official version of LSynth would be nice.