Class: Sketchup::LoadHandler Abstract

Inherits:
Object
  • Object
show all

Overview

This class is abstract.

Implement the methods described in this class to create a tool. You can not sub-class this class because it is not defined by the API.

The main purpose of the LoadHandler interface is to be used as an optional second parameter of the DefinitionList#load_from_url method.

Its methods that require implementation handle the process of downloading and managing the state of the load operation, including progress updates and error handling.

Version:

  • SketchUp 6.0

Instance Method Summary # collapse

Instance Method Details

#cancelled?Boolean

This method is called when the download is canceled by the user.

Examples:

def cancelled?
  # You could, for example, show a messagebox after X seconds asking if the
  # user wants to cancel the download. If this method returns true, then
  # the download cancels.
  return false
end

Returns:

  • (Boolean)

#onFailure(message) ⇒ Boolean

This method is called when the download unsuccessfully completes

Examples:

def onFailure(message)
  self.error = message
  Sketchup::set_status_text('')
end

Parameters:

Returns:

  • (Boolean)

#onPercentChange(percent) ⇒ nil

This method is triggered whenever the percent value updates.

Examples:

def onPercentChange(percent)
  Sketchup::set_status_text("loading: #{percent.round}%")
end

Parameters:

  • percent (Float)

Returns:

  • (nil)

#onSuccessnil

This method is called when the download successfully completes

Examples:

def onSuccess
  Sketchup::set_status_text('')
end

Returns:

  • (nil)