
LEGO
2023-05-21
I'm an AFOL. I have a reasonable collection of LEGO from my childhood, but have continued to buy the occasional set. Right now my focus is on the Creator Expert vehicles and train sets.
LEGO MOCs and experiments in LeoCAD
Recently I've been using LeoCAD to design and render MOCs and experiments. LeoCAD is a LEGO CAD tool, one of the LDraw system of tools for designing and sharing LEGO creations. Subpages related to these MOCs and experiments:
Experiments
MOCs
Showcases
Rendering models and submodels
I'm using a Makefile with some LeoCAD scripting to render images of the models and submodels. With an "ortographic" projection and flat shading, these renders look similar to official LEGO manual renders.
Makefile
LEOCAD=/Applications/LeoCAD.app/Contents/MacOS/LeoCAD
FILE=main.ldr
# identify the submodel names, which must not contain spaces.
SUBMODELS=$(shell cat ${FILE} | grep "^0 FILE" | cut -d " " -f 3- - | cut -d "." -f 1 -)
test:
echo ${SUBMODELS}
render-all:
for submodel in ${SUBMODELS}; do \
SUBMODEL=$submodel make render-submodel ; \
done
render-submodel:
# top and bottom
SUBMODEL=$SUBMODEL LAT=90 LONG=0 make render-submodel-angle
SUBMODEL=$SUBMODEL LAT=270 LONG=180 make render-submodel-angle
# sides
SUBMODEL=$SUBMODEL LAT=0 LONG=0 make render-submodel-angle
SUBMODEL=$SUBMODEL LAT=0 LONG=90 make render-submodel-angle
SUBMODEL=$SUBMODEL LAT=0 LONG=180 make render-submodel-angle
SUBMODEL=$SUBMODEL LAT=0 LONG=270 make render-submodel-angle
# elevated diagonals
SUBMODEL=$SUBMODEL LAT=35 LONG=45 make render-submodel-angle
SUBMODEL=$SUBMODEL LAT=35 LONG=135 make render-submodel-angle
SUBMODEL=$SUBMODEL LAT=35 LONG=225 make render-submodel-angle
SUBMODEL=$SUBMODEL LAT=35 LONG=315 make render-submodel-angle
render-submodel-angle:
mkdir -p images
${LEOCAD} \
-i images/${SUBMODEL}-${LAT}-${LONG}.png \
-s ${SUBMODEL}.ldr \
--camera-angles ${LAT} ${LONG} \
--shading flat \
-w 1280 -h 720 \
--line-width 2 \
--orthographic ${FILE}
export-all:
for submodel in ${SUBMODELS}; do \
SUBMODEL=$submodel make export-submodel ; \
done
export-submodel:
${LEOCAD} \
--export-collada ${FILE}.dae \
-s ${SUBMODEL}.ldr ${FILE}
blender --background --python dae2glb.py -- ${FILE}Feedback? Questions? Email me
LEGO: Train bogies
LEGO: Train bases
LEGO: Tangara (2023)
LEGO: Tangara (2025)
LEGO: Train board
All articles
About Sinclair Studios