That’s because the position of the edges are stored on the vertices, and the vertices are owned by the edges, not the entities collection - so the EntitiesObserver isn’t triggering.
I know, it’s awkward. It’s a side effect of the internal implementation detail.
In my own experience working with observers I found that it was better to use as few as possible. And use them on more generic levels. The observer API isn’t great at giving really fine grained feedback.
Can you explain a little bit about the context of tracking the movement of edges? Maybe we can find some alternative for you.
class EntSpy
def onChangeEntity(entity)
puts "onChangeEntity: #{entity}"
end
end
@spy = EntSpy.new
group.entities.grep(Sketchup::Edge) do |edge|
edge.vertices.each { |v| v.add_observer(@spy) }
end
But the observers do not tell how an object changes.
My wall is generated from the edges.
I want to observe the movement of the sideline to move other components attached to the wall.
However, I also find it inappropriate to realize this requirement by observing the movement of the edges.