plane_tools/WorkPlane.rb
# This is called when the user types a value into the VCB
This is called when the user types a value into the VCB
This is called when the user types a value into the VCB
def onUserText(text, view)
    begin
        value=text.to_l
    rescue
        UI.beep
        puts "Can't make that into a length!"
        value=nil
        Sketchup::set_status_text("", SB_VCB_VALUE)
    end
    return unless value
    case @state
      when 1 
        vec=@pts[1] - @pts[0]
        if vec.length > 0.0
            vec.length=value
            @pts[1]=@pts[0].offset(vec)
            view.invalidate
            self.increment_state()
        end
        @msg=@msg1
        Sketchup::set_status_text(@msg)
      when 2 
        vec=@pts[3] - @pts[0]
        if vec.length > 0.0
            vec.length=value
            @pts[2]=@pts[1].offset(vec)
            @pts[3]=@pts[0].offset(vec)
            self.increment_state()
        end
        @msg=@msg2
        Sketchup::set_status_text(@msg)
    end
end
def onUserText ( text , view ) begin value = text . to_l rescue UI . beep puts "Can't make that into a length!" value = nil Sketchup :: set_status_text ( "" , SB_VCB_VALUE ) end return unless value case @state when 1 vec = @pts [ 1 ] - @pts [ 0 ] if vec . length > 0.0 vec . length = value @pts [ 1 ] = @pts [ 0 ] . offset ( vec ) view . invalidate self . increment_state ( ) end @msg = @msg1 Sketchup :: set_status_text ( @msg ) when 2 vec = @pts [ 3 ] - @pts [ 0 ] if vec . length > 0.0 vec . length = value @pts [ 2 ] = @pts [ 1 ] . offset ( vec ) @pts [ 3 ] = @pts [ 0 ] . offset ( vec ) self . increment_state ( ) end @msg = @msg2 Sketchup :: set_status_text ( @msg ) end end
This is called when the user types a value into the VCB
This is called when the user types a value into the VCB
# The user may type in something that we can't parse as a length # so we set up some exception handling to trap that # Error parsing the text ### # update the width ### # update the height ###
text
<not_specific>
view
<not_specific>