Tag Archive: “mac”

Using LDView to make it easier to add parts to your LDraw library

A common concern among LDraw users is how to add new parts to their libraries. Often, “in-progress” versions of desired parts are available in the LDraw.org Parts Tracker (get involved!), but downloading and installing them manually can be tedious. If you don’t want to download every unofficial part, you can let LDView download and install the parts you want for you.

First, identify the number of a needed part. Let’s suppose it’s this brick:

It’s not yet in the official part library, but an unofficial version of 60475 is in the LDraw.org parts tracker. You can download the unofficial part and its prerequisites manually, or you can create a dummy model that requires it, and let LDView retrieve the files you. Here’s how.

Create a file consisting of a single reference to the desired part, 60745.dat:

1 71 0 0 0 1 0 0 0 1 0 0 0 1 60475.dat

Let’s call it download.ldr. Next time you want to download a new part, just change the highlighted part number (or add a new line for the new part; it doesn’t matter how the parts are positioned):

LDView can download missing parts automatically. First, make sure “Automatically check ldraw.org for missing parts” is checked in the “Updates” tab of LDView Preferences:

Next, open download.ldr in LDView. If it’s already open, reload it. (This will happen instantly if you’ve selected “Auto-update immediately” from the File → Polling menu.) When LDView loads the model, it will attempt to retrieve any missing parts from the parts tracker. After a moment, your new part should appear:

The new part (and any prerequisite sub-parts or primitives) will be added to your library:

To use your new part in Bricksmith, click “Reload Parts” in the “Parts” tab of Bricksmith Preferences:

The new part will now be available in the Bricksmith Parts Browser:

So, the point is that if you want to use a part that’s not yet in your library, just paste the part number in download.ldr, open it in LDView, and reload your parts library in Bricksmith.

Posted on Saturday, April 24th, 2010.

LDTrim Service

LDTrim is a little command line utility I wrote to help format LDraw code. Using Automator in Mac OS X 10.6, I made a Service that applies LDTrim to selected files in the Finder:

The screenshot above shows exactly how to set it up. So, if you’re cleaning up a lot of old LDraw files, now you can do it with nothing more than a right-click on the file or files of interest.

Posted on Sunday, April 18th, 2010.

NetNewsWire Folders

I use NetNewsWire as my newsreader. I like it, but I wish that it would display a list of posts (or even just unread posts) from subscriptions in a folder when that folder is selected. This is how Google Reader works, and it is a sensible behavior. Perhaps I’d like to read all bike-related news, instead of opening the folder to look at items blog-by-blog.

Is there an option I have overlooked that enables this sort of behavior?

Clarification: NetNewsWire does this with unread posts – all new items from subscriptions within a folder appear together when you select the folder – but I’d like to be able to browse all items, whether or not they’re new.

Posted on Friday, April 16th, 2010.

Processing Syntax Coloring in TextWrangler

Processing is based on Java. TextWrangler supports syntax highlighting for Java code, but it doesn’t automatically recognize that Processing uses Java syntax. So, head over to the Languages pane of TextWrangler’s preferences and click Add next to the Suffix Mappings list. Enter .pde as the Extension and select Java as the language that should be associated with .pde files.

Now if you open a Processing source code file in TextWrangler, it will be displayed with basic syntax highlighting.

Posted on Thursday, March 18th, 2010.

Reading on the Big Screen

Big displays are worthwhile because they improve the ratio of visible content to “computer stuff”.

Here is a story from Issue 114 of Hub Magazine viewed in Tofu, a little app that displays text in a side-scrolling columnar format suitable for comfortable reading. The story is The Unpopular Opinion of Reverend Tobias Thackery, by Adam Christopher. Yes, we are all dog-men.

Two pages of a document can be displayed side-by-side at life size (in other words, the image of the typical page is eleven inches tall, just as it would be if printed). This is especially useful when reading documents whose layout would require scrolling back and forth to follow the flow of text on a smaller screen.

What am I reading? The paper which introduced the collective animal behavior model presented by Iain Couzin at a recent EvoS seminar:

