Draft Scale: Difference between revisions

From FreeCAD Documentation
(More details on the options)
No edit summary
(23 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
<translate>
<translate>
<!--T:16-->
{{Docnav
|[[Draft_Downgrade|Downgrade]]
|[[Draft_Edit|Edit]]
|[[Draft_Module|Draft]]
|IconL=Draft_Downgrade.svg
|IconC=Workbench_Draft.svg
|IconR=Draft_Edit.svg
}}

<!--T:1-->
<!--T:1-->
{{GuiCommand
{{GuiCommand
|Name=Draft Scale
|Name=Draft Scale
|MenuLocation=Draft → Scale
|MenuLocation=Draft → Scale
|Workbenches=[[Draft Module|Draft]], [[Arch Module|Arch]]
|Workbenches=[[Draft_Module|Draft]], [[Arch_Module|Arch]]
|Shortcut=S C
|Shortcut={{KEY|S}} {{KEY|C}}
|SeeAlso=[[Draft Clone|Draft Clone]], [[Draft Offset]]
|SeeAlso=[[Draft_Clone|Draft Clone]], [[Draft_Offset|Draft Offset]]
}}
}}


Line 13: Line 23:


<!--T:3-->
<!--T:3-->
The Scale tool scales selected objects around a base point. If no object is selected, you will be invited to select one.
The {{Button|[[Image:Draft Scale.svg|16px]] [[Draft Scale|Draft Scale]]}} tool scales or copies selected objects around a base point.

<!--T:12-->
The Scale tool can produce a copy or a [[Draft Clone|Draft Clone]] at a defined scale. Use [[Draft Offset|Draft Offset]] to produce a scaled copy of a wire set at a certain offset. A simple copy with no scaling can be produced with [[Draft Move|Draft Move]].

<!--T:13-->
This tool can be used on 2D shapes created with the [[Image:Workbench_Draft.svg|16px]] [[Draft Workbench|Draft Workbench]] but can also be used on many types of 3D objects such as those created with the [[Image:Workbench_Part.svg|16px]] [[Part Workbench|Part]] or [[Image:Workbench_PartDesign.svg|16px]] [[PartDesign Workbench|PartDesign]] workbenches.


</translate>
</translate>
[[Image:Draft_Scale_example.jpg|400px]]
[[Image:Draft_Scale_example.jpg|400px]]
<translate>
<translate>
<!--T:14-->
{{Caption|Scaling one object from a reference point to a second point}}


==How to use== <!--T:4-->
==Usage== <!--T:4-->


<!--T:5-->
<!--T:5-->
# Select objects you wish to scale.
# Select the objects that you wish to scale.
# Press the {{Button|[[Image:Draft Scale.svg|16px]] [[Draft Scale]]}} button, or press {{KEY|S}} then {{KEY|C}} keys.
# Press the {{Button|[[Image:Draft Scale.svg|16px]] [[Draft Scale|Draft Scale]]}} button, or press {{KEY|S}} then {{KEY|C}} keys. If no object is selected, you will be invited to select one.
# 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. This serves as the base point of the operation.
# 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. This serves as the base point of the operation.
# Change the X factor, Y factor, or Z factor and press {{KEY|Enter}} or the {{Button|OK}} button to finish the scaling.
# Set the X, Y, and Z factors, and the appropriate result options, then press {{KEY|Enter}} or the {{Button|OK}} button to finish the operation.


==Options== <!--T:6-->
==Options== <!--T:6-->
Line 35: Line 53:
** Click the "Working plane orientation" checkbox to lock the X, Y and Z scaling along the current [[Draft SelectPlane|Working Plane]]; otherwise, global X, Y and Z directions are used.
** Click the "Working plane orientation" checkbox to lock the X, Y and Z scaling along the current [[Draft SelectPlane|Working Plane]]; otherwise, global X, Y and Z directions are used.
* Three options control the result of the scaling operation:
* Three options control the result of the scaling operation:
** Create a clone. A [[Draft Clone]] of the original object will be created. This will work for all object types.
** Create a clone. A [[Draft Clone|Draft Clone]] of the original object will be created. This will work for all object types.
::{{Emphasis|Note:}} even if the scaling factors are left at their default values (1.0, 1.0, 1.0), a clone allows you to change these factors manually in the [[property editor]].
::{{Emphasis|Note:}} even if the scaling factors are left at their default values (1.0, 1.0, 1.0), once the clone is created you will be able to change these factors manually in the [[property editor|property editor]].
:* Modify original. The original object will have its size modified. This will only work with Draft objects and non-parametric Part shapes.
:* Modify original. The original object will have its size modified. This will only work with [[Draft Workbench|Draft]] objects and non-parametric [[Part Workbench|Part]] shapes.
:* Create a copy. A scaled copy of the original object will be created. This will work for all object types, but only the copies of Draft objects will be parametric.
:* Create a copy. A scaled copy of the original object will be created. This will work for all object types, but only the copies of [[Draft Workbench|Draft]] objects will be parametric.
::{{Emphasis|Note:}} a copy is a completely different object from the original shape; it will be created at the specified scale, and then will have its own set of properties. On the other hand, a [[Draft Clone]] is linked to the original shape and the only property that can be changed is the scale.
::{{Emphasis|Note:}} a copy is a completely different object from the original shape; it will be created at the specified scale, and then will have its own set of properties. On the other hand, a [[Draft Clone|Draft Clone]] is linked to the original shape and the only property that can be changed is the scale.
* Image planes created with the Image workbench are also supported (but not in clone mode).


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


<!--T:9-->
<!--T:9-->
The Scale tool can by used in [[macros]] and from the python console by using the following function:
The Scale tool can be used in [[macros|macros]] and from the [[Python|Python]] console by using the following function:


</translate>
</translate>
{{Code|code=
{{Code|code=
scale (objects,vector,[center,copy,legacy])
scaledlist = scale(objectslist, delta=Vector(1,1,1), center=Vector(0,0,0), copy=False, legacy=False)
}}
}}
<translate>
<translate>


<!--T:10-->
<!--T:10-->
* Scales the objects contained in objects (that can be a list of objects or an object) of the given scale factors defined by the given vector (in X, Y and Z directions) around the given center.
* Scales the objects in {{incode|objectslist}} by the factors specified by the components of {{incode|delta}}, defined as a {{incode|FreeCAD.Vector}}, and using {{incode|center}} as base point.
** {{incode|objectslist}} is either a single object or a list of objects.
* If legacy is True, direct (old) mode is used, otherwise a parametric copy is made.
* If copy is True, the actual objects are not moved, but copies are created instead.
* If {{incode|copy}} is {{incode|True}} copies are created instead of modifying the original objects.
* If {{incode|legacy}} is {{incode|True}}, direct copy mode is used (outdated), otherwise a parametric copy is made.
* The objects (or their copies) are returned.
* {{incode|scaledlist}} is returned with the original scaled objects, or with the new clones.
** {{incode|scaledlist}} is either a single object or a list of objects, depending on the input {{incode|objectslist}}.


<!--T:11-->
<!--T:11-->
Line 63: Line 85:
</translate>
</translate>
{{Code|code=
{{Code|code=
import FreeCAD,Draft
import FreeCAD, Draft

Draft.scale(FreeCAD.ActiveDocument.ActiveObject,FreeCAD.Vector(2,2,2))
Polygon1 = Draft.makePolygon(3, radius=1200)
delta1 = FreeCAD.Vector(2.3, 0.75, 0)

clone_1 = Draft.scale(Polygon1, delta1, copy=True)

Polygon2 = Draft.makePolygon(5, radius=750)
delta2 = FreeCAD.Vector(-2, -1.5, 0)

clone_2 = Draft.scale([Polygon1, Polygon2], delta2, copy=True)
Draft.move(clone_2, FreeCAD.Vector(3500, 1000, 0))
}}
}}
<translate>

<!--T:15-->
{{Docnav
|[[Draft_Downgrade|Downgrade]]
|[[Draft_Edit|Edit]]
|[[Draft_Module|Draft]]
|IconL=Draft_Downgrade.svg
|IconC=Workbench_Draft.svg
|IconR=Draft_Edit.svg
}}

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

Revision as of 21:14, 24 November 2020

Draft Scale

Menu location
Draft → Scale
Workbenches
Draft, Arch
Default shortcut
S C
Introduced in version
-
See also
Draft Clone, Draft Offset

Description

The Draft Scale tool scales or copies selected objects around a base point.

The Scale tool can produce a copy or a Draft Clone at a defined scale. Use Draft Offset to produce a scaled copy of a wire set at a certain offset. A simple copy with no scaling can be produced with Draft Move.

This 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 or PartDesign workbenches.

File:Draft Scale example.jpg

Scaling one object from a reference point to a second point

Usage

  1. Select the objects that you wish to scale.
  2. Press the Draft Scale button, or press S then C 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.
  4. Set the X, Y, and Z factors, and the appropriate result options, then press Enter or the OK button to finish the operation.

Options

  • To enter coordinates manually, simply enter the numbers, then press Enter between each X, Y and Z component. You can press the add point button when you have the desired values to insert the point.
  • Fill in the X, Y and Z factors to define the scaling along that direction.
    • Click the "Uniform scaling" checkbox to lock the X, Y and Z factors to the same value.
    • Click the "Working plane orientation" checkbox to lock the X, Y and Z scaling along the current Working Plane; otherwise, global X, Y and Z directions are used.
  • Three options control the result of the scaling operation:
    • Create a clone. A Draft Clone of the original object will be created. This will work for all object types.
Note: even if the scaling factors are left at their default values (1.0, 1.0, 1.0), once the clone is created you will be able to change these factors manually in the property editor.
  • Modify original. The original object will have its size modified. This will only work with Draft objects and non-parametric Part shapes.
  • Create a copy. A scaled copy of the original object will be created. This will work for all object types, but only the copies of Draft objects will be parametric.
Note: a copy is a completely different object from the original shape; it will be created at the specified scale, and then will have its own set of properties. On the other hand, a Draft Clone is linked to the original shape and the only property that can be changed is the scale.
  • Image planes created with the Image workbench are also supported (but not in clone mode).

Scripting

See also: Draft API and FreeCAD Scripting Basics.

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

scaledlist = scale(objectslist, delta=Vector(1,1,1), center=Vector(0,0,0), copy=False, legacy=False)
  • Scales the objects in objectslist by the factors specified by the components of delta, defined as a FreeCAD.Vector, and using center as base point.
    • objectslist is either a single object or a list of objects.
  • If copy is True copies are created instead of modifying the original objects.
  • If legacy is True, direct copy mode is used (outdated), otherwise a parametric copy is made.
  • scaledlist is returned with the original scaled objects, or with the new clones.
    • scaledlist is either a single object or a list of objects, depending on the input objectslist.

Example:

import FreeCAD, Draft

Polygon1 = Draft.makePolygon(3, radius=1200)
delta1 = FreeCAD.Vector(2.3, 0.75, 0)

clone_1 = Draft.scale(Polygon1, delta1, copy=True)

Polygon2 = Draft.makePolygon(5, radius=750)
delta2 = FreeCAD.Vector(-2, -1.5, 0)

clone_2 = Draft.scale([Polygon1, Polygon2], delta2, copy=True)
Draft.move(clone_2, FreeCAD.Vector(3500, 1000, 0))