Class: Autocad::Viewport

Inherits:
Element show all
Defined in:
lib/autocad/viewport.rb

Instance Attribute Summary

Attributes inherited from Element

#acad_type, #app, #ole_obj, #original

Instance Method Summary collapse

Methods inherited from Element

#[], #app_ole_obj, #clone, convert_item, #delete, #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, #visible?

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

#centerObject

Returns the center of the viewport



11
12
13
# File 'lib/autocad/viewport.rb', line 11

def center
  Point3d.new(ole_obj.Center)
end

#heightObject



41
42
43
# File 'lib/autocad/viewport.rb', line 41

def height
  ole_obj.Height
end

#lower_leftObject Also known as: bottom_left



45
46
47
# File 'lib/autocad/viewport.rb', line 45

def lower_left
  ole_obj.LowerLeftCorner.map { |p| Point3d.new(p) }
end

#nameObject

Returns the name of the viewport



5
6
7
# File 'lib/autocad/viewport.rb', line 5

def name
  ole_obj.Name
end

#split(split_type) ⇒ Object

Splits the viewport

the split_type is from the AcViewportSplitType enum
can take the integer or symbol corressponding to the enum


24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/autocad/viewport.rb', line 24

def split(split_type)
  case split_type
  when Integer then ole_obj.Split(split_type)
  when :horizontal then ole_obj.Split(0)
  when :vertical then ole_obj.Split(1)
  when :two_horizontal then ole.Split(0)
  when :two_vertical then ole_obj.Split(1)
  when :three_left then ole_obj.Split(2)
  when :three_right then ole_obj.Split(3)
  when :three_horizontal then ole_obj.Split(4)
  when :three_vertical then ole_obj.Split(5)
  when :three_above then ole_obj.Split(6)
  when :three_below then ole_obj.Split(7)
  when :four then ole_obj.Split(8)
  end
end

#upper_rightObject Also known as: top_right



51
52
53
# File 'lib/autocad/viewport.rb', line 51

def upper_right
  ole_obj.UpperRightCorner.map { |p| Point3d.new(p) }
end

#widthObject

Returns the width of the viewport



17
18
19
# File 'lib/autocad/viewport.rb', line 17

def width
  ole_obj.Width
end