123456789_123456789_123456789_123456789_123456789_

Module: Sketchup::Skp

Relationships

Overview

The Skp module is used to read metadata from external SketchUp files without loading the whole file.

Version:

  • SketchUp 2021.0

Class Method Summary

Class Method Details

.read_guid(filepath) ⇒ String

The .read_guid method is used to read the GUID, globally unique identifier, for an external model.

In SketchUp, GUIDs are used to test if ComponentDefinitions and Models match (a component being an embedded model). When you insert a component to a model, its GUID is compared to existing component definitions in that model, and if there is a match the existing component definition is re-used rather than a duplicate being added. When a component definition is modified or a model is saved, their GUIDs are renewed.

Examples:

model = Sketchup.active_model
definitions = model.definitions
definition = definitions.find { |definition| !definition.internal? }
# true if component matches its external file.
definition.guid == Sketchup::Skp.read_guid(definition.path)

Parameters:

Raises:

  • (ArgumentError)

    if the file is missing or is not a SketchUp model.

Version:

  • SketchUp 2021.0