Lets look at EntitiesObserver
and PushPull:
class MyEntitiesObserver < Sketchup::EntitiesObserver
def onElementAdded(entities, entity)
puts "onElementAdded: #{entity}"
end
def onElementModified(entities, entity)
puts "onElementModified: #{entity}"
end
def onElementRemoved(entities, entity_id)
puts "onElementRemoved: #{entity_id}"
end
end
observer = MyEntitiesObserver.new
Sketchup.active_model.entities.add_observer(observer)
When I push-pulled a face from a flat surface - making an extrusion:
onElementAdded: #<Sketchup::Edge:0x0002667b2e8ab8>
onElementAdded: #<Sketchup::Edge:0x0002667b2e88d8>
onElementAdded: #<Sketchup::Edge:0x0002667b2e8770>
onElementAdded: #<Sketchup::Edge:0x0002667b2e85b8>
onElementAdded: #<Sketchup::Edge:0x0002667b2e83d8>
onElementAdded: #<Sketchup::Face:0x0002667b316e90>
onElementAdded: #<Sketchup::Edge:0x0002667b2e80b8>
onElementAdded: #<Sketchup::Face:0x0002667b2e8428>
onElementAdded: #<Sketchup::Edge:0x0002667b2e8d60>
onElementAdded: #<Sketchup::Face:0x0002667b2e9710>
onElementAdded: #<Sketchup::Face:0x0002667b2ea0c0>
onElementAdded: #<Sketchup::Edge:0x0002667b2d3f00>
onElementAdded: #<Sketchup::Face:0x0002667b2d3ca8>
onElementRemoved: 14245
onElementModified: #<Sketchup::Edge:0x0002667b44ab40>
onElementModified: #<Sketchup::Edge:0x0002667b44a8c0>
onElementModified: #<Sketchup::Edge:0x0002667b44a500>
onElementModified: #<Sketchup::Edge:0x0002667b44a3e8>
But when I PushPull such that I’m only moving a face:
onElementModified: #<Sketchup::Face:0x0002667b316e90>
From what I gather, you would also need some notification for the neighboring faces. Understandably.
I think that I would try to get the neighbouring faces from the EntitiesObserver. Though, I can see that you might not want to do that for every face. Initially I thought that we could perhaps leverage the ToolsObserver to know when a PushPull was performed (but face.pushpull complicates that).
Need to ponder about this one… I really don’t think observing every Loop will be viable in terms of performance.