Draft Line/sv: Difference between revisions

From FreeCAD Documentation
(Updating to match new version of source page)
(Updating to match new version of source page)
Line 1: Line 1:
<languages/>
<languages/>

{{Docnav
{{Docnav
|
|
Line 20: Line 21:
Detta verktyg ber användaren om 2 punkter och ritar en linje mellan dem. Punkterna kan väljas med musen i 3d vyn eller genom att mata in koordinater med tangentbordet.
Detta verktyg ber användaren om 2 punkter och ritar en linje mellan dem. Punkterna kan väljas med musen i 3d vyn eller genom att mata in koordinater med tangentbordet.
</div>
</div>

A Draft Line is in fact a [[Draft_Wire|Draft Wire]] with only two points.


[[Image:Draft_Line_example.jpg|400px]]
[[Image:Draft_Line_example.jpg|400px]]
Line 27: Line 30:


==Usage==
==Usage==

See also: [[Draft_Tray|Draft Tray]], [[Draft_Snap|Draft Snap]] and [[Draft_Constrain|Draft Constrain]].


<div class="mw-translate-fuzzy">
<div class="mw-translate-fuzzy">
Line 40: Line 45:
</div>
</div>


==Options==
The line can be edited by double clicking on the element in the tree view, or by pressing the {{Button|[[Image:Draft Edit.svg|16px]] [[Draft Edit|Draft Edit]]}} button. Then you can move the points to a new position.


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.
=== Fusing single lines ===
If several connected [[Draft_Line|Draft Lines]] are selected they can be fused into a wire by pressing the {{Button|[[Image:Draft_Upgrade.svg|16px]] [[Draft_Upgrade|Draft Upgrade]]}} tool; however, this [[Image:Workbench_Part.svg|24px]] Wire will not be editable. To '''create an editable wire''', use {{Button|[[Image:Draft_Upgrade.svg|16px]] [[Draft_Upgrade|Draft Upgrade]]}} three more times on the new shapes (wire, closed wire, face). You can also fuse the original lines with the {{Button|[[Image:Draft_Wire.svg|16px]] [[Draft_Wire|Draft Wire]]}} tool.


* 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.
=== Adding points ===
* You can use polar coordinates for the second point. Enter a value for the {{MenuCommand|Length}} and a value for the {{MenuCommand|Angle}}, and press {{KEY|Enter}} after each. Note that for an angle of {{Value|0.0°}} you must overwrite the default value even if it is already {{Value|0.0°}}.
A wire can also be created from a single line by adding another point anywhere along its length. To do this, press the {{Button|[[Image:Draft_AddPoint.svg|16px]] [[Draft_AddPoint|add point]]}} button, and click anywhere on the line.
* Check the {{MenuCommand|Angle}} checkbox to constrain the pointer to the specified angle. For this to work the {{MenuCommand|Length}} input box must contain a non-zero value.
* 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|T}} 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.
* 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.


==Options==
==Notes==

* Press {{KEY|X}}, {{KEY|Y}} or {{KEY|Z}} after the first point to constrain the second point on the given axis.
* A Draft Line can be edited with the [[Draft_Edit|Draft Edit]] command.
* To enter coordinates manually, simply enter the numbers, then press {{KEY|Enter}} between each X, Y and Z component.
* 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.
** 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.
* If the {{MenuCommand|Edit → Preferences... → Draft → General settings → Draft tools options → Use Part Primitives when available}} option is checked, the command will create a [[Part_Line|Part Line]] instead of a Draft Line. See [[Draft_Preferences#General_settings|Draft Preferences]].
** You can press the {{Button|[[Image:Draft_AddPoint.svg|16px]] [[Draft_AddPoint|add 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).
==Properties==
* 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|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]] [[Draft_UndoLine|Undo]]}} button to undo the last point.
* Press {{KEY|Esc}} or the {{Button|Close}} button to abort the current command.


<div class="mw-translate-fuzzy">
<div class="mw-translate-fuzzy">
Line 67: Line 73:
</div>
</div>


===Data===
==Scripting==
* {{PropertyData|Start}}: specifies the start point.
* {{PropertyData|End}}: specifies the end point.
* {{PropertyData|Subdivisions}}: specifies the number of interior nodes in the line. {{version|0.16}}
* {{PropertyData|Length}}: (read-only) specifies the length of the segment.


See also: [https://www.freecadweb.org/api Autogenerated API documentation] and [[FreeCAD Scripting Basics|FreeCAD Scripting Basics]].
===View===
* {{PropertyView|End Arrow}}: if it is {{TRUE}} it will display a symbol at the last point of the line, so it can be used as an annotation line.
* {{PropertyView|Arrow Size}}: specifies the size of the symbol displayed at the end of the line.
* {{PropertyView|Arrow Type}}: specifies the type of symbol displayed at the end of the line, which can be "Dot", "Circle", "Arrow", or "Tick".


To create a Draft Line use the {{incode|make_line}} method ({{Version|0.19}}) of the Draft module. This method replaces the deprecated {{incode|makeLine}} method.
==Scripting==
{{Emphasis|See also:}} [[Draft API|Draft API]] and [[FreeCAD Scripting Basics|FreeCAD Scripting Basics]].


The Line tool can be used in [[macros|macros]] and from the [[Python|Python]] console by using the following function:
{{Code|code=
{{Code|code=
Line = makeLine(p1, p2)
line = make_line(p1, p2)
Line = makeLine(LineSegment)
line = make_line(LineSegment)
Line = makeLine(Shape)
line = make_line(Shape)
}}
}}


Line 93: Line 90:


Example:
Example:

{{Code|code=
{{Code|code=
import FreeCAD as App
import FreeCAD as App
import Draft
import Draft


_doc = App.newDocument()
doc = App.newDocument()


p1 = App.Vector(0, 0, 0)
p1 = App.Vector(0, 0, 0)
Line 104: Line 102:
p4 = App.Vector(500, 1000, 0)
p4 = App.Vector(500, 1000, 0)


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

_doc.recompute()
doc.recompute()
}}
}}



{{Docnav
{{Docnav
Line 120: Line 120:
{{Draft Tools navi{{#translation:}}}}
{{Draft Tools navi{{#translation:}}}}
{{Userdocnavi{{#translation:}}}}
{{Userdocnavi{{#translation:}}}}
{{clear}}

Revision as of 11:14, 4 May 2021

Draft Line

Menyplacering
Draft → Line
Arbetsbänkar
Skiss
Standard genväg
L I
Introducerad i version
-
Se även
Draft Wire

Description

Beskrivning

Detta verktyg ber användaren om 2 punkter och ritar en linje mellan dem. Punkterna kan väljas med musen i 3d vyn eller genom att mata in koordinater med tangentbordet.

A Draft Line is in fact a Draft Wire with only two points.

Usage

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

Bruk

  • Markera punkter i ett tomt område i 3d vyn, eller på ett existerande objekt.
  • Nedtryckning av CTRL kommer att snäppa din punkt till tillgängliga snäpp-punkter.
  • Nedtryckning av SKIFT kommer att begränsa din nya punkt i relation till föregående punkt.
  • Skriv in siffror för att manuellt mata in en koordinat.
  • Nedtryckning av CTRL+Z eller klickning på "Undo" knappen kommer att ångra den sista punkten.
  • Om du trycker på ESC så avbryts funktionen.
  • Den skapade cirkeln kommer att ha nuvarande linjestil.

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 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.
  • You can use polar coordinates for the second point. Enter a value for the Length and a value for the Angle, and press Enter after each. Note that for an angle of 0.0° you must overwrite the default value even if it is already 0.0°.
  • Check the Angle checkbox to constrain the pointer to the specified angle. For this to work the Length input box must contain a non-zero value.
  • 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 finishing, allowing you to continue creating lines.
  • The Undo button has no purpose for this command.
  • Press Esc or the Close button to abort the command.

Notes

  • A Draft Line can be edited with the Draft Edit command.
  • Draft Lines and Draft Wires can be joined with the Draft Wire command, the Draft Join command or the Draft Upgrade command.
  • If the Edit → Preferences... → Draft → General settings → Draft tools options → Use Part Primitives when available option is checked, the command will create a Part Line instead of a Draft Line. See Draft Preferences.

Properties

Egenskaper

  • DATAStart: Startpunkten
  • DATAEnd: Slutpunkten
  • DATASubdivisions: Delar linjen med det angivna antalet underavdelningar introduced in version 0.16

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