Tag Archive: “LDraw”

“Export to LDraw” plugin for Google SketchUp

As mentioned in my previous post, I recently drafted a new LDraw part in SketchUp. I converted that model to LDraw format with a script derived from su2ldraw. My version of the plugin is now available as ldraw_export.rb; you can get it here (now at GitHub). More details on installation and usage in the file itself.

Posted on Tuesday, February 1st, 2011.

2011 (1)

Here is a progress report on some of my 2011 objectives, roughly a month in to the year. (But don’t expect this to become a regular thing. What do you think this is – some kind of blog?)

1. Running

Like a million other people, I went for a run on New Year’s Day.

Unlike most of them, I’ve continued running, in hardy defiance of the Dark and the Cold and the Wet. I ran in two January Freeze 10ks – my first races at the 10k length. As reported elsewhere, I even sustained minor flesh wounds in the second race. I’ll spare you photos, but it was rad.

Three weeks in, I got a cold. I took about a week off from running to let my damage repair crews immune system restore full respiratory function. Went back out for a jog today to shake the kinks out. Felt good to rev the jets up above idle again! A week off really sets you back, though.

Fitting a run into the daily schedule can be hard, especially in winter. For me, the hardest part is not coping with the cold or negotiating snowy paths (hell, that’s the fun part; see e.g. here) but just crossing the threshold from indoors to out. I find that focusing on getting outdoors by just putting on some running clothes before I’m entirely out of workday/errand mode helps make that happen. A little attitude helps, too. (“Yeah, it’s 16˚F out and I’m running. You’re not. I win.”)

What’s in store for this month? There’s a 5k coming up in a week or two I’d like to do. Otherwise, just get in the habit of running and work on a modest base to launch from once spring hits. My friend and running mentor Pre promises me it’s gonna be brutal.

2. Brick Blueprint

I enjoy fiddling with LEGO and LDraw software. Most of the models I build these days are built with pieces from specific sets. I started a Flickr group called LEGO Remix for these sort of creations, and it seems to have caught on. I’ve thought about combining these interests with a little modest capitalism for a few years. Now I’m going to give it a shot.

Brick Blueprint is the working name for an online store where you will be able to buy affordable high quality instructions for new models you can build with the LEGO sets you already have.

There are already some great sources out there for awesome custom models, such as Brickmania. Two things set Brick Blueprint apart, and will, I think, make it appealing to a broad market:

There’s not much to report on the web site side of things, but a few pawns are in place. (Incidentally, the Brothers Brick posted an interview with four part resellers today – some of them full-time.)

If I’m going to design many models using parts from popular sets, I don’t want to be hung up by the absence of certain new or unusual parts in the LDraw part library. I’ll need to be able to draft them myself. Towards that end, I’ve modeled a newly-introduced canopy.

92579 progress

I used SketchUp to generate most of the shape, and a Ruby script based on Jim Foltz’ su2ldraw to export the SketchUp model to LDraw format. I intend to post my version of the script once I get a chance to clean it up a bit and add some more error handling.

More images documenting my part-authoring experiments are posted here. My canopy part is now in the library tracker and progressing towards certification. (That’s a lot of big talk for a digital model of a model toy, I know, but hey – geek cred where credit is due.)

3. Bicycles

Is announcing your intent to build something fun really much of a new year’s resolution? I guess this questions applies to objectives 2 and 3.

The goal of this project is to build a new bike for my stable. I already have a couple bikes, but I look forward to the process of picking out individual components and assembling a machine tailored for my needs and interests.

Earlier this week I was actually thinking about building two bikes – one city bike for errands and commuting, and one touring bike for trips and more recreational rides. Then I realized that duh, I already have a solid city bike. (Insert lesson about candy-shop greed here.)

A few repairs and additions (lighting and new brakes, for sure, and maybe a rebuilt/replaced rear hub) will bring the Schwinn up to the desired level of performance and reliability that lead me to think about a new city bike – for far less than the cost of a new bike. (When I say “city bike” I have the upright posture and relaxed handlebars of a cruiser in mind. It’s about comfort and everyday practicality.)

So, the new bike will fill the go-fast/go-far niche. It will be heavy by racing bike standards, but light and zippy compared to my cruiser or mountain-bike-hybrid-street-stomper. Its load-bearing capacity will rival the hybrid’s, with less of the Frankenstein’s monster look. Chances are good it will begin with a Nashbar touring frame, but I’ll have to have a look at some of the area bike shops that sell parts and used machines before committing to any components.

4. Occupation

