|Modification → Rotate|
|Introduced in version|
The Draft Rotate command rotates or copies selected objects around a center point by a given angle. In subelement mode the command rotates selected points and edges, or copies selected edges, of Draft Lines and Draft Wires.
The command can be used on 2D objects created with the Draft Workbench or Sketcher Workbench, but also on many 3D objects such as those created with the Part Workbench, PartDesign Workbench or Arch Workbench.
Rotating an object around a center point
- Optionally select one or more objects, or one or more subelements of Draft Lines or Draft Wires.
- There are several ways to invoke the command:
- If you have not yet selected an object: select an object in the 3D view.
- The Rotate task panel opens. See Options for more information.
- If subelements have been selected: check the Modify subelements checkbox to switch on subelement mode.
- Pick the first point, the center of rotation, in the 3D view, or type coordinates and press the button.
- Pick the second point in the 3D view, or enter a Base angle.
- Pick the third point in the 3D view, or enter a Rotation.
The single character keyboard shortcuts and the modifier key mentioned here can be changed. See Draft Preferences.
- To manually enter the coordinates for the center of rotation enter the X, Y and Z component, and press 3D view before entering coordinates. after each. Or you can press the button when you have the desired values. It is advisable to move the pointer out of the
- The Relative checkbox has no purpose for this command.
- Press working plane coordinate system. introduced in version 0.20 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
- Press Preferences. 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
- Press or click the Copy checkbox to toggle copy mode. If copy mode is on, the command will create rotated copies instead of rotating the original objects.
- Press Draft Lines or Draft Wires. or click the Modify subelements checkbox to toggle subelement mode. If subelement mode is on, the command will use the selected subelements instead of the whole objects. The subelements must belong to
- If copy mode and subelement mode are both on, and edges of Draft Wires are selected, new wires will be created from those edges.
- Holding down after entering the Base angle will also toggle copy mode. While is held down multiple points can be picked for the Rotation. Release to finish the command and see the created copies.
- Press or the button to abort the command.
- 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.
- To change the number of decimals used for the input of coordinates and angles: Edit → Preferences... → General → Units → Units settings → Number of decimals.
- To store and reuse the same copy mode setting across commands: Edit → Preferences... → Draft → General settings → Draft tools options → Global copy mode.
- To reselect the base objects after copying objects: Edit → Preferences... → Draft → General settings → Draft tools options → Select base objects after copying.
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)
objectslistcontains the objects to be rotated. It is either a single object or a list of objects.
angleis the angle of rotation in degrees.
centeris the center point of rotation.
axisis the direction of the axis of rotation.
Truecopies are created instead of rotating the original objects.
rotated_listis returned with the original rotated objects, or with the new copies. It is either a single object or a list of objects, depending on
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()