Draft Array: Difference between revisions

From FreeCAD Documentation
(Vertical GuiCommand. See also PointArray and Draft Clone)
m (Changed section to 'Usage')
(38 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
<translate>
<translate>
<!--T:37-->
{{Docnav
|[[Draft_Draft2Sketch|Draft to Sketch]]
|[[Draft_LinkArray|Link Array]]
|[[Draft_Module|Draft]]
|IconL=Draft_Draft2Sketch.svg
|IconC=Workbench_Draft.svg
|IconR=Draft_LinkArray.svg
}}

<!--T:1-->
<!--T:1-->
{{GuiCommand
{{GuiCommand
|Name=Draft Array
|Name=Draft Array
|MenuLocation=Draft → Array
|MenuLocation=Draft → Array
|Workbenches=[[Draft Module|Draft]], [[Arch Module|Arch]]
|Workbenches=[[Draft Module|Draft]]
|SeeAlso=[[Draft PathArray|PathArray]], [[Draft PointArray]], [[Draft Clone]]
|SeeAlso=[[Draft_PolarArray|PolarArray]], [[Draft_CircularArray|CircularArray]], [[Draft_PathArray|PathArray]], [[Draft_PointArray|PointArray]], [[Draft_Clone|Clone]]
}}
}}


==Description== <!--T:2-->
==Description== <!--T:2-->
The Array tool creates an orthogonal (3-axes) or polar array from a selected object. If no object is selected, you will be invited to select one.


<!--T:44-->
The {{Button|[[Image:Draft Array.svg|16px]] [[Draft Array|Draft Array]]}} tool creates an orthogonal (3-axes), polar, or circular array from a selected object.

<!--T:19-->
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]].

<!--T:20-->
To create polar and circular arrays directly, use the corresponding [[Draft_PolarArray|PolarArray]] and [[Draft_CircularArray|CircularArray]] tools; 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]].

<!--T:45-->
To create [[App_Link|App Links]] instead of simple copies, use [[Draft_LinkArray|LinkArray]], [[Draft_PathLinkArray|Path LinkArray]], and the proper option with [[Draft_PolarArray|PolarArray]] and [[Draft_CircularArray|CircularArray]] .

</translate>
[[File:Draft_Array_example.png|x300px]] [[File:Draft_PolarArray_example.png|x300px]]
<translate>
<!--T:3-->
<!--T:3-->
{{Caption|Orthogonal array (left) and polar array (right) from a solid object.}}
[[Image:Draft_Array_example.jpg|400px]]

<!--T:41-->
[[File:Draft_CircularArray_example.png|x300px]]

<!--T:42-->
{{Caption|Circular array from a solid object}}

==Usage== <!--T:4-->
# Select an object with which you wish to make an array.
# Press the {{Button|[[Image:Draft Array.svg|16px]] [[Draft Array|Draft Array]]}} button. If no object is selected, you will be invited to select one.
# The Array object is immediately created. You must change the properties of the array to change the number and direction of copies created.

<!--T:21-->
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.

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

<!--T:23-->
There are no options for this tool. Either it works with the selected object or not.

== Properties == <!--T:24-->
* {{PropertyData|Base}}: specifies the object to duplicate in the array.
* {{PropertyData|Array Type|Enumeration}}: specifies the type of array to create, {{value|"ortho"}}, {{value|"polar"}}, or {{value|"circular"}}.
* {{PropertyData|Fuse}}: if it is {{TRUE}}, and the copies intersect with each other, they will be fused together into a single shape.

<!--T:25-->
For orthogonal arrays:
* {{PropertyData|Interval X}}: specifies the interval between each copy on the X axis.
* {{PropertyData|Interval Y}}: specifies the interval between each copy on the Y axis.
* {{PropertyData|Interval Z}}: specifies the interval between each copy on the Z axis.
* {{PropertyData|Number X}}: specifies the number of copies on the X axis.
* {{PropertyData|Number Y}}: specifies the number of copies on the Y axis.
* {{PropertyData|Number Z}}: specifies the number of copies on the Z axis.

