Draft Line: Difference between revisions

From FreeCAD Documentation
No edit summary
Line 54: Line 54:
* To enter coordinates manually enter the X, Y and Z component, and press {{KEY|Enter}} after each. Or you can press the {{Button|[[Image:Draft_AddPoint.svg|16px]] Enter point}} button when you have the desired values. It is advisable to move the pointer out of the [[3D_view|3D view]] before entering coordinates.
* To enter coordinates manually enter the X, Y and Z component, and press {{KEY|Enter}} after each. Or you can press the {{Button|[[Image:Draft_AddPoint.svg|16px]] Enter point}} button when you have the desired values. It is advisable to move the pointer out of the [[3D_view|3D view]] before entering coordinates.
* You can use polar coordinates for the second point. Enter values for {{MenuCommand|Length}} and {{MenuCommand|Angle}}, and then press the {{Button|[[Image:Draft_AddPoint.svg|16px]] Enter point}} button.
* You can use polar coordinates for the second point. Enter values for {{MenuCommand|Length}} and {{MenuCommand|Angle}}, and then press the {{Button|[[Image:Draft_AddPoint.svg|16px]] Enter point}} button.
* Check the {{MenuCommand|Angle}} checkbox and enter an angle to constrain the pointer to the specified angle. For this to work the pointer has to have been in the [[3D_view|3D view]] after entering the first point.
* Check the {{MenuCommand|Angle}} checkbox and enter an angle to constrain the pointer to that angle. For this to work the pointer has to have been in the [[3D_view|3D view]] after entering the first point.
* Press {{KEY|R}} or click the {{MenuCommand|Relative}} checkbox to toggle relative mode. If relative mode is on, the coordinates of the second point are relative to the first point, else they are relative to the coordinate system origin.
* Press {{KEY|R}} or click the {{MenuCommand|Relative}} checkbox to toggle relative mode. If relative mode is on, the coordinates of the second point are relative to the first point, else they are relative to the coordinate system origin.
* Press {{KEY|G}} or click the {{MenuCommand|Global}} checkbox to toggle global mode. If global mode is on, coordinates are relative to the global coordinate system, else they are relative to the [[Draft_SelectPlane|working plane]] coordinate system. {{Version|0.20}}
* Press {{KEY|G}} or click the {{MenuCommand|Global}} checkbox to toggle global mode. If global mode is on, coordinates are relative to the global coordinate system, else they are relative to the [[Draft_SelectPlane|working plane]] coordinate system. {{Version|0.20}}

Revision as of 14:02, 31 March 2021

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 Line

Menu location
Drafting → Line
Workbenches
Draft, Arch
Default shortcut
L I
Introduced in version
0.7
See also
Draft Wire

Description

The Draft Line command creates a straight line.

A Draft Line defined by two points

Usage

See also: Draft Linestyle, Draft Snap and Draft Constrain.

  1. There are several ways to invoke the command:
    • Press the Draft Line button.
    • Select the Drafting → Line option from the menu.
    • Use the keyboard shortcut: L then I.
  2. The Line task panel opens. See Options for more information.
  3. Click the first point in the 3D view, or type coordinates and press the Enter point button.
  4. Click the second point in the 3D view, or type coordinates and press the Enter point button.

Options

The single character keyboard shortcuts available in the task panel can be changed. See Draft Preferences. The shortcuts mentioned here are the default shortcuts.

  • To enter coordinates manually enter the X, Y and Z component, and press Enter after each. Or you can press the Enter point button when you have the desired values. It is advisable to move the pointer out of the 3D view before entering coordinates.
  • You can use polar coordinates for the second point. Enter values for Length and Angle, and then press the Enter point button.
  • Check the Angle checkbox and enter an angle to constrain the pointer to that angle. For this to work the pointer has to have been in the 3D view after entering the first point.
  • Press R or click the Relative checkbox to toggle relative mode. If relative mode is on, the coordinates of the second point are relative to the first point, else they are relative to the coordinate system origin.
  • Press G or click the Global checkbox to toggle global mode. If global mode is on, coordinates are relative to the global coordinate system, else they are relative to the working plane coordinate system. introduced in version 0.20
  • Press T or click the Continue checkbox to toggle continue mode. If continue mode is on, the command will restart after entering the second point of the line, allowing you to continue drawing lines.
  • The Undo button cannot be used for the Draft Line command.
  • Press Esc or the Close button to abort the command.

Notes

Properties

A Draft Line is in fact a Draft Wire with only two points and has the same properties.

Scripting

See also: Autogenerated API documentation and FreeCAD Scripting Basics.

To create a Draft Line use the make_line method (introduced in version 0.19) of the Draft module. This method replaces the deprecated makeLine method.

line = make_line(p1, p2)
line = make_line(LineSegment)
line = make_line(Shape)
  • Creates a Line object between points p1 and p2, each defined by its FreeCAD.Vector, with units in millimeters.
  • Creates a Line object from a Part.LineSegment.
  • Creates a Line object from the first vertex to the last vertex of the given Shape.

Example:

import FreeCAD as App
import Draft

doc = App.newDocument()

p1 = App.Vector(0, 0, 0)
p2 = App.Vector(1000, 500, 0)
p3 = App.Vector(-250, -500, 0)
p4 = App.Vector(500, 1000, 0)

line1 = Draft.make_line(p1, p2)
line2 = Draft.make_line(p3, p4)

doc.recompute()