Module: Microstation::ElementTrait
- Included in:
- Element
- Defined in:
- lib/microstation/element.rb
Instance Method Summary collapse
- #cell? ⇒ Boolean
- #complex? ⇒ Boolean
- #graphical? ⇒ Boolean
- #has_tags? ⇒ Boolean
- #id_from_record(id) ⇒ Object
-
#line? ⇒ Boolean
True if ole type is TypeLine.
- #microstation_id ⇒ Object
-
#microstation_type ⇒ Object
def Type ole_obj.Type end.
- #model ⇒ Object
- #parent ⇒ Object
- #select ⇒ Object
-
#text? ⇒ Boolean
True if ole type is Text.
-
#text_node? ⇒ Boolean
True if ole type is TextNode.
-
#textual? ⇒ Boolean
True if Text or TextNode.
- #to_ole ⇒ Object
Instance Method Details
#cell? ⇒ Boolean
36 37 38 |
# File 'lib/microstation/element.rb', line 36 def cell? ole_obj.Type == ::Microstation::MSD::MsdElementTypeCellHeader end |
#complex? ⇒ Boolean
40 41 42 |
# File 'lib/microstation/element.rb', line 40 def complex? ole_obj.IsComplexElement end |
#graphical? ⇒ Boolean
61 62 63 |
# File 'lib/microstation/element.rb', line 61 def graphical? ole_obj.IsGraphical end |
#has_tags? ⇒ Boolean
28 29 30 |
# File 'lib/microstation/element.rb', line 28 def ole_obj.HasAnyTags end |
#id_from_record(id) ⇒ Object
73 74 75 76 77 78 |
# File 'lib/microstation/element.rb', line 73 def id_from_record(id) return unless id.instance_of?(WIN32OLE_RECORD) return id.Low if id.Low > id.High id.High end |
#line? ⇒ Boolean
Returns true if ole type is TypeLine.
57 58 59 |
# File 'lib/microstation/element.rb', line 57 def line? ole_obj.Type == ::Microstation::MSD::MsdElementTypeLine end |
#microstation_id ⇒ Object
49 50 51 52 53 54 |
# File 'lib/microstation/element.rb', line 49 def microstation_id id = ole_obj.Id || ole_obj.ID64 return nil unless id id_from_record(id) end |
#microstation_type ⇒ Object
def Type
ole_obj.Type
end
88 89 90 |
# File 'lib/microstation/element.rb', line 88 def microstation_type ole_obj.Type end |
#model ⇒ Object
92 93 94 |
# File 'lib/microstation/element.rb', line 92 def model Model.new(app, app.current_drawing, ole_obj.ModelReference) end |
#parent ⇒ Object
65 66 67 68 69 70 71 |
# File 'lib/microstation/element.rb', line 65 def parent parent_id = ole_obj.ParentID return nil unless parent_id id = id_from_record(parent_id) app.active_design_file.find_by_id(id) end |
#select ⇒ Object
80 81 82 |
# File 'lib/microstation/element.rb', line 80 def select app.active_model_reference.select_element(self) end |
#text? ⇒ Boolean
Returns true if ole type is Text.
19 20 21 |
# File 'lib/microstation/element.rb', line 19 def text? ole_obj.Type == ::Microstation::MSD::MsdElementTypeText end |
#text_node? ⇒ Boolean
Returns true if ole type is TextNode.
24 25 26 |
# File 'lib/microstation/element.rb', line 24 def text_node? ole_obj.Type == ::Microstation::MSD::MsdElementTypeTextNode end |
#textual? ⇒ Boolean
Returns true if Text or TextNode.
45 46 47 |
# File 'lib/microstation/element.rb', line 45 def textual? text? || text_node? end |
#to_ole ⇒ Object
32 33 34 |
# File 'lib/microstation/element.rb', line 32 def to_ole ole_obj end |