Giving LPub an ability it should already have

The open source LPub is an application that lets you publish instructions for LEGO models from LDraw data, primarily as PDF files. One of its nice additional features is the export of pages as PNG files. While functional, this export doesn’t properly support transparency. Since PNG files do support transparency, this is a bit irritating.

There is UI to set the background, and it has a “none” choice, but using it results in a solid white background instead of a transparent (or, worse in older versions, to a solid black background). Another choice is to use a background image, so you can try to fake out the application by setting the background image to a PNG that is nothing but transparent. The program allows this, but when you export the result, you see the art for each page layered on top of each other (clearly, the app is not clearing a buffer between pages).

Over a year ago, I submitted bugs for both of these problems to the LPub team (here and here). As of this writing, neither of them have been assigned to anyone, much less fixed.

So, I decided to fix it myself. Getting the code downloaded and built in XCode took several hours, and would have taken even longer had I not found the very useful “Compile LPub4 using XCode on Mac OS X” post by Mark from More than just bricks. I had to tweak a couple other things to get it to work, but nothing too drastic.

Knowing nothing about how the code worked and very little about Qt, the GUI package it uses, it took a couple of hours figure out where to make the fix and getting it working properly. The main trick is to add QPixmap.fill(Qt::transparent) in a key place in Gui::exportAs. The rest of the changes are just slight alterations to the UI. Not many changes needed, and maybe I missed something, but seems to work for me.

A patch containing my changes was made against the current head of the project’s CVS tree. I have submitted it to the LPub team. I will update this post if it gets included in a release.

LDraw language grammar for TextMate

Data files for LDraw software, such as Bricksmith, are really just text files with a specific syntax, and it can be useful to treat these files as text by opening them in a text editor and manipulating the source directly. This is particularly true if you are using LPub to build instructions for the model, as editing the text directly is the only way to add certain commands to the file.

My text editor of choice, TextMate, supports large numbers of language grammars to provide syntax coloring. It also allows you to add your own. I threw together this one to get a bit of coloring into .ldr files:

{
   scopeName = 'source.ldr';
   firstLineMatch = '^0 FILE .+\.ldr$';
   fileTypes = ( 'ldr' );
   patterns = (
      {
	name = 'comment.line.ldraw';
        match = '^0 [^!].*$\n?';
      },
      {
	name = 'constant.other.ldraw';
        match = '^0 !.*$\n?';
      },
   );
}

To install this, pick Bundles→Bundle Editor→Edit Languages… from the menu bar. Click the + at the bottom of the window that comes up to create a new item. Then cut and paste the grammar. This should make your LDraw files go from what is shown on the left, to what is on the right:
Application of TextMate grammar

Looking for instructions for building Mobile Frame Zero frames?

In honor of the successful completion of the MFØ kickstarter, I’m volunteering to produce (and publicly post) seven LDraw files of mobile frames, with companion PDFs of assembly instructions. If you have a frame you’d like to see get this treatment, post it to the thread built for the purpose on the Mobile Frame Hangar forum. First come, first served and some restrictions apply.

LDraw files for Mechaton inspired by hardsuits

Minifig for scaleSimilar to my last LDraw/Mechaton post, here are some more files. These all come from the “hardsuit community”, a group of Lego enthusiasts who build minifig-in-powered-armor-looking figures. Since these “hardsuits” are built to minifig scale (to the right is a minifig shown at the same scale as the images below), they work pretty well for Mechaton, with a few alterations.

The hardsuit community (apparently) has evolved a number of “standard” body types, where the core of the model uses a particular idea, which is then embellished. I selected a number of these standard cores, but only present one example of each. I believe that I give credit below to the originator of any given standard core, but it can be hard to track this down, so I may have got it wrong. Let me know if you know better.

As before, I had to guess at some of these models, going by pictures posted to the net. In most cases, I changed the head entirely, as hardsuits typically use minifig heads, which Mechaton models usually avoid. I also sometimes added extra stuff or changed a bit here and there. I’m sure I also guessed wrong in a few places. So, if these drift from the standard, that is why.

The LDraw files use the latest part collection, but may contain unofficial parts. (Also, you may need to right-click on the .ldr files and “Save Link As…”.)

Blacktron by pasukaru76 Blacktron
by pasukaru76
Source: Flickr
LDraw file: pasukaru76-blacktron.ldr
Double Edge by xezav Double Edge
by xezav
Source: Flickr
LDraw file: xezav-doubleedge.ldr
Hardersuit by Alvaro Gunawan Hardersuit
by Alvaro Gunawan
Source: Flickr
LDraw file: alvarogunawan-hardersuit.ldr
Reclean, based on design by PolarBear!! Reclean (based on “Cleanbot”)
by PolarBear!!
Source: Flickr
LDraw file: polarbear-reclean.ldr
Retriever by xezav Retriever
by xezav
Source: Flickr
LDraw file: xezav-retriever.ldr
Übermann by Geoff Herndon Übermann
by Geoff Herndon
Source: Flickr
LDraw file: geoffherndon-ubermann.ldr
W. Mk1 by W. Mark W. Mk1
by W. Mark
Source: MocPages
LDraw file: wmark-wmk1.ldr
ZSF-AHTP by Mr. Villa ZSF-AHTP
by Mr. Villa
Source: Flickr
LDraw file: mrvilla-ZSF-AHTP-4.ldr

