onTextChanged not called?

I drew a rectangle and attached dimension and then pasted this in the console:
# This is an example of a DimensionObserver
class MyDimensionObserver < Sketchup::DimensionObserver
def onTextChanged(dimension)
puts “onTextChanged: #{dimension}, new_text= #{dimension.text}”
end
end

# Attach the observer. (Assumes there is a dimension in the model root.)
dim = Sketchup.active_model.entities.grep(Sketchup::Dimension).first
dim.add_observer(MyDimensionObserver.new)

(taken from the documentation)

Now I change the rectangle, the dimension’s text is updated, but the observer is not called (I don’t see a message in the console). Can you help me understand why?

NM. The observer is called only when the user manually changes the text

Your forum profile is empty of the 3 IT questions.

What OS are you seeing this on ?

What SketchUp build number ? (The Help > About dialog will tell you.)


A dimension is an entity sublcass. Does the EntityObserver#onChangeEntity callback fire ?

This topic was automatically closed after 91 days. New replies are no longer allowed.