Lego Piece Generator (Python)

Figure 1. Render of assembled vehicle model using generated Lego pieces.

The objectives of this computer graphics assignment were:
  • Create a Python tool in Maya to generate Lego Technic pieces
  • Tool should have a interactable GUI
  • User should be able to change values for the pieces being generated to reasonable limits
It was challenging when developing the procedural generation of pieces from basic Maya primitives (cube) using Python scripting as it required a strong understanding of how to transform the 3D shapes programmatically. I also had to set limits and allow the user to manipulate values using the graphical user interface, as seen in Figure 2 below.

Figure 2. Screenshot of GUI and generated piece.

Particularly challenging pieces were those with holes, since I needed to ensure that the face count is accurate when cutting and Booleans cannot be performed on top of another Boolean. Furthermore, pieces that connect at an angle with a hole in the corner required moving the pivot point to line up the hole appropriately.

Here is a demonstration of the script at work in Maya:

Finally, I assembled a vehicle model using the generated pieces and additional special pieces that were be required for the 3D Computer Graphics course.

Figure 3. Screenshot of assembled vehicle in Maya showing geometry.

Comments