Draft Line: Difference between revisions

From FreeCAD Documentation
No edit summary
Line 26: Line 26:


<!--T:2-->
<!--T:2-->
The [[Image:Draft_Line.svg|24px]] [[Draft_Line|Draft Line]] command creates a straight line defined by two points. It uses the [[Draft_Linestyle|Draft Linestyle]] set on the [[Draft_Tray|Draft Tray]].
The [[Image:Draft_Line.svg|24px]] [[Draft_Line|Draft Line]] tool creates a straight line defined by two points. It uses the [[Draft_Linestyle|Draft Linestyle]] set on the [[Draft_Tray|Draft Tray]].


</translate>
</translate>
Line 37: Line 37:


<!--T:4-->
<!--T:4-->
# There are several ways to invoke the command:
# There are several ways to invoke the tool:
#* Press the {{Button|[[Image:Draft_Line.svg|16px]] [[Draft_Line|Draft Line]]}} button.
#* Press the {{Button|[[Image:Draft_Line.svg|16px]] [[Draft_Line|Draft Line]]}} button.
#* Select the {{MenuCommand|Drafting → [[Image:Draft_Line.svg|16px]] Line}} option from the menu.
#* Select the {{MenuCommand|Drafting → [[Image:Draft_Line.svg|16px]] Line}} option from the menu.
Line 52: Line 52:
** You can press the {{Button|[[Image:Draft_AddPoint.svg|16px]] Enter point}} button when you have the desired values to insert the point.
** You can press the {{Button|[[Image:Draft_AddPoint.svg|16px]] Enter point}} button when you have the desired values to insert the point.
* Press {{KEY|R}} or click the checkbox to toggle ''relative'' mode. If relative mode is on, the coordinates of the second point are relative to the first one; if not, they are absolute, taken from the origin (0,0,0).
* Press {{KEY|R}} or click the checkbox to toggle ''relative'' mode. If relative mode is on, the coordinates of the second point are relative to the first one; if not, they are absolute, taken from the origin (0,0,0).
* Press {{KEY|T}} or click the checkbox to toggle ''continue'' mode. If continue mode is on, the Line command will restart after you give the second point, allowing you to draw another line segment without pressing the command button again.
* Press {{KEY|T}} or click the checkbox to toggle ''continue'' mode. If continue mode is on, the Line tool will restart after you give the second point, allowing you to draw another line segment without pressing the tool button again.
* Hold {{KEY|Ctrl}} while drawing to force [[Draft_Snap|snapping]] your point to the nearest snap location, independently of the distance.
* Hold {{KEY|Ctrl}} while drawing to force [[Draft_Snap|snapping]] your point to the nearest snap location, independently of the distance.
* Hold {{KEY|Shift}} while drawing to [[Draft_Constrain|constrain]] your second point horizontally or vertically in relation to the first one.
* Hold {{KEY|Shift}} while drawing to [[Draft_Constrain|constrain]] your second point horizontally or vertically in relation to the first one.
* Press {{KEY|Ctrl}}+{{KEY|Z}} or press the {{button|[[Image:Draft_UndoLine.svg|12px]] Undo}} button to undo the last point.
* Press {{KEY|Ctrl}}+{{KEY|Z}} or press the {{button|[[Image:Draft_UndoLine.svg|12px]] Undo}} button to undo the last point.
* Press {{KEY|Esc}} or the {{Button|Close}} button to abort the command.
* Press {{KEY|Esc}} or the {{Button|Close}} button to abort the tool.


==Notes==
==Notes==


<!--T:10-->
<!--T:10-->
* A Draft Line can be edited with the [[Image:Draft_Edit.svg|16px]] [[Draft_Edit|Draft Edit]] command.
* A Draft Line can be edited with the [[Image:Draft_Edit.svg|16px]] [[Draft_Edit|Draft Edit]] tool.
* Draft Lines and [[Draft_Wire|Draft Wires]] can be joined with the [[Image:Draft_Wire.svg|16px]] [[Draft_Wire|Draft Wire]] command, the [[Image:Draft_Join.svg|16px]] [[Draft_Join|Draft Join]] command, or the [[Image:Draft_Upgrade.svg|16px]] [[Draft_Upgrade|Draft Upgrade]] command.
* Draft Lines and [[Draft_Wire|Draft Wires]] can be joined with the [[Image:Draft_Wire.svg|16px]] [[Draft_Wire|Draft Wire]] tool, the [[Image:Draft_Join.svg|16px]] [[Draft_Join|Draft Join]] tool, or the [[Image:Draft_Upgrade.svg|16px]] [[Draft_Upgrade|Draft Upgrade]] tool.


==Properties==
==Properties==

Revision as of 12:56, 17 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 tool creates a straight line defined by two points. It uses the Draft Linestyle set on the Draft Tray.

Line defined by two points

Usage

  1. There are several ways to invoke the tool:
    • Press the Draft Line button.
    • Select the Drafting → Line option from the menu.
    • Use the keyboard shortcut: L 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.

Options

  • Press X, Y or Z after the first point to constrain the second 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 also define the polar coordinates of the point by giving a value to "Length" and "Angle". Click on the checkbox next to "Angle" to constrain the pointer to the specified angle.
    • 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 second point are relative to the first 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 Line tool will restart after you give the second point, allowing you to draw another line segment without pressing the tool button again.
  • 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 second point horizontally or vertically in relation to the first one.
  • Press Ctrl+Z or press the Undo button to undo the last point.
  • Press Esc or the Close button to abort the tool.

Notes

Properties

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

Scripting

See also: Autogenerated API documentation and FreeCAD Scripting Basics.

To create a Draft Line use the make_line method of the Draft module:

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()