Draft Offset

From FreeCAD Documentation
Revision as of 13:33, 21 May 2021 by Roy 043 (talk | contribs) (Updated Scripting)
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 Offset

Menu location
Modification → 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: 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 contains 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 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: open Draft Wires are offset on both sides, and new wires are connected with rounded corners. This does not work for Draft Circles and Draft BSplines.
  • 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 will be a Part::PartFeature 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()