Draft Rotate/sv: Difference between revisions

From FreeCAD Documentation
(Updating to match new version of source page)
(Updating to match new version of source page)
 
(16 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<languages/>
<languages/>

{{Docnav|[[Draft_Move|Move]]|[[Draft_Offset|Offset]]|[[Draft_Module|Draft]]|IconL=Draft_Move.svg|IconC=Workbench_Draft.svg|IconR=Draft_Offset.svg}}
{{Docnav
|[[Draft_Move|Move]]
|[[Draft_Scale|Scale]]
|[[Draft_Workbench|Draft]]
|IconL=Draft_Move.svg
|IconR=Draft_Scale.svg
|IconC=Workbench_Draft.svg
}}


<div class="mw-translate-fuzzy">
<div class="mw-translate-fuzzy">
{{GuiCommand/sv|Name=Draft_Rotate|Workbenches=[[Draft Module/sv|Skiss]]|MenuLocation=Draft -> Rotate}}
{{GuiCommand/sv|Name=Draft_Rotate|Workbenches=[[Draft_Workbench/sv|Skiss]]|MenuLocation=Draft -> Rotate}}
</div>
</div>


<span id="Description"></span>
==Beskrivning==
==Beskrivning==


Line 12: Line 21:
</div>
</div>


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

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


[[Image:Draft_Rotate_example.jpg|400px]]
[[Image:Draft_Rotate_example.jpg|400px]]
{{Caption|Rotating one object using a center reference point, from one reference angle to another angle}}
{{Caption|Rotating an object around a center point}}


<span id="Usage"></span>
<div class="mw-translate-fuzzy">
==Bruk==
==Bruk==
</div>

See also: [[Draft_Snap|Draft Snap]] and [[Draft_Constrain|Draft Constrain]].


<div class="mw-translate-fuzzy">
<div class="mw-translate-fuzzy">
Line 26: Line 38:
* Nedtryckning av {{KEY|SKIFT}} kommer att [[Draft_Constrain/sv|begränsa]] dig vertikalt eller horisontellt i relation till rotationscentrum.
* Nedtryckning av {{KEY|SKIFT}} kommer att [[Draft_Constrain/sv|begränsa]] dig vertikalt eller horisontellt i relation till rotationscentrum.
* Om du trycker på {{KEY|ESC}} så avbryts funktionen.
* Om du trycker på {{KEY|ESC}} så avbryts funktionen.
* Skriv in siffror för att [[Draft_Coordinates/sv|manuellt mata in en koordinat]].
* Skriv in siffror för att manuellt mata in en koordinat.
* {{KEY|C}} växlar kopieringsläget på/av. Med kopiering på, så kommer objekt(en) att kopieras istället för att flyttas.
* {{KEY|C}} växlar kopieringsläget på/av. Med kopiering på, så kommer objekt(en) att kopieras istället för att flyttas.
* Nedtryckning av {{KEY|ALT}} kommer att skapa en kopia, även om kopieringsknappen är av.
* Nedtryckning av {{KEY|ALT}} kommer att skapa en kopia, även om kopieringsknappen är av.
* Om {{KEY|ALT}} är nedtryckt, så kan du göra multipla kopior ända tills {{KEY|ALT}} släpps.
* Om {{KEY|ALT}} är nedtryckt, så kan du göra multipla kopior ända tills {{KEY|ALT}} släpps.
</div>
</div>

===Limitations===
When rotating an object that is based on a [[Sketcher Sketch]], for example, a feature created with the [[PartDesign Workbench]] ([[PartDesign Pad|Pad]], [[PartDesign Revolution|Revolution]], etc.) you must move the original sketch. If you move the derived object, it will just go back to the position defined by the sketch.


==Options==
==Options==


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).
* Press {{KEY|X}}, {{KEY|Y}} or {{KEY|Z}} after a point to constrain the next point on the given axis.

* 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.
* 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.
* 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|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|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|N}} 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.
* 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|C}} 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.
* Press {{KEY|B}} 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==

