| name | build123d-design |
| description | Create 3D CAD models using build123d, a modern Python CAD library with builder pattern. Use for parametric modeling, assemblies, and STEP/STL export. Offers cleaner syntax than CadQuery with context managers. |
build123d Design
build123d is a modern Python CAD library using builder patterns for cleaner code.
Installation
pip install build123d
Basic Workflow
from build123d import *
# Create a box with a hole using context manager
with BuildPart() as part:
Box(10, 10, 5)
with Locations((0, 0, 5)):
Hole(radius=1, depth=5)
# Export
part.part.export_step("part.step")
part.part.export_stl("part.stl")
Builder Types
BuildPart - 3D Solid Modeling
with BuildPart() as result:
Box(20, 20, 10)
with Locations((5, 5, 10)):
Cylinder(radius=3, height=5)
BuildSketch - 2D Sketching
with BuildSketch() as sketch:
Rectangle(20, 10)
with Locations((5, 0)):
Circle(radius=2, mode=Mode.SUBTRACT)
BuildLine - Wire/Path Creation
with BuildLine() as path:
Line((0, 0), (10, 0))
Line((10, 0), (10, 10))
Line((10, 10), (0, 0))
Common Operations
Extrusions and Cuts
with BuildPart() as part:
with BuildSketch():
Rectangle(20, 20)
extrude(amount=10)
with BuildSketch(part.faces().sort_by(Axis.Z)[-1]):
Circle(radius=5)
extrude(amount=-5, mode=Mode.SUBTRACT)
Fillets and Chamfers
with BuildPart() as part:
Box(10, 10, 10)
fillet(part.edges().filter_by(Axis.Z), radius=1)
chamfer(part.edges().sort_by(Axis.Z)[-4:], length=0.5)
Assemblies
from build123d import *
base = Box(50, 50, 10)
pin = Cylinder(radius=5, height=20)
# Position parts
pin_located = Pos(10, 10, 10) * pin
# Combine
assembly = Compound([base, pin_located])
assembly.export_step("assembly.step")
Face and Edge Selection
# Get top face
top_face = part.faces().sort_by(Axis.Z)[-1]
# Get vertical edges
vertical_edges = part.edges().filter_by(Axis.Z)
# Get edges on face
face_edges = top_face.edges()