I think I understand all of that (but I probably don’t). The problem is distinguishing the first time in a session the tool is used (when I have to either pass the 90 default to it, or use the initialize method to set it) and later uses when I want the last user override (if any) to be used as default. Here’s my code with the default set in the initialize method. please edit to demonstrate how It should work:
module Testtool
class PutTool
def initialize
@@defangle = 90
puts "PutTool: initialize angle = " + @@defangle.to_s
end
def enableVCB?
puts "PutTool: enableVCB? callback"
return true
end
def activate
puts "PutTool: activate callback"
puts "PutTool: activate angle = " + @@defangle.to_s
#here'e where I will insert call rotate method to do initial rotation
#here's users chance to reset default:
Sketchup.vcb_label = "Enter new angle to revise rotation."
Sketchup.status_text = "Type new angle and press [ENTER]."
end
def deactivate(view)
puts "PutTool: deactivate callback"
Sketchup.status_text = ""
Sketchup.vcb_value = ""
Sketchup.vcb_label = "Measurements"
end
def onKeyDown(key, repeat, flags, view)
return false
end
def onKeyUp(key, repeat, flags, view)
return false
end
def onUserText(text, view)
@@defangle = text
puts "PutTool: onUserText = "<< @@defangle.inspect
Sketchup.vcb_value = ""
end
end # class
end # module