Draft Mirror: Difference between revisions

From FreeCAD Documentation
(Created page with "<translate> {{GuiCommand|Name=Draft Mirror|Workbenches=Draft, Arch|MenuLocation=Draft → Mirror|SeeAlso=Draft Scale}} ==Desc...")
 
(Marked this version for translation)
(28 intermediate revisions by 5 users not shown)
Line 1: Line 1:
<languages/>
<translate>
<translate>
<!--T:16-->
{{GuiCommand|Name=Draft Mirror|Workbenches=[[Draft Module|Draft]], [[Arch Module|Arch]]|MenuLocation=Draft → Mirror|SeeAlso=[[Draft Scale|Draft Scale]]}}
{{Docnav
|[[Draft_Drawing|Drawing]]
|[[Draft_Stretch|Stretch]]
|[[Draft_Module|Draft]]
|IconL=Draft_Drawing.svg
|IconC=Workbench_Draft.svg
|IconR=Draft_Stretch.svg
}}


<!--T:1-->
==Description==
{{GuiCommand
This tool produces a mirrored copy of a selected object, using a [[Part Mirror]] object. The copy is parametrically bound to the original object: If the original object changes, the mirrored copy changes too, but keeps mirrored.
|Name=Draft Mirror
|MenuLocation=Draft → Mirror
|Workbenches=[[Draft Module|Draft]], [[Arch Module|Arch]]
|SeeAlso=[[Draft Scale|Draft Scale]], [[Draft Clone|Draft Clone]]
}}


==Description== <!--T:19-->

<!--T:2-->
The {{Button|[[Image:Draft Mirror.svg|16px]] [[Draft Mirror|Draft Mirror]]}} tool produces a mirrored copy of a selected object, using the [[Part Mirror|Part Mirror]] operation. The copy, just like a [[Draft Clone|Draft Clone]], is linked to the original object. This means that if the original object changes its shape and properties, the mirrored shape changes as well.

<!--T:10-->
The Mirror tool can be used on 2D shapes created with the [[Draft Workbench|Draft Workbench]], but can also be used on many types of 3D objects such as those created with the [[Part Workbench|Part]], [[PartDesign Workbench|PartDesign]], or [[Arch Workbench|Arch Workbench]]es.

<!--T:11-->
To create copies or clones, and manually place them use [[Draft Move|Draft Move]], [[Draft Rotate|Draft Rotate]], and [[Draft Clone|Draft Clone]].

</translate>
[[Image:Draft_Mirror_example.jpg|400px]]
[[Image:Draft_Mirror_example.jpg|400px]]
<translate>
<!--T:3-->
{{Caption|Mirrored object created using a mirroring line}}


==Usage== <!--T:20-->
==How to use==
# Select objects you wish to mirror
# Press the {{KEY|[[Image:Draft Mirror.png|16px]] [[Draft Mirror]]}} button
# Click the first point of the mirror line on the 3D view, or type a [[Draft_Coordinates|coordinate]]
# Click the other point of the mirror line on the 3D view, or type a [[Draft_Coordinates|coordinate]]


<!--T:4-->
==Properties==
# Select an object that you wish to mirror.
* {{PropertyData|Base}}: The base point of the mirror plane
# Press the {{Button|[[Image:Draft Mirror.svg|16px]] [[Draft Mirror|Draft Mirror]]}} button. If no object is selected, you will be invited to select one.
* {{PropertyData|Normal}}: The normal direction of the mirror plane
# Click a first point on the 3D view, or type a [[Draft_Coordinates|coordinate]] and press the {{Button|[[Image:Draft_AddPoint.svg|16px]] [[Draft_AddPoint|add point]]}} button.
# Click a second point on the 3D view, or type a [[Draft_Coordinates|coordinate]] and press the {{Button|[[Image:Draft_AddPoint.svg|16px]] [[Draft_AddPoint|add point]]}} button. These points define a line, which together with the camera view, define a mirroring plane that is used to create the mirrored object.


