Draft Offset: Difference between revisions

From FreeCAD Documentation
m (png to svg)
(37 intermediate revisions by 6 users not shown)
Line 1: Line 1:
<languages/>
{{GuiCommand|Name=Draft Offset|Workbenches=[[Draft Module|Draft]], [[Arch Module|Arch]]|MenuLocation=Draft -> Offset|Shortcut=O S}}
<translate>
<!--T:16-->
{{Docnav
|[[Draft_Rotate|Rotate]]
|[[Draft_Trimex|Trim/Extend (Trimex)]]
|[[Draft_Module|Draft]]
|IconL=Draft_Rotate.svg
|IconC=Workbench_Draft.svg
|IconR=Draft_Trimex.svg
}}


<!--T:1-->
==Description==
{{GuiCommand
|Name=Draft Offset
|MenuLocation=Draft → Offset
|Workbenches=[[Draft Module|Draft]], [[Arch Module|Arch]]
|Shortcut={{KEY|O}} {{KEY|S}}
|SeeAlso=[[Draft Scale]], [[Part_Offset2D|Part 2D Offset]]
}}


==Description== <!--T:2-->
The Offset tool offsets the selected object by a given distance on the current [[Draft Workingplane|work plane]]. If no object is selected, you will be invited to select one.


<!--T:3-->
The Offset tool moves the selected object by a given distance (offset) perpendicular to itself.

<!--T:12-->
Typically this tool is used in copy mode to create offset copies of a base wire while leaving this wire in the same place. The offset copies are scaled versions of the original object. To create other scaled copies use [[Draft Scale|Draft Scale]]. To produce exact copies shifted a distance use [[Draft Move|Draft Move]].

</translate>
[[Image:Draft_Offset_example.jpg|400px]]
[[Image:Draft_Offset_example.jpg|400px]]
<translate>
<!--T:13-->
{{Caption|Offsetting a wire a certain distance from one of its edges}}


==Usage== <!--T:4-->
==How to use==


<!--T:5-->
# Select objects you wish to offset
# Select the object that you wish to offset.
# Press the {{KEY|[[Image:Draft Offset.png|16px]] [[Draft Offset]]}} button, or press {{KEY|O}} then {{KEY|S}} keys
# Press the {{Button|[[Image:Draft_Offset.svg|16px]] [[Draft Offset|Draft Offset]]}} button, or press {{KEY|O}} then {{KEY|S}} keys. If no object is selected, you will be invited to select one.
# Click a point on the 3D view, or type a distance.
# Click a point on the 3D view, or type in a distance.


<!--T:14-->
==Options==
The distance used to create the offset is perpendicular to one of the edges of the original shape, depending on the position of the pointer. If the pointer is moved closer to another edge, this edge now becomes the reference for the distance. Hold the {{KEY|Shift}} key to keep the current reference edge despite moving the pointer closer to other edges.


==Options== <!--T:6-->
* Press {{KEY|T}} or click the checkbox to check/uncheck the {{KEY|'''Continue'''}} button. If continue mode is on, the Offset tool will restart after you finish or close it, allowing you to offset or copy the objects another time without pressing the Offset button again.
* Pressing {{KEY|ALT}} or {{KEY|C}} or clicking the {{KEY|'''Copy'''}} button will make a copy of the objects, instead of moving them. If you keep {{KEY|ALT}} pressed after clicking the second point, you will be able to place more copies, until you release the {{KEY|ALT}} key.
* Press {{KEY|CTRL}} while drawing to force [[Draft_Snap|snapping]] your point to the nearest snap location, independently of the distance.
* Pressing {{KEY|SHIFT}} will [[Draft_Constrain|constrain]] you to the current segment, instead of picking the closest one.
* Press {{KEY|ESC}} or the {{KEY|'''Cancel'''}} button to abort the current command.


