Hello everyone, my EntitiesObserver has the ability to detect added faces, create groups, and add various objects. Below is the code content of my EntitiesObserver.
module Test
module TestFunc
class TestObserver < Sketchup::EntitiesObserver
def onElementAdded(entities, entity)
return unless entity.is_a?(Sketchup::Face)
if entity.normal.z == 1 then
gp = entities.add_group()
gp.entities.add_line([5, 0, 0], [5, 0, 0].offset(Z_AXIS, 1000))
end
end
end
class TestGroup
mod = Sketchup.active_model
ents = mod.active_entities
points = [[10, 10, 0], [20, 10, 0], [20, 20, 0], [10, 20, 0]]
gp = ents.add_group(ents.add_face(points))
observer = TestObserver.new()
gp.entities.add_observer(observer)
end
end
end
However, if you enter dimensions using the Pushpull tool on the face of the group to which my EntitiesObserver is applied, the pushpull will not be as much as the dimension, but only up to the current mouse cursor. Also, it seems like the pushpull function doesn’t end and the pushpull continues to run as the mouse moves. Is there any way to solve this problem?