Can the Ruby API monitor the consumer’s actions in drawing faces with the drawing instrument? Every time the consumer attracts a floor get the coordinate info of that floor.
I discovered the related code, however I don’t know how you can management MyEntitiesObserver to run or cease. I might recognize any recommendation, thanks!
class MyEntitiesObserver < Sketchup::EntitiesObserver
def onElementAdded(entities, entity)
places "onElementAdded: #{entity}"
if entity.typename == "Face"
p entity.persistent_id
finish
finish
finish
# Connect the observer
Sketchup.active_model.entities.add_observer(MyEntitiesObserver.new)
See the instance right here
Entities #remove_observer-instance_method
By the best way:entity.typename == "Face"
compassion is sluggish, use entity.is_a?(Sketchup::Face)
as a substitute.