Draft PolarArray: Difference between revisions

From FreeCAD Documentation
(The PolarArray tool...)
(14 intermediate revisions by the same user not shown)
Line 17: Line 17:
|Workbenches=[[Draft Module|Draft]]
|Workbenches=[[Draft Module|Draft]]
|Version=0.19
|Version=0.19
|SeeAlso=[[Draft_Array|Array]], [[Draft_CircularArray|CircularArray]], [[Draft_PathArray|PathArray]], [[Draft_PointArray|PointArray]], [[Draft_Clone|Clone]]
|SeeAlso=[[Draft_OrthoArray|OrthoArray]], [[Draft_CircularArray|CircularArray]], [[Draft_PathArray|PathArray]], [[Draft_PathLinkArray|PathLinkArray]], [[Draft_PointArray|PointArray]], [[Draft_Clone|Clone]]
}}
}}


Line 26: Line 26:


<!--T:5-->
<!--T:5-->
This 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 Workbench]] or [[PartDesign_Workbench|PartDesign Workbench]].
This tool can be used on any object that has a [[Part_TopoShape|Part TopoShape]], meaning 2D shapes created with the [[Draft_Workbench|Draft Workbench]], but also 3D solids created with other workbenches, for example, [[Part_Workbench|Part]], [[PartDesign_Workbench|PartDesign]], or [[Arch_Workbench|Arch]]. It can also create [[App_Link|App Links]] instead of simple copies.


<!--T:6-->
<!--T:6-->
* To create orthogonal or circular arrays, use the corresponding {{Button|[[File:Draft_OrthoArray.svg|16px]] [[Draft_OrthoArray|OrthoArray]]}} and {{Button|[[File:Draft_CircularArray.svg|16px]] [[Draft_CircularArray|CircularArray]]}} tools.
To position copies in a rectangular grid use [[Draft_Array|Array]]; to position in a circular pattern use [[Draft_CircularArray|CircularArray]]; to position copies along a path use [[Draft_PathArray|PathArray]]; to position copies at specified points use [[Draft_PointArray|PointArray]]; to create copies or clones, and manually place them use [[Draft_Move|Move]], [[Draft_Rotate|Rotate]], and [[Draft_Clone|Clone]].
* To position copies along a path use {{Button|[[File:Draft_PathArray.svg|16px]] [[Draft_PathArray|PathArray]]}} or {{Button|[[File:Draft_PathLinkArray.svg|16px]] [[Draft_PathLinkArray|PathLinkArray]]}}.
* To position copies at specified points use {{Button|[[File:Draft_PointArray.svg|16px]] [[Draft_PointArray|PointArray]]}}.
* To create copies and manually place them use {{Button|[[File:Draft_Move.svg|16px]] [[Draft_Move|Move]]}} or {{Button|[[File:Draft_Rotate.svg|16px]] [[Draft_Rotate|Rotate]]}}.
* To create exact copies and manually place or scale them, use {{Button|[[File:Draft_Clone.svg|16px]] [[Draft_Clone|Clone]]}} or {{Button|[[File:Std_LinkMake.svg|16px]] [[Std_LinkMake|Std LinkMake]]}}.


</translate>
</translate>
Line 41: Line 45:


<!--T:9-->
<!--T:9-->
# Select an object from which you wish to make the polar array.
# Select the object that you wish to array.
# Press the {{Button|[[File:Draft_PolarArray.svg|16px]] [[Draft_PolarArray|Polar array]]}} button. If no object is selected, the [[task_panel|task panel]] will open, but you still need to select an object to proceed.
# Press the {{Button|[[File:Draft_PolarArray.svg|16px]] [[Draft_PolarArray|Polar array]]}} button. If no object is selected, you will be invited to select one before proceeding.
# Choose the polar angle, which determines where the last element of the array will be.
# The [[task_panel|task panel]] is launched where you can select the polar angle, the number of elements, and the center of the axis of rotation.
# You can click on the [[3D_view|3D view]] to simultaneously set the position of the center of rotation, and complete the command. Otherwise, just press {{KEY|Enter}} or the {{Button|OK}} button to complete the operation.
# Choose the number of elements in the array. Minimum of 2, maximum of 99.
# Choose the center of the axis of rotation. You can click on the [[3D_view|3D view]], to simultaneously set the position of the center of rotation, and complete the command.
# Optionally, check the fuse or link options.
# Press {{Button|OK}} to complete the command.


<!--T:10-->
<!--T:10-->
Notes:
Notes:
* By default, the axis of rotation is the positive Z axis {{Value|(0, 0, 1)}}. This can be changed in the [[property_editor|property editor]] after the object is created.
* By default, the axis of rotation is the positive Z axis {{Value|(0, 0, 1)}}. This can be changed in the [[property_editor|property editor]] after the object is created.
* The polar angle is positive in the counter-clockwise direction, and negative in the clockwise direction.
* Each element in the array is an exact clone of the original object, but the entire array is considered a single unit in terms of properties and appearance.
* Each element in the array is an exact clone of the original object, but the entire array is considered a single unit in terms of properties and appearance.
* This command creates the same object as the one created with the [[Draft_Array|Array]] and [[Draft_CircularArray|CircularArray]] tools. Therefore, the array can be converted to orthogonal, polar, or circular just by changing its properties.
* This command creates the same parametric "Array" object as the one created with the {{Button|[[File:Draft_OrthoArray.svg|16px]] [[Draft_OrthoArray|OrthoArray]]}} and {{Button|[[File:Draft_CircularArray.svg|16px]] [[Draft_CircularArray|CircularArray]]}} tools. Therefore, the array can be converted to orthogonal, polar, or circular by changing its {{PropertyData|Array Type}} property.