To view these files, you’ll need some kind of .ldr viewer, such as Bricksmith or others.

Lastly, a repeat of my earlier plea: when you come up with the next great frame, please give the world an LDraw file for it, so we can marvel at your genius from any angle we like.

LDraw files for popular Mechaton models

As you might have noticed from my other Mechaton posts, I’m still pretty new to building giant fighty robots out of Lego. Part of learning more about this includes looking at some of the popular Mechaton frames others have made and figuring out how they work.

I haven’t found this easy, as often all you have to go on are some low resolution photos that never seem to include the angle you need. To spare would-be frame builders some of the irritation I went through, I created some LDraw files detailing step-by-step instructions on how to make some of these frames. (You may need to right-click on the .ldr files and “Save Link As…”.)

Classic by D. Vincent Baker The “Classic”
by D. Vincent Baker
Source: Mechaton rules
LDraw file: vincentbaker-classic.ldr
Chucker by D. Vincent Baker Chucker
by D. Vincent Baker
Source: ptimanya designs
LDraw file: vincentbaker-chucker.ldr
5gen by D. Vincent Baker 5gen
by D. Vincent Baker
Source: ptimanya designs
LDraw file: vincentbaker-5gen.ldr
AIn-11 by Joshua A. C. Newman AIn-11
by Joshua A. C. Newman
Source: the glyphpress
LDraw file: joshuanewman-AIn-11.ldr
Radial bot by David Laurence Radial
by David Laurence
Source: Brickshelf
LDraw file: davidlaurence-radial.ldr
Conscript by Soren Conscript
by Soren
Source: Flickr
LDraw file: soren-conscript.ldr
MgN-302 by Malcolm Craig MgN-302
by Malcolm Craig
Source: Mechatonic
LDraw file: malcolmcraig-MgN-302.ldr
Mini-frame by Squieu Mini-frame
by Squieu
Source: Brickshelf
LDraw file: squieu-mini-frame.ldr

To view these files, you’ll need some kind of .ldr viewer. I use Bricksmith, but there are others. Note that a number of viewers can also generate part lists from a model automatically.

There may be part mistakes, as I pretty much just guessed on a lot of things. If you find an error, please drop a comment about it below. It would help if you used the LDraw part numbers to identify both what part is wrong and with what it should be replaced.

Lastly, a plea to all you frame builders out there: when you come up with the next great frame, please give the world an LDraw file for it, so we can marvel at your genius from any angle we like. Heck, post a link to it in a comment below. I’d love to see it.

Mechaton: Flex chassis

Here’s another chassis for Mechaton. The idea behind this one was an experiment to get as many points of articulation as was manageable in a small size. The result is extremely posable, but a bit fragile, particularly in the waist.

Flex Chassis

The LDraw file is here.

Part Color Quantity Description
This parts list generated by LDView. Part images provided by Peeron.
View on Peeron.com 2429 71:
Light Bluish Gray
 
4 Hinge Plate 1 x 4 Base
View on Peeron.com 2430 71:
Light Bluish Gray
 
4 Hinge Plate 1 x 4 Top
View on Peeron.com 2540 72:
Dark Bluish Gray
 
2 Plate 1 x 2 with Handle
View on Peeron.com 2555 71:
Light Bluish Gray
 
3 Tile 1 x 1 with Clip
View on Peeron.com 3023 71:
Light Bluish Gray
 
1 Plate 1 x 2
View on Peeron.com 3024 72:
Dark Bluish Gray
 
1 Plate 1 x 1
View on Peeron.com 3623 71:
Light Bluish Gray
 
2 Plate 1 x 3
View on Peeron.com 3623 72:
Dark Bluish Gray
 
1 Plate 1 x 3
View on Peeron.com 3794 71:
Light Bluish Gray
 
1 Plate 1 x 2 with 1 Stud
View on Peeron.com 4070 71:
Light Bluish Gray
 
1 Brick 1 x 1 with Headlight
View on Peeron.com 4081a 71:
Light Bluish Gray
 
2 Plate 1 x 1 with Clip Light Type 1
View on Peeron.com 4081a 72:
Dark Bluish Gray
 
1 Plate 1 x 1 with Clip Light Type 1
View on Peeron.com 4085c 71:
Light Bluish Gray
 
2 Plate 1 x 1 with Clip Vertical Type 3
View on Peeron.com 4590 71:
Light Bluish Gray
 
