gdt::distanceFunction in std::gdt
GD&T distance annotation for displaying measured edge lengths or distances between two entities.
This is part of model-based definition (MBD).
Arguments
| Name | Type | Description | Required |
|---|---|---|---|
tolerance | number(Length) | The acceptable distance tolerance. If not given, or 0, tolerance will not be shown. | No |
from | Face or TaggedFace or Edge or any | The face or edge to measure from. Must be used with to. The default position is the entity center. Edges can be specified by their adjacent faces with { sideFaces = [...], endFaces = [...], index = 0 }; endFaces and index are optional. Point-and-click uses these references instead of deprecated edge lookup calls. | No |
to | Face or TaggedFace or Edge or any | The face or edge to measure to. Must be used with from. The default position is the entity center. Edges can be specified by their adjacent faces with { sideFaces = [...], endFaces = [...], index = 0 }; endFaces and index are optional. Point-and-click uses these references instead of deprecated edge lookup calls. | No |
edges | [Edge or any; 1+] | The edges whose lengths are annotated. Cannot be combined with from or to. Edges can be specified by their adjacent faces with { sideFaces = [...], endFaces = [...], index = 0 }; endFaces and index are optional. Point-and-click uses these references instead of deprecated edge lookup calls. | No |
precision | number(_) | The number of decimal places to display. The default is 3. Must be greater than or equal to 0 and less than or equal to 9. | No |
framePosition | Point2d | The distance label's local offset [along, setback], in length units. along moves the label from the measurement midpoint, positive toward from and negative toward to; 0 centers it when the text fits. setback sets the perpendicular leader extent in framePlane; the dimension line lies at 80% of this extent. Its sign chooses the side. When omitted, the label is centered with a setback equal to the average of the positive dimensions of the measured entities' bounding box, matching the scale used by other GD&T annotations. If the selected bounds are unavailable, the model bounds are used, then [0mm, 20mm] as a fallback. Point-and-click writes the calculated position as literal lengths. Explicit positions are preserved, including [0, 0]. | No |
framePlane | Plane | The plane in which to display the distance. Handwritten KCL defaults to XY when omitted. Point-and-click uses the common face plane for hole spacing and a plane containing the edge direction for edge lengths, then falls back to selected KCL topology and writes the plane explicitly. For measurements along Z, use XZ or YZ so the dimension is visible. The distance may be displayed in a plane parallel to the given plane. | No |
leaderScale | number(_) | Scale of the distance arrows. The default is 1.0. Must be greater than 0. | No |
fontSize | number(Length) | The model-space height to use for annotation text. The default is 10mm. Explicit units are supported; bare numbers use the file's default length unit. This changes the scene size, not the internal raster texture quality. | No |
annotationName | string | Human-friendly name for this annotation in exports and model metadata. This is not displayed visually. | No |
Returns
[GdtAnnotation; 1+]
Examples


