Draft PointArray/tr: Difference between revisions

From FreeCAD Documentation
(Updating to match new version of source page)
(Updating to match new version of source page)
Line 25: Line 25:
The {{Button|[[Image:Draft_PointArray.svg|16px]] [[Draft PointArray|Draft PointArray]]}} tool places copies of a selected shape along various selected points.
The {{Button|[[Image:Draft_PointArray.svg|16px]] [[Draft PointArray|Draft PointArray]]}} tool places copies of a selected shape along various selected points.


The PointArray 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.
The PointArray 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 the [[Part_Workbench|Part]], [[PartDesign_Workbench|PartDesign]], or the [[Arch_Workbench|Arch Workbenches]].


* To create orthogonal, polar or circular arrays, use the corresponding {{Button|[[File:Draft_OrthoArray.svg|16px]] [[Draft_OrthoArray|OrthoArray]]}}, {{Button|[[File:Draft_PolarArray.svg|16px]] [[Draft_PolarArray|PolarArray]]}}, or {{Button|[[File:Draft_CircularArray.svg|16px]] [[Draft_CircularArray|CircularArray]]}} tools.
To position copies in an orthogonal array use [[Draft Array|Draft Array]]; to position copies along a path use [[Draft PathArray|Draft PathArray]]; to create copies or clones, and manually place them use [[Draft Move|Draft Move]], [[Draft Rotate|Draft Rotate]], and [[Draft Clone|Draft Clone]].
* To position copies along a path use {{Button|[[File:Draft_PathArray.svg|16px]] [[Draft_PathArray|PathArray]]}}.
* 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]]}}.


[[Image:Draft_PointArray_Example.png|400px]]
[[Image:Draft_PointArray_Example.png|400px]]
Line 34: Line 37:
==Usage==
==Usage==


# Select an object that you wish to distribute.
# Select the object that you wish to distribute.
# Select a point compound.
# Select a point compound.
# Press the {{Button|[[Image:Draft_PointArray.svg|16px]] [[Draft PointArray|Draft PointArray]]}} button.
# Press the {{Button|[[Image:Draft_PointArray.svg|16px]] [[Draft PointArray|Draft PointArray]]}} button.

To create a point compound select various [[Draft Point|Draft Point]]s and then press the {{Button|[[Image:Draft Upgrade.svg|16px]] [[Draft Upgrade|Draft Upgrade]]}} button.


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.

=== Point compound ===

The point compound object can be created in different ways.
* Create various {{Button|[[File:Draft_Point.svg|16px]] [[Draft_Point|Draft Points]]}} or {{Button|[[File:Part_Point.svg|16px]] [[Part_Point|Part Points]]}}, and then press {{Button|[[File:Part_Compound.svg|16px]] [[Part_Compound|Part Compound]]}} to create the compound.
* Repeat the previous method but instead of a compound use {{Button|[[Image:Draft_Upgrade.svg|16px]] [[Draft_Upgrade|Draft Upgrade]]}} to create a "Block".
* Create a {{Button|[[File:Sketcher_NewSketch.svg|16px]] [[Sketch|Sketch]]}}, and inside add various {{Button|[[File:Sketcher_CreatePoint.svg|16px]] [[Sketcher_CreatePoint|Points]]}}.

In essence, the object to be used as the compound must have one of three properties, {{PropertyData|Components}}, {{PropertyData|Links}}, or {{PropertyData|Geometry}}, and inside that compound, there must be at least one point with {{PropertyData|X}}, {{PropertyData|Y}}, and {{PropertyData|Z}} properties.

{{Emphasis|Note:}} in the case of {{Button|[[File:Draft_Point.svg|16px]] [[Draft_Point|Draft Point]]}} and {{Button|[[File:Part_Point.svg|16px]] [[Part_Point|Part Point]]}} the array will try to position the copies using the {{PropertyData|Placement}} of the point. In the case of a sketcher {{Button|[[File:Sketcher_CreatePoint.svg|16px]] [[Sketcher_CreatePoint|Point]]}}, the position will be taken from its internal {{incode|X}}, {{incode|Y}}, and {{incode|Z}} attributes.