SIGINT sources report low to no chatter on this channel.

Posted on Sunday, January 30th, 2011.

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.

LSynth 3.1 for Mac OS X

I have compiled a Mac OS X version of LSynth 3.1, the recently released update to the program that synthesizes LDraw code for flexible LEGO parts.

Download LSynth 3.1 for Mac OS X 10.5+ (Universal Binary; 85 KB)

This download includes the lsynthcp executable as well as the configuration file (.zip) and the constraint parts (.zip) available at Willy Tschager’s installation tutorial page for MLCad users (which contains some useful information for all LSynth users).

Important Compatibility Note: The executable in the above download may only work with Mac OS X 10.5 (Leopard) or greater. Click here to download a version of lsynthcp that should also be compatible with Mac OS X 10.4 (Tiger), provided by current LSynth developer Don Heyse. Thanks, Don!

Installation

Copy the LSynth constraint parts to the parts/ or Unofficial/parts/ directory of your LDraw part library. Keep the lsynth.mpd configuration file in the same directory as the lsynthcp executable. LSynth is not integrated with Bricksmith, so you can keep these files wherever you prefer. You will need to use the command line to run LSynth.

Usage

To use LSynth, you manually place constraint parts at key locations such as the endpoints of a hose. Then you input the LDraw file to lsynthcp, which generates a duplicate file containing all the hose segments, chain links, etc. necessary to represent the flexible part described by the constraints.

For example, here is the RUBBER_BAND-Constraints.ldr file from Willy’s excellent page of LSynth examples:

rubberbandconstraints

With the file in same directory as lsynthcp and lsynth.mpd, run the following command:

./lsynthcp RUBBER_BAND-Constraints.ldr Rubber_band_output.ldr

Here is the output:

rubberbandconstraintsoutput

For more detailed information about using LSynth, peruse Willy’s troubleshooting page and the pages linked above.

Notes

