I have developed a
tool that allows users to select a few surfaces and then perform some calculations on them.
When the user either deactivate the tool or hits Return, I would like to show a message with the results of these calculations.
tool = RG::Aoi::PickSurface.new Sketchup.active_model.select_tool(tool) UI.messagebox(tool.results)
The tool is defined as follows
module RG::Aoi class PickSurface attr_reader :results def activate ..... end other events end end
The problem that I have is that
UI.messagebox is executed immediately after the tool activation and the tool cannot be used until I click OK. This means that
tool.results is of course
nil. The tool is activated within a callback from
webdialog if that counts.
I guess I could save the results of the calculation in a file and read the file later, but this would require the user to perform another action.
Is there a better solution? Can tools be used in this way?