How to read the measure tool values and what variable ?
-
Hi,
I have a query regarding the measure tool. The measure tool as you know is for measuring the distance between tow points. Now I want to know in which variable is it stored and if more than one what is the variable array for it? I want to read it through code in Ruby. Please let me know.
-
It is stored in "no" variable that could be accessible with Ruby. The native measurements tool is not written in Ruby but in C code and the only linkage between SketchUp's internal C code and Ruby are the methods of the Ruby API.
Even if we had access to the C code objects, it depends on the variable scope whether the measurements tool exposes its internal methods and variables.Sometimes a solution is to rebuild a native tool with Ruby (or only the part that you need).
-
Look at the linetool.rb example that ships with Sketchup.
All you need to do is use the two picked points and length=point1.distance(point2) without drawing the line at all.
You can then 'format' the result as desired...
Advertisement