Sha256: 48bd31ae3bd6af17f5d86718ffcc8efeb37aae6d7244e08d6817dcc25957c5a1

Contents?: true

Size: 836 Bytes

Versions: 1

Compression:

Stored size: 836 Bytes

Contents

module Autocad
  class Layer < Element
    def name
      ole_obj.name
    end

    def description
      ole_obj.description
    end

    def lock(lk = true)
      ole_obj.Lock = lk
    rescue
      raise Autocad::Error.new("Error locking layer #{name}")
    end

    def visible?
      ole_obj.Visible
    end

    def visible=(vis)
      ole_obj.Visible = vis
    end

    def delete
      ole_obj.Delete
    rescue => e
      raise Autocad::Error.new("Error deleting layer #{name} #{e}")
    end

    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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
autocad-0.4.6 lib/autocad/layer.rb