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
39 40 41 |
# File 'lib/microstation/element.rb', line 39 def cell? ole_obj.Type == ::Microstation::MSD::MsdElementTypeCellHeader end |
#complex? ⇒ Boolean
43 44 45 |
# File 'lib/microstation/element.rb', line 43 def complex? ole_obj.IsComplexElement end |
#graphical? ⇒ Boolean
63 64 65 |
# File 'lib/microstation/element.rb', line 63 def graphical? ole_obj.IsGraphical end |
#has_tags? ⇒ Boolean
31 32 33 |
# File 'lib/microstation/element.rb', line 31 def ole_obj.HasAnyTags end |
#id_from_record(id) ⇒ Object
74 75 76 77 78 79 80 81 82 |
# File 'lib/microstation/element.rb', line 74 def id_from_record(id) if id.class == WIN32OLE_RECORD if id.Low > id.High return id.Low else return id.High end end end |
#line? ⇒ Boolean
Returns true if ole type is TypeLine.
59 60 61 |
# File 'lib/microstation/element.rb', line 59 def line? ole_obj.Type == ::Microstation::MSD::MsdElementTypeLine end |
#microstation_id ⇒ Object
52 53 54 55 56 |
# File 'lib/microstation/element.rb', line 52 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
92 93 94 |
# File 'lib/microstation/element.rb', line 92 def microstation_type ole_obj.Type end |
#model ⇒ Object
97 98 99 |
# File 'lib/microstation/element.rb', line 97 def model Model.new(app, app.current_drawing, ole_obj.ModelReference) end |
#parent ⇒ Object
67 68 69 70 71 72 |
# File 'lib/microstation/element.rb', line 67 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
84 85 86 |
# File 'lib/microstation/element.rb', line 84 def select app.active_model_reference.select_element(self) end |
#text? ⇒ Boolean
Returns true if ole type is Text.
22 23 24 |
# File 'lib/microstation/element.rb', line 22 def text? ole_obj.Type == ::Microstation::MSD::MsdElementTypeText end |
#text_node? ⇒ Boolean
Returns true if ole type is TextNode.
27 28 29 |
# File 'lib/microstation/element.rb', line 27 def text_node? ole_obj.Type == ::Microstation::MSD::MsdElementTypeTextNode end |
#textual? ⇒ Boolean
Returns true if Text or TextNode.
48 49 50 |
# File 'lib/microstation/element.rb', line 48 def textual? text? || text_node? end |
#to_ole ⇒ Object
35 36 37 |
# File 'lib/microstation/element.rb', line 35 def to_ole ole_obj end |