Moving the sideline does not trigger the function (onElementModified)

There are only edges in the group.
When I move the edge in the group, the function of onElementModified was not triggered.

class TestOb < Sketchup::EntitiesObserver
  def self.add_observer(group)
    @obj ||= self.new
    group.entities.add_observer(@obj)
  end

  def self.remove_observer(group)
    @obj ||= self.new
    group.entities.remove_observer(@obj)
  end

  def onElementModified(entities, entity)
    puts "onElementModified", entities, entity
  end
end
TestOb.add_observer Sketchup.active_model.selection[0]

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.

Your method can meet my needs. I will record the position before the vertex.