Class: Layout::Layer

Inherits:
Object
  • Object
show all
Defined in:
lib/sketchup-api-stubs/stubs/Layout/Layer.rb

Overview

This is the interface to a LayOut Layer Definition. A layer definition specifies the document-wide information about a layer. To access the entities on a layer for a given page, use LayerInstance.

Examples:

# Grab a handle to an existing LayOut document.
doc = Layout::Document.open("C:/path/to/document.layout")

new_layer = doc.layers.add(true)
new_layer.name = "A new layer"

Version:

  • LayOut 2018

Constant Summary collapse

SHARELAYERACTION_CLEAR =

Constants

nil
SHARELAYERACTION_KEEPONEPAGE =

Stub value.

nil
SHARELAYERACTION_MERGEALLPAGES =

Stub value.

nil
UNSHARELAYERACTION_CLEAR =

Stub value.

nil
UNSHARELAYERACTION_COPYTOALLPAGES =

Stub value.

nil
UNSHARELAYERACTION_COPYTOONEPAGE =

Stub value.

nil

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Boolean

The #== method checks to see if the two Layout::Layers are equal. This checks whether the Ruby Objects are pointing to the same internal object.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
document = doc.pages.first.document
doc.layers.first == document.layers.first

Parameters:

Returns:

  • (Boolean)

Version:

  • LayOut 2018



44
45
# File 'lib/sketchup-api-stubs/stubs/Layout/Layer.rb', line 44

def ==(other)
end

#documentLayout::Document

The #document method returns the Document that the Layout::Layer belongs to.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
first_layer = doc.layers.first
# layer_doc should reference the same document as doc
layer_doc = first_layer.document

Returns:

Version:

  • LayOut 2018



59
60
# File 'lib/sketchup-api-stubs/stubs/Layout/Layer.rb', line 59

def document
end

#layer_instanceLayout::LayerInstance #layer_instance(page) ⇒ Layout::LayerInstance

The #layer_instance method returns a Layout::LayerInstance from the Layout::Layer. If the Layout::Layer is shared, a Page does not have to be provided.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
layers = doc.layers
page = doc.pages.first
layer_instance = layers.first.layer_instance(page)

Overloads:

Raises:

  • (ArgumentError)

    if the Layout::Layer is not shared and no page is provided

Version:

  • LayOut 2018



85
86
# File 'lib/sketchup-api-stubs/stubs/Layout/Layer.rb', line 85

def layer_instance(page)
end

#locked=(locked) ⇒ Object

The #locked= method sets whether the Layout::Layer is locked.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
layers = doc.layers
layers.first.locked = false

Parameters:

  • locked (Boolean)

    true to lock the Layout::Layer, false to unlock it

Raises:

Version:

  • LayOut 2018



103
104
# File 'lib/sketchup-api-stubs/stubs/Layout/Layer.rb', line 103

def locked=(locked)
end

#locked?Boolean

The #locked? method returns whether the Layout::Layer is locked.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
layers = doc.layers
is_locked = layer.first.locked?

Returns:

  • (Boolean)

Version:

  • LayOut 2018



116
117
# File 'lib/sketchup-api-stubs/stubs/Layout/Layer.rb', line 116

def locked?
end

#nameString

The #name method returns the name of the Layout::Layer.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
layers = doc.layers
layer_name = layers.first.name

Returns:

Version:

  • LayOut 2018



129
130
# File 'lib/sketchup-api-stubs/stubs/Layout/Layer.rb', line 129

def name
end

#name=(name) ⇒ Object

The #name= sets the name of the Layout::Layer.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
layers = doc.layers
layers.first.name = "Base layer"

Parameters:

Raises:

  • (ArgumentError)

    if name is an empty string

Version:

  • LayOut 2018



144
145
# File 'lib/sketchup-api-stubs/stubs/Layout/Layer.rb', line 144

def name=(name)
end

#set_nonshared(page, unshare_action) ⇒ Object

The #set_nonshared method sets the Layout::Layer to non-shared.

The unshare action can be one of the following values:

Layout::Layer::UNSHARELAYERACTION_CLEAR
Layout::Layer::UNSHARELAYERACTION_COPYTOONEPAGE
Layout::Layer::UNSHARELAYERACTION_COPYTOALLPAGES

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
layers = doc.layers
page = doc.pages.first
layers.first.set_nonshared(page, Layout::Layer::UNSHARELAYERACTION_COPYTOONEPAGE);

Parameters:

Raises:

Version:

  • LayOut 2018



173
174
# File 'lib/sketchup-api-stubs/stubs/Layout/Layer.rb', line 173

def set_nonshared(page, unshare_action)
end

#set_shared(page, share_action) ⇒ Object

The #set_shared method sets the Layout::Layer to shared.

The share action can be one of the following values:

Layout::Layer::SHARELAYERACTION_CLEAR
Layout::Layer::SHARELAYERACTION_KEEPONEPAGE
Layout::Layer::SHARELAYERACTION_MERGEALLPAGES

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
layers = doc.layers
page = doc.pages.first
layers.first.set_shared(page, Layout::Layer::SHARELAYERACTION_KEEPONEPAGE);

Parameters:

Raises:

Version:

  • LayOut 2018



202
203
# File 'lib/sketchup-api-stubs/stubs/Layout/Layer.rb', line 202

def set_shared(page, share_action)
end

#shared?Boolean

The #shared? method returns whether the Layout::Layer is shared.

Examples:

doc = Layout::Document.open("C:/path/to/document.layout")
layers = doc.layers
is_shared = layers.first.shared?

Returns:

  • (Boolean)

Version:

  • LayOut 2018



215
216
# File 'lib/sketchup-api-stubs/stubs/Layout/Layer.rb', line 215

def shared?
end