<!--T:26-->
For polar arrays:
* {{PropertyData|Axis}}: specifies the normal direction of the array circle.
* {{PropertyData|Center}}: specifies the center point of the array circle.
* {{PropertyData|Angle}}: specifies the aperture of the circular arc to cover with copies; use 360 to cover an entire circle.
* {{PropertyData|Number Polar}}: specifies the number of copies to place in the circular arrangement.
* {{PropertyData|Interval Axis}}: specifies the interval between each copy on the {{PropertyData|Axis}} direction.

<!--T:43-->
For circular arrays:
* {{PropertyData|Number Circles}}:
* {{PropertyData|Radial distance}}:
* {{PropertyData|Symmetry}}:
* {{PropertyData|Tangential Distance}}:

<!--T:27-->
The number property, either X, Y, Z, or Polar, also includes the original object, so this number will be at least one.

<!--T:28-->
An interval is not a simple distance, but a vector (x, y, z). If more than one value is non-zero, the copy will be created in the main direction, but will also be displaced in the other non-zero directions.

<!--T:29-->
For example, if {{PropertyData|Interval X}} is (2 m, 1 m, 1 m), and {{PropertyData|Number X}} is 3, it will create 3 copies in the X direction; the first copy will be at the original position, the second will be displaced 2 m on X, 1 m on Y, and 1 m on Z; the third copy will be displaced 4 m on X, 2 m on Y, and 2 m on Z. Each array element will be moved slightly to one side (Y direction) and up (Z direction) beside the main X direction.


==How to use== <!--T:4-->
<!--T:30-->
The {{PropertyData|Interval Axis}} property works in the same way. If the original shape lies on the XY plane, creating a polar array with {{PropertyData|Interval Axis}} (0, 0, z) allows you to make spiral arrangements.
# Select an object you wish to make an array with
# Press the {{KEY|[[Image:Draft Array.png|16px]] [[Draft Array]]}} button
# Select {{PropertyData|Array Type}}: Specifies the type of the array, ortho or polar
# For orthogonal arrays:
## {{PropertyData|Interval X}}: The interval between each copy on the first axis
## {{PropertyData|Interval Y}}: The interval between each copy on the second axis
## {{PropertyData|Interval Z}}: The interval between each copy on the third axis
## {{PropertyData|Number X}}: The number of copies on the first axis
## {{PropertyData|Number Y}}: The number of copies on the second axis
## {{PropertyData|Number Z}}: The number of copies on the third axis
# For polar arrays:
## {{PropertyData|Axis}}: The normal direction of the array circle
## {{PropertyData|Center}}: The center point of the array
## {{PropertyData|Angle}}: The angle to cover with copies
## {{PropertyData|Number Polar}}: The number of copies


==Scripting== <!--T:18-->
==Scripting== <!--T:18-->
{{Emphasis|See also:}} [[Draft API|Draft API]] and [[FreeCAD Scripting Basics|FreeCAD Scripting Basics]].
The Array tool can by used in [[macros]] and from the python console by using one of the following functions, depending if you wish to obtain simple, standalone copies of your base object, or a parametric array object, that stays linked to the original object.

<!--T:31-->
The Array tool can be used in [[macros|macros]] and from the [[Python|Python]] console by using two different functions, depending on if you wish to obtain standalone copies of your base object, or a parametric array object that stays linked to the original object.


=== Simple array === <!--T:5-->
=== Simple array === <!--T:5-->
The basic signature is as follows:
For rectangular array:

</translate>
</translate>
{{Code|code=
{{Code|code=
array (objectslist,xvector,yvector,xnum,ynum)
array_list = array(objectslist, arg1, arg2, arg3, arg4=None, arg5=None, arg6=None)
array (objectslist,xvector,yvector,zvector,xnum,ynum,znum)
}}
}}
<translate>
<translate>

