Draft Offset: Difference between revisions

From FreeCAD Documentation
(More information for the options)
(Updated default shortcuts.)
 
(72 intermediate revisions by 7 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
<translate>
<translate>

<!--T:16-->
{{Docnav
|[[Draft_Mirror|Mirror]]
|[[Draft_Trimex|Trimex]]
|[[Draft_Workbench|Draft]]
|IconL=Draft_Mirror.svg
|IconR=Draft_Trimex.svg
|IconC=Workbench_Draft.svg
}}

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


Line 13: Line 24:


<!--T:3-->
<!--T:3-->
The Offset tool moves the selected object by a given distance (offset) perpendicular to itself. If no object is selected, you will be invited to select one.
The [[Image:Draft_Offset.svg|24px]] '''Draft Offset''' command offsets each segment of a selected object over a given distance, or creates an offset copy of the selected object.

Typically this tool is used in copy mode to create offset copies of the base object while leaving the original object in the same place.


</translate>
</translate>
[[Image:Draft_Offset_example.jpg|400px]]
[[Image:Draft_Offset_example.jpg|400px]]
<translate>
<translate>
<!--T:13-->
{{Caption|Offsetting a Draft Wire}}


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

<!--T:20-->
See also: [[Draft_Snap|Draft Snap]] and [[Draft_Constrain|Draft Constrain]].


<!--T:5-->
<!--T:5-->
# Optionally select one object. The object must lie on the current [[Draft_SelectPlane|Draft working plane]].
# Select objects you wish to offset.
# There are several ways to invoke the command:
# Press the {{Button|[[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|Offset]]}} button.
# Click a point on the 3D view, or type a distance. This distance is perpendicular to one of the edges of the original shape.
#* Select the {{MenuCommand|Modification → [[Image:Draft_Offset.svg|16px]] Offset}} option from the menu.
#* Use the keyboard shortcut: {{KEY|O}} then {{KEY|S}}.
# If you have not yet selected an object: select an object in the [[3D_view|3D view]].
# The {{MenuCommand|Offset}} task panel opens. See [[#Options|Options]] for more information.
# To define the offset distance do one of the following:
#* Pick a point in the [[3D_view|3D view]].
#* Enter a numerical value:
#*# Make sure the pointer is on the correct side of the object in the [[3D_view|3D view]].
#*# Do not move the pointer out of the [[3D_view|3D view]].
#*# Enter a {{MenuCommand|Distance}}.
#*# Press {{KEY|Enter}} to finish the command.


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

<!--T:21-->
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:7-->
<!--T:7-->
* If the {{MenuCommand|OCC-style offset}} checkbox is checked a special offset style is used: open [[Draft_Wire|Draft Wires]] are offset on both sides, and new edges are connected with rounded corners. This only works for planar objects with at least two edges. Note that with this style a new non-parametric object is created, and if copy mode is off the original object is deleted.
* 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 offsets.
* Press {{KEY|C}} or click the {{MenuCommand|Copy}} checkbox to toggle copy mode. If copy mode is on, the command will create an offset copy instead of offsetting the original object.
* Holding down {{KEY|Alt}} before picking points in the [[3D_view|3D view]] will also toggle copy mode. While {{KEY|Alt}} is held down multiple offset points can be picked. Release {{KEY|Alt}} to finish the command and see the created copies.
* 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 end of the lines.
* Hold down {{KEY|Shift}} to keep the offset distance linked to the current segment.
:With this style the original line 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.
* Press {{KEY|S}} to switch [[Draft_Snap|Draft snapping]] on or off.
* Hold {{KEY|Shift}} to keep the offset distance on the current segment, instead of picking another one.
* Press {{KEY|Esc}} or the {{Button|Close}} button to abort the command.

* Press {{KEY|Esc}} or the {{button|Close}} button to abort the current command; copies already placed will remain.
==Notes== <!--T:22-->

<!--T:23-->
* To create an offset version of a [[Draft_BSpline|Draft BSpline]] its points are offset individually, and from the new points a new spline is calculated. This new spline is not parallel to the original spline. For an exact parallel offset of a [[Draft_BSpline|Draft BSpline]] the [[Part_Offset2D|Part Offset2D]] command should be used.
* The Draft Offset command cannot handle [[Draft_BezCurve|Draft BezCurves]]. Use the [[Part_Offset2D|Part Offset2D]] command instead.

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


==Scripting== <!--T:8-->
<!--T:8-->
See also: [https://freecad.github.io/SourceDoc/ Autogenerated API documentation] and [[FreeCAD Scripting Basics|FreeCAD Scripting Basics]].


<!--T:9-->
<!--T:9-->
To offset objects use the {{incode|offset}} method of the Draft module. The method can only handle [[Draft_Wire|Draft Wires]], [[Draft_Circle|Draft Circles]], [[Draft_Rectangle|Draft Rectangles]], [[Draft_Polygon|Draft Polygons]] and [[Draft_BSpline|Draft BSplines]].
The Offset tool can by used in [[macros]] and from the python console by using the following function:


</translate>
</translate>
{{Code|code=
{{Code|code=
offset_obj = offset(obj, delta, copy=False, bind=False, sym=False, occ=False)
offset (object,Vector,[copymode],[bind],[sym])
}}
}}
<translate>
<translate>


<!--T:10-->
<!--T:10-->
* {{incode|obj}} is the object to be offset.
* Offsets the given wire by applying the given Vector to its first vertex.
* {{incode|delta}} contains the offset information:
* If copymode is True, another object is created, otherwise the same object gets offsetted.
** For [[Draft_Wire|Draft Wires]], [[Draft_Rectangle|Draft Rectangles]] and [[Draft_Polygon|Draft Polygons]] it is an offset vector that must be perpendicular to the first segment of the object.
* 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.
** For [[Draft_Circle|Draft Circles]] it is the new radius.
* If sym is True, the offset is made on both sides, the total width being the length of the given vector.
** For [[Draft_BSpline|Draft BSplines]] it is a list of new points.
* Returns the offsetted object (or its copy if copymode as True).
* If {{incode|copy}} is {{incode|True}} the original object is kept and a new object is created.
* If {{incode|bind}} is {{incode|True}} a face is created by connecting the shape of the original object and the shape of its offset. This only works for open [[Draft_Wire|Draft Wires]].
* If {{incode|sym}} is {{incode|True}}, and {{incode|bind}} is {{incode|True}} as well, the offset is made on both sides of the original object, the total width being the length of the given vector. This only works for open [[Draft_Wire|Draft Wires]].
* If {{incode|occ}} is {{incode|True}} OCC-style offsetting is used. See [[#Options|Options]]. If {{incode|occ}} is {{incode|True}} the {{incode|bind}} and {{incode|sym}} arguments are ignored.
* {{incode|offset_obj}} is returned with the original offset object, or with the new object. If {{incode|bind}} is {{incode|True}} or {{incode|occ}} is {{incode|True}}, the new object is a {{incode|[[Part_Feature|Part::Feature]]}} object.


<!--T:11-->
<!--T:11-->
Line 62: Line 103:
</translate>
</translate>
{{Code|code=
{{Code|code=
import FreeCAD,Draft
import FreeCAD as App
import Draft
Draft.offset(FreeCAD.ActiveDocument.ActiveObject,FreeCAD.Vector(2,2,0))

doc = App.newDocument()

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

wire = Draft.make_wire([p1, p2, p3])
doc.recompute()

vector = App.Vector(-200, 150, 0)
offset1 = Draft.offset(wire, vector, copy=True, bind=True, sym=True)
offset2 = Draft.offset(wire, 3*vector, copy=True)
offset3 = Draft.offset(wire, 6*vector, copy=True)
offset4 = Draft.offset(wire, 9*vector, copy=True)
offset5 = Draft.offset(wire, 1.5*vector, copy=True, occ=True)

doc.recompute()
}}
}}
<translate>


<!--T:15-->
{{Docnav
|[[Draft_Mirror|Mirror]]
|[[Draft_Trimex|Trimex]]
|[[Draft_Workbench|Draft]]
|IconL=Draft_Mirror.svg
|IconR=Draft_Trimex.svg
|IconC=Workbench_Draft.svg
}}

</translate>
{{Draft Tools navi{{#translation:}}}}
{{Userdocnavi{{#translation:}}}}

Latest revision as of 18:41, 6 January 2024

Draft Offset

Menu location
Modification → Offset
Workbenches
Draft, Arch
Default shortcut
O S
Introduced in version
-
See also
Part Offset2D

Description

The Draft Offset command offsets each segment of a selected object over a given distance, or creates an offset copy of the selected object.

Offsetting a Draft Wire

Usage

See also: Draft Snap and Draft Constrain.

  1. Optionally select one object. The object must lie on the current Draft working plane.
  2. There are several ways to invoke the command:
    • Press the Offset button.
    • Select the Modification → Offset option from the menu.
    • Use the keyboard shortcut: O then S.
  3. If you have not yet selected an object: select an object in the 3D view.
  4. The Offset task panel opens. See Options for more information.
  5. To define the offset distance do one of the following:
    • Pick a point in the 3D view.
    • Enter a numerical value:
      1. Make sure the pointer is on the correct side of the object in the 3D view.
      2. Do not move the pointer out of the 3D view.
      3. Enter a Distance.
      4. Press Enter to finish the command.

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

  • If the OCC-style offset checkbox is checked a special offset style is used: open Draft Wires are offset on both sides, and new edges are connected with rounded corners. This only works for planar objects with at least two edges. Note that with this style a new non-parametric object is created, and if copy mode is off the original object is deleted.
  • Press C or click the Copy checkbox to toggle copy mode. If copy mode is on, the command will create an offset copy instead of offsetting the original object.
  • Holding down Alt before picking points in the 3D view will also toggle copy mode. While Alt is held down multiple offset points can be picked. Release Alt to finish the command and see the created copies.
  • Hold down Shift to keep the offset distance linked to the current segment.
  • Press S to switch Draft snapping on or off.
  • Press Esc or the Close button to abort the command.

Notes

  • To create an offset version of a Draft BSpline its points are offset individually, and from the new points a new spline is calculated. This new spline is not parallel to the original spline. For an exact parallel offset of a Draft BSpline the Part Offset2D command should be used.
  • The Draft Offset command cannot handle Draft BezCurves. Use the Part Offset2D command instead.

Scripting

See also: Autogenerated API documentation and FreeCAD Scripting Basics.

To offset objects use the offset method of the Draft module. The method can only handle Draft Wires, Draft Circles, Draft Rectangles, Draft Polygons and Draft BSplines.

offset_obj = offset(obj, delta, copy=False, bind=False, sym=False, occ=False)
  • obj is the object to be offset.
  • delta contains the offset information:
  • If copy is True the original object is kept and a new object is created.
  • If bind is True a face is created by connecting the shape of the original object and the shape of its offset. This only works for open Draft Wires.
  • If sym is True, and bind is True as well, the offset is made on both sides of the original object, the total width being the length of the given vector. This only works for open Draft Wires.
  • If occ is True OCC-style offsetting is used. See Options. If occ is True the bind and sym arguments are ignored.
  • offset_obj is returned with the original offset object, or with the new object. If bind is True or occ is True, the new object is a Part::Feature object.

Example:

import FreeCAD as App
import Draft

doc = App.newDocument()

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

wire = Draft.make_wire([p1, p2, p3])
doc.recompute()

vector = App.Vector(-200, 150, 0)
offset1 = Draft.offset(wire, vector, copy=True, bind=True, sym=True)
offset2 = Draft.offset(wire, 3*vector, copy=True)
offset3 = Draft.offset(wire, 6*vector, copy=True)
offset4 = Draft.offset(wire, 9*vector, copy=True)
offset5 = Draft.offset(wire, 1.5*vector, copy=True, occ=True)

doc.recompute()