Draft Dimension

From FreeCAD Documentation
Revision as of 17:56, 29 April 2021 by Yorik (talk | contribs) (→‎View)
This documentation is a work in progress. Please don't mark it as translatable since it will change in the next hours and days.

Draft Dimension

Menu location
Annotation → Dimension
Workbenches
Draft, Arch
Default shortcut
D I
Introduced in version
0.8
See also
Draft FlipDimension

Description

The Draft Dimension command creates an object that measures and displays the distance between two points; a third point specifies the position of the dimension line.

The tool can measure edges or lines directly attached to solid bodies; if the body changes, the dimension updates itself. The tool can also measure a diameter or radius of curvature such as those produced by a Draft Arc, or by the Part Fillet, Sketcher CreateFillet, and PartDesign Fillet operations.

The resulting dimension is placed in the 3D view, and is considered a Draft object. This object can be displayed on a TechDraw Workbench Page, using the TechDraw DraftView or TechDraw ArchView tools. Alternatively, TechDraw has its own tools to display dimensions, such as TechDraw Dimension Length and TechDraw Dimension Radius; however, these tools are meant for preparing technical drawings, so they create the dimensions only in the drawing page, and not in the 3D view.

Dimension defined by three points

Usage

  1. There are several ways to invoke the command:
    • Press the Draft Dimension button.
    • Select the Annotation → Dimension option from the menu.
    • Use the keyboard shortcut: D then I.
  2. Click the first point in the 3D view, or type coordinates and press the Enter point button.
  3. Click the second point in the 3D view, or type coordinates and press the Enter point button. The first two points define the measured distance.
  4. Click the third point in the 3D view, or type coordinates and press the Enter point button. The final point defines the position of the dimension line.

Available dimension types

Release the modifier, Alt or Shift, after picking a point or an edge.

  • Linear dimensions: hold the Alt key, or click on the select edge button, and pick a straight edge, then pick a second point to draw the dimension line parallel to that edge.
Note: you can also pre-select the edge before calling the tool.
  • Horizontal and vertical dimensions: pick one point, then pick a second point, then hold the Shift key and move the pointer horizontally or vertically, then pick a third point to draw the dimension line parallel to either the X axis or the Y axis.
Note 1: click and hold Shift and move the pointer in different directions many times until the dimension line aligns to the desired axis. Clicking Shift while the pointer is far from the first point will usually align the dimension to the X axis; if the pointer is close to the first point it will usually align the dimension to the Y axis.
Note 2: instead of picking two points, pick an edge while holding Alt.
  • Diameter dimensions: hold the Alt key and pick a curved edge, then pick a second point to draw the dimension line.
    • Radius dimensions: hold the Alt key and pick a curved edge, then hold the Shift key and pick a second point to draw the dimension line.
  • Angular dimensions: hold the Alt key and then pick two straight edges, then pick a point between the two edges to show the acute or obtuse angle, or elsewhere to show a supplementary or explementary angle.
Note: the displayed angle largely depends on the original position of the selected edges. If you would like to display a particular angle, you may have to add auxiliary Draft Lines that extend from the original edges, and measure these extensions.

Note: by pre-selecting an edge, or by picking it with Alt or select edge, the dimension will become parametric, that is, it will remember which edge it is bound to. If the endpoints of that edge move later on, the dimension will follow them, and adjust the displayed measurement.

Options

  • Press X, Y or Z after a point to constrain the next point on the given axis.
  • To enter coordinates manually, simply enter the numbers, then press Enter between each X, Y and Z component. You can press the Enter point button when you have the desired values to insert the point.
  • Press R or click the checkbox to toggle relative mode. If relative mode is on, the coordinates of the next point are relative to the previous one; if not, they are absolute, taken from the origin (0,0,0).
  • Press T or click the checkbox to toggle continue mode. If continue mode is on, the Dimension tool will restart after you give the final point, allowing you to draw another dimension without pressing the tool button again; the following dimensions will start from the final point of the previous dimension, and will share the same baseline.
  • Hold Ctrl while drawing to force snapping your point to the nearest snap location, independently of the distance.
  • Hold Shift while drawing to constrain your next point horizontally or vertically in relation to the previous one, and to switch between diameter and radius modes.
  • Press Esc or the Close button to abort the current command, and finish continued dimensions; dimensions already placed will remain.

Notes

  • A Draft Dimension can be edited with the Draft Edit command.

Properties

See also: Property editor.

A Draft Dimension object is derived from an App FeaturePython object and inherits all its properties. The following properties are additional unless otherwise stated:

Data angular dimensions

Angular dimension

  • DataAngle (Angle): (read-only) specifies the value of the measurement.
  • DataCenter (VectorDistance): specifies the center of the measurement.
  • DataFirst Angle (Angle): specifies the start angle of the measurement.
  • DataLast Angle (Angle): specifies the end angle of the measurement.

Dimension

  • DataDimline (VectorDistance): specifies the point through which the dimension arc passes.
  • Data (hidden)Linked Geometry (LinkSubList): not used.
  • Data (hidden)Normal (Vector): specifies the normal of the plane of the dimension.
  • Data (hidden)Support (Link): not used.

Data linear and radial dimensions

Dimension

  • DataDimline (VectorDistance): specifies the point through which the dimension line passes.
  • DataLinked Geometry (LinkSubList): specifies the object and its subelement(s) the dimension is linked to.
  • DataNormal (Vector): specifies the normal of the plane of the text.
  • Data (hidden)Support (Link): specifies the measured object.

Linear/radial dimension

  • DataDirection (Vector): specifies the direction of the measurement.
  • DataDistance (Length): (read-only) specifies the value of the measurement.
  • DataEnd (VectorDistance): specifies the end point of the measurement.
  • DataStart (VectorDistance): specifies the start point of the measurement.

