# Observer calls missing when using push/pull

**URL:** <https://forums.sketchup.com/t/observer-calls-missing-when-using-push-pull/32132>\
**Category:** Ruby API\
**Created:** [October 13, 2016, 2:14pm UTC](https://forums.sketchup.com/t/observer-calls-missing-when-using-push-pull/32132 "2016-10-13T14:14:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![OricAtmos](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/oricatmos/32/16061_2.png) [@OricAtmos](https://forums.sketchup.com/u/OricAtmos)\
**Post date:** [October 13, 2016, 2:14pm UTC](https://forums.sketchup.com/t/observer-calls-missing-when-using-push-pull/32132/1 "2016-10-13T14:14:38Z")

</div>

Hi,

it’s me again with another observer related problem. This time I’ll provide a ruby snippet right away. 😉  
Okay, so here’s the problem: I’ve attached an EntitiesObserver to the entities of the model, and am attaching EntityObservers to each face that is created. Then I create a rectangle, use push/pull to make a box. So far everything works as expected. But when I use the push/pull tool to grab one of the sides of the box to push or pull it, the only observers that are called are related to the face that I grabbed, not the four faces that are connected to this face and are also changed by the push/pull operation.  
If I use the Move tool instead to move one side of the box, the observers for the connected faces are called as expected.

So here’s the code:

```
require 'sketchup'

module OricAtmos

class MyEntityObserver < Sketchup::EntityObserver
    def onChangeEntity(entity)
        puts("EntityObserver::onChangeEntity: #{entity.to_s} #{entity.entityID}")
    end

    def onEraseEntity(entity)
        puts("EntityObserver::onEraseEntity: #{entity.to_s}, is deleted? #{entity.deleted?}")
    end
end

class MyEntitiesObserver < Sketchup::EntitiesObserver
    def onElementAdded(su_entities, su_entity)
        puts "MyEntitiesObserver(#{self})::onElementAdded: #{su_entities} #{su_entity} #{su_entity.entityID}"
        if su_entity.is_a?(Sketchup::Face)
            #puts "Face: #{su_entity.vertices.map{|v| v.position.to_a}}"
            su_entity.add_observer(MyEntityObserver.new)
        end
    end

    def onElementModified(su_entities, su_entity)
        puts "MyEntitiesObserver(#{self})::onElementModified: #{su_entities} #{su_entity} #{su_entity.entityID}"
        #if su_entity.is_a?(Sketchup::Face)
        # puts "Face: #{su_entity.vertices.map{|v| v.position.to_a}}"
        #end
    end

    def onElementRemoved(su_entities, su_entity_id)
        puts "MyEntitiesObserver(#{self})::onElementRemoved: #{su_entities} #{su_entity_id}"
    end

    def onEraseEntities(su_entities)
        puts "MyEntitiesObserver(#{self})::onEraseEntities: #{su_entities}"
    end
end

class MyAppObserver < Sketchup::AppObserver
    def expectsStartupModelNotifications()
        return true
    end

    def onNewModel(su_model)
        puts "MyAppObserver::onNewModel: " + su_model.to_s
        su_model.entities.add_observer(MyEntitiesObserver.new())
    end

    def onOpenModel(su_model)
        puts "MyAppObserver::onOpenModel: " + su_model.to_s
        su_model.entities.add_observer(MyEntitiesObserver.new())
    end
end

Sketchup.add_observer(MyAppObserver.new())
end

```

This is the text output when using the push/pull tool:

```
MyEntitiesObserver(#<OricAtmos::MyEntitiesObserver:0x007f9b51994938>)::onElementModified: #<Sketchup::Entities:0x007f9b519949b0> #<Sketchup::Face:0x007f9b519a7bf0> 492
EntityObserver::onChangeEntity: #<Sketchup::Face:0x007f9b519a7bf0>

```

and this is the output when using move:

```
MyEntitiesObserver(#<OricAtmos::MyEntitiesObserver:0x007f9b51994938>)::onElementModified: #<Sketchup::Entities:0x007f9b519949b0> #<Sketchup::Face:0x007f9b5199cf98> 485
MyEntitiesObserver(#<OricAtmos::MyEntitiesObserver:0x007f9b51994938>)::onElementModified: #<Sketchup::Entities:0x007f9b519949b0> #<Sketchup::Face:0x007f9b519a7bf0> 492
MyEntitiesObserver(#<OricAtmos::MyEntitiesObserver:0x007f9b51994938>)::onElementModified: #<Sketchup::Entities:0x007f9b519949b0> #<Sketchup::Face:0x007f9b519a7a38> 498
MyEntitiesObserver(#<OricAtmos::MyEntitiesObserver:0x007f9b51994938>)::onElementModified: #<Sketchup::Entities:0x007f9b519949b0> #<Sketchup::Face:0x007f9b5199f310> 456
MyEntitiesObserver(#<OricAtmos::MyEntitiesObserver:0x007f9b51994938>)::onElementModified: #<Sketchup::Entities:0x007f9b519949b0> #<Sketchup::Face:0x007f9b519a7448> 457
EntityObserver::onChangeEntity: #<Sketchup::Face:0x007f9b5199f310>
EntityObserver::onChangeEntity: #<Sketchup::Face:0x007f9b5199cf98>
EntityObserver::onChangeEntity: #<Sketchup::Face:0x007f9b519a7bf0>
EntityObserver::onChangeEntity: #<Sketchup::Face:0x007f9b519a7a38>
EntityObserver::onChangeEntity: #<Sketchup::Face:0x007f9b519a7448>
MyEntitiesObserver(#<OricAtmos::MyEntitiesObserver:0x007f9b51994938>)::onElementModified: #<Sketchup::Entities:0x007f9b519949b0> #<Sketchup::AttributeDictionary:0x007f9b519af4e0> 499

```

Again, I’m using this version of SketchUp:

![](https://global.discourse-cdn.com/sketchup/original/3X/9/8/98a49006cfc7d64ba1729e81fd31a1b16a9675a8.jpg)

---

<div class="post-metadata">

**Author:** ![nekitu](https://avatars.discourse-cdn.com/v4/letter/n/ea5d25/32.png) [@nekitu](https://forums.sketchup.com/u/nekitu)\
**Post date:** [October 13, 2016, 5:31pm UTC](https://forums.sketchup.com/t/observer-calls-missing-when-using-push-pull/32132/2 "2016-10-13T17:31:56Z")

</div>

This happened to me too, I just gave up relying too much on the SU observers 🙂
