Link FreeCAD TechDraw Dimensions to 3D Parameters

This article explains how to link dimension values and annotations in FreeCAD's TechDraw workbench directly to 3D model parameters and spreadsheet values. While standard TechDraw dimensions measure projected 3D geometry automatically, integrating explicit 3D model parameters—such as constraint lengths or spreadsheet values—into your drawing ensures design intent is dynamically reflected. Below are the exact steps to reference model parameters using FreeCAD's expression engine.

Method 1: Using TechDraw Annotations with Expressions

When you need to display a specific 3D model parameter (such as a named constraint or a spreadsheet cell) rather than a measured edge:

  1. Ensure Parameters Are Named: In the 3D model, assign a name to your parameter. This can be a named constraint inside a sketch (e.g., TotalWidth) or an alias in a Spreadsheet workbench table (e.g., PartLength).
  2. Insert an Annotation: Switch to the TechDraw Workbench and select your drawing page. Click Insert Annotation from the toolbar.
  3. Open the Expression Editor: Select the newly created annotation in the tree view. Look at the Property View under the Data tab.
  4. Link to the Parameter:
    • Find the Text property.
    • Click the small blue f(x) (expression) icon on the right side of the field.
    • Enter your reference expression. If referencing a spreadsheet, enter:
      sprintf("Length: %.2f mm", <<Spreadsheet>>.PartLength)
      If referencing a sketch constraint directly, enter:
      sprintf("Width: %.2f mm", <<Sketch>>.Constraints.TotalWidth)
  5. Apply: Click OK. The annotation text will now update dynamically whenever the 3D model changes.

Method 2: Overriding Standard Dimensions with Model Parameters

Standard TechDraw dimensions calculate their value from the 2D projected geometry. To override the displayed text with a dynamic model parameter:

  1. Create the Dimension: Place a standard linear, horizontal, or vertical dimension on the TechDraw view by selecting the appropriate vertices or edges.
  2. Locate Text Properties: Select the dimension in the tree view or the drawing canvas. In the Property View on the Data tab, find the FormatSpec or Arbitrary properties (depending on your FreeCAD version).
  3. Enable Expressions:
    • To append or prepend parameters, use the Prefix or Suffix property and click the f(x) icon next to it to bind it to a 3D model variable.
    • To replace the measured value entirely, set the Arbitrary property to True and bind the ArbitraryText field to your model parameter using the f(x) expression editor (e.g., String(<<Spreadsheet>>.PartLength) + " mm").

Updating the Drawing

Whenever modifications are made to the 3D model or associated spreadsheet:

  1. Switch back to your TechDraw page.
  2. Press F5 or select Edit > Refresh to recalculate the document.
  3. Click the Redraw Page icon in the TechDraw toolbar to clear any cached dimensions and update the displayed values to match the 3D model parameters.