Test this code. It creates various Draft Points, then places them in a compound with Draft Upgrade, then creates a polygon, and finally uses the compound of points together with the polygon to produce the array.
The problem is that the array appears displaced twice the distance of the value of the point. One point is at x=1.5, but the array element appears at x=3.0; one point is at y=1, but the array element is at y=2.0.
Code: Select all
import FreeCAD
import Draft
Polygon = Draft.makePolygon(3, radius=500.0)
p1 = Draft.makePoint(FreeCAD.Vector(1500, 0, 0))
p2 = Draft.makePoint(FreeCAD.Vector(2500, 0, 0))
p3 = Draft.makePoint(FreeCAD.Vector(2000, 1000, 0))
# Create a compound of points
addList, deleteList = Draft.upgrade([p1, p2, p3])
# Extract the compound from the list
compound = addList[0]
PointArray = Draft.makePointArray(Polygon, compound)
Code: Select all
if hasattr(pts, 'Placement'):
place = pts.Placement
nshape.translate(place.Base)
nshape.rotate(place.Base, place.Rotation.Axis, place.Rotation.Angle * 180 / math.pi )
nshape.translate(Base.Vector(pts.X,pts.Y,pts.Z))
Code: Select all
if hasattr(pts, 'Placement'):
place = pts.Placement
nshape.translate(place.Base)
nshape.rotate(place.Base, place.Rotation.Axis, place.Rotation.Angle * 180 / math.pi )
else:
nshape.translate(Base.Vector(pts.X,pts.Y,pts.Z))