== Options == <!--T:11-->
== Options == <!--T:11-->

These are the options displayed in the [[task_panel|task panel]].


<!--T:12-->
<!--T:12-->
* {{MenuCommand|Polar angle}}: the angle which determines where the last element of the array will be placed in the polar arrangement. The angle is positive in the counter-clockwise direction, and negative in the clockwise direction.
* Press {{Button|Reset point}} to set the center of rotation to the origin {{Value|(0, 0, 0)}}.
* If the {{MenuCommand|Fuse}} checkbox is ticked, the resulting objects in the array will be fused into a single shape, if they touch or intersect each other.
* {{MenuCommand|Number of elements}}: the number of elements in the array. Minimum of 2, maximum of 99.
* {{MenuCommand|Center of rotation}}: the coordinates through which the axis of rotation goes through.
* If the {{MenuCommand|Use Links}} checkbox is ticked, the resulting objects in the array will be [[App_Link|App Links]] instead of simple copies. This improves the memory usage of the array, as the App Link re-uses the [[Shape|shape]] of the original object, and does not create new shapes. If this option is used, the {{MenuCommand|Fuse}} checkbox has no effect.
* {{MenuCommand|Reset point}}: it resets the center of rotation to the origin {{Value|(0, 0, 0)}}.
* {{MenuCommand|Fuse}}: if it is checked, the resulting objects in the array will fuse together if they touch each other. This only works if {{MenuCommand|Link array}} is unchecked.
* {{MenuCommand|Link array}}: if it is checked, the resulting array will be a "Link array". This array internally uses [[App_Link|App Link]] objects, so it is more efficient when handling many copies of complex shapes. However, in this case, the objects cannot be fused together.
* Press {{KEY|Esc}} or the {{Button|Cancel}} button to abort the current command.
* Press {{KEY|Esc}} or the {{Button|Cancel}} button to abort the current command.

{{Emphasis|Note:}} if a Link array is created, this object cannot be converted to a regular array. And similarly, a regular array cannot be converted to a Link array. Therefore, you must choose the type of array that you want at creation time.


== Properties == <!--T:13-->
== Properties == <!--T:13-->


<!--T:14-->
<!--T:14-->
An [[Draft_PolarArray|Array]] object is based on [[Part_Feature|Part Feature]] ({{incode|Part::Feature}} class), and thus shares all properties of the latter. In addition to the properties listed in [[Part_Feature|Part Feature]], the Array object has additional properties.
A [[Draft_PolarArray|PolarArray]] object internally is the same object produced with the {{Button|[[Image:Draft_OrthoArray.svg|16px]] [[Draft_OrthoArray|OrthoArray]]}} tool. It is based on [[Part_Feature|Part Feature]] ({{incode|Part::Feature}} class), and thus shares all properties of the latter.


<!--T:15-->
<!--T:15-->
See the {{Button|[[Image:Draft_Array.svg|16px]] [[Draft_OrthoArray|OrthoArray]]}} tool for the complete information.
See the {{Button|[[Image:Draft_OrthoArray.svg|16px]] [[Draft_OrthoArray|OrthoArray]]}} tool for the complete description of the properties. All properties apply, except for those under the {{TitleProperty|Orthogonal array}} and {{TitleProperty|Circular array}} groups.


== Scripting == <!--T:16-->
== Scripting == <!--T:16-->
Line 114: Line 121:
tri = Draft.make_polygon(3, 600)
tri = Draft.make_polygon(3, 600)
center = App.Vector(-1600, 0, 0)
center = App.Vector(-1600, 0, 0)

array = Draft.make_polar_array(tri, 8, 270, center)
array = Draft.make_polar_array(tri, 8, 270, center)
doc.recompute()
}}
<translate>

== Scripting, non-parametric array ==

When using the {{Button|[[Image:Draft_PolarArray.svg|16px]] [[Draft_PolarArray|PolarArray]]}} tool, a parametric {{incode|"Array"}} object is created. This can be scripted as described in the previous section.

However, to obtain standalone copies of the base object, the simple {{incode|Draft.array}} function can be used. This will create simple copies, not a new parametric object.

To create a polar array, use it like this:
</translate>
{{Code|code=
array_list = array(objectslist, center, angle, number)
}}
<translate>