<!--T:7-->
==Scripting==
* Press {{KEY|P}} or click the checkbox to toggle ''copy'' mode. If copy mode is on, the Offset tool will keep the original shape in its place but will make a scaled copy at the chosen point.
* Hold {{KEY|Alt}} while picking the point to also toggle copy mode. Keeping {{KEY|Alt}} pressed will allow you to continue placing offset copies; release {{KEY|Alt}} to finish the operation and see all offset shapes.
* Click the "OCC-style" checkbox to toggle ''OCC'' mode. This will create an offset from both sides of an line segment, which will produce a specially closed shape with rounded edges at the ends of the segments.
:{{Emphasis|Note:}} with this style the original segments will be removed, so use copy mode to preserve the original edges.
* Hold {{KEY|Ctrl}} while offsetting to force [[Draft_Snap|snapping]] your point to the nearest snap location, independently of the distance.
* Hold {{KEY|Shift}} to keep the offset distance referred to the current segment, and avoid picking another reference.
* Press {{KEY|Esc}} or the {{button|Close}} button to abort the current command; offset copies already placed will remain.


==Scripting== <!--T:8-->
The Offset tool can by used in [[macros]] and from the python console by using the following function:
{{Emphasis|See also:}} [[Draft API|Draft API]] and [[FreeCAD Scripting Basics|FreeCAD Scripting Basics]].


<!--T:9-->
'''offset (object,Vector,[copymode],[bind],[sym])''': Offsets the given wire by applying the given Vector to its first vertex.
The Offset tool can be used in [[macros|macros]] and from the [[Python|Python]] console by using the following function:
If copymode is True, another object is created, otherwise the same object gets offsetted. If bind is True, and provided
the wire is open, the original and the offsetted wires will be bound by their endpoints, forming a face. If sym is True,
the offset is made on both sides, the total width being the length of the given vector. Returns
the offsetted object (or its copy if copymode as True).


</translate>
{{Code|code=
Offsetobj = offset(obj, delta, copy=False, bind=False, sym=False, occ=False)
}}
<translate>

<!--T:10-->
* Offsets the given {{incode|obj}} wire by applying the given {{incode|delta}}, defined as a vector, to its first vertex.
* If {{incode|copy}} is {{incode|True}} another object is created instead of offsetting the original object.
* If {{incode|bind}} is {{incode|True}}, and provided the wire object is open, the original and the offset wire will be tied at their endpoints, forming a face.
** If {{incode|sym}} is {{incode|True}}, {{incode|bind}} must be {{incode|True}} as well, and the offset is made on both sides of the wire, the total width being the length of the given vector.
* If {{incode|occ}} is {{incode|True}}, it will use OCC-style offsetting: it will offset from both sides, then tie the new wires together, and round the corners.
* {{incode|Offsetobj}} is returned with the original offset object, or with the new copy.

<!--T:11-->
Example:
Example:


</translate>
import FreeCAD,Draft
{{Code|code=
Draft.offset(FreeCAD.ActiveDocument.ActiveObject,FreeCAD.Vector(2,2,0))
import FreeCAD, Draft

p1 = FreeCAD.Vector(0, 0, 0)
p2 = FreeCAD.Vector(1500, 2000, 0)
p3 = FreeCAD.Vector(4000, 0, 0)

Wire = Draft.makeWire([p1, p2, p3])

vector = FreeCAD.Vector(0, 500, 0)
Offset_1 = Draft.offset(Wire, vector, copy=True)
Offset_2 = Draft.offset(Wire, 3*vector, copy=True)
Offset_3 = Draft.offset(Wire, 6*vector, copy=True)
Offset_4 = Draft.offset(Wire, 9*vector, copy=True)
Offset_5 = Draft.offset(Wire, 1.5*vector, copy=True, occ=True)
}}
<translate>

