Class: Microstation::TagSet

Inherits:
Object
  • Object
show all
Defined in:
lib/microstation/tag_set.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(drawing, ole) ⇒ TagSet

Returns a new instance of TagSet.



243
244
245
246
247
# File 'lib/microstation/tag_set.rb', line 243

def initialize(drawing, ole)
  @drawing = drawing
  @ole_obj = ole
  @instances = nil
end

Instance Attribute Details

#drawingObject (readonly)

Returns the value of attribute drawing.



241
242
243
# File 'lib/microstation/tag_set.rb', line 241

def drawing
  @drawing
end

#instancesObject (readonly)

def find_instances_in_model(model)

result = create_instances(model.scan_tags)
instances[model.name] = result
result

end



287
288
289
# File 'lib/microstation/tag_set.rb', line 287

def instances
  @instances
end

#ole_objObject (readonly)

Returns the value of attribute ole_obj.



241
242
243
# File 'lib/microstation/tag_set.rb', line 241

def ole_obj
  @ole_obj
end

Instance Method Details

#==(other) ⇒ Object



318
319
320
# File 'lib/microstation/tag_set.rb', line 318

def ==(other)
  @ole_obj == other.ole_obj
end

#[](name) ⇒ Object



330
331
332
# File 'lib/microstation/tag_set.rb', line 330

def [](name)
  definition[name]
end

#add_attribute(name, type, **options, &block) ⇒ Object



249
250
251
# File 'lib/microstation/tag_set.rb', line 249

def add_attribute(name, type, **options, &block)
  ts = definition.add_attribute(name, type, **options, &block)
end

#add_instance(array) ⇒ Object

def definer

@definer ||= Definer.new(self)

end



257
258
259
# File 'lib/microstation/tag_set.rb', line 257

def add_instance(array)
  @instances << TS::Instance.new(self, array)
end

#attribute_namesObject



322
323
324
# File 'lib/microstation/tag_set.rb', line 322

def attribute_names
  definition.attribute_names
end

#attributesObject



326
327
328
# File 'lib/microstation/tag_set.rb', line 326

def attributes
  definition.attributes
end

#closeObject

def all_tags_in_drawing

Microstation.app.current_drawing.scan_tags

end



306
307
308
# File 'lib/microstation/tag_set.rb', line 306

def close
  @ole_obj = nil
end

#create_instance(id, elements, model) ⇒ Object



261
262
263
264
265
266
267
268
# File 'lib/microstation/tag_set.rb', line 261

def create_instance(base_element_id, tags, model)
  return unless @instaces.nil?

  @instance = []
  ti = TS::Instances.new(self, base_element_id, tags, model)
  @instances << ti
  ti
end

#nameObject



310
311
312
# File 'lib/microstation/tag_set.rb', line 310

def name
  @ole_obj.name
end

#to_sObject



314
315
316
# File 'lib/microstation/tag_set.rb', line 314

def to_s
  "TagSet: #{name}"
end