Screen won't update
-
I was putting together some methods to do some selections.
The first was a method to select all connected planar faces. This worked fine.
Then I modified that a little to a new method which selected all connected entities which had the same material as the selected face. The script correctly selects the entities, Entity Info confirms, but the viewport doesn't show the entities as selected. If I use the Move tool the view finally updates the selection, but not if I pan or rotate the view.
I also tried to force refresh the view after the selection method is one by doing this:
Sketchup.active_model.active_view.invalidate
But that doesn't do anything either.
If I add
Sketchup.active_model.active_view.last_refresh_time
to before and after the selection loop the time is identical. Even with the force refresh code.
What gives? (SU7 Pro + Vista Ultimate)
-
To control the display refresh, you invalidate the view (as you show you tried), but you have to do that within the context of your class that is defined as Sketchup::Tool.
-
So invalidating the view only works for Tools?
Well, in any case, it's working now as I changed the way it looped through the entities. I was using .all_connected and that's when the oddity occurred. But I changed that because it didn't do what I wanted. I initially thought .all_connected returned the entities immediately connected, not the whole lot. I still don't understand why it happened though.
-
Yes, view.invalidate is designed to work with Tools.
Advertisement