Module: Microstation::ElementTrait

Included in:
Element
Defined in:
lib/microstation/element.rb

Instance Method Summary collapse

Instance Method Details

#cell?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/microstation/element.rb', line 39

def cell?
  ole_obj.Type == ::Microstation::MSD::MsdElementTypeCellHeader
end

#complex?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/microstation/element.rb', line 43

def complex?
  ole_obj.IsComplexElement
end

#graphical?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/microstation/element.rb', line 63

def graphical?
  ole_obj.IsGraphical
end

#has_tags?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/microstation/element.rb', line 31

def has_tags?
  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.

Returns:

  • (Boolean)

    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_idObject



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_typeObject

def Type

ole_obj.Type

end



92
93
94
# File 'lib/microstation/element.rb', line 92

def microstation_type
  ole_obj.Type
end

#modelObject



97
98
99
# File 'lib/microstation/element.rb', line 97

def model
  Model.new(app, app.current_drawing, ole_obj.ModelReference)
end

#parentObject



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

#selectObject



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.

Returns:

  • (Boolean)

    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.

Returns:

  • (Boolean)

    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.

Returns:

  • (Boolean)

    true if Text or TextNode



48
49
50
# File 'lib/microstation/element.rb', line 48

def textual?
  text? || text_node?
end

#to_oleObject



35
36
37
# File 'lib/microstation/element.rb', line 35

def to_ole
  ole_obj
end