HI Ken and TIG,
Thanx for your feedback, I really enjoy learning to code with your help!
I decided to change the approach of Booleanhelper a bit. In the latest version (1.04) its only possible to scale with factor 10, 100, or 1000. You can choose a value from a dropdown-menu.
I've done this because the plugin is only needed to temporary scale up and down a model.
If you work on a scaled up model for instance with scale 100 you can adapt your measurements easily.
In other words, it makes no sense to scale up and down with a factor of eg 9,81.
@TIG Here is the code of version 1.04. I managed to integrate the scalefactor in the tooltip of the toolbar icons, but the method I used for the tooltips is not working for the menu-items, unfortunately.
Further I put this piece of code in the Getinfo class. As a result the tooltips only update after setting the scalefactor. My idea was to put the code for the tooltip outside the classes, but to no avail;
<span class="syntaxdefault">require </span><span class="syntaxstring">'sketchup.rb'<br /><br /></span><span class="syntaxcomment">#=============================================================================<br /></span><span class="syntaxdefault"> <br /> <br /> </span><span class="syntaxcomment">#$booleanhelper_scaleoption = 1 # Uncomment the first line of code to scale your object about the origin. ( Restart needed!)<br /></span><span class="syntaxdefault"> <br /> </span><span class="syntaxcomment"># Leave it as it is to scale your object about it's center.<br /></span><span class="syntaxdefault"> <br /><br /><br /><br /><br /><br /><br />module Bhelper<br /><br /> sf </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> 100<br /> if Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">read_default</span><span class="syntaxkeyword">(</span><span class="syntaxstring">'liquidsscalefactor'</span><span class="syntaxkeyword">,</span><span class="syntaxstring">'value'</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">==</span><span class="syntaxdefault"> nil<br /> <br /> Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">write_default</span><span class="syntaxkeyword">(</span><span class="syntaxstring">'liquidsscalefactor'</span><span class="syntaxkeyword">,</span><span class="syntaxstring">'value'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault">sf</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> <br /> end <br /> <br /><br /> <br />class Getinfo<br /> <br /> def initialize</span><span class="syntaxkeyword">()</span><span class="syntaxdefault"> <br /> <br /> <br /><br /> </span><span class="syntaxkeyword">@@</span><span class="syntaxdefault">sf </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">read_default</span><span class="syntaxkeyword">(</span><span class="syntaxstring">'liquidsscalefactor'</span><span class="syntaxkeyword">,</span><span class="syntaxstring">'value'</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> <br /> prompts </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">[</span><span class="syntaxstring">"Set scalefactor "</span><span class="syntaxkeyword">]<br /></span><span class="syntaxdefault"> <br /> defaults </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">[@@</span><span class="syntaxdefault">sf</span><span class="syntaxkeyword">]<br /></span><span class="syntaxdefault"> values </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">[</span><span class="syntaxstring">"10|100|1000"</span><span class="syntaxkeyword">]</span><span class="syntaxdefault"> </span><span class="syntaxcomment"># For other scale factors please use the native Sketchup-scale tool . This script is intended only for quick scale up and down actions .<br /><br /></span><span class="syntaxdefault"> <br /> results </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> UI</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">inputbox prompts</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> defaults</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> values</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"Scalefactor."<br /></span><span class="syntaxdefault"> <br /> return if not results<br /><br /> <br /> <br /> </span><span class="syntaxkeyword">@@</span><span class="syntaxdefault">sf </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> results</span><span class="syntaxkeyword">[</span><span class="syntaxdefault">0</span><span class="syntaxkeyword">]<br /></span><span class="syntaxdefault"> <br /> <br /> $cmdbooleanhelperscale</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">tooltip </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">(</span><span class="syntaxstring">"Scalefactor#{@@sf}"</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> <br /> $cmdbooleanhelperscale1</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">tooltip </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">(</span><span class="syntaxstring">"Scalefactor#{@@sf}"</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">write_default</span><span class="syntaxkeyword">(</span><span class="syntaxstring">'liquidsscalefactor'</span><span class="syntaxkeyword">,</span><span class="syntaxstring">'value'</span><span class="syntaxkeyword">,@@</span><span class="syntaxdefault">sf</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> <br /> <br /> <br /> <br /> end<br /><br />end<br /><br /><br /> <br /><br /><br />class Kleiner<br /> <br /> def initialize</span><span class="syntaxkeyword">()</span><span class="syntaxdefault"> <br /> sf </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">(</span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">read_default </span><span class="syntaxstring">'liquidsscalefactor'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">'value'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">'100'</span><span class="syntaxkeyword">).</span><span class="syntaxdefault">to_f<br /> <br /> model </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_model<br /> entities </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_entities<br /> selection </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">selection<br /> <br /> boundbox </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">bounds<br /> center</span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> boundbox</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">center<br /><br /> <br /> if $booleanhelper_scaleoption </span><span class="syntaxkeyword">==</span><span class="syntaxdefault"> 1<br /> <br /> center </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">[</span><span class="syntaxdefault">0</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> 0</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> 0</span><span class="syntaxkeyword">]<br /></span><span class="syntaxdefault"> <br /> <br /> end <br /> <br /> trans </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> Geom</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Transformation</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">scaling</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">center</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> 1.0</span><span class="syntaxkeyword">/</span><span class="syntaxdefault">sf</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> entities</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">transform_entities</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">trans</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> selection</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">to_a</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> <br /> </span><span class="syntaxcomment">#new_view = view.zoom_extents<br /></span><span class="syntaxdefault"> <br /> end<br />end<br /><br /><br /><br /><br /><br />class Groter<br /> <br /> def initialize</span><span class="syntaxkeyword">()</span><span class="syntaxdefault"> <br /> sf </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">(</span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">read_default </span><span class="syntaxstring">'liquidsscalefactor'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">'value'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">'100'</span><span class="syntaxkeyword">).</span><span class="syntaxdefault">to_f<br /> <br /> model </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_model<br /> entities</span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_entities<br /> selection </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">selection<br /> <br /> <br /> <br /> boundbox </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">bounds<br /> center</span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> boundbox</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">center<br /> <br /> <br /> if $booleanhelper_scaleoption </span><span class="syntaxkeyword">==</span><span class="syntaxdefault"> 1<br /> <br /> center </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">[</span><span class="syntaxdefault">0</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> 0</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> 0</span><span class="syntaxkeyword">]<br /></span><span class="syntaxdefault"> <br /> <br /> <br /> end<br /><br /> trans </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> Geom</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Transformation</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">scaling</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">center</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> sf</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> entities</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">transform_entities</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">trans</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> selection</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">to_a</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> <br /> </span><span class="syntaxcomment">#new_view = view.zoom_extents<br /></span><span class="syntaxdefault"> <br /> end<br />end<br /><br /><br /> <br /> <br /> <br /> <br /><br /></span><span class="syntaxcomment">#=============================================================================<br /></span><span class="syntaxkeyword">if(</span><span class="syntaxdefault"> not $booleanhelper_menu_loaded </span><span class="syntaxkeyword">)<br /><br /></span><span class="syntaxdefault"> <br /> add_separator_to_menu</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"Plugins"</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> new_menu </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> UI</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">menu</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"Plugins"</span><span class="syntaxkeyword">).</span><span class="syntaxdefault">add_submenu</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"Boolean helper"</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> new_toolbar </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> UI</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Toolbar</span><span class="syntaxkeyword">.new(</span><span class="syntaxstring">"Boolean helper"</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> plugins </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">find_support_file</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"Plugins"</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> imgdir </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> File</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">join</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">plugins</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"Booleanhelper"</span><span class="syntaxkeyword">)<br /><br /></span><span class="syntaxdefault"> $cmdbooleanhelperscale </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> UI</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Command</span><span class="syntaxkeyword">.new(</span><span class="syntaxstring">"Scale down"</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">{</span><span class="syntaxdefault">Bhelper</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Kleiner</span><span class="syntaxkeyword">.new()</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">}<br /></span><span class="syntaxdefault"> $cmdbooleanhelperscale</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">small_icon </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> File</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">join</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">imgdir</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"smaller.png"</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> $cmdbooleanhelperscale</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">large_icon </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> File</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">join</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">imgdir</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"smallerL.png"</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> <br /> <br /><br /> new_menu</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">add_item</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">$cmdbooleanhelperscale</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> new_toolbar</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">add_item</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">$cmdbooleanhelperscale</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> <br /> $cmdbooleanhelperscale1</span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> UI</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Command</span><span class="syntaxkeyword">.new(</span><span class="syntaxstring">"Scale up"</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">{</span><span class="syntaxdefault">Bhelper</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Groter</span><span class="syntaxkeyword">.new()</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">}<br /></span><span class="syntaxdefault"> $cmdbooleanhelperscale1</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">small_icon </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> File</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">join</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">imgdir</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"bigger.png"</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> $cmdbooleanhelperscale1</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">large_icon </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> File</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">join</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">imgdir</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">"biggerL.png"</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> <br /><br /><br /> new_menu</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">add_item</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">$cmdbooleanhelperscale1</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> new_toolbar</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">add_item</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">$cmdbooleanhelperscale1</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> <br /> cmd </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> UI</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Command</span><span class="syntaxkeyword">.new(</span><span class="syntaxstring">"set scale factor"</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">{</span><span class="syntaxdefault">Bhelper</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Getinfo</span><span class="syntaxkeyword">.new()}<br /></span><span class="syntaxdefault"> <br /> new_menu</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">add_item</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">cmd</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> new_toolbar</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">show<br /><br /> $booleanhelper_menu_loaded </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> true<br />end <br /><br />end </span><span class="syntaxcomment">#module </span><span class="syntaxdefault"></span>