Draw model while moving mouse in custom tool

YES

It is quite fast with small components from the distro library … try it …

# encoding: UTF-8

module Testing

  @@loaded ||= false

  class DragTool

    def activate
      @model = Sketchup.active_model
      choice = get_definition()
      if choice
        @cancelled = @placed = false
        @model.start_operation("DragInsert Component")
        cdef  = @model.definitions.load(choice)
        @inst = @model.active_entities.add_instance(cdef,IDENTITY)
      else
        @model.select_tool(nil)
      end
    end

    def deactivate(view)
      if @placed && !@cancelled
        @model.commit_operation
      else
        @model.abort_operation
      end
    end

    def get_definition()
      path = Sketchup.find_support_file("Components/Components Sampler")
      choice = UI.openpanel("Choose a component ...",path,"*.skp")
    end

    def onCancel(reason, view)
      puts "Cancel reason: #{reason}"
      @cancelled = true
      @model.select_tool(nil)
    end

    def onLButtonDown( flags, x, y, view )
      ip = view.inputpoint( x,y )
      point = ip.position
      @inst.move!( Geom::Transformation::translation(point) )
      view.invalidate
      @placed = true
      @model.select_tool(nil)
    end

    def onMouseMove( flags, x, y, view )
      ip = view.inputpoint( x,y )
      point = ip.position
      @inst.move!( Geom::Transformation::translation(point) )
      view.invalidate
    end

  end

  if !@@loaded
    UI.add_context_menu_handler {|popup|
      popup.add_item("DragInsert Component Tool") {
        Sketchup.active_model.select_tool(DragTool::new)
      }
    }
    @@loaded = true
  end

end