If your parts are all rectangular and only rotated in 90-degree increments, something like this would work:
That thread has some more discussion as well.