Draft Rotate

From FreeCAD Documentation
Revision as of 13:41, 29 May 2021 by Roy 043 (talk | contribs) (Updated Options)
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 Rotate

Menu location
Modification → Rotate
Workbenches
Draft, Arch
Default shortcut
R O
Introduced in version
0.7
See also
Draft Move, Draft Array

Description

The Rotate tool rotates or copies the selected objects by a given angle around a reference point.

The Rotate tool can be used on 2D shapes created with the Draft Workbench or Sketcher Workbench, but can also be used on many types of 3D objects such as those created with the Part Workbench or Arch Workbench.

To move without rotation, use Draft Move. To produce various copies in different arrangements use Draft Array, Draft PathArray and Draft PointArray.

Rotating one object using a center reference point, from one reference angle to another angle

Usage

  1. Select the objects that you wish to move or copy.
  2. Press the Draft Rotate button, or press R then O keys. If no object is selected, you will be invited to select one.
  3. Click a first point on the 3D view, or type a coordinate and press the add point button. This serves as the base point of the operation, through which the axis of rotation will pass.
  4. Click a second point on the 3D view, or type a base angle. This defines a baseline that will rotate around the first point.
  5. Click a third point on the 3D view, or type a rotation angle. This indicates the rotation of the baseline, and thus the objects.

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 the coordinates for the center of rotation 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.
  • The Relative checkbox has no purpose for this command.
  • 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. This mode really only makes sense if copy mode is switched on. Depending on the Select base objects after copying preference, either the original objects are selected for the next command call or the copies that were created last. See Preferences.
  • Press P or click the Copy checkbox to toggle copy mode. If copy mode is on, the command will copy the selected objects instead of rotating them.
  • Holding down Alt after entering the Base angle will also toggle copy mode. While Alt is held down multiple points can be picked for the Rotation. Release Alt to finish the command and see the created copies.
  • Press Esc or the Close button to abort the command.

Notes

  • An Object that is attached cannot be rotated with the Draft Rotate command. To rotate it either its DataSupport object has to be rotated, or its DataAttachment Offset has to be changed.

Preferences

See also: Preferences Editor and Draft Preferences.

  • To switch on copy mode by default check: Edit → Preferences... → Draft → General settings → Draft tools options → Global copy mode.
  • To reselect the base objects after copying objects check: Edit → Preferences... → Draft → General settings → Draft tools options → Select base objects after copying.

Scripting

See also: Autogenerated API documentation and FreeCAD Scripting Basics.

To rotate objects use the rotate method of the Draft module.

rotated_list = rotate(objectslist, angle, center=Vector(0,0,0), axis=Vector(0,0,1), copy=False)
  • objectslist contains the objects to be rotated. It is either a single object or a list of objects.
  • angle is the angle of rotation in degrees.
  • center is the center point of rotation.
  • axis is the direction of the axis of rotation.
  • If copy is True copies are created instead of rotating the original objects.
  • rotated_list is returned with the original rotated objects, or with the new copies. It is either a single object or a list of objects, depending on objectlist.

Example:

import FreeCAD as App
import Draft

doc = App.newDocument()

polygon1 = Draft.make_polygon(3, radius=300)
Draft.move(polygon1, App.Vector(1000, 0, 0))

# Rotation around the origin
angle1 = 45
rot2 = Draft.rotate(polygon1, angle1, copy=True)
rot3 = Draft.rotate(polygon1, 2*angle1, copy=True)
rot4 = Draft.rotate(polygon1, 4*angle1, copy=True)

polygon2 = Draft.make_polygon(3, radius=1000)
polygon3 = Draft.make_polygon(5, radius=500)
Draft.move(polygon2, App.Vector(2000, 0, 0))
Draft.move(polygon3, App.Vector(2000, 0, 0))

# Rotation around another point
angle2 = 60
cen = App.Vector(3100, 0, 0)
list2 = [polygon2, polygon3]
rot_list2 = Draft.rotate(list2, angle2, center=cen, copy=True)
rot_list3 = Draft.rotate(list2, 2*angle2, center=cen, copy=True)
rot_list4 = Draft.rotate(list2, 4*angle2, center=cen, copy=True)

doc.recompute()