Hi there,
Please help me solve this trouble. I tried to re-draw a Layout::Path base on an existing Path in the document. Then I got another Path with exactly the same #point_types but have different shape.
Here’s the code:
def self.draw_path(entity,x,y)
start = entity.bounds.upper_left
points = entity.points.map{|po| po.set!(po.x - start.x + x, po.y - start.y + y)}
point_types = entity.point_types
style = entity.style
i = 0
path2 = ''
while i < points.length-1
case point_types[i+1]
when Layout::Path::POINT_TYPE_BEZIER_CONTROL
if i == 0
path2 = Layout::Path.new(points[i],points[i+1],points[i+2],points[i+3])
else
path2.append_point(points[i+3],points[i+1],points[i+2])
end
i += 3
when Layout::Path::POINT_TYPE_LINE_TO
if i == 0
path2 = Layout::Path.new(points[i],points[i+1])
else
path2.append_point(points[i+1])
end
i += 1
else
# do arc or circle, later :(
return
end
end
path2.style = style
return path2
end
And the result
Please help me
Thanks a lot!!!
Regards