* Creates an array from the objects contained in {{incode|objectslist}}, which can be a single object or a list of objects.
** In case of a polar array, {{incode|center}} defines the center of the array circle, {{incode|angle}} is the angle of the arc in degrees to cover with copies, and {{incode|number}} is the number of copies to arrange on the circular arc, not including the original object.
** {{incode|array_list}} is returned with the new copies. It is either a single object or a list of objects, depending on the input {{incode|objectslist}}.

This function internally uses {{incode|Draft.rotate()}} with <code>copy=True</code>.

Example:

</translate>
{{Code|code=
import FreeCAD as App
import Draft

doc = App.newDocument()

tri = Draft.make_polygon(3, 600)
center = App.Vector(-3200, 0, 0)

array_list = Draft.array(tri, center, 180, 5)
doc.recompute()
doc.recompute()
}}
}}

Revision as of 14:47, 30 June 2020

Draft PolarArray

Menu location
Draft → Polar array
Workbenches
Draft
Default shortcut
None
Introduced in version
0.19
See also
OrthoArray, CircularArray, PathArray, PathLinkArray, PointArray, Clone

Description

The Draft PolarArray tool creates an array from a selected object placing the copies along a circumference.

This tool can be used on any object that has a Part TopoShape, meaning 2D shapes created with the Draft Workbench, but also 3D solids created with other workbenches, for example, Part, PartDesign, or Arch. It can also create App Links instead of simple copies.

A polar array of an object.

Usage

  1. Select the object that you wish to array.
  2. Press the Polar array button. If no object is selected, you will be invited to select one before proceeding.
  3. The task panel is launched where you can select the polar angle, the number of elements, and the center of the axis of rotation.
  4. You can click on the 3D view to simultaneously set the position of the center of rotation, and complete the command. Otherwise, just press Enter or the OK button to complete the operation.

Notes:

  • By default, the axis of rotation is the positive Z axis (0, 0, 1). This can be changed in the property editor after the object is created.
  • Each element in the array is an exact clone of the original object, but the entire array is considered a single unit in terms of properties and appearance.
  • This command creates the same parametric "Array" object as the one created with the OrthoArray and CircularArray tools. Therefore, the array can be converted to orthogonal, polar, or circular by changing its DataArray Type property.

Options

These are the options displayed in the task panel.

  • Polar angle: the angle which determines where the last element of the array will be placed in the polar arrangement. The angle is positive in the counter-clockwise direction, and negative in the clockwise direction.
  • Number of elements: the number of elements in the array. Minimum of 2, maximum of 99.
  • Center of rotation: the coordinates through which the axis of rotation goes through.
  • Reset point: it resets the center of rotation to the origin (0, 0, 0).
  • Fuse: if it is checked, the resulting objects in the array will fuse together if they touch each other. This only works if Link array is unchecked.
  • Link array: if it is checked, the resulting array will be a "Link array". This array internally uses App Link objects, so it is more efficient when handling many copies of complex shapes. However, in this case, the objects cannot be fused together.
  • Press Esc or the Cancel button to abort the current command.

Note: if a Link array is created, this object cannot be converted to a regular array. And similarly, a regular array cannot be converted to a Link array. Therefore, you must choose the type of array that you want at creation time.

Properties

A PolarArray object internally is the same object produced with the OrthoArray tool. It is based on Part Feature (Part::Feature class), and thus shares all properties of the latter.

See the OrthoArray tool for the complete description of the properties. All properties apply, except for those under the Orthogonal array and Circular array groups.

Scripting

See also: Draft API and FreeCAD Scripting Basics.

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

Older call:

array = makeArray(baseobject, center, totalangle, totalnum, use_link=False)

New call:

array = make_polar_array(base_object,
                         number=5, angle=360, center=App.Vector(0, 0, 0),
                         use_link=True)
  • Creates an "Array" object from the base_object.
    • number is the number of copies in the polar pattern, including the original object.
    • angle is the angle of the polar arc in degrees.
    • center is a vector that defines the center of the array pattern.
    • If use_link is true the created copies will be App Links and not regular copies.

Example:

import FreeCAD as App
import Draft

doc = App.newDocument()

tri = Draft.make_polygon(3, 600)
center = App.Vector(-1600, 0, 0)

array = Draft.make_polar_array(tri, 8, 270, center)
doc.recompute()

Scripting, non-parametric array

When using the PolarArray tool, a parametric "Array" object is created. This can be scripted as described in the previous section.

However, to obtain standalone copies of the base object, the simple Draft.array function can be used. This will create simple copies, not a new parametric object.

To create a polar array, use it like this:

array_list = array(objectslist, center, angle, number)
  • Creates an array from the objects contained in objectslist, which can be a single object or a list of objects.
    • In case of a polar array, center defines the center of the array circle, angle is the angle of the arc in degrees to cover with copies, and number is the number of copies to arrange on the circular arc, not including the original object.
    • array_list is returned with the new copies. It is either a single object or a list of objects, depending on the input objectslist.

This function internally uses Draft.rotate() with copy=True.

Example:

import FreeCAD as App
import Draft

doc = App.newDocument()

tri = Draft.make_polygon(3, 600)
center = App.Vector(-3200, 0, 0)

array_list = Draft.array(tri, center, 180, 5)
doc.recompute()