I'm not sure what you're trying to achieve...
This might help [a bit] - it traps errors ..........
class MyEntitiesObserver < Sketchup;;EntityObserver
def onChangeEntity(entity)
width = entity.bounds.width.to_f
model = Sketchup.active_model
entities = model.active_entities
pts = []
pts[0] = [0, 0, 0]
pts[1] = [width, 0, 0]
pts[2] = [width, width*2.0, 0]
pts[3] = [0, width*2.0, 0]
begin
face = entities.add_face pts
face.add_observer($mmmmmmmmmmmmmmmmmmmmm)
entity.edges.each{|i| i.erase! if not e.edges[1]}
rescue
puts 'error'
face.remove_observer($mmmmmmmmmmmmmmmmmmmmm)
face.add_observer($mmmmmmmmmmmmmmmmmmmmm)
end
end
end
model = Sketchup.active_model
entities = model.active_entities
pts = []
pts[0] = [0, 0, 0]
pts[1] = [1, 0, 0]
pts[2] = [1, 2, 0]
pts[3] = [0, 2, 0]
face = entities.add_face pts
$mmmmmmmmmmmmmmmmmmmmm=MyEntitiesObserver.new()
face.add_observer($mmmmmmmmmmmmmmmmmmmmm)
I suggest you rename your observer as something less obvious... i.e. others might have used it !