Draft Scale: Difference between revisions

From FreeCAD Documentation
Line 59: Line 59:


=== Second task panel ===
=== Second task panel ===



<!--T:7-->
<!--T:7-->
* Fill in the X, Y and Z factors to define the scaling along that direction.
* Enter the X, Y and Z factors to define the scaling.
** Click the "Uniform scaling" checkbox to lock the X, Y and Z factors to the same value.
* Check the {{MenuCommand|Uniform scaling}} checkbox to lock the X, Y and Z factors to the same value. For this setting to take effect one of the scale factors has to be changed. Alternatively you can click in the inputbox with the desired scale and press {{KEY|Enter}} to finish the command.
** 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.
* If the {{MenuCommand|Working plane orientation}} checkbox is checked the scale factors are relative to the [[Draft_SelectPlane|working plane]] coordinate system, else they are relative to the global coordinate system.
* If the {{MenuCommand|Copy}} checkbox is checked a scaled copy of the original object is created. This only works for objects that have a {{PropertyData|Points}} property, such as [[Draft_Wire|Draft Wires]].
* Three options control the result of the scaling operation:
* If the {{MenuCommand|Modify subelements}} checkbox is checked the selected subelements are scaled instead of the whole objects. The subelements must belong to objects with a {{PropertyData|Points}} property.
** Create a clone. A [[Draft Clone|Draft Clone]] of the original object will be created. This will work for all object types.
* If the {{MenuCommand|Create a clone}} checkbox is checked a scaled clone of the original object is created. This works for all object types. See [[Draft_Clone|Draft Clone]] for more information.
::{{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 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 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|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:19-->
==Scripting== <!--T:19-->

Revision as of 08:28, 30 May 2021

This documentation is a work in progress. Please don't mark it as translatable since it will change in the next hours and days.

Draft Scale

Menu location
Modification → 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

First task panel

The single character keyboard shortcuts available in this task panel can be changed. See Draft Preferences. The shortcuts mentioned here are the default shortcuts.

  • To manually enter the coordinates for the base point 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.
  • The Relative checkbox 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
  • The remaining checkboxes in this task panel are ignore by the command.

Second task panel

  • Enter the X, Y and Z factors to define the scaling.
  • Check the Uniform scaling checkbox to lock the X, Y and Z factors to the same value. For this setting to take effect one of the scale factors has to be changed. Alternatively you can click in the inputbox with the desired scale and press Enter to finish the command.
  • If the Working plane orientation checkbox is checked the scale factors are relative to the working plane coordinate system, else they are relative to the global coordinate system.
  • If the Copy checkbox is checked a scaled copy of the original object is created. This only works for objects that have a DataPoints property, such as Draft Wires.
  • If the Modify subelements checkbox is checked the selected subelements are scaled instead of the whole objects. The subelements must belong to objects with a DataPoints property.
  • If the Create a clone checkbox is checked a scaled clone of the original object is created. This works for all object types. See Draft Clone for more information.

Scripting

See also: Autogenerated API documentation and FreeCAD Scripting Basics.

To scale objects use the scale method of the Draft module.

scaled_list = scale(objectslist, scale=Vector(1,1,1), center=Vector(0,0,0), copy=False)
  • objectslist contains the objects to be scaled. It is either a single object or a list of objects.
  • scale is the vector that specifies by the X, Y and Z scale factors.
  • center is the center point of the scaling operation.
  • If copy is True copies are created instead of scaling the original objects.
  • scaled_list is returned with the original scaled objects, or with the new copies. It is either a single object or a list of objects, depending on objectslist.

Example:

import FreeCAD as App
import Draft

doc = App.newDocument()

pts = [App.Vector(0, 0, 0), App.Vector(500, 500, 0), App.Vector(600, 0, 0)]
wire1 = Draft.make_wire(pts, closed=True)
doc.recompute()

scale1 = App.Vector(2.3, 0.75, 0)
wire2 = Draft.scale(wire1, scale1, copy=True)
doc.recompute()

scale2 = App.Vector(-2, -1.5, 0)
wires = Draft.scale([wire1, wire2], scale2, copy=True)
doc.recompute()