Draft Line: Difference between revisions

From FreeCAD Documentation
(Updated default shortcuts.)
 
(46 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Page_in_progress}}
<languages/>
<languages/>
<translate>
<translate>
Line 7: Line 6:
|
|
|[[Draft_Wire|Wire]]
|[[Draft_Wire|Wire]]
|[[Draft_Module|Draft]]
|[[Draft_Workbench|Draft]]
|IconL=
|IconL=
|IconR=Draft_Wire.svg
|IconR=Draft_Wire.svg
Line 17: Line 16:
|Name=Draft Line
|Name=Draft Line
|MenuLocation=Drafting → Line
|MenuLocation=Drafting → Line
|Workbenches=[[Draft_Module|Draft]], [[Arch_Module|Arch]]
|Workbenches=[[Draft_Workbench|Draft]], [[Arch_Workbench|Arch]]
|Shortcut={{KEY|L}} {{KEY|I}}
|Shortcut={{KEY|L}} {{KEY|I}}
|Version=0.7
|Version=0.7
Line 27: Line 26:
<!--T:2-->
<!--T:2-->
The [[Image:Draft_Line.svg|24px]] '''Draft Line''' command creates a straight line.
The [[Image:Draft_Line.svg|24px]] '''Draft Line''' command creates a straight line.

<!--T:22-->
A Draft Line is in fact a [[Draft_Wire|Draft Wire]] with only two points.


</translate>
</translate>
Line 32: Line 34:
<translate>
<translate>
<!--T:3-->
<!--T:3-->
{{Caption|A Draft Line defined by two points}}
{{Caption|Line defined by two points}}


==Usage== <!--T:21-->
==Usage== <!--T:21-->


<!--T:23-->
See also: [[Draft_Linestyle|Draft Linestyle]], [[Draft_Snap|Draft Snap]] and [[Draft_Constrain|Draft Constrain]].
See also: [[Draft_Tray|Draft Tray]], [[Draft_Snap|Draft Snap]] and [[Draft_Constrain|Draft Constrain]].


<!--T:4-->
<!--T:4-->
# There are several ways to invoke the command:
# There are several ways to invoke the command:
#* Press the {{Button|[[Image:Draft_Line.svg|16px]] [[Draft_Line|Draft Line]]}} button.
#* Press the {{Button|[[Image:Draft_Line.svg|16px]] [[Draft_Line|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.
#* Use the keyboard shortcut: {{KEY|L}} then {{KEY|I}}.
#* Use the keyboard shortcut: {{KEY|L}} then {{KEY|I}}.
# The {{MenuCommand|Line}} task panel opens. See [[#Options|Options]] for more information.<!--Correct task panel name in version 0.20-->
# The {{MenuCommand|Line}} task panel opens. See [[#Options|Options]] for more information.
# Click the first point in the [[3D_view|3D view]], or type [[Draft_Coordinates|coordinates]] and press the {{Button|[[Image:Draft_AddPoint.svg|16px]] Enter point}} button.
# Pick the first point in the [[3D_view|3D view]], or type coordinates and press the {{Button|[[Image:Draft_AddPoint.svg|16px]] Enter point}} button.
# Click the second point in the [[3D_view|3D view]], or type [[Draft_Coordinates|coordinates]] and press the {{Button|[[Image:Draft_AddPoint.svg|16px]] Enter point}} button.
# Pick the second point in the [[3D_view|3D view]], or type coordinates and press the {{Button|[[Image:Draft_AddPoint.svg|16px]] Enter point}} button.


==Options==
==Options== <!--T:24-->


<!--T:25-->
The single character keyboard shortcuts available in the task panel can be changed. See [[Draft_Preferences|Draft Preferences]]. The shortcuts mentioned here are the default shortcuts.
The single character keyboard shortcuts available in the task panel can be changed. See [[Draft_Preferences|Draft Preferences]]. The shortcuts mentioned here are the default shortcuts (for version 0.22).


