Class: Autocad::Layer
Instance Attribute Summary
Attributes inherited from Element
#acad_type, #app, #ole_obj, #original
Instance Method Summary collapse
-
#activate ⇒ Object
Activates the current layer by setting it as the active layer in the drawing.
-
#active? ⇒ Boolean
is the layer the active layer.
-
#color ⇒ Object
Get the color of the layer.
-
#color=(color) ⇒ Object
Set the color of the layer.
-
#color_name ⇒ Object
Get the symbolic color name if available.
- #delete ⇒ Object
- #description ⇒ Object
-
#freeze ⇒ Object
freeze the layer - entities on layer are invisible and wont be regenerated.
- #frozen? ⇒ Boolean
- #linetype=(ltname) ⇒ Object
-
#lock ⇒ Object
lock the layer - entities on layer can’t be changed.
- #locked? ⇒ Boolean
- #name ⇒ Object
-
#name=(name) ⇒ Object
set the name of the layer.
- #on? ⇒ Boolean
- #thawed? ⇒ Boolean
- #turn_off ⇒ Object
-
#turn_on ⇒ Object
turn on the layer.
-
#unfreeze ⇒ Object
(also: #thaw)
unfreeze the layer.
-
#unlock ⇒ Object
unlock the layer.
- #visible=(vis) ⇒ Object
- #visible? ⇒ Boolean
Methods inherited from Element
#[], #app_ole_obj, #clone, convert_item, #do_update, #each_complex, #get_property_handler, #in_cell?, #initialize, #method_missing, #move, #move_ole, #move_x, #move_y, #ole_cell, ole_object?, #property_handler, #read_ole, #redraw, #update, #updated?, #write_ole
Methods included from ElementTrait
#autocad_type, #block_reference?, #bounds, #cell?, #def, #drawing, #explode, #graphical?, #has_tags?, #highlight, #id_from_record, #inspect, #line?, #model, #parent, #pviewport?, #select, #text?, #to_ole
Constructor Details
This class inherits a constructor from Autocad::Element
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Autocad::Element
Instance Method Details
#activate ⇒ Object
Activates the current layer by setting it as the active layer in the drawing. This method assigns the current layer’s OLE object to the ActiveLayer property of the drawing’s OLE object.
48 49 50 |
# File 'lib/autocad/layer.rb', line 48 def activate drawing.ole_obj.ActiveLayer = ole_obj end |
#active? ⇒ Boolean
is the layer the active layer
40 41 42 |
# File 'lib/autocad/layer.rb', line 40 def active? drawing.active_layer_name == name end |
#color ⇒ Object
Get the color of the layer
10 11 12 |
# File 'lib/autocad/layer.rb', line 10 def color ole_obj.Color end |
#color=(color) ⇒ Object
Set the color of the layer
17 18 19 |
# File 'lib/autocad/layer.rb', line 17 def color=(color) ole_obj.Color = Autocad.color_to_index(color) end |
#color_name ⇒ Object
Get the symbolic color name if available
23 24 25 |
# File 'lib/autocad/layer.rb', line 23 def color_name Autocad::Color.from_index(color) end |
#delete ⇒ Object
113 114 115 116 117 |
# File 'lib/autocad/layer.rb', line 113 def delete ole_obj.Delete rescue => e raise Autocad::Error.new("Error deleting layer #{name} #{e}") end |
#description ⇒ Object
34 35 36 |
# File 'lib/autocad/layer.rb', line 34 def description ole_obj.description end |
#freeze ⇒ Object
freeze the layer - entities on layer are invisible and wont be
regenerated
59 60 61 |
# File 'lib/autocad/layer.rb', line 59 def freeze ole_obj.Freeze = true end |
#frozen? ⇒ Boolean
53 54 55 |
# File 'lib/autocad/layer.rb', line 53 def frozen? ole_obj.Freeze end |
#linetype=(ltname) ⇒ Object
119 120 121 122 123 124 125 126 127 |
# File 'lib/autocad/layer.rb', line 119 def linetype=(ltname) found_lt = app.current_drawing.linetypes.find { |lt| lt.name == ltname } app.current_drawing.ole_obj.Linetypes.Load(ltname, ltname) unless found_lt ole_obj.Linetype = ltname rescue => e raise Autocad::Error.new("Error setting linetype of layer #{name} : #{e}") end |
#lock ⇒ Object
lock the layer - entities on layer can’t be changed
76 77 78 |
# File 'lib/autocad/layer.rb', line 76 def lock ole_obj.Lock = true end |
#locked? ⇒ Boolean
86 87 88 |
# File 'lib/autocad/layer.rb', line 86 def locked? ole_obj.Lock end |
#name ⇒ Object
4 5 6 |
# File 'lib/autocad/layer.rb', line 4 def name ole_obj.name end |
#name=(name) ⇒ Object
set the name of the layer
30 31 32 |
# File 'lib/autocad/layer.rb', line 30 def name=(name) ole_obj.name = name end |
#on? ⇒ Boolean
109 110 111 |
# File 'lib/autocad/layer.rb', line 109 def on? ole_obj.LayerOn end |
#thawed? ⇒ Boolean
69 70 71 |
# File 'lib/autocad/layer.rb', line 69 def thawed? !frozen? end |
#turn_off ⇒ Object
104 105 106 |
# File 'lib/autocad/layer.rb', line 104 def turn_off ole_obj.LayerOn = false end |
#turn_on ⇒ Object
turn on the layer.
100 101 102 |
# File 'lib/autocad/layer.rb', line 100 def turn_on ole_obj.LayerOn = true end |
#unfreeze ⇒ Object Also known as: thaw
unfreeze the layer
64 65 66 |
# File 'lib/autocad/layer.rb', line 64 def unfreeze ole_obj.Freeze = false end |
#unlock ⇒ Object
unlock the layer
81 82 83 |
# File 'lib/autocad/layer.rb', line 81 def unlock ole_obj.Lock = false end |
#visible=(vis) ⇒ Object
94 95 96 |
# File 'lib/autocad/layer.rb', line 94 def visible=(vis) ole_obj.Visible = vis end |
#visible? ⇒ Boolean
90 91 92 |
# File 'lib/autocad/layer.rb', line 90 def visible? ole_obj.Visible end |