Couzin, I. D., Krause, J., James, R., Ruxton, G. D., & Franks, N. R. (2002). Collective Memory and Spatial Sorting in Animal Groups. Journal of Theoretical Biology, 218(1), 1-11. (PDF)

I’d like to write my own implementation of the model (or some representative subset) in Processing. I spawn a lot of eventually-neglected side projects, of course, but right now this subject has my attention.

Posted on Sunday, March 14th, 2010.

Add Curved Drop Shadow plugin for Acorn

This is a variation on the Curved Drop Shadow without Border plugin for Acorn I posted a few days ago (which is itself a derivative of the original Create New Image with Curved Drop Shadow plugin). It adds the drop shadow to the current image instead of spawning a new document. The drop shadow is added to the active layer.

Download AddCurvedDropShadow.py (2.3 KB) and install it in ~/Application Support/Acorn/Plug-Ins.

Posted on Sunday, March 14th, 2010.

Search with Google Scholar Service

Download this service (53 KB; might require Snow Leopard), unzip it, and install it in ~/Library/Services. Then select some text, right-click the selection, and choose “Search with Google Scholar” to find related articles. If the text you selected is the title of a paper, chances are the first result will include exactly what you want: a PDF copy of the paper, or at least an abstract.

This service is shamelessly derived from the “Show Address in Google Maps” service that ships with Mac OS X 10.6.

Posted on Friday, March 12th, 2010.

Curved Drop Shadow without Border (A Modified Plug-in for Acorn)

This is a very slightly modified version of the “New Image with Curved Drop Shadow” plug-in that ships with Acorn. The original plug-in adds a narrow white border with a gray frame to the image in addition to the curved drop shadow. I removed the code that adds the border, so all this version does is add the subtle shadow (illustrated in the screenshot below).

Download New Image with Curved Drop Shadow without Border.jstalk (1.5 KB; unzip and install in ~/Library/Application Support/Acorn/Plug-Ins; restart Acorn). I’m not sure what license terms apply to this plug-in, but the JSTalk plug-in and the original Python filter were written by Gus, inspired by the screenshots in an article by Sebastiaan.

Posted on Saturday, March 6th, 2010.

Keep Working with Full Screen Movies on a Second Monitor

Do you have a big external monitor for your Mac laptop? If so, you might want to watch a DVD or a video file on it while you continue to work on your main monitor. With the click of a checkbox, you can keep the video playing full screen while you use other applications.

In the DVD Player application preferences, check “Remain in full screen when DVD Player is inactive”:

In the QuickTime Player 7 application preferences, click “Remain in full screen when player is inactive”:

It’s a little tricker to set up the same configuration in iTunes, but you can play many iTunes videos (including television shows and movies purchased from the iTunes store – but not rentals) in QuickTime Player. Right-click a movie in iTunes and select “Show in Finder” to locate the file.

Posted on Saturday, March 6th, 2010.

XML Parsing in AppleScript

I recently wrote a script that posts bookmarks from Yojimbo to Pinboard. Now that I have a nice system for posting links, I find that I’d like even more integration. For instance, I’d like to be able to keep Yojimbo in sync by downloading any links I post to Pinboard via other interfaces.

The Pinboard/Delicious API provides a variety of methods for retrieving link information, but there isn’t a straightforward way to parse the results in AppleScript. In my posting script, I just search the response for code="done". This is sufficient to tell if the add method succeeded, but methods that return more detailed information need more rigorous handling.

Incidentally, AppleScript supports direct interaction with SOAP or XML-RPC web services; see the documentation here. However, the Pinboard API uses a different architecture, REST (sort of).

Essentially, a query is represented as a URL, with parameters, and the XML results are returned by the server like the content of any other web page. (I use do shell script and curl to make the request and get the raw results; I don’t know if there is a better AppleScript idiom for general HTTP transactions. URL Access Scripting is dusty and requires writing temporary files.) The task is to extract the relevant bookmark information from the response.

As it turns out, the System Events scripting dictionary includes an XML suite, pictured above. Some experiments based on the examples given in this discussion at MacScripter confirm that it can be used to parse data returned by the Pinboard API. So, all the pieces necessary to implement a more sophisticated AppleScript bookmark syncing system are available.

Posted on Saturday, February 20th, 2010.