Class: Sketchup::Layer
- Includes:
- Comparable
- Defined in:
- lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb
Overview
The Layer class contains methods modifying and extracting information for a layer.
By default, a SketchUp model has one layer, Layer 0 (zero), which is the base layer. You can’t delete or rename Layer 0. Unlike certain other CAD software packages, entities associated with different layers in SketchUp still intersect with each other. (If you want collections of entities to not intersect, place them in Groups instead.)
Layers are commonly used to organize your model and control the visibility of related groups and components. For example, you could make all of your wall and roof entities different groups, associate layers with those groups, and then hide those layers so as to display just the floor plan in the model.
You can programatically create a new layer by calling the Layers.add method.
Instance Method Summary collapse
-
#<=>(layer2) ⇒ Object
The <=> method is used to compare two layers based on their names.
-
#==(layer2) ⇒ Object
The == method is used to determine if two layers are the same.
-
#color ⇒ Object
The color method is used to retrieve the color of the layer.
-
#color=(color) ⇒ Object
The color= method is used to set the name of a layer.
-
#display_name ⇒ String
The #display_name method is used to retrieve the display name of the layer.
-
#line_style ⇒ Sketchup::LineStyle?
The #line_style method retrieves the line style on this layer.
-
#line_style=(line_style) ⇒ Sketchup::Layer
The #line_style= method lets you set a specific line style to a layer.
-
#name ⇒ String
The #name method is used to retrieve the name of the layer.
-
#name=(name) ⇒ Object
The name= method is used to set the name of a layer.
-
#page_behavior ⇒ Object
The page_behavior method is used to retrieve the visibility behavior of the layer for new pages and existing pages.
-
#page_behavior=(page_behavior) ⇒ Integer
The #page_behavior= method is used to control the layer’s visibility behavior on existing and new pages.
-
#visible=(is_visible) ⇒ Object
The visible= method is used to set if the layer is visible.
-
#visible? ⇒ Boolean
The visible? method is used to determine if the layer is visible.
Methods inherited from Entity
#add_observer, #attribute_dictionaries, #attribute_dictionary, #delete_attribute, #deleted?, #entityID, #get_attribute, #inspect, #model, #parent, #persistent_id, #remove_observer, #set_attribute, #to_s, #typename, #valid?
Instance Method Details
#<=>(layer2) ⇒ Object
The <=> method is used to compare two layers based on their names. You could use this for sorting if you’re building a list of layer names.
53 54 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb', line 53 def <=>(layer2) end |
#==(layer2) ⇒ Object
The == method is used to determine if two layers are the same.
72 73 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb', line 72 def ==(layer2) end |
#color ⇒ Object
The color method is used to retrieve the color of the layer.
86 87 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb', line 86 def color end |
#color=(color) ⇒ Object
The color= method is used to set the name of a layer.
103 104 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb', line 103 def color=(color) end |
#display_name ⇒ String
The #display_name method is used to retrieve the display name of the layer.
119 120 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb', line 119 def display_name end |
#line_style ⇒ Sketchup::LineStyle?
The #line_style method retrieves the line style on this layer.
130 131 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb', line 130 def line_style end |
#line_style=(line_style) ⇒ Sketchup::Layer
The #line_style= method lets you set a specific line style to a layer
145 146 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb', line 145 def line_style=(line_style) end |
#name ⇒ String
The #name method is used to retrieve the name of the layer.
161 162 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb', line 161 def name end |
#name=(name) ⇒ Object
The name= method is used to set the name of a layer.
178 179 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb', line 178 def name=(name) end |
#page_behavior ⇒ Object
The page_behavior method is used to retrieve the visibility behavior of the layer for new pages and existing pages. For example, you may want your layer to be visible or hidden by default in any new pages (aka Scenes) created by the user.
A page keeps a list of layers that do not have their default behavior. If a layer is not in that list, then it is set to its default visibility determined by one of these values:
The behaviour is composed of a combination of these flags:
- LAYER_VISIBLE_BY_DEFAULT: 0x0000
- LAYER_HIDDEN_BY_DEFAULT: 0x0001
- LAYER_USES_DEFAULT_VISIBILITY_ON_NEW_PAGES: 0x0000
- LAYER_IS_VISIBLE_ON_NEW_PAGES: 0x0010
- LAYER_IS_HIDDEN_ON_NEW_PAGES: 0x0020
The default visibility for a layer is set by either LAYER_VISIBLE_BY_DEFAULT
or LAYER_HIDDEN_BY_DEFAULT
. This is what will be used when a page does not contain the visibility state of a layer.
The remaining flags control the visibility of the layer for new pages.
215 216 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb', line 215 def page_behavior end |
#page_behavior=(page_behavior) ⇒ Integer
Prior to SketchUp 2014 the LAYER_HIDDEN_BY_DEFAULT
flag would trigger the validation check in SketchUp that would reset the #page_behavior of the layer.
The #page_behavior= method is used to control the layer’s visibility behavior on existing and new pages.
When you Update a page (as opposed to creating a new page) the current visibility of the layer is used.
The behavior is composed of a combination of these flags:
- LAYER_VISIBLE_BY_DEFAULT: 0x0000
- LAYER_HIDDEN_BY_DEFAULT: 0x0001
- LAYER_USES_DEFAULT_VISIBILITY_ON_NEW_PAGES: 0x0000
- LAYER_IS_VISIBLE_ON_NEW_PAGES: 0x0010
- LAYER_IS_HIDDEN_ON_NEW_PAGES: 0x0020
246 247 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb', line 246 def page_behavior=(page_behavior) end |
#visible=(is_visible) ⇒ Object
The visible= method is used to set if the layer is visible.
263 264 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb', line 263 def visible=(is_visible) end |
#visible? ⇒ Boolean
The visible? method is used to determine if the layer is visible.
277 278 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb', line 277 def visible? end |