2 Plate 1 x 4 Offset
View on Peeron.com 4697b 71:
Light Bluish Gray
 
2 Technic Pneumatic T-Piece – Type 2
View on Peeron.com 47905 71:
Light Bluish Gray
 
4 Brick 1 x 1 with Studs on Two Opposite Sides
View on Peeron.com 47905 72:
Dark Bluish Gray
 
1 Brick 1 x 1 with Studs on Two Opposite Sides
View on Peeron.com 48336 72:
Dark Bluish Gray
 
1 Plate 1 x 2 with Handle Type 2
View on Peeron.com 6019 72:
Dark Bluish Gray
 
2 Plate 1 x 1 with Clip Horizontal
View on Peeron.com 61409 71:
Light Bluish Gray
 
2 Slope Brick 18 2 x 1 x 2/3 Grille
View on Peeron.com 6141 0:
Black
 
2 Plate 1 x 1 Round
View on Peeron.com 6141 43:
Trans Very Light Blue
 
1 Plate 1 x 1 Round
View on Peeron.com 6141 72:
Dark Bluish Gray
 
3 Plate 1 x 1 Round

Mechaton: Swingarm chassis

I’ve been playing around building mechs for Mechaton, Vincent Baker‘s game of giant fighty robots made out of Legos. Compared to some, I’m not that good at it yet. So far, I’m restricting myself to Lego parts that I already have, which is a bit limiting. Still, I managed to put together a basic chassis that is fairly easy to make, doesn’t use too many freaky pieces and seems to be extremely versatile.

In its naked state, it doesn’t look like much, but the attachments fill it out nicely. The arms have two points of articulation with a wide motion range (at the shoulder and elbow), and the lower arm can be flipped around or even swapped out for different parts that use a “locking hinge”. The basic assembly is shown in the image below. In the final stage, there are two different 2×4 pieces that work for the side torso, both of which are shown. The one on the right gives a slimmer look, while the one on the left provides more options for attaching things to the front of the mech.

Swingarm Assembly

Here are some samples using both variations. Each is pictured with a plate containing an indication of how many of each type of dice the mech would use in a Mechaton game. If you’ve seen the game, this should be relatively straightforward. For the red dice, shorter ranges are closer to you, and one of the optional rules is used in some cases. Transparent pips are d6’s, solid pips are d8’s.

Balanced Bulky Jumper Missile Firepower

All of these models were built using Bricksmith, then rendered with LDView. In making these models, I took some liberties with the colors, as I don’t have all the right colors of these bricks. Bricksmith is built on top of LDraw, and uses its file format. Some of these use one or two unofficial parts (which you will need to download if you want to use the files).

Parts for the naked chassis are:

Part Color Quantity Description
This parts list generated by LDView. Part images provided by Peeron.
View on Peeron.com 3020 72:
Dark Bluish Gray
 
1 Plate 2 x 4
View on Peeron.com 3021 71:
Light Bluish Gray
 
1 Plate 2 x 3
View on Peeron.com 3040b 72:
Dark Bluish Gray
 
2 Slope Brick 45 2 x 1
View on Peeron.com 3298 72:
Dark Bluish Gray
 
1 Slope Brick 33 3 x 2
View on Peeron.com 3666 72:
Dark Bluish Gray
 
1 Plate 1 x 6
View on Peeron.com 3794 72:
Dark Bluish Gray
 
1 Plate 1 x 2 with 1 Stud
View on Peeron.com 4070 71:
Light Bluish Gray
 
2 Brick 1 x 1 with Headlight
View on Peeron.com 4287 71:
Light Bluish Gray
 
2 Slope Brick 33 3 x 1 Inverted
View on Peeron.com 43720 71:
Light Bluish Gray
 
1 Wedge 4 x 2 Sloped Right
View on Peeron.com 43721 71:
Light Bluish Gray
 
1 Wedge 4 x 2 Sloped Left
View on Peeron.com 43710 71:
Light Bluish Gray
 
1 Slope Brick 2 x 4 Triple Left
View on Peeron.com 43711 71:
Light Bluish Gray
 
1 Slope Brick 2 x 4 Triple Right
View on Peeron.com 44301 0:
Black
 
2 Hinge Plate 1 x 2 Locking with Single Finger on End Vertical
View on Peeron.com 44301 71:
Light Bluish Gray
 
2 Hinge Plate 1 x 2 Locking with Single Finger on End Vertical
View on Peeron.com 44302 0:
Black
 
2 Hinge Plate 1 x 2 Locking with Dual Finger on End Vertical
View on Peeron.com 44302 71:
Light Bluish Gray
 
2 Hinge Plate 1 x 2 Locking with Dual Finger on End Vertical
View on Peeron.com 6141 0:
Black
 
4 Plate 1 x 1 Round
View on Peeron.com 6141 43:
Trans Very Light Blue
 
1 Plate 1 x 1 Round