Class: Autocad::BlockReference
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
#autocad_type, #bounds, #cell?, #def, #drawing, #graphical?, #has_tags?, #highlight, #id_from_record, #line?, #model, #parent, #pviewport?, #select, #text?, #to_ole, #visible?
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Autocad::Element
Instance Method Details
#attribute_hash ⇒ Object
91
92
93
94
95
|
# File 'lib/autocad/block_reference.rb', line 91
def attribute_hash
attributes.each.with_object({}) do |a, h|
h[a.key] = a.value
end
end
|
#attributes ⇒ Object
101
102
103
104
105
106
107
108
|
# File 'lib/autocad/block_reference.rb', line 101
def attributes
return to_enum(__callee__) unless block_given?
els = @ole_obj.GetAttributes
return [] if els.empty?
els.each { |e| yield app.wrap(e) }
end
|
#block_reference? ⇒ Boolean
5
6
7
|
# File 'lib/autocad/block_reference.rb', line 5
def block_reference?
true
end
|
#dynamic? ⇒ Boolean
44
45
46
|
# File 'lib/autocad/block_reference.rb', line 44
def dynamic?
@ole_obj.IsDynamicBlock
end
|
#each ⇒ Object
20
21
22
23
24
25
26
|
# File 'lib/autocad/block_reference.rb', line 20
def each
return enum_for(:each) unless block_given?
@ole_obj.each do |ole|
yield app.wrap(ole)
end
end
|
#explode ⇒ Object
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/autocad/block_reference.rb', line 9
def explode
return enum_for(__callee__) unless block_given?
ole = ole_obj.explode
ole.each do |ole|
yield app.wrap(ole)
end
rescue => e
binding.irb
end
|
#external? ⇒ Boolean
28
29
30
|
# File 'lib/autocad/block_reference.rb', line 28
def external?
false
end
|
#get_block_extents ⇒ Object
32
33
34
35
36
|
# File 'lib/autocad/block_reference.rb', line 32
def get_block_extents
min_point = ole_obj.GeometricExtents.MinPoint
max_point = ole_obj.GeometricExtents.MaxPoint
BoundingBox.from_min_max(min_point, max_point)
end
|
#has_attributes? ⇒ Boolean
48
49
50
|
# File 'lib/autocad/block_reference.rb', line 48
def has_attributes?
@ole_obj.HasAttributes
end
|
#insertion_point ⇒ Object
38
39
40
41
42
|
# File 'lib/autocad/block_reference.rb', line 38
def insertion_point
Point3d(ole_obj.InsertionPoint)
rescue
Autocad::Error.new("error getting insertion point of block #{name}")
end
|
#inspect ⇒ Object
97
98
99
|
# File 'lib/autocad/block_reference.rb', line 97
def inspect
"<BlockReference: name:#{name}>"
end
|
#layout? ⇒ Boolean
85
86
87
88
89
|
# File 'lib/autocad/block_reference.rb', line 85
def layout?
@ole_obj.IsLayout
rescue
false
end
|
#name ⇒ Object
52
53
54
|
# File 'lib/autocad/block_reference.rb', line 52
def name
@ole_obj.Name
end
|
#scale_by(amt) ⇒ Object
56
57
58
59
|
# File 'lib/autocad/block_reference.rb', line 56
def scale_by(amt)
@ole_obj.XScaleFactor = amt
@ole_obj.YScaleFactor = amt
end
|
#x_effective_scale_factor ⇒ Object
65
66
67
|
# File 'lib/autocad/block_reference.rb', line 65
def x_effective_scale_factor
@ole_obj.XEffectiveScaleFactor
end
|
#x_scale_factor ⇒ Object
61
62
63
|
# File 'lib/autocad/block_reference.rb', line 61
def x_scale_factor
@ole_obj.XScaleFactor
end
|
#y_effective_scale_factor ⇒ Object
73
74
75
|
# File 'lib/autocad/block_reference.rb', line 73
def y_effective_scale_factor
@ole_obj.YEffectiveScaleFactor
end
|
#y_scale_factor ⇒ Object
69
70
71
|
# File 'lib/autocad/block_reference.rb', line 69
def y_scale_factor
@ole_obj.YScaleFactor
end
|
#z_effective_scale_factor ⇒ Object
81
82
83
|
# File 'lib/autocad/block_reference.rb', line 81
def z_effective_scale_factor
@ole_obj.ZEffectiveScaleFactor
end
|
#z_scale_factor ⇒ Object
77
78
79
|
# File 'lib/autocad/block_reference.rb', line 77
def z_scale_factor
@ole_obj.ZScaleFactor
end
|