Macros to generate 'plastic toy brick' models in FreeCAD
This is a learning exercise undertaken to master the following:
- FreeCAD and concepts for parametric modelling: sketches, constraints, datum planes etc.
- Python and scripting with FreeCAD
- Detailed modelling of toy bricks
These all form the basis of a future planned project...
NOTE: This is no longer actively developed as I have learnt enough. The main lesson being that using Python scripts to create parametric models in FreeCAD is quite possibly insane!
Tested with FreeCAD version 0.20 beta
-
Clone this repository:
git clone https://github.com/vectronic/freecad-legify-macros.git
-
Link the cloned folder and macro files into the FreeCAD macros directory:
ln -s <absolute path of cloned repository>/Legify <absolute path of user preferences folder>/FreeCAD/Macro/ ln -s <absolute path of cloned repository>/legify-brick.FCMacro <absolute path of user preferences folder>/FreeCAD/Macro/ ln -s <absolute path of cloned repository>/legify-technic-pin.FCMacro <absolute path of user preferences folder>/FreeCAD/Macro/
NOTE: On MacOS the typical location for the user preferences folder is /Users/<username>/Library/Application\ Support
.
- Create a new document
- Run the
legify-brick.FCMacro
- Modify parameters as desired in the popup dialog
- Click OK
- Wait for a lot of sketches, constraints, pads, pockets and fillets to be rendered...
- Admire the resulting beauty!
- Within the Part Design workbench, create a body.
- Create a datum point on an existing face representing the centre point of the base of the pin.
- Create a datum point extended 8mm from the normal to the face representing the centre point of the tip of the pin.
- Create a datum line supported by the base datum point and the tip datum point in that order.
- Select the body and select the datum line.
- Run the
legify-technic-pin.FCMacro
- Wait for Linear Pattern bug fix needed when rendering more than one technic pin
- Technic Axle Pin Rendering
- Technic Axle Hole Rendering
- 0.25mm fillet on internal brick corners
- Determine a replacement for internal ribs if side studs with holes exist
- Determine a replacement for tube ribs if technic holes exist
- Support rib variation in modern 2x1 tile and 2x1 technic brick with 2 non-offset holes:
- Support modern tile with small outside pocket on bottom
Initial drawing and dimensions used as reference for this work was done by Nick Turo-Shields