{{Emphasis|Note 2:}} for {{Button|[[File:Draft_Point.svg|16px]] [[Draft_Point|Draft Point]]}} its {{PropertyData|Placement}} always follows the values of {{PropertyData|X}}, {{PropertyData|Y}}, {{PropertyData|Z}}, so modifying these values is enough to produce the desired displacement. However, for {{Button|[[File:Part_Point.svg|16px]] [[Part_Point|Part Point]]}}, the net displacement is given by the sum of {{PropertyData|Placement}} with the vector with components {{PropertyData|X}}, {{PropertyData|Y}}, and {{PropertyData|Z}}.


==Options==
==Options==
Line 48: Line 62:
==Properties==
==Properties==


A [[Draft_PointArray|PointArray]] is derived from a [[Part_Feature|Part Feature]] ({{incode|Part::Feature}} class), therefore it shares all the latter's properties. In addition to the properties described in [[Part_Feature|Part Feature]], the PointArray has the following properties in the [[property editor|property editor]].
* {{PropertyData|Base}}: the object to duplicate.

* {{PropertyData|Count}}: (read-only) specifies the number of copies of the base object. This number will depend on the number of [[Draft Point|Draft Point]]s in the compound.
{{TitleProperty|Objects}}
* {{PropertyData|PointList}}: specifies a compound object with point objects that indicate where the copies of the {{PropertyData|Base}} object will appear.
* {{PropertyData|Base|Link}}: the object to duplicate; it must have a [[Part_TopoShape|Part TopoShape]].
The compound object needs to have a {{PropertyData|Links}}, {{PropertyData|Componets}}, or {{PropertyData|Geometry}} attribute. Each of the objects inside the compound should be [[Draft Point|Draft Points]] that have {{PropertyData|X}}, {{PropertyData|Y}}, and {{PropertyData|Z}} attributes.
* {{PropertyData|Count|Integer}}: (read-only) specifies the number of copies in the array. This property is read-only because the number of copies is determined by the number of points inside of {{PropertyData|Point Object}}.
The compounds could be created with [[Part Compound|Part Compound]] ({{PropertyData|Links}} attribute) or with [[Draft Upgrade|Draft Upgrade]] ({{PropertyData|Componets}} attribute).
* {{PropertyData|Extra Placement|Placement}}: specifies an additional [[Placement|placement]], translation and rotation, that will be applied to each copy in the array. Each copy normally appears with the same rotation as the {{PropertyData|Base}} object; with this property it is possible to provide additional rotation, or counter the original rotation, and make small adjustments to the position of the copies. {{Version|0.19}}
* {{PropertyData|Point Object|Link}}: specifies a compound object with points that indicate where the copies of the {{PropertyData|Base}} object will appear. The compound object needs to have one of {{PropertyData|Links}}, {{PropertyData|Components}}, or {{PropertyData|Geometry}} properties, and contain at least one element with {{PropertyData|X}}, {{PropertyData|Y}}, and {{PropertyData|Z}} attributes.


==Scripting==
==Scripting==
Line 58: Line 74:


The PointArray tool can be used in [[macros|macros]] and from the [[Python|Python]] console by using the following function:
The PointArray tool can be used in [[macros|macros]] and from the [[Python|Python]] console by using the following function:

Older call
{{Code|code=
point_array = makePointArray(base_object, point_object)
}}

New call
{{Code|code=
{{Code|code=
point_array = make_point_array(base_object, point_object, extra=None):
PointArray = makePointArray(base, ptlst)
}}
}}


* Creates a {{incode|PointArray}} object from the {{incode|base}} object, by placing the copies along {{incode|ptlst}}.
* Creates a {{incode|"PointArray"}} object from the {{incode|base_object}}, by placing the copies in the points contained within {{incode|point_object}}.
* {{incode|ptlst}} is an object with {{incode|Geometry}}, {{incode|Links}}, or {{incode|Components}} attributes that define the position of the copies.
** {{incode|point_object}} should have one of {{incode|Geometry}}, {{incode|Links}}, or {{incode|Components}} attributes containing points.
** Instead of a reference to an object, {{incode|base_object}} and {{incode|point_object}} can also be {{incode|Labels}} (strings) of objects existing in the current document.
** {{incode|extra}} can be a full {{incode|App.Placement}}, or just an {{incode|App.Vector}} or {{incode|App.Rotation}}.


