Dimensions & Text Annotations
build123d-techdraw renders all dimensions in true 2D paper space (mm).
๐ Dimension Types
1. Horizontal Dimensions
# Dimension between model X=-40.0 and X=+40.0 at baseline model Y=-10.0
layout.front.dim_horizontal(
model_x1=-40.0,
model_x2=40.0,
model_y=-10.0,
offset_y=12.0, # Positive moves downward in paper space
tolerance="ยฑ0.1",
prefix="2x ",
)
2. Vertical Dimensions
# Dimension between model Z=0.0 and Z=30.0 at baseline model X=-40.0
layout.front.dim_vertical(
model_y1=0.0,
model_y2=30.0,
model_x=-40.0,
offset_x=-15.0, # Negative moves leftward in paper space
tolerance="H7",
)
If the requested offset would put the dimension line or its text (rotated text and tolerance
suffix included) on or inside the view outline, the dimension is pushed outward to the first free
row: FIRST_DIM_OFFSET_MM (10 mm) from the view, then DIM_STACK_STEP_MM (7 mm) past any
parallel dimension already there (ISO 129-1). The offset you asked for is kept in
requested_offset. Text too long for the span goes on an extension of the dimension line.
3. Aligned (Skewed) Dimensions
4. Radial Dimensions (R)
# Radial dimension pointing to a fillet or round
sheet.add_radial_dimension(
center=(100.0, 100.0),
radius=15.0,
angle_deg=45.0,
tolerance="ยฑ0.05",
)
5. Diameter Dimensions (โ)
# Full diametral dimension with leader shelf
sheet.add_diameter_dimension(
center=(100.0, 100.0),
diameter=20.0,
angle_deg=30.0,
tolerance="H7",
)
The leader keeps its short default length when the landing shelf and text are clear of the view's edges, bolt circles and other annotations. Otherwise it is lengthened until the text clears them, at most to just outside the view's outline.
6. Diametral Centerline Half-Dimensions (ISO 129-1 ยง5.2.3)
For turned parts, shafts, and half-section views, HalfDiameterDimension draws a single extension
line and arrowhead on one cylindrical contour with the dimension line extending past the axis of
symmetry and displaying the full diameter (โD):
from build123d_techdraw import Anchor, HalfDiameterDimension, Tolerance
# Directly from a cylindrical face or semantic Anchor (auto-detects diameter and axis)
HalfDiameterDimension(
Anchor.of(journal_face, shape=shaft),
offset=-14.0,
tolerance=Tolerance.fit("h6"),
)
# Or via SheetView helper
section_view.dim_half_diameter(
feature_point=(120.0, 130.0),
centerline_coord=150.0,
diameter=40.0,
offset=-12.0,
)
7. DIN 509 Relief Undercut & Conical Chamfer Callouts
from build123d_techdraw import (
ChamferCallout,
UndercutCallout,
get_din509_spec,
recommend_din509_undercut,
)
# Look up or recommend standard DIN 509 relief undercuts (Forms E, F, G, H)
spec = recommend_din509_undercut(diameter=26.0, form="E") # DIN 509 - E 0.8 ร 0.3
UndercutCallout(target=(140.0, 152.0), spec=spec, roughness="Ra 1.6")
# Conical chamfer faces automatically extract axial width and bevel angle
ChamferCallout(chamfer_cone_face) # e.g. "2 ร 45ยฐ"
๐ท๏ธ Centerlines & Crosshairs
Center Crosshairs (centermark)
# Draw center crosshairs on a hole at model coordinates (X, Y)
layout.front.centermark(model_x=0.0, model_y=15.0, size=8.0)
Centerlines (centerline_horizontal / centerline_vertical)
# Draw dash-dot centerlines through symmetry planes
layout.front.centerline_horizontal(model_y=0.0)
layout.front.centerline_vertical(model_x=0.0)
Bolt Circle / Pitch Circle Diameter (bolt_circle)
# 6-hole bolt circle with diameter 50mm
layout.front.bolt_circle(
center_model=(0.0, 0.0),
diameter_model=50.0,
num_holes=6,
start_angle_deg=0.0,
)
๐ Leaders & Multi-Line Notes
layout.front.leader(
model_x=12.0,
model_y=10.0,
lines=[
"2x M6x1.0 THRU",
"C'BORE โ10.5 x 6.0 DEEP",
],
elbow_dx=18.0,
elbow_dy=-14.0,
terminator="arrow", # or "dot"
)
Leader callouts (LeaderNote, HoleCallout, ThreadCallout, ChamferCallout) keep the
requested elbow offset when the text is clear of the view's edges. If it is not, the elbow is
moved outward in 2.5 mm steps, along the requested direction or its mirror images, until the text
clears the edges, preferring the shortest leader that keeps the text outside the view and away
from other annotations. The offset you asked for stays in requested_elbow_offset; elbow_offset
is the one drawn. The check uses the part's edges, so the side outlines of curved surfaces are
not considered, and rotated views are skipped.
Welding Symbols (ISO 2553, system A)
WeldingSymbol draws the solid reference line with a dashed identification line 1.5 mm below
it. The arrow-side weld symbol (arrow_side=True) sits on the solid line; the other-side symbol
(arrow_side=False) hangs below the dashed line, so neither line crosses the text. The tail fork
is at the far end of the reference line, and the field-weld flag is drawn filled at the elbow.
Weld symbols do not move away from geometry by themselves; choose elbow_offset accordingly.
๐ ๏ธ Sheet Metal Bend Lines, Schedules & Punch Markers
BendLineAnnotation draws UP bends (line-bend-up, ISO 128-2 dash-dot-dot) and DOWN bends
(line-bend-down, dashed) with ISO 3098 bottom/right-readable inline callouts (automatically
falling back to a collision-free leader on short bend lines). PunchMarker adds oriented
crosshairs and tooling tags (ROUND, OBROUND, SQUARE, RECTANGLE, D_HOLE, LOUVER,
EMBOSS, KNOCKOUT).
from build123d_techdraw import BendTable, PunchTable, unfold_sheet_metal
fp = unfold_sheet_metal(bracket_part, k_factor="din6935")
flat_view = sheet.add_flat_pattern(fp, center=(135.0, 140.0), scale=0.5)
flat_view.auto_dimension_flat_pattern()
BendTable(fp, position=(303.0, 210.0), sheet=sheet)
PunchTable(fp, position=(318.0, 160.0), grouped=True, sheet=sheet)