<!--T:32-->
To create a rectangular array, use it like this:

</translate>
{{Code|code=
array_list = array(objectslist, xvector, yvector, xnum, ynum)
array_list = array(objectslist, xvector, yvector, zvector, xnum, ynum, znum)
}}
<translate>

<!--T:6-->
<!--T:6-->
For polar array:
To create a polar array, use it like this:

</translate>
</translate>
{{Code|code=
{{Code|code=
array (objectslist,center,totalangle,totalnum)
array_list = array(objectslist, center, totalangle, totalnum)
}}
}}
<translate>
<translate>

<!--T:17-->
<!--T:17-->
* Creates an array from the objects contained in {{incode|objectslist}}, which can be a single object or a list of objects.
* Creates an array of the objects contained in list (that can be an object or a list of objects) with, in case of rectangular array, xnum of iterations in the x direction at xvector distance between iterations, and same for y direction with yvector and ynum, and same for z direction with zvector and znum if that version is used. In case of polar array, center is a vector, totalangle is the angle to cover (in degrees) and totalnum is the number of objects, including the original.
* In case of a rectangular array, {{incode|xvector}}, {{incode|yvector}}, and {{incode|zvector}} determine the distance between the base points of each copy, in the X, Y, and Z directions; and {{incode|xnum}}, {{incode|ynum}}, and {{incode|znum}} are the number of copies in the respective direction.
* This function produces standalone copies of the base object(s)
* In case of a polar array, {{incode|center}} defines the center of the array circle, {{incode|totalangle}} is the angle of the arc in degrees to cover with copies, and {{incode|totalnum}} is the number of copies to arrange around the circle, including the original object.
* {{incode|array_list}} is returned with the new copies.
** {{incode|array_list}} is either a single object or a list of objects, depending on the input {{incode|objectslist}}.

<!--T:33-->
This function internally uses {{incode|Draft.move()}} and {{incode|Draft.rotate()}} with <code>copy=True</code>.

<!--T:34-->
Example:

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

Rect = Draft.makeRectangle(1500, 500)

array_list = Draft.array(Rect, FreeCAD.Vector(1600, 0, 0), FreeCAD.Vector(0, 600, 0), 3, 4)
}}
<translate>


=== Parametric array === <!--T:8-->
=== Parametric array === <!--T:8-->

<!--T:35-->
The basic signature is as follows:

</translate>
{{Code|code=
Array = makeArray(baseobject, arg1, arg2, arg3, arg4=None, arg5=None, arg6=None, name="Array")
}}
<translate>


<!--T:14-->
<!--T:14-->
For rectangular array:
To create a rectangular array, use it like this:

</translate>
</translate>
{{Code|code=
{{Code|code=
makeArray (object,xvector,yvector,xnum,ynum,[name])
Array = makeArray(baseobject, xvector, yvector, xnum, ynum, name="Array")
makeArray (object,xvector,yvector,zvector,xnum,ynum,znum,[name])
Array = makeArray(baseobject, xvector, yvector, zvector, xnum, ynum, znum, name="Array")
}}
}}
<translate>
<translate>

<!--T:9-->
<!--T:9-->
For polar array:
To create a polar array, use it like this:

</translate>
</translate>
{{Code|code=
{{Code|code=
makeArray (object,center,totalangle,totalnum,[name])
Array = makeArray(baseobject, center, totalangle, totalnum, name="Array")
}}
}}
<translate>
<translate>

