Class: ModraUp::Layer
- Inherits:
-
ModraUp::Entity
- Object
- ModraUp::Entity
- ModraUp::Layer
- Includes:
- Comparable
Overview
Layers (Product Name: Tag). The API name remains Layer.
Instance Method Summary # collapse
-
#name ⇒ String
Layer name. Defaults to "Layer0".
-
#line_style ⇒ ModraUp::LineStyle, nil
Layer line style. Defaults to nil (viewport lines as solid).
-
#line_style=(style) ⇒ ModraUp::Layer
Sets the layer line style. nil restores the default solid line. Viewport edges use this dash pattern.
-
#name=(name) ⇒ String
Set the layer name. Append a number if the name is duplicated. Cannot change #name to the default layer "Layer0".
-
#display_name ⇒ String
Display name for the interface. Layer0 displays as "Untagged", while the rest are the same as #name.
-
#color ⇒ ModraUp::Color
Layer Color (used when coloring by Tag).
-
#color=(color) ⇒ ModraUp::Color, Array<Integer>
Sets the layer color.
-
#visible? ⇒ Boolean
Returns whether the layer is visible. Hidden layers do not draw their entities in the viewport.
-
#visible=(visible) ⇒ Boolean
Sets the layer visibility.
-
#folder ⇒ ModraUp::LayerFolder, nil
Layer folder it belongs to. Directly attached to the layer table results in nil.
-
#folder=(parent) ⇒ ModraUp::LayerFolder, nil
Place layers into a folder. nil returns to the root of the layer table. Layer0 cannot be placed into a folder.
-
#page_behavior ⇒ Integer
Flags indicating the visibility of a new scene relative to the default scene. Can be set using LAYER_VISIBLE_BY_DEFAULT, LAYER_HIDDEN_BY_DEFAULT, LAYER_IS_VISIBLE_ON_NEW_PAGES, or LAYER_IS_HIDDEN_ON_NEW_PAGES.
-
#page_behavior=(flags) ⇒ Integer
Set the visibility flag for the scene.
-
#== ⇒ Boolean
Two elements in the same model belong to the same layer if they are true.
-
#<=> ⇒ Integer
Compare by #name for use with sort.
Inherited from ModraUp::Entity
-
#typename ⇒ String
Type name (e.g., Face / Edge / Group).
-
#entityID ⇒ Integer
Entity ID within the current session: A small integer starting from 1 that increments and remains constant for the lifetime of the entity, unchanged by undo/redo operations. This ID is not preserved when saving the file; it will be renumbered upon reopening the model. For cross-session identification, use #persistent_id. Copied entities will receive new IDs.
-
#add_observer(observer) ⇒ Boolean
Register a ModraUp::EntityObserver. Adding the same object a second time returns false. Locking, property, and material changes will dispatch an onChangeEntity event.
-
#remove_observer(observer) ⇒ Boolean
Remove the entity observer.
-
#persistent_id ⇒ Integer
Number assigned with the model: A unique, incrementing small integer starting from 1 that persists across model saves and reloads, independent of #entityID. Copied entities receive new numbers, and deleted entities do not reuse their numbers. Edges, faces, vertices, curves, groups, component instances/definitions, dimensions, leader lines/points, section planes, materials, layers, layer folders, and drawing sheets have assigned numbers; all others (rings, EdgeUses, attribute dictionaries, line types, sets, etc.) return 0.
-
#parent ⇒ ModraUp::Model, ModraUp::ComponentDefinition
Returns the owner of this drawing context. At the root this is the model. Inside a definition it is the definition itself.
-
#model ⇒ ModraUp::Model
The model it belongs to.
-
#to_s ⇒ String
String form. Returns "#<Deleted Entity>” when the entity has been deleted.
-
#inspect ⇒ String
Same as #to_s.
-
#attribute_dictionaries ⇒ ModraUp::AttributeDictionaries, nil
Collection of attribute dictionaries. Returns nil (evaluates to false) if there are no dictionaries.
-
#attribute_dictionary(name) ⇒ ModraUp::AttributeDictionary, nil
Retrieve an attribute dictionary by name. If none exists, return nil; if create is true, create an empty dictionary. ModraUp::Loop / ModraUp::EdgeUse / ModraUp::Curve always return nil.
-
#valid? ⇒ Boolean
Returns true if the entity is valid, meaning it has not been deleted from the model. Revoked entities are false; even if new geometry is drawn occupying its original position, this object remains an invalid entity (still false). Repeating the action to restore it makes it valid again.
-
#deleted? ⇒ Boolean
Opposite of #valid?.
-
#set_attribute(dict_name, key, value) ⇒ Object
Write attribute values. Materials, groups, component instances, faces, and edges are supported. When dict_name and key are Symbols, they are converted to strings. The type of data written is the same type that will be read back.
-
#get_attribute(dict_name, key, default = nil) ⇒ Object
Read the attribute. If dict_name and key are Symbols, convert them to strings (similar to SketchUp). If the dictionary or key does not exist, return default. The return value type is the same as what is written by #set_attribute.
-
#delete_attribute(dict_name) ⇒ Boolean
Delete a key, or delete the entire dictionary when the key is omitted.
Instance Method Details
layer.name ⇒ String
Layer name. Defaults to "Layer0".
layer.line_style ⇒ ModraUp::LineStyle, nil
Layer line style. Defaults to nil (viewport lines as solid).
layer.line_style=(style) ⇒ layer
Sets the layer line style. nil restores the default solid line. Viewport edges use this dash pattern.
layer.name=(name) ⇒ String
Set the layer name. Append a number if the name is duplicated. Cannot change #name to the default layer "Layer0".
layer.display_name ⇒ String
Display name for the interface. Layer0 displays as "Untagged", while the rest are the same as #name.
layer.color ⇒ ModraUp::Color
Layer Color (used when coloring by Tag).
layer.color=(color) ⇒ color
Sets the layer color.
layer.visible? ⇒ Boolean
Returns whether the layer is visible. Hidden layers do not draw their entities in the viewport.
layer.visible=(visible) ⇒ visible
Sets the layer visibility.
layer.folder ⇒ ModraUp::LayerFolder, nil
Layer folder it belongs to. Directly attached to the layer table results in nil.
layer.folder=(parent) ⇒ parent
Place layers into a folder. nil returns to the root of the layer table. Layer0 cannot be placed into a folder.
layer.page_behavior ⇒ Integer
Flags indicating the visibility of a new scene relative to the default scene. Can be set using LAYER_VISIBLE_BY_DEFAULT, LAYER_HIDDEN_BY_DEFAULT, LAYER_IS_VISIBLE_ON_NEW_PAGES, or LAYER_IS_HIDDEN_ON_NEW_PAGES.
layer.page_behavior=(flags) ⇒ flags
Set the visibility flag for the scene.
layer == other ⇒ Boolean
Two elements in the same model belong to the same layer if they are true.
layer <=> other ⇒ Integer
Compare by #name for use with sort.