VCB values disappear on orbit
-
So I'm writing a script that draws lines following a vector. All of it is working well until the part where I am now trying to integrate the VCB into my script. Here's the parts of the script that I think are messed up somehow. I could use some help, I'm guessing its a view and draw and invalidate problem (because I don't quite understand all that just yet).
This is what gets run everytime the user enters a VCB value and hits enter:
def onUserText(text, view) @@last_height = text.to_l endpoint_maker @faces if (@last_line[0]) (@last_line[0]).erase! end make_line end # onUserText
I also have a working draw method (I've canablized one of the example scripts, so they wrote it and it works great for it was written for which is updating the inputpoint on the screen (I think)):
def draw(view) Sketchup.set_status_text.draw view if( @ip.valid? && @ip.display? ) @ip.draw view @displayed = true else @displayed = false end end
So to re-iterate the problem: The VCB shows the values when the user types it. And it stays there. Until the model is orbited, then the value is not shown anymore.
So....any thoughts? Thanks,
Chris
NOTE: I also included the entire tool class I've written just in case the problem is outside of the small bits I posted and someone would like to dig through the rest of the class. Thanks!
-
Come to think of it, here's the entire script as it stands so you can just install it (temporarily) and test it to see what I mean. This script is not intended to be a distributed release. So there's really no need to instll it unless you are helping troubleshoot the problem. Once the problem is solved, I'll post an update of the actual script, thanks.
Chris
-
So I had a breakthrough idea: just add the set status code to my draw method. So I've added the line:
Sketchup.set_status_text @@last_height, SB_VCB_VALUE
to the draw method. And it is always shown, but its being called non-stop (I think because I have an onMouseMove method that calls the draw method?). Is that really the way to do it?
Chris
-
Chris, does the resume method get called after an Orbit? Maybe it can be used to reset the displayed values.
def resume view Sketchup.set_status_text @@last_height, SB_VCB_VALUE end
-
Hey, that works great Jim, thanks! [me thinking this through out loud to make sure I have the logic straight] So the VCB is being set to blank because another tool is being called (oribt). Defining a resume method tells my tool what to do when it is resumed? Excellent. Thanks Jim,
Chris
Advertisement