It looks like you're new here. If you want to get involved, click one of these buttons!
Steps to reproduce the problem:
=
lv = RBA::Application.instance.main_window.current_view
lv.each_object_selected { |obj|
obj.shape.path.points = [RBA::Point.new(1,2),RBA::Point.new(3,4)]
}
I thought maybe it's not changing it because obj.shape.path is a pointer to the path rather than the path itself or something.. Is this the desired behavior or am I missing something?
The only way I've found to do it is to make a second path with the desired points, place it, and erase the first path. But this is troublesome and not perfect, e.g. User Properties and beginning and end types etc are not copied over without some effort.
Thanks,
David
Comments
Hi David,
recall our discussion about "OO style" API? That's another case.
I shall explain that:
obj.shape.path
returns a copy of that path. You basically modify the copy, so it won't have an effect.But you can assign the path object:
That should preserve the user properties.
It's actually not possible to adopt a "OO style" API, because a shape does not necessarily represent a
RBA::Path
object. The layout database stores objects in a compact way, soShape
is a facade delivering the working objects such asBox
,Path
orPolygon
.Matthias
I am slowly learning...
Thanks,
David