Python Lego Generator Plugin : Autodesk Maya


The purpose of this Autodesk Maya plugin is to allow users to generate various types of Lego pieces in a wide range of sizes and colours according to specification. Many of the standard Lego pieces with and without holes can be generated. Pieces with rounded edges, axles, pegs, and wheels can also be achieved. Users of the plugin may choose the colour of the pieces by clicking on the colour window which brings up a colour wheel. The length of the Lego pieces can also be adjusted by moving the slider or by inputting a value.


Using Python scripting within Autodesk Maya, I was able to initialize the size of the user interface, header names, default colour, and size values. Each piece has its own function which initializes the exact spacing, size of bumps, and holes according to official Lego pieces. For loops are used in order to repeat certain commands such as placing bumps on a piece or using the boolean attribute to cut holes from the pieces. Once the loops have run, the code then unites the geometry of the piece by using the “polyUnite” function to allow the user to select the Lego piece as one object.


•Autodesk Maya 2016

Python Scripting