Skip to main content

Module gdt

Module gdt 

Source
Expand description

Feature control frames, datum feature symbols and labels: the part’s AP242 PMI as crate::pmi_lowering lowers it, placed beside its view and drawn (draftwright’s annotations/_gdt.py render_gdt, and build123d_drafting’s FeatureControlFrame, DatumFeature, TextBlock and Leader).

  • A feature control frame is laid out as a CAD system lays out a native TOLERANCE, in QCAD’s gdt and Standard fonts (haecceity’s cad_control_frame): text 2.5 mm tall, cells two text heights (5 mm) tall and each as wide as its ink plus a text height, the characteristic’s symbol in the first, the zone’s ⌀ or S⌀, the magnitude and the material condition’s ringed letter in the second, one cell per datum letter after. Its leader runs straight from its site into its strip, with an arrowhead at the site, a shelf of 2 mm, and the frame hung from the shelf’s end (draftwright’s Leader with a callout), the all-around circle or the all-over double circle at the bend.
  • A datum feature symbol is drawn as ISO 5459 and ASME Y14.5 draw it: a filled triangle whose base sits on the datum’s surface at its site, a line along the outward normal to a frame two text heights (5 mm) tall, and as wide unless the letters need more, holding the letter in the same font. draftwright hangs its DatumFeature glyph (triangle, line and frame together) off an arrowed leader’s shelf instead, so its triangle sits beside the frame in mid-air, not on the surface.
  • A surface texture symbol (a face’s AP242 surface texture) is ISO 1302’s graphical symbol, as the default finish beside the title block draws it, standing on its leader’s shelf, its parameters (Ra 0.8) under the bar: its leader runs from a proven site on its face’s edge line along the face’s outward normal, as a datum’s does, with an arrowhead at the site (draftwright’s Finish, a SurfaceFinish glyph on a Leader, which only draftwright’s face-finish lowering for one external cylinder makes). A cylinder with no proven silhouette is reached head-on instead, its leader ending in a dot inside the outline (ISO 128-22).
  • A label (a surface or common label: A, F1.1, 2X R) is its text at the dimensions’ text height, unframed, hung from a leader as a frame is (draftwright’s Note, a TextBlock callout on a Leader).

Placement (additive to the dimensions’ and leaders’): the layout reserves each item’s lowering strip (demand, crate::layout::Strips::reserve_gdt). Automatic datums first try compact tiers between their face and the first dimension lane, retaining the triangle, shaft, frame and normal clearances. Only after these choices are exhausted do they try the existing tiers beyond the dimensions. Cylinder sites are proved on either trimmed-face silhouette; planar symbols may stand on a drawn face extension beyond either end of the view outline. Constrained planar datums precede cylinders. At equal clearance and crossing counts automatic datums prefer shorter leaders; original site order breaks remaining ties. Filled triangles reserve clearance alongside the letter boxes, and final-plan lint rejects touching or overlapping datum triangles. A plane’s finish keeps its outward side; a cylinder’s tries compact tiers in its own strip, then the other proven silhouette only when its own has no place clear of every label and line; its leader keeps a text height from any line it runs alongside, and the finish with fewest sites in a strip is placed first. Frames and labels can retry the other strips (_gdt_retry_sides).

All glyphs share the same obstacle grade: clearance from labels, views, sheet furniture and reserved-area boundaries, followed by the count of leader crossings with dimension lines, extension lines, arrow shafts and other leaders (the collision reporter’s lines_meet, including collinear travel). Only the all-zero grade ends the search immediately. Within equal clearances, fewer crossings win. When the original arrangement separates datum triangles, a new arrangement must not introduce any annotation contact (unique unordered pairs, independent of reporting direction). An original arrangement with touching triangles is already illegal: repair may trade soft contacts for fewer symbol overlaps, retaining all findings. Joint attachment reservations are used only when ordinary placement cannot separate the triangles. Later frames must not be displaced merely to clear an earlier leader in an already legal arrangement. Unavoidable collisions are retained and reported (Policy B). Explicit placement intents retain their strip/tier rules. If the full rearrangement introduces contact, the datum changes are also tried alone. Pins and canonical hand placements take precedence over automatic compact placement.

Each item’s text layer is its compartments as the plan states them (⌖, ⌀0.05Ⓜ, A, …), one invisible run over each, so the PDF and SVG can be searched and lint reads it. The ink of //! the symbols and of a frame’s text is strokes and arcs in the SVG and PDF, drawn with the text pen (crate::output::TEXT_PEN, crate::output::Item::FrameText); the DXF writes each frame as one native TOLERANCE with the gdt font’s symbols instead, from [frame], and the same size, since its style’s DIMTXT is the frame text’s height. A character the CAD fonts lack is left out of the frame’s ink and reported ([frame_missing]); a label’s text is drawn as the file states it, a character the font lacks as its missing-glyph box (as draftwright’s FreeType draws it).

Structs§

GdtPlaced
A frame’s or symbol’s ink, mm on the page.
GdtText
PlannedGdt
A feature control frame or datum feature symbol the sheet will carry.

Functions§

demand
The part’s lowered PMI as the layout reserves room for it (crate::layout::Gdt, crate::layout::Strips::reserve_gdt), shown saying which principal views the sheet carries: each item’s strip as lowering chose it, its site across the strip, and its glyph’s extents as plan places it (the leader and shelf of a frame or label, a datum’s frame centred on its line), with the room [first_tier] leaves for the arrowhead or triangle.
finish_collisions
What the default surface finish’s symbol (r) collides with among the placed items (the dimensions, frames and labels), judged as their collisions are.
finish_proxy
The default surface finish’s symbol beside the title block (r) as the placed items’ collision checks and the blocks placed after it see it: its strokes as lines, its whole box as its label.
placement_options
plan
The part’s PMI lowered and placed around views on sheet, after the dimensions dims: the items, and the problems met (lowering’s, and what the placed items collide with). An item whose view spec omits is fixed by restoring it.
proxy
A placed item as the dimensions’ collision checks see it: a callout whose leader is its lines and whose label is its frame.
render
Draws a planned item into items (the dims layer) and its runs into text, from the plan alone; returns its annotation for lint (no measurement claims: a frame states the source’s requirement, not a measurement of the part).
symbol_collisions
Independent final-plan lint, including pinned and unavoidable placements.