<!--T:15-->
{{Docnav
|[[Draft_Rotate|Rotate]]
|[[Draft_Trimex|Trim/Extend (Trimex)]]
|[[Draft_Module|Draft]]
|IconL=Draft_Rotate.svg
|IconC=Workbench_Draft.svg
|IconR=Draft_Trimex.svg
}}

<!--T:17-->
{{Draft Tools navi}}


<!--T:18-->
{{languages | {{es|Draft Offset/es}} {{fr|Draft Offset/fr}} {{it|Draft Offset/it}} {{se|Draft Offset/se}} }}
{{Userdocnavi}}
</translate>
{{clear}}

Revision as of 03:28, 21 February 2020

Draft Offset

Menu location
Draft → Offset
Workbenches
Draft, Arch
Default shortcut
O S
Introduced in version
-
See also
Draft Scale, Part 2D Offset

Description

The Offset tool moves the selected object by a given distance (offset) perpendicular to itself.

Typically this tool is used in copy mode to create offset copies of a base wire while leaving this wire in the same place. The offset copies are scaled versions of the original object. To create other scaled copies use Draft Scale. To produce exact copies shifted a distance use Draft Move.

Offsetting a wire a certain distance from one of its edges

Usage

  1. Select the object that you wish to offset.
  2. Press the Draft Offset button, or press O then S keys. If no object is selected, you will be invited to select one.
  3. Click a point on the 3D view, or type in a distance.

The distance used to create the offset is perpendicular to one of the edges of the original shape, depending on the position of the pointer. If the pointer is moved closer to another edge, this edge now becomes the reference for the distance. Hold the Shift key to keep the current reference edge despite moving the pointer closer to other edges.

Options

  • Press P or click the checkbox to toggle copy mode. If copy mode is on, the Offset tool will keep the original shape in its place but will make a scaled copy at the chosen point.
  • Hold Alt while picking the point to also toggle copy mode. Keeping Alt pressed will allow you to continue placing offset copies; release Alt to finish the operation and see all offset shapes.
  • Click the "OCC-style" checkbox to toggle OCC mode. This will create an offset from both sides of an line segment, which will produce a specially closed shape with rounded edges at the ends of the segments.
Note: with this style the original segments will be removed, so use copy mode to preserve the original edges.
  • Hold Ctrl while offsetting to force snapping your point to the nearest snap location, independently of the distance.
  • Hold Shift to keep the offset distance referred to the current segment, and avoid picking another reference.
  • Press Esc or the Close button to abort the current command; offset copies already placed will remain.

Scripting

See also: Draft API and FreeCAD Scripting Basics.

The Offset tool can be used in macros and from the Python console by using the following function:

Offsetobj = offset(obj, delta, copy=False, bind=False, sym=False, occ=False)
  • Offsets the given obj wire by applying the given delta, defined as a vector, to its first vertex.
  • If copy is True another object is created instead of offsetting the original object.
  • If bind is True, and provided the wire object is open, the original and the offset wire will be tied at their endpoints, forming a face.
    • If sym is True, bind must be True as well, and the offset is made on both sides of the wire, the total width being the length of the given vector.
  • If occ is True, it will use OCC-style offsetting: it will offset from both sides, then tie the new wires together, and round the corners.
  • Offsetobj is returned with the original offset object, or with the new copy.

Example:

import FreeCAD, Draft

p1 = FreeCAD.Vector(0, 0, 0)
p2 = FreeCAD.Vector(1500, 2000, 0)
p3 = FreeCAD.Vector(4000, 0, 0)

Wire = Draft.makeWire([p1, p2, p3])

vector = FreeCAD.Vector(0, 500, 0)
Offset_1 = Draft.offset(Wire, vector, copy=True)
Offset_2 = Draft.offset(Wire, 3*vector, copy=True)
Offset_3 = Draft.offset(Wire, 6*vector, copy=True)
Offset_4 = Draft.offset(Wire, 9*vector, copy=True)
Offset_5 = Draft.offset(Wire, 1.5*vector, copy=True, occ=True)