<!--T:12-->
==Options==
* After the creation of the mirror, its binding with the original object can be removed using the [[Part_CreateSimpleCopy|Part Create Simple Copy]] tool.
After creating the mirrored copy, its binding with the original object can be removed using the {{Button|[[Image:Tree_Part.svg|16px]] [[Part_SimpleCopy|Part Create simple copy]]}} tool.
* The mirror of a Draft object can also be turned into a Draft Wire, using [[Draft Downgrade]] then [[Draft Upgrade]].


<!--T:13-->
==Scripting==
A mirrored copy of a Draft object can be turned into a [[Draft Wire|Draft Wire]], by using {{Button|[[Image:Draft Downgrade.svg|16px]] [[Draft Downgrade]]}} then {{Button|[[Image:Draft Upgrade.svg|16px]] [[Draft Upgrade|Draft Upgrade]]}}.
The Clone tool can by used in [[macros]] and from the python console by using the following function:


==Options== <!--T:6-->
* Press {{KEY|X}}, {{KEY|Y}} or {{KEY|Z}} after the first point to constrain the second point on the given axis.
* To enter coordinates manually, simply enter the numbers, then press {{KEY|Enter}} between each X, Y and Z component.
* Press {{KEY|R}} or click the checkbox to toggle ''relative'' mode. If relative mode is on, the coordinates of the second point are relative to the first one; if not, they are absolute, taken from the origin (0,0,0).
* Press {{KEY|T}} or click the checkbox to toggle ''continue'' mode. If continue mode is on, the Mirror tool will restart after you give the second point, allowing you to put another object without pressing the tool button again.
* Hold {{KEY|Ctrl}} while drawing to force [[Draft_Snap|snapping]] your point to the nearest snap location, independently of the distance.
* Hold {{KEY|Shift}} while drawing to [[Draft_Constrain|constrain]] your second point horizontally or vertically in relation to the first one.
* Press {{KEY|Esc}} or the {{Button|Close}} button to abort the current command.

==Properties== <!--T:5-->
* {{PropertyData|Source}}: specifies the object to mirror,
* {{PropertyData|Base}}: specifies the base point of the mirror plane.
* {{PropertyData|Normal}}: specifies the normal direction of the mirror plane.

==Scripting== <!--T:7-->
{{Emphasis|See also:}} [[Draft API|Draft API]] and [[FreeCAD Scripting Basics|FreeCAD Scripting Basics]].

<!--T:14-->
The Mirror tool can be used in [[macros|macros]] and from the [[Python|Python]] console by using the following function:
</translate>
</translate>
{{Code|code=
<syntaxhighlight>
mirror (objectslist,p1,p2)
mirrored_list = mirror(objlist, p1, p2)
}}
</syntaxhighlight>
<translate>
<translate>


<!--T:8-->
* Makes mirror(s) of the given object(s) across a plane defined by a line from p1 to p2, and parallel to the current view
* Creates [[Part Mirror|Part Mirror]] objects from {{incode|objlist}}, which can be a single object or a list of objects.
* The result is a [[Part Mirror]] object
* The mirroring plane is defined by the line built with points {{incode|p1}} and {{incode|p2}}, and parallel to the current view.
* If the original object changes, the final object changes too but keeps mirrored
* {{incode|mirrored_list}} is returned with the new objects.
** {{incode|mirrored_list}} is either a single object or a list of objects, depending on the input {{incode|objlist}}.


<!--T:9-->
Example:
Example:

</translate>
</translate>
{{Code|code=
<syntaxhighlight>
import Draft,FeeCAD
import FeeCAD, Draft
p1 = FreeCAD.Vector(0,0,0)
p2 = FreeCAD.Vector(2,2,0)
Draft.mirror(FreeCAD.ActiveDocument.ActiveObject,p1,p2)
</syntaxhighlight>


place = FreeCAD.Placement(FreeCAD.Vector(1000, 0, 0), FreeCAD.Rotation())
Polygon1 = Draft.makePolygon(3, 750)
Polygon2 = Draft.makePolygon(5, 750, placement=place)

p1 = FreeCAD.Vector(2000, -1000, 0)
p2 = FreeCAD.Vector(2000, 1000, 0)

Line1 = Draft.makeLine(p1, p2)
mirrored1 = Draft.mirror(Polygon1, p1, p2)

Line2 = Draft.makeLine(-p1, -p2)
mirrored2 = Draft.mirror([Polygon1, Polygon2], -p1, -p2)
}}
<translate>