Example:
Example:
{{Code|code=
{{Code|code=
import FreeCAD, Draft
import FreeCAD as App
import Draft


doc = App.newDocument()
Polygon = Draft.makePolygon(3, radius=500.0)


p1 = Draft.makePoint(FreeCAD.Vector(1500, 0, 0))
polygon = Draft.make_polygon(3, radius=500.0)
p2 = Draft.makePoint(FreeCAD.Vector(2500, 0, 0))
p3 = Draft.makePoint(FreeCAD.Vector(2000, 1000, 0))


p1 = Draft.make_point(App.Vector(1500, 0, 0))
# Create a compound of points
addList, deleteList = Draft.upgrade([p1, p2, p3])
p2 = Draft.make_point(App.Vector(2500, 0, 0))
p3 = Draft.make_point(App.Vector(2000, 1000, 0))


compound = doc.addObject("Part::Compound", "Compound")
# Extract the compound from the list
compound = addList[0]
compound.Links = [p1, p2, p3]


PointArray = Draft.makePointArray(Polygon, compound)
point_array = Draft.make_point_array(polygon, compound)
doc.recompute()
}}
}}



Revision as of 21:41, 5 June 2020

Nokta dizisi

Menü konumu
Draft → PointArray
Tezgahlar
Draft, Arch
Varsayılan kısayol
Hiçbiri
Versiyonda tanıtıldı
0.18
Ayrıca bkz
Draft Array, Draft PathArray

Tanım

The Draft PointArray tool places copies of a selected shape along various selected points.

The PointArray 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 the Part, PartDesign, or the Arch Workbenches.

Object arranged at specific points

Usage

  1. Select the object that you wish to distribute.
  2. Select a point compound.
  3. Press the Draft PointArray button.

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.

Point compound

The point compound object can be created in different ways.

In essence, the object to be used as the compound must have one of three properties, VeriComponents, VeriLinks, or VeriGeometry, and inside that compound, there must be at least one point with VeriX, VeriY, and VeriZ properties.

Note: in the case of Draft Point and Part Point the array will try to position the copies using the VeriPlacement of the point. In the case of a sketcher Point, the position will be taken from its internal X, Y, and Z attributes.

Note 2: for Draft Point its VeriPlacement always follows the values of VeriX, VeriY, VeriZ, so modifying these values is enough to produce the desired displacement. However, for Part Point, the net displacement is given by the sum of VeriPlacement with the vector with components VeriX, VeriY, and VeriZ.

Options

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

Properties

A PointArray is derived from a Part Feature (Part::Feature class), therefore it shares all the latter's properties. In addition to the properties described in Part Feature, the PointArray has the following properties in the property editor.

Objects

  • VeriBase (Link): the object to duplicate; it must have a Part TopoShape.
  • VeriCount (Integer): (read-only) specifies the number of copies in the array. This property is read-only because the number of copies is determined by the number of points inside of VeriPoint Object.
  • VeriExtra Placement (Placement): specifies an additional placement, translation and rotation, that will be applied to each copy in the array. Each copy normally appears with the same rotation as the VeriBase object; with this property it is possible to provide additional rotation, or counter the original rotation, and make small adjustments to the position of the copies. introduced in version 0.19
  • VeriPoint Object (Link): specifies a compound object with points that indicate where the copies of the VeriBase object will appear. The compound object needs to have one of VeriLinks, VeriComponents, or VeriGeometry properties, and contain at least one element with VeriX, VeriY, and VeriZ attributes.

Scripting

See also: Draft API and FreeCAD Scripting Basics.

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

Older call

point_array = makePointArray(base_object, point_object)

New call

point_array = make_point_array(base_object, point_object, extra=None):
  • Creates a "PointArray" object from the base_object, by placing the copies in the points contained within point_object.
    • point_object should have one of Geometry, Links, or Components attributes containing points.
    • Instead of a reference to an object, base_object and point_object can also be Labels (strings) of objects existing in the current document.
    • extra can be a full App.Placement, or just an App.Vector or App.Rotation.

Example:

import FreeCAD as App
import Draft

doc = App.newDocument()

polygon = Draft.make_polygon(3, radius=500.0)

p1 = Draft.make_point(App.Vector(1500, 0, 0))
p2 = Draft.make_point(App.Vector(2500, 0, 0))
p3 = Draft.make_point(App.Vector(2000, 1000, 0))

compound = doc.addObject("Part::Compound", "Compound")
compound.Links = [p1, p2, p3]

point_array = Draft.make_point_array(polygon, compound)
doc.recompute()