Radial dimension

  • DataDiameter (Bool): specifies if a radial dimension is displayed as a diameter dimension. If it changed the symbol used in ViewOverride must be updated manually (from Ø to R or vice versa). Not used for linear dimensions.

View

Annotation

  • ViewAnnotation Style (Enumeration): specifies the annotation style applied to the dimension. See Draft AnnotationStyleEditor.
  • ViewScale Multiplier (Float): specifies the general scaling factor applied to the dimension.

Display Options

  • ViewDisplay Mode (Enumeration): specifies how the text is displayed. If it is 2D text the text will be displayed in a plane defined by the DataNormal of the measurement. If it is 3D text the text will always face the camera. Note that these values are switched compared to Draft Texts. This is an inherited property.

Graphics

  • ViewArrow Size (Length): specifies the size of the symbols displayed at the ends of the dimension line or arc.
  • ViewArrow Type (Enumeration): specifies the type of symbol displayed at the ends of the dimension line or arc, which can be Dot, Circle, Arrow, Tick or Tick-2.
  • ViewDim Overshoot (Distance): specifies the additional length added to the dimension line. Not used for angular dimensions.
  • ViewExt Lines (Distance): specifies the maximum length of the extension lines that go from the measured points to the dimension line. Not used for angular dimensions.
  • ViewExt Overshoot (Distance): specifies the additional length of the extension lines beyond the dimension line. Not used for angular dimensions.
  • ViewFlip Arrows (Bool): specifies whether to flip the orientation of the symbols at the ends of the dimension line or arc. Only works if the symbols are arrows.
  • ViewLine Color (Color): specifies the color of the dimension including the text.
  • ViewLine Width (Float): specifies the width of the lines or arc belonging to the dimension.
  • ViewShow Line (Bool): specifies whether to display the dimension line. Does not affect the display of extension lines and overshoots. Not used for angular dimensions.

Text

  • ViewFlip Text (Bool): specifies whether to flip the orientation of the text.
  • ViewFont Name (Font): specifies the font used to draw the text. It can be a font name, such as Arial, a default style such as sans, serif or mono, a family such as Arial,Helvetica,sans, or a name with a style such as Arial:Bold. If the given font is not found on the system, a default font is used instead.
  • ViewFont Size (Length): specifies the size of the letters. The text can be invisible in the 3D view if this value is very small.
  • ViewOverride (String): specifies a custom text to display instead of the actual measurement. Use the string $dim inside the text to include the measurement.
  • ViewText Position (VectorDistance): specifies the position of the text in absolute coordinates. [0, 0, 0] will display the text in its default position near the dimension line or arc.
  • ViewText Spacing (Length): specifies the space between the text and the dimension line or arc.

Units

  • ViewDecimals (Integer): specifies the number of decimal places to display for the measurement. Not used for angular dimensions.
  • ViewShow Unit (Bool): specifies whether to display the unit next to the numerical value of the measurement. Not used for angular dimensions.
  • ViewUnit Override (String): specifies the unit in which to express the measurement, for example, km, m, cm, mm, mi, ft, in or arch for arch units. Leave this blank to use the default unit. Not used for angular dimensions.

Scripting

See also: Autogenerated API documentation and FreeCAD Scripting Basics.

To create a Draft Dimension use the make_dimension method (introduced in version 0.19) of the Draft module. This method replaces the deprecated makeDimension method.

dimension = make_dimension(p1, p2, p3=None, p4=None)

There are various ways to invoke this method, depending on the arguments passed to it:

dimension = make_dimension(p1, p2, p3=None)
dimension = make_dimension(object, i1, i2, p4=None)
dimension = make_dimension(object, i1, mode, p4=None)
  • Creates a linear dimension by measuring the distance between points p1 and p2.
  • Creates a linear dimension linked to object, measuring the distance between its vertices indexed i1 and i2.
  • Creates a circular dimension linked to object, with i1 being the index of the curved edge to measure, and mode being either "radius" or "diameter" to specify the type of dimension.
    • p3 in the first call, and p4 in the other two, specify an optional point through which the dimension line should go.
    • All points are defined by their FreeCAD.Vector.

To create an angular dimension use the following method:

dimension = make_angular_dimension(center, angles, p3, normal=None)
dimension = make_angular_dimension(center, [angle1, angle2], p3, normal=None)
  • Creates an angular dimension from the given center point, the angles list with two elements, and the point p3 through which the arc should go.
    • If angle1 > angle2, the displayed angle is the difference angle1 - angle2; otherwise, the explementary angle is displayed, 360 - (angle2 - angle1).
    • The angles should be given in degrees.

The view properties of dimension can be changed by overwriting its attributes; for example, overwrite ViewObject.FontSize with the new size in millimeters.

Example:

import FreeCAD as App
import Draft

doc = App.newDocument()

p1 = App.Vector(0, 0, 0)
p2 = App.Vector(1000, 1000, 0)
p3 = App.Vector(-2500, 0, 0)
dimension1 = Draft.make_dimension(p1, p2, p3)
dimension1.ViewObject.FontSize = 200

polygon = Draft.make_polygon(3, radius=1000)
doc.recompute()

p4 = App.Vector(-2000, 1500, 0)
dimension2 = Draft.make_dimension(polygon, 1, 2, p4)
dimension2.ViewObject.FontSize = 200

center = App.Vector(2000, 0, 0)
p5 = App.Vector(3000, 1000, 0)
angle1 = 45
angle2 = 10
dimension3 = Draft.make_angular_dimension(center, [angle1, angle2], p5)
dimension3.ViewObject.FontSize = 200

dimension4 = Draft.make_angular_dimension(center, [angle2, angle1], p5*1.2)
dimension4.ViewObject.FontSize = 200

doc.recompute()