<!--T:10-->
<!--T:10-->
* Creates an {{incode|Array}} object from the given {{incode|baseobject}}.
* Creates an array of the given object with, in case of rectangular array, xnum of iterations in the x direction at xvector distance between iterations, and same for y direction with yvector and ynum, and for zvector and znum if that version is used. In case of polar array, center is a vector, totalangle is the angle to cover (in degrees) and totalnum is the number of objects, including the original.
* In case of a rectangular array, {{incode|xvector}}, {{incode|yvector}}, and {{incode|zvector}} determine the distance between the base points of each copy, in the X, Y, and Z directions; and {{incode|xnum}}, {{incode|ynum}}, and {{incode|znum}} are the number of copies in the respective direction.
* The result of this function is a parametric Draft Array object.
* In case of a polar array, {{incode|center}} defines the center of the array circle, {{incode|totalangle}} is the angle of the arc in degrees to cover with copies, and {{incode|totalnum}} is the number of copies to arrange around the circle, including the original object.


<!--T:11-->
<!--T:11-->
Line 79: Line 195:
</translate>
</translate>
{{Code|code=
{{Code|code=
import FreeCAD,Draft
import FreeCAD, Draft
Draft.array(FreeCAD.ActiveDocument.ActiveObject,FreeCAD.Vector(2,0,0),FreeCAD.Vector(0,2,0),2,2)


Rect = Draft.makeRectangle(1500, 500)
xvector = FreeCAD.Vector(1600, 0, 0)
yvector = FreeCAD.Vector(0, 600, 0)
Array = Draft.makeArray(Rect, xvector, yvector, 3, 4)

Tri = Draft.makePolygon(3, 600)
center = FreeCAD.Vector(-1600, 0, 0)
Array2 = Draft.makeArray(Tri, center, 360, 6)
}}
}}
<translate>

<!--T:36-->
{{Docnav
|[[Draft_Draft2Sketch|Draft to Sketch]]
|[[Draft_LinkArray|Link Array]]
|[[Draft_Module|Draft]]
|IconL=Draft_Draft2Sketch.svg
|IconC=Workbench_Draft.svg
|IconR=Draft_LinkArray.svg
}}

<!--T:38-->
{{Draft Tools navi}}

<!--T:39-->
{{Userdocnavi}}

</translate>
{{clear}}
{{clear}}

Revision as of 19:01, 29 January 2020

Draft Array

Menu location
Draft → Array
Workbenches
Draft
Default shortcut
None
Introduced in version
-
See also
PolarArray, CircularArray, PathArray, PointArray, Clone

Description

The Draft Array tool creates an orthogonal (3-axes), polar, or circular array from a selected object.

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 Workbench or PartDesign Workbench.

To create polar and circular arrays directly, use the corresponding PolarArray and CircularArray tools; to position copies along a path use PathArray; to position copies at specified points use PointArray; to create copies or clones, and manually place them use Move, Rotate, and Clone.

To create App Links instead of simple copies, use LinkArray, Path LinkArray, and the proper option with PolarArray and CircularArray .

Orthogonal array (left) and polar array (right) from a solid object.

Circular array from a solid object

Usage

  1. Select an object with which you wish to make an array.
  2. Press the Draft Array button. If no object is selected, you will be invited to select one.
  3. The Array object is immediately created. You must change the properties of the array to change the number and direction of copies 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.

Options

There are no options for this tool. Either it works with the selected object or not.

Properties

  • DataBase: specifies the object to duplicate in the array.
  • DataArray Type (Enumeration): specifies the type of array to create, "ortho", "polar", or "circular".
  • DataFuse: if it is true, and the copies intersect with each other, they will be fused together into a single shape.

For orthogonal arrays:

  • DataInterval X: specifies the interval between each copy on the X axis.
  • DataInterval Y: specifies the interval between each copy on the Y axis.
  • DataInterval Z: specifies the interval between each copy on the Z axis.
  • DataNumber X: specifies the number of copies on the X axis.
  • DataNumber Y: specifies the number of copies on the Y axis.
  • DataNumber Z: specifies the number of copies on the Z axis.

For polar arrays:

  • DataAxis: specifies the normal direction of the array circle.
  • DataCenter: specifies the center point of the array circle.
  • DataAngle: specifies the aperture of the circular arc to cover with copies; use 360 to cover an entire circle.
  • DataNumber Polar: specifies the number of copies to place in the circular arrangement.
  • DataInterval Axis: specifies the interval between each copy on the DataAxis direction.

