Force a redraw after a value is entered in the vcb?
-
I am having trouble finding a work around to a bug in sketchup. The bug occurs when a dynamic component with nested subcomponents is scaled to a specific dimension using the scale tool and entering a dimension with units (ie. 35") in the vcb. The parent DC scales correctly to the given dimension, but the subcomponents do not redraw according to their attributes and the subcomponents attributes are not updated. Using the context menu "Dynamic Components -> Redraw" redraws the subcomponents correctly.
My question is this: how do I force a redraw every time I enter a dimension with units in the VCB?
Usually I add the value in the VCB after scaling to an arbitrary size so the observer would need to watch for vcb input all the time.
-
A selection-observer to see if it contains DC instance[s] ?
A tools-observer to see if Scale in active && @check1 gives you @check2 ??
Now an entities-observer if @check2 looking at the DC[s] looks for any changes, gives check3 ???
If @check3 then call something like:<span class="syntaxdefault">def dc_redraw</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">ent</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> pbar_visible</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">true</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> undo</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">false</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> ldc</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">$dc_observers</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">get_latest_class</span><span class="syntaxkeyword">()<br /></span><span class="syntaxdefault"> if undo<br /> ldc</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">method</span><span class="syntaxkeyword">(;</span><span class="syntaxdefault">redraw_with_undo</span><span class="syntaxkeyword">).</span><span class="syntaxdefault">call</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">ent</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> pbar_visible</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> else<br /> ldc</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">determine_movetool_behaviors</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">ent</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> DCProgressBar</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">clear</span><span class="syntaxkeyword">()<br /></span><span class="syntaxdefault"> ldc</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">method</span><span class="syntaxkeyword">(;</span><span class="syntaxdefault">redraw</span><span class="syntaxkeyword">).</span><span class="syntaxdefault">call</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">ent</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> pbar_visible</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> DCProgressBar</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">clear</span><span class="syntaxkeyword">()<br /></span><span class="syntaxdefault"> ldc</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">refresh_dialogs</span><span class="syntaxkeyword">()<br /></span><span class="syntaxdefault"> end<br /> </span><span class="syntaxkeyword">@</span><span class="syntaxdefault">view</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">refresh<br /> rescue TypeError </span><span class="syntaxkeyword">=></span><span class="syntaxdefault"> e<br /> </span><span class="syntaxcomment"># suppress nil to float conversion error that happens<br /></span><span class="syntaxdefault"> </span><span class="syntaxcomment"># when redraw is called directly with true 2nd arg ?<br /></span><span class="syntaxdefault">end</span><span class="syntaxcomment">#def<br />### so it is NOT; $dc_observers.get_latest_class.redraw_with_undo(dc)<br />### it's; self.dc_redraw(dc, true, false) </span><span class="syntaxdefault"></span>
Advertisement