Draft PointArray: Difference between revisions
No edit summary |
(Code example) |
||
Line 43: | Line 43: | ||
<translate> |
<translate> |
||
<!--T:12--> |
<!--T:12--> |
||
* {{incode|base}} is the shape to copy, and {{incode|ptlst}} is |
* {{incode|base}} is the shape to copy, and {{incode|ptlst}} is an object with Geometry, Links, or Components that define the position of the copies. |
||
<!--T:13--> |
<!--T:13--> |
||
Line 50: | Line 50: | ||
{{Code|code= |
{{Code|code= |
||
import FreeCAD, Draft |
import FreeCAD, Draft |
||
⚫ | |||
poly = Draft.makePolygon(3, radius=500.0) |
|||
p1 = Draft.makePoint(FreeCAD.Vector(1000, 0, 0)) |
|||
p2 = Draft.makePoint(FreeCAD.Vector(2000, 0, 0)) |
|||
p3 = Draft.makePoint(FreeCAD.Vector(1500, 1000, 0)) |
|||
comp = Draft.upgrade([p1, p2, p3], delete=True) |
|||
compound = comp[0][0] # Extract the compound from the list |
|||
⚫ | |||
}} |
}} |
||
<translate> |
<translate> |
Revision as of 04:27, 5 November 2018
Draft PointArray |
Menu location |
---|
Draft → PointArray |
Workbenches |
Draft, Arch |
Default shortcut |
None |
Introduced in version |
0.18 |
See also |
Draft Array, Draft PathArray |
Description
The PointArray tool places copies of a selected shape along various selected points.
How to use
- Create a shape object you wish to distribute. You will get the best results if your object is centred around the origin, even if the path starts somewhere else.
- Place points using Draft Point
- Select the points and create a compound of them using Draft Upgrade
- First select your shape, then the new point compound, and then press the Draft PointArray button.
Options
- The array starts with shape copies which are not aligned to the path, nor translated to a new position by default. You can then change the alignment and/or translation vector in the properties.
Properties
- DataBase: The shape object
- DataCount: The number of times to copy the shape (read only)
- DataPointList: a compound of points
Scripting
The PointArray tool can be used in macros and from the Python console by using the following function:
makePointArray(base, ptlst)
base
is the shape to copy, andptlst
is an object with Geometry, Links, or Components that define the position of the copies.
Example:
import FreeCAD, Draft
poly = Draft.makePolygon(3, radius=500.0)
p1 = Draft.makePoint(FreeCAD.Vector(1000, 0, 0))
p2 = Draft.makePoint(FreeCAD.Vector(2000, 0, 0))
p3 = Draft.makePoint(FreeCAD.Vector(1500, 1000, 0))
comp = Draft.upgrade([p1, p2, p3], delete=True)
compound = comp[0][0] # Extract the compound from the list
array = Draft.makePointArray(poly, compound)
Usage Notes
- in progress
Limitations
- This tool is not available before version 0.18