<!--T:5-->
<!--T:5-->
* 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 manually enter coordinates 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.
* To use polar coordinates enter a value for the {{MenuCommand|Length}} and a value for the {{MenuCommand|Angle}}, and press {{KEY|Enter}} after each.
* 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.
* Check the {{MenuCommand|Angle}} checkbox to constrain the pointer to the specified angle.
* Press {{KEY|L}} to change the focus from the {{MenuCommand|X}} input box to the {{MenuCommand|Length}} input box and back. Depending on the input box that receives the focus the {{MenuCommand|Angle}} checkbox is checked or unchecked.
* 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}}
* Press {{KEY|T}} or click the {{MenuCommand|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.
* Press {{KEY|N}} or click the {{MenuCommand|Continue}} checkbox to toggle continue mode. If continue mode is on, the command will restart after finishing, allowing you to continue creating lines.
* Press {{KEY|S}} to switch [[Draft_Snap|Draft snapping]] on or off.
* The {{button|[[Image:Draft_UndoLine.svg|16px]] Undo}} button has no purpose for this command.
* Press {{KEY|Esc}} or the {{Button|Close}} button to abort the command.
* Press {{KEY|Esc}} or the {{Button|Close}} button to abort the command.


==Notes==
==Notes== <!--T:26-->


<!--T:10-->
<!--T:10-->
Line 67: Line 72:
* Draft Lines and [[Draft_Wire|Draft Wires]] can be joined with the [[Draft_Wire|Draft Wire]] command, the [[Draft_Join|Draft Join]] command or the [[Draft_Upgrade|Draft Upgrade]] command.
* Draft Lines and [[Draft_Wire|Draft Wires]] can be joined with the [[Draft_Wire|Draft Wire]] command, the [[Draft_Join|Draft Join]] command or the [[Draft_Upgrade|Draft Upgrade]] command.


==Preferences== <!--T:29-->
==Properties==

<!--T:30-->
See also: [[Preferences_Editor|Preferences Editor]] and [[Draft_Preferences|Draft Preferences]].

<!--T:31-->
* To change the initial focus of the task panel to the {{MenuCommand|Length}} input box: {{MenuCommand|Edit → Preferences... → Draft → General → Set focus on Length instead of X coordinate}}. Note that you must move the pointer in the [[3D_view|3D view]] for the change to take effect.
* If the {{MenuCommand|Edit → Preferences... → Draft → General → Create Part primitives if possible}} option is checked, the command will create a [[Part_Line|Part Line]] instead of a Draft Line.

==Properties== <!--T:27-->


<!--T:6-->
<!--T:6-->
See [[Draft_Wire#Properties|Draft Wire]].
A Draft Line is in fact a [[Draft_Wire|Draft Wire]] with only two points and has the same [[Draft_Wire#Properties|properties]].


==Scripting==
==Scripting== <!--T:28-->


<!--T:7-->
<!--T:7-->
See also: [https://www.freecadweb.org/api Autogenerated API documentation] and [[FreeCAD Scripting Basics|FreeCAD Scripting Basics]].
See also: [https://freecad.github.io/SourceDoc/ Autogenerated API documentation] and [[FreeCAD Scripting Basics|FreeCAD Scripting Basics]].


<!--T:15-->
<!--T:15-->
Line 120: Line 134:
|
|
|[[Draft_Wire|Wire]]
|[[Draft_Wire|Wire]]
|[[Draft_Module|Draft]]
|[[Draft_Workbench|Draft]]
|IconL=
|IconL=
|IconR=Draft_Wire.svg
|IconR=Draft_Wire.svg

Latest revision as of 18:16, 6 January 2024

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 is in fact a Draft Wire with only two points.

Line defined by two points

Usage

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

  1. There are several ways to invoke the command:
    • Press the 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. Pick the first point in the 3D view, or type coordinates and press the Enter point button.
  4. Pick 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 (for version 0.22).

  • To manually enter coordinates 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.
  • To use polar coordinates enter a value for the Length and a value for the Angle, and press Enter after each.
  • Check the Angle checkbox to constrain the pointer to the specified angle.
  • Press L to change the focus from the X input box to the Length input box and back. Depending on the input box that receives the focus the Angle checkbox is checked or unchecked.
  • 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 N or click the Continue checkbox to toggle continue mode. If continue mode is on, the command will restart after finishing, allowing you to continue creating lines.
  • Press S to switch Draft snapping on or off.
  • Press Esc or the Close button to abort the command.

Notes

Preferences

See also: Preferences Editor and Draft Preferences.

  • To change the initial focus of the task panel to the Length input box: Edit → Preferences... → Draft → General → Set focus on Length instead of X coordinate. Note that you must move the pointer in the 3D view for the change to take effect.
  • If the Edit → Preferences... → Draft → General → Create Part primitives if possible option is checked, the command will create a Part Line instead of a Draft Line.

Properties

See Draft Wire.

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