For circular arrays:

  • DataNumber Circles:
  • DataRadial distance:
  • DataSymmetry:
  • DataTangential Distance:

The number property, either X, Y, Z, or Polar, also includes the original object, so this number will be at least one.

An interval is not a simple distance, but a vector (x, y, z). If more than one value is non-zero, the copy will be created in the main direction, but will also be displaced in the other non-zero directions.

For example, if DataInterval X is (2 m, 1 m, 1 m), and DataNumber X is 3, it will create 3 copies in the X direction; the first copy will be at the original position, the second will be displaced 2 m on X, 1 m on Y, and 1 m on Z; the third copy will be displaced 4 m on X, 2 m on Y, and 2 m on Z. Each array element will be moved slightly to one side (Y direction) and up (Z direction) beside the main X direction.

The DataInterval Axis property works in the same way. If the original shape lies on the XY plane, creating a polar array with DataInterval Axis (0, 0, z) allows you to make spiral arrangements.

Scripting

See also: Draft API and FreeCAD Scripting Basics.

The Array tool can be used in macros and from the Python console by using two different functions, depending on if you wish to obtain standalone copies of your base object, or a parametric array object that stays linked to the original object.

Simple array

The basic signature is as follows:

array_list = array(objectslist, arg1, arg2, arg3, arg4=None, arg5=None, arg6=None)

To create a rectangular array, use it like this:

array_list = array(objectslist, xvector, yvector, xnum, ynum)
array_list = array(objectslist, xvector, yvector, zvector, xnum, ynum, znum)

To create a polar array, use it like this:

array_list = array(objectslist, center, totalangle, totalnum)
  • Creates an array from the objects contained in objectslist, which can be a single object or a list of objects.
  • In case of a rectangular array, xvector, yvector, and zvector determine the distance between the base points of each copy, in the X, Y, and Z directions; and xnum, ynum, and znum are the number of copies in the respective direction.
  • In case of a polar array, center defines the center of the array circle, totalangle is the angle of the arc in degrees to cover with copies, and totalnum is the number of copies to arrange around the circle, including the original object.
  • array_list is returned with the new copies.
    • array_list is either a single object or a list of objects, depending on the input objectslist.

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

Example:

import FreeCAD, Draft

Rect = Draft.makeRectangle(1500, 500)

array_list = Draft.array(Rect, FreeCAD.Vector(1600, 0, 0), FreeCAD.Vector(0, 600, 0), 3, 4)

Parametric array

The basic signature is as follows:

Array = makeArray(baseobject, arg1, arg2, arg3, arg4=None, arg5=None, arg6=None, name="Array")

To create a rectangular array, use it like this:

Array = makeArray(baseobject, xvector, yvector, xnum, ynum, name="Array")
Array = makeArray(baseobject, xvector, yvector, zvector, xnum, ynum, znum, name="Array")

To create a polar array, use it like this:

Array = makeArray(baseobject, center, totalangle, totalnum, name="Array")
  • Creates an Array object from the given baseobject.
  • In case of a rectangular array, xvector, yvector, and zvector determine the distance between the base points of each copy, in the X, Y, and Z directions; and xnum, ynum, and znum are the number of copies in the respective direction.
  • In case of a polar array, center defines the center of the array circle, totalangle is the angle of the arc in degrees to cover with copies, and totalnum is the number of copies to arrange around the circle, including the original object.

Example:

import FreeCAD, Draft

Rect = Draft.makeRectangle(1500, 500)
xvector = FreeCAD.Vector(1600, 0, 0)
yvector = FreeCAD.Vector(0, 600, 0)
Array = Draft.makeArray(Rect, xvector, yvector, 3, 4)

Tri = Draft.makePolygon(3, 600)
center = FreeCAD.Vector(-1600, 0, 0)
Array2 = Draft.makeArray(Tri, center, 360, 6)