<!--T:15-->
{{Docnav
|[[Draft_Drawing|Drawing]]
|[[Draft_Stretch|Stretch]]
|[[Draft_Module|Draft]]
|IconL=Draft_Drawing.svg
|IconC=Workbench_Draft.svg
|IconR=Draft_Stretch.svg
}}

</translate>
{{Draft Tools navi{{#translation:}}}}
{{Userdocnavi{{#translation:}}}}
{{clear}}
{{clear}}
<languages/>

Revision as of 20:29, 21 February 2020

Draft Mirror

Menu location
Draft → Mirror
Workbenches
Draft, Arch
Default shortcut
None
Introduced in version
-
See also
Draft Scale, Draft Clone

Description

The Draft Mirror tool produces a mirrored copy of a selected object, using the Part Mirror operation. The copy, just like a Draft Clone, is linked to the original object. This means that if the original object changes its shape and properties, the mirrored shape changes as well.

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

To create copies or clones, and manually place them use Draft Move, Draft Rotate, and Draft Clone.

Mirrored object created using a mirroring line

Usage

  1. Select an object that you wish to mirror.
  2. Press the Draft Mirror button. 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.
  4. Click a second point on the 3D view, or type a coordinate and press the add point button. These points define a line, which together with the camera view, define a mirroring plane that is used to create the mirrored object.

After creating the mirrored copy, its binding with the original object can be removed using the Part Create simple copy tool.

A mirrored copy of a Draft object can be turned into a Draft Wire, by using Draft Downgrade then Draft Upgrade.

Options

  • Press X, Y or Z after the first point to constrain the second point on the given axis.
  • To enter coordinates manually, simply enter the numbers, then press Enter between each X, Y and Z component.
  • Press R or click the checkbox to toggle relative mode. If relative mode is on, the coordinates of the second point are relative to the first one; if not, they are absolute, taken from the origin (0,0,0).
  • Press T or click the checkbox to toggle continue mode. If continue mode is on, the Mirror tool will restart after you give the second point, allowing you to put another object without pressing the tool button again.
  • Hold Ctrl while drawing to force snapping your point to the nearest snap location, independently of the distance.
  • Hold Shift while drawing to constrain your second point horizontally or vertically in relation to the first one.
  • Press Esc or the Close button to abort the current command.

Properties

  • DataSource: specifies the object to mirror,
  • DataBase: specifies the base point of the mirror plane.
  • DataNormal: specifies the normal direction of the mirror plane.

Scripting

See also: Draft API and FreeCAD Scripting Basics.

The Mirror tool can be used in macros and from the Python console by using the following function:

mirrored_list = mirror(objlist, p1, p2)
  • Creates Part Mirror objects from objlist, which can be a single object or a list of objects.
  • The mirroring plane is defined by the line built with points p1 and p2, and parallel to the current view.
  • mirrored_list is returned with the new objects.
    • mirrored_list is either a single object or a list of objects, depending on the input objlist.

Example:

import FeeCAD, Draft

place = FreeCAD.Placement(FreeCAD.Vector(1000, 0, 0), FreeCAD.Rotation())
Polygon1 = Draft.makePolygon(3, 750)
Polygon2 = Draft.makePolygon(5, 750, placement=place)

p1 = FreeCAD.Vector(2000, -1000, 0)
p2 = FreeCAD.Vector(2000, 1000, 0)

Line1 = Draft.makeLine(p1, p2)
mirrored1 = Draft.mirror(Polygon1, p1, p2)

Line2 = Draft.makeLine(-p1, -p2)
mirrored2 = Draft.mirror([Polygon1, Polygon2], -p1, -p2)