Class: Sketchup::Classifications

Inherits:
Object
  • Object
show all
Includes:
Enumerable

Overview

The Classifications class is a container/manager for all classifications in a model.

Version:

  • SketchUp 2015

Instance Method Summary collapse

Instance Method Details

#[](index_or_name) ⇒ Object

The [] method is used to get a classification schema by name or index.

Examples:

# Get schema by name:
schema = Sketchup.active_model.classifications["IFC 2x3"]

# Get schema by index:
schema = Sketchup.active_model.classifications[1]

Returns schema - a ClassificationSchema object if successful, otherwise nil.

Parameters:

  • index_or_name

    The index or name of the ClassificationSchema object.

Returns:

  • schema - a ClassificationSchema object if successful, otherwise nil.

Version:

  • SketchUp 2015

#each {|schema| ... } ⇒ Object

The each method is used to iterate through loaded classification schemas.

Examples:

Sketchup.active_model.classifications.each { |schema|
  puts schema.name
}

Yields:

  • (schema)

    A variable that will hold each ClassificationSchema object as they are found.

Returns:

  • nil

Version:

  • SketchUp 2015

#keysObject

The keys method is used to get a list of keys in the Classifications class, which are the same as the names of the schemas.

Examples:

schema_names = Sketchup.active_model.classifications.keys

Returns:

  • keys - Array of string keys

Version:

  • SketchUp 2015

#lengthObject

The length method returns the number of loaded classification schemas.

Examples:

Sketchup.active_model.classifications.size

Returns:

  • integer - number of ClassificationSchema object

Version:

  • SketchUp 2015

#load_schema(file) ⇒ Object

The load_schema method is used to load a classification schema into a model.

Examples:

c = Sketchup.active_model.classifications
file = Sketchup.find_support_file('IFC 4.skc', 'Classifications')
status = c.load_schema(file) if !file.nil?

Returns True if successful.

Parameters:

  • file

    Full path to the schema file

Returns:

  • True if successful.

Version:

  • SketchUp 2015

#sizeObject

The length method returns the number of loaded classification schemas.

Examples:

Sketchup.active_model.classifications.size

Returns:

  • integer - number of ClassificationSchema object

Version:

  • SketchUp 2015

#unload_schema(schema_name) ⇒ Object

The unload_schema method is used to unload a classification schema that was previously loaded into a model.

Examples:

c = Sketchup.active_model.classifications
status = c.unload_schema('IFC 2x3')

Returns True if successful.

Parameters:

  • schema_name

    Name of the schema to unload

Returns:

  • True if successful.

Version:

  • SketchUp 2015