Here are the minor modifications I made to compile the LSynth 3.1 source package for Mac OS X:

  1. Edit the comment on Line 69 of lsynthcp.c to begin with slashes (//) instead of backslashes (\\).
  2. Append “-arch i386 -arch ppc” to lines 3 and 17 of makefile to enable Universal Binary support.

The make command is sufficient to compile the program.

This release supersedes the LSynth Service I made a few years ago.

Posted on Saturday, November 21st, 2009.

LDraw and “Multitouch Augmented Reality”

An upcoming version of the library behind the SSTT Visualizer used in LDraw Augmented Reality will support multitouch input, allowing your fingers to be recognized as input devices. It looks like you can use gestures to operate virtual/visual controls like sliders along the side of the marker image. Here’s a video of examples:

A variant of my Scout model appears near the end of the video. Neat!

Posted on Tuesday, September 1st, 2009.

Unofficial build of LDView 4.1 (with 3DS export)

My introductory guide to LDraw Augmented Reality relies on LDView’s 3DS export feature, which is currently present only in unreleased development versions of LDView.

Here is an unofficial Macintosh build of LDView 4.1 (code retrieved from Sourceforge on 31 August 2009). It includes 3DS export. Hopefully this helps a few more people get started with LDraw and SSTT Visualizer.

Download LDView-Unofficial.zip (Intel Mac OS X only) 1MB

Update: A formal beta version of LDView 4.1 has been released.

Posted on Monday, August 31st, 2009.

LDraw Augmented Reality

Step 1

Create an LDraw model using Bricksmith or some other LDraw editor.

Bricksmith

I use LDraw to record the design of models I’ve built. Here are the originals:

both

Step 2

Open the LDraw model in LDView.

LDView

(Note: as reported in the comments, 3DS export is not available in LDView 4.0.1, the most recent stable release. For the time being, you’ll need to build LDView yourself to utilize this feature.)

Choose Export from the File menu. Select “3DS: 3D-Studio File” from the File Format popup menu.

export

Name the file and click Save.

Step 3

Download the SSTT Visualizer Augmented Reality Demo from technotecture.com. Models, fiduciary marker images, and configuration files are stored inside the visualizer application package. Right-click the application and select Show Package Contents:

PackageContents

Drag the model you saved in Step 2 into the Contents/Resources/sstt subfolder:

DragModel

Step 4

Edit the config.txt file.

fiducial sstt/watch_fiducial.jpg 80 52
translate 0 0 0
model sstt/model.3ds 0.26

Consult the visualizer User Manual for more details about the syntax of this file. Here’s a line-by-line explanation of the example:

fiducial sstt/watch_fiducial.jpg 80 52

This identifies the tracking image from which the model’s position and orientation should be derived – the model will appear above this image (the default) wherever it appears in the scene.

translate 0 0 0

The translate statement can be used to adjust the position of the model relative to the image. Increase the last coordinate to elevate the model above the image surface or to compensate if the origin of your LDraw model is above or below the point where it should contact the ground.

model sstt/model.3ds 0.26

This line identifies the model to display. Adjust the number to change the apparent display size of the model. A scale factor of 0.26 seems to work well with the default tracking image printout.

Step 5

Print out the tracking image sheet (PDF), start the SSTT Visualizer program, and point your computer camera at the sheet. It may take a moment for larger models to load.

As you may notice, it lags a little sometimes, but I’d say it’s still pretty neat. It may prove possible to optimize the 3DS files for smoother performance, as there is a lot of internal part and model geometry that is unnecessary in this context.

Posted on Saturday, August 1st, 2009.

How to Build LPub

LPub is a program by Kevin Clague which you can use to create building instructions from LDraw models. If you are eager to test out features that are still in development, you will need to compile it yourself. Here’s how!

Install Qt

QtDownload.png

Qt is an interface toolkit and application framework. The current version of LPub requires Qt 4.5. I downloaded the LGPL/Free version of the Qt SDK for Mac (436 Mb). Installation is easy: just double-click the installer package and accept the default settings.

Download the LPub Code

LPubCheckout.png

Fire up Terminal and navigate to an appropriate place to store your files (probably not the Desktop). Check out a fresh copy of the LPub source code with the following two commands (just press enter when prompted for a password):

cvs -d:pserver:anonymous@lpub4.cvs.sourceforge.net:/cvsroot/lpub4 login
cvs -z3 -d:pserver:anonymous@lpub4.cvs.sourceforge.net:/cvsroot/lpub4 co -P LPub4

This will result in an LPub4 folder containing everything you need. To update your working copy of the code with any recent changes, issue the following command from anywhere within the LPub4 folder:

cvs update

Compile LPub

LPubApp.png

Navigate to the innermost LPub4 directory, create a Makefile for your machine, and compile the program with the following commands:

cd LPub4/LPub4
/usr/bin/qmake -spec /usr/local/Qt4.5/mkspecs/macx-g++ -macx -o Makefile LPub.pro
make

After updating from previous versions of LPub, you may occasionally find it necessary to delete the com.lpub.LDraw Building Instruction Tool.plist file from your ~/Library/Preferences directory.

Test and Provide Feedback

Now you’re ready to experiment with the latest LPub technology. Make some custom instructions! (Explaining the ins and outs of the program itself is a subject for another post.)

LPubWindow.png

Your work is not done yet, though: an important part of playing with unreleased software, in my opinion, is to provide feedback to the developer (even if you are not a programmer, your input can be very useful). Offer detailed descriptions of any bugs you encounter, cogent suggestions for improvements, and thanks to folks like Kevin for investing so much effort in programs like LPub.

Posted on Saturday, May 16th, 2009.

Bricksmith Custom Categories

Here is a hack to add new categories to the Bricksmith part browser. The part catalog is normally organized into categories based on the type of each part (such as brick, plate, or tile). However, if you’re building a model based on a real set, it’s just as useful to present the parts from that set in one category.

Adding a category from a Peeron inventory

To create a category consisting of the parts from set 4891, enter 4891 and click Peeron Inventory:

Screenshot: Naming a category based on a Peeron inventory

The script will retrieve the corresponding list of parts and populate a new category containing them:

Screenshot: Browsing a category retrieved from Peeron

Adding a category from a file

To create a category based on an arbitrary group of parts, save a list of part file names, like this:

3005.dat
3004.dat
3003.dat
3001.dat

Then enter a name for your category and click From File. You’ll be prompted to select the list you just created.

Screenshot: Naming a category to be loaded from a file

The script will add the listed parts to the named category:

Screenshot: Browsing a category loaded from a file

Limitations

The script is awfully slow. AppleScript’s property list commands are not well suited for making many changes.

Parts listed in the file or inventory which are not already present in your part library will not be included in the category.

New categories are not visible until you restart Bricksmith. (I recommend quitting Bricksmith before running the script anyway.) Custom categories are lost when you reload the part list from Bricksmith’s Parts preferences.

No feedback is provided while the script is running.

Errors are not handled particularly well.

Mac OS X 10.5 is required.

It’s really slow.

Download

Bricksmith Catalog Custom Categories 26.4 KB

Posted on Saturday, June 21st, 2008.