* 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.
* The base angle concept can be somewhat confusing. Especially since it works only when selecting points, not when specifying the angle using the input field. An explanation of how it works, with an example, can be found in [https://forum.freecad.org/viewtopic.php?p=736674#p736674 this forum thread].

==Preferences==

See also: [[Preferences_Editor|Preferences Editor]] and [[Draft_Preferences|Draft Preferences]].

* To reselect the base objects after copying objects: {{MenuCommand|Edit → Preferences... → Draft → General → Select base objects after copying}}.


==Scripting==
==Scripting==
{{Emphasis|See also:}} [[Draft API]] and [[FreeCAD Scripting Basics]].


See also: [https://freecad.github.io/SourceDoc/ Autogenerated API documentation] and [[FreeCAD_Scripting_Basics|FreeCAD Scripting Basics]].
The Rotate tool can be used in [[macros]] and from the [[Python]] console by using the following function:

To rotate objects use the {{incode|rotate}} method of the Draft module.


{{Code|code=
{{Code|code=
rotatedlist = rotate(objectslist, angle, center=Vector(0,0,0), axis=Vector(0,0,1), copy=False)
rotated_list = rotate(objectslist, angle, center=Vector(0,0,0), axis=Vector(0,0,1), copy=False)
}}
}}


* {{incode|objectslist}} contains the objects to be rotated. It is either a single object or a list of objects.
* Rotates the base point of the objects in {{incode|objectlist}} by the given {{incode|angle}}.
** {{incode|objectlist}} is either a single object or a list of objects.
* {{incode|angle}} is the angle of rotation in degrees.
* {{incode|center}} is the center point of rotation.
** If a rotation base point ({{incode|center}}), and {{incode|axis}} are given, they are used; otherwise the rotation is based on the origin and around the Z axis.
* {{incode|axis}} is the direction of the axis of rotation.
:The rotation angle is relative to the base point of the object, which means that if an object is rotated 45 degrees, and then another 45 degrees, it will have rotated 90 degrees in total from its original position.
* If {{incode|copy}} is {{incode|True}} copies are created instead of rotating the original objects.
* If {{incode|copy}} is {{incode|True}} copies are created instead of rotating the original objects.
* {{incode|rotatedlist}} is returned with the original rotated objects, or with the new copies.
* {{incode|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 {{incode|objectlist}}.
** {{incode|rotatedlist}} is either a single object or a list of objects, depending on the input {{incode|objectlist}}.


Example:
Example:

{{Code|code=
{{Code|code=
import FreeCAD, Draft
import FreeCAD as App
import Draft


doc = App.newDocument()
Polygon1 = Draft.makePolygon(3, radius=500)
Draft.move(Polygon1, FreeCAD.Vector(1500, 0, 0))


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


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


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


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

doc.recompute()
}}
}}


{{Docnav|[[Draft_Move|Move]]|[[Draft_Offset|Offset]]|[[Draft_Module|Draft]]|IconL=Draft_Move.svg|IconC=Workbench_Draft.svg|IconR=Draft_Offset.svg}}


{{Docnav
{{Draft Tools navi}}
|[[Draft_Move|Move]]
|[[Draft_Scale|Scale]]
|[[Draft_Workbench|Draft]]
|IconL=Draft_Move.svg
|IconR=Draft_Scale.svg
|IconC=Workbench_Draft.svg
}}


{{Draft Tools navi{{#translation:}}}}
{{Userdocnavi}}
{{Userdocnavi{{#translation:}}}}
{{clear}}

Latest revision as of 17:30, 26 February 2024

Draft_Rotate

Menyplacering
Draft -> Rotate
Arbetsbänkar
Skiss
Standard genväg
Ingen
Introducerad i version
-
Se även
Ingen

Beskrivning

Detta verktyg roterar de markerade objekten. Om inga objekt är valda så kommer du ombes att välja ett. Sedan ombes användaren att ange rotationscentrum, startvinkel och rotationsvinkel.

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

Bruk

See also: Draft Snap and Draft Constrain.

  • Markera punkter i ett tomt område i 3d vyn, eller på ett existerande objekt.
  • Nedtryckning av CTRL kommer att snäppa din punkt till tillgängliga snäpp-punkter.
  • Nedtryckning av SKIFT kommer att begränsa dig vertikalt eller horisontellt i relation till rotationscentrum.
  • Om du trycker på ESC så avbryts funktionen.
  • Skriv in siffror för att manuellt mata in en koordinat.
  • C växlar kopieringsläget på/av. Med kopiering på, så kommer objekt(en) att kopieras istället för att flyttas.
  • Nedtryckning av ALT kommer att skapa en kopia, även om kopieringsknappen är av.
  • Om ALT är nedtryckt, så kan du göra multipla kopior ända tills ALT släpps.

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

  • 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.
  • 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 N 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 C 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 B 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.
  • The base angle concept can be somewhat confusing. Especially since it works only when selecting points, not when specifying the angle using the input field. An explanation of how it works, with an example, can be found in this forum thread.

Preferences

See also: Preferences Editor and Draft Preferences.

  • To reselect the base objects after copying objects: Edit → Preferences... → Draft → General → 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()