Class: Sketchup::InstancePath
Relationships | |
Super Chains via Extension / Inclusion / Inheritance | |
Instance Chain:
self,
Enumerable
|
|
Inherits: | Object |
Overview
The InstancePath
class represent the instance path to a given entity within the model hierarchy.
Class Method Summary
- .new(path) ⇒ Sketchup::InstancePath constructor
Instance Attribute Summary
- #empty? ⇒ Boolean readonly
-
#valid? ⇒ Boolean
readonly
An instance path is valid if it has at least one element and consist of groups and instances with exception of the leaf which can be any entity.
Instance Method Summary
- #==(other) ⇒ Boolean
-
#[](index) ⇒ Sketchup::Entity
The elements of an instance path can be accessed similarly to an array.
-
#each {|entity| ... } ⇒ nil
The yielded entities will start with the root and end with the leaf.
-
#include?(object) ⇒ Boolean
Returns ‘true` if the instance path contain the given object.
-
#leaf ⇒ Sketchup::Entity
The leaf of an instance path is the last element which can be any entity that can be represented in the model.
- #length ⇒ Integer
-
#persistent_id_path ⇒ String
The serialized version of an instance path is the persistent ids of its entities concatenated with a period.
-
#root ⇒ Sketchup::Group, ...
The root of an instance path is the element located closest to the model root.
- #size ⇒ Integer
- #to_a ⇒ Array
- #transformation ⇒ Geom::Transformation
Constructor Details
.new(path) ⇒ InstancePath
Instance Attribute Details
#empty? ⇒ Boolean
(readonly)
#valid? ⇒ Boolean
(readonly)
An instance path is valid if it has at least one element and consist of groups and instances with exception of the leaf which can be any entity.
This method doesn’t check if the path can actually be looked up in the model.
Instance Method Details
#==(other) ⇒ Boolean
#[](index) ⇒ Sketchup::Entity
This method does not accept negative indices. For the exact behavior of an array, use {#to_a}.
The elements of an instance path can be accessed similarly to an array.
#each {|entity| ... } ⇒ nil
The yielded entities will start with the root and end with the leaf.
#include?(object) ⇒ Boolean
Returns ‘true` if the instance path contain the given object.
#leaf ⇒ Sketchup::Entity
The leaf of an instance path is the last element which can be any entity that can be represented in the model. This is normally a Drawingelement
, but could be a Vertex
.
An instance can also be a leaf.
#length ⇒ Integer
#length
is an alias of #size.
#persistent_id_path ⇒ String
The serialized version of an instance path is the persistent ids of its entities concatenated with a period.
#root ⇒ Sketchup::Group, ...
The root of an instance path is the element located closest to the model root. This will be a group or component instance. If you have a non-instance as a leaf with no other parent component this will return ‘nil`.