Difference between revisions of "Draft Rotate"

From FreeCAD Documentation
Jump to navigation Jump to search
(Added Notes and Preferences)
(Relative checkbox remove in V0.20. See https://github.com/FreeCAD/FreeCAD/pull/5384)
 
(34 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Page_in_progress}}
 
 
<languages/>
 
<languages/>
 
<translate>
 
<translate>
Line 7: Line 6:
 
|[[Draft_Move|Move]]
 
|[[Draft_Move|Move]]
 
|[[Draft_Scale|Scale]]
 
|[[Draft_Scale|Scale]]
|[[Draft_Module|Draft]]
+
|[[Draft_Workbench|Draft]]
 
|IconL=Draft_Move.svg
 
|IconL=Draft_Move.svg
 
|IconR=Draft_Scale.svg
 
|IconR=Draft_Scale.svg
Line 17: Line 16:
 
|Name=Draft Rotate
 
|Name=Draft Rotate
 
|MenuLocation=Modification → Rotate
 
|MenuLocation=Modification → Rotate
|Workbenches=[[Draft_Module|Draft]], [[Arch_Module|Arch]]
+
|Workbenches=[[Draft_Workbench|Draft]], [[Arch_Workbench|Arch]]
 
|Shortcut={{KEY|R}} {{KEY|O}}
 
|Shortcut={{KEY|R}} {{KEY|O}}
 
|Version=0.7
 
|Version=0.7
|SeeAlso=[[Draft_Move|Draft Move]], [[Draft_Array|Draft Array]]
+
|SeeAlso=[[Draft_SubelementHighlight|Draft SubelementHighlight]]
 
}}
 
}}
  
Line 26: Line 25:
  
 
<!--T:3-->
 
<!--T:3-->
The Rotate tool rotates or copies the selected objects by a given angle around a reference point.
+
The [[Image:Draft_Rotate.svg|24px]] '''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_Line|Draft Lines]] and [[Draft_Wire|Draft Wires]].
  
 
<!--T:13-->
 
<!--T:13-->
The Rotate tool can be used on 2D shapes created with the [[Draft_Module|Draft Workbench]] or [[Sketcher_Workbench|Sketcher Workbench]], but can also be used on many types of 3D objects such as those created with the [[Part_Module|Part Workbench]] or [[Arch_Module|Arch Workbench]].
+
The command can be used on 2D objects created with the [[Draft_Workbench|Draft Workbench]] or [[Sketcher_Workbench|Sketcher Workbench]], but also on many 3D objects such as those created with the [[Part_Workbench|Part Workbench]], [[PartDesign_Workbench|PartDesign Workbench]] or [[Arch_Workbench|Arch Workbench]].
 
 
<!--T:14-->
 
To move without rotation, use [[Draft_Move|Draft Move]]. To produce various copies in different arrangements use [[Draft_Array|Draft Array]], [[Draft_PathArray|Draft PathArray]] and [[Draft_PointArray|Draft PointArray]].
 
  
 
</translate>
 
</translate>
Line 38: Line 34:
 
<translate>
 
<translate>
 
<!--T:15-->
 
<!--T:15-->
{{Caption|Rotating one object using a center reference point, from one reference angle to another angle}}
+
{{Caption|Rotating an object around a center point}}
  
 
==Usage== <!--T:4-->
 
==Usage== <!--T:4-->
 +
 +
<!--T:22-->
 +
See also: [[Draft_Snap|Draft Snap]] and [[Draft_Constrain|Draft Constrain]].
  
 
<!--T:5-->
 
<!--T:5-->
# Select the objects that you wish to move or copy.
+
# Optionally select one or more objects, or one or more subelements of [[Draft_Line|Draft Lines]] or [[Draft_Wire|Draft Wires]].
# Press the {{Button|[[Image:Draft Rotate.svg|16px]] [[Draft_Rotate|Draft Rotate]]}} button, or press {{KEY|R}} then {{KEY|O}} keys. If no object is selected, you will be invited to select one.
+
# There are several ways to invoke the command:
# Click a first point on the [[3D_view|3D view]], or type a [[Draft_Coordinates|coordinate]] and press the {{Button|[[Image:Draft_AddPoint.svg|16px]] [[Draft_AddPoint|add point]]}} button. This serves as the base point of the operation, through which the axis of rotation will pass.
+
#* Press the {{Button|[[Image:Draft_Rotate.svg|16px]] [[Draft_Rotate|Draft Rotate]]}} button.
# Click a second point on the [[3D_view|3D view]], or type a base angle. This defines a baseline that will rotate around the first point.
+
#* Select the {{MenuCommand|Modification → [[Image:Draft_Rotate.svg|16px]] Rotate}} option from the menu.
# Click a third point on the [[3D_view|3D view]], or type a rotation angle. This indicates the rotation of the baseline, and thus the objects.
+
#* Use the keyboard shortcut: {{KEY|R}} then {{KEY|O}}.
 +
# If you have not yet selected an object: select an object in the [[3D_view|3D view]].
 +
# The {{MenuCommand|Rotate}} task panel opens. See [[#Options|Options]] for more information.
 +
# If subelements have been selected: check the {{MenuCommand|Modify subelements}} checkbox to switch on subelement mode.
 +
# Pick the first point, the center of rotation, in the [[3D_view|3D view]], or type coordinates and press the {{Button|[[Image:Draft_AddPoint.svg|16px]] Enter point}} button.
 +
# Pick the second point in the [[3D_view|3D view]], or enter a {{MenuCommand|Base angle}}.
 +
# Pick the third point in the [[3D_view|3D view]], or enter a {{MenuCommand|Rotation}}.
  
 
==Options== <!--T:6-->
 
==Options== <!--T:6-->
 +
 +
<!--T:23-->
 +
The single character keyboard shortcuts and the modifier key mentioned here can be changed. See [[Draft_Preferences|Draft Preferences]].
  
 
<!--T:7-->
 
<!--T:7-->
* Press {{KEY|X}}, {{KEY|Y}} or {{KEY|Z}} after a point to constrain the next point on the given axis.
+
* To manually enter the coordinates for the center of rotation enter the X, Y and Z component, and press {{KEY|Enter}} after each. Or you can press the {{Button|[[Image:Draft_AddPoint.svg|16px]] Enter point}} button when you have the desired values. It is advisable to move the pointer out of the [[3D_view|3D view]] before entering coordinates.
* To enter coordinates manually, simply enter the numbers, then press {{KEY|Enter}} between each X, Y and Z component. You can press the {{Button|[[Image:Draft_AddPoint.svg|16px]] [[Draft_AddPoint|add point]]}} button when you have the desired values to insert the point.
+
* The {{MenuCommand|Relative}} checkbox, displayed in FreeCAD version 0.19 and earlier, has no purpose for this command.
* Press {{KEY|T}} or click the checkbox to toggle ''continue'' mode. If continue mode is on, the Rotate tool will restart after you finish the operation, allowing you to rotate or copy the objects again without pressing the tool button again.
+
* Press {{KEY|G}} or click the {{MenuCommand|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 [[Draft_SelectPlane|working plane]] coordinate system. {{Version|0.20}}
* Press {{KEY|P}} or click the checkbox to toggle ''copy'' mode. If copy mode is on, the Rotate tool will keep the original shape in its place but will make a copy at the set angle set by the third point.
+
* Press {{KEY|T}} or click the {{MenuCommand|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 {{MenuCommand|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|Preferences]].
:You can use both {{KEY|T}} and {{KEY|P}} to place several copies in sequence. In this case, the duplicated element is the last placed copy.
+
* Press {{KEY|P}} or click the {{MenuCommand|Copy}} checkbox to toggle copy mode. If copy mode is on, the command will create rotated copies instead of rotating the original objects.
* Hold {{KEY|Alt}} after the second point to also toggle copy mode. Keeping {{KEY|Alt}} pressed after clicking on the third point will allow you to continue placing copies using the same rotation base point and baseline; release {{KEY|Alt}} to finish the operation and see all copies.
+
* Press {{KEY|D}} or click the {{MenuCommand|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 [[Draft_Line|Draft Lines]] or [[Draft_Wire|Draft Wires]].
* Hold {{KEY|Ctrl}} while rotating to force [[Draft_Snap|snapping]] your point to the nearest snap location, independently of the distance.
+
* If copy mode and subelement mode are both on, and edges of [[Draft_Wire|Draft Wires]] are selected, new wires will be created from those edges.
* Hold {{KEY|Shift}} while rotating to [[Draft_Constrain|constrain]] your next point horizontally or vertically in relation to the rotation base point.
+
* Holding down {{KEY|Alt}} after entering the {{MenuCommand|Base angle}} will also toggle copy mode. While {{KEY|Alt}} is held down multiple points can be picked for the {{MenuCommand|Rotation}}. Release {{KEY|Alt}} to finish the command and see the created copies.
* Press {{KEY|Esc}} or the {{button|Close}} button to abort the current command; copies already placed will remain.
+
* Press {{KEY|S}} to switch [[Draft_Snap|Draft snapping]] on or off.
 +
* Press {{KEY|Esc}} or the {{Button|Close}} button to abort the command.
  
== Notes ==
+
==Notes== <!--T:24-->
  
* An Object that is [[Part_Attachment|attached]] cannot be rotated with the Draft Rotate command. To rotate it either its {{PropertyData|Support}} object has to be rotated, or its {{PropertyData|Attachment Offset}} has to be changed.
+
<!--T:25-->
 +
* An Object that is [[Part_EditAttachment|attached]] cannot be rotated with the Draft Rotate command. To rotate it either its {{PropertyData|Support}} object has to be rotated, or its {{PropertyData|Attachment Offset}} has to be changed.
  
== Preferences ==
+
==Preferences== <!--T:26-->
  
 +
<!--T:27-->
 
See also: [[Preferences_Editor|Preferences Editor]] and [[Draft_Preferences|Draft Preferences]].
 
See also: [[Preferences_Editor|Preferences Editor]] and [[Draft_Preferences|Draft Preferences]].
  
* To switch on copy mode by default check: {{MenuCommand|Edit → Preferences... → Draft → General settings → Draft tools options → Global copy mode}}.
+
<!--T:28-->
* To reselect the base objects after copying objects check: {{MenuCommand|Edit → Preferences... → Draft → General settings → Draft tools options → Select base objects after copying}}.
+
* To change the number of decimals used for the input of coordinates and angles: {{MenuCommand|Edit → Preferences... → General → Units → Units settings → Number of decimals}}.
 +
* To store and reuse the same copy mode setting across commands: {{MenuCommand|Edit → Preferences... → Draft → General settings → Draft tools options → Global copy mode}}.
 +
* To reselect the base objects after copying objects: {{MenuCommand|Edit → Preferences... → Draft → General settings → Draft tools options → Select base objects after copying}}.
  
 
==Scripting== <!--T:21-->
 
==Scripting== <!--T:21-->
Line 136: Line 149:
 
|[[Draft_Move|Move]]
 
|[[Draft_Move|Move]]
 
|[[Draft_Scale|Scale]]
 
|[[Draft_Scale|Scale]]
|[[Draft_Module|Draft]]
+
|[[Draft_Workbench|Draft]]
 
|IconL=Draft_Move.svg
 
|IconL=Draft_Move.svg
 
|IconR=Draft_Scale.svg
 
|IconR=Draft_Scale.svg

Latest revision as of 19:33, 24 January 2022

Other languages:
Deutsch • ‎English • ‎Türkçe • ‎español • ‎français • ‎italiano • ‎polski • ‎português do Brasil • ‎română • ‎svenska • ‎čeština • ‎русский
Arrow-left.svg Previous: Draft Move.svg Move
Next: Scale Draft Scale.svg Arrow-right.svg

Draft Rotate.svg Draft Rotate

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

Description

The Draft Rotate.svg 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.

Draft Rotate example.jpg

Rotating an object around a center point

Usage

See also: Draft Snap and Draft Constrain.

  1. Optionally select one or more objects, or one or more subelements of Draft Lines or Draft Wires.
  2. There are several ways to invoke the command:
    • Press the Draft Rotate.svg Draft Rotate button.
    • Select the Modification → Draft Rotate.svg Rotate option from the menu.
    • Use the keyboard shortcut: R then O.
  3. If you have not yet selected an object: select an object in the 3D view.
  4. The Rotate task panel opens. See Options for more information.
  5. If subelements have been selected: check the Modify subelements checkbox to switch on subelement mode.
  6. Pick the first point, the center of rotation, in the 3D view, or type coordinates and press the Draft AddPoint.svg Enter point button.
  7. Pick the second point in the 3D view, or enter a Base angle.
  8. Pick the third point in the 3D view, or enter a Rotation.

Options

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 Enter after each. Or you can press the Draft AddPoint.svg 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, displayed in FreeCAD version 0.19 and earlier, 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 create rotated copies instead of rotating the original objects.
  • Press D 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 Draft Lines or Draft Wires.
  • 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 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 S to switch Draft snapping on or off.
  • 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 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.

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


Arrow-left.svg Previous: Draft Move.svg Move
Next: Scale Draft Scale.svg Arrow-right.svg