@archidave said:
... Since I was thinking along these lines, I was expecting the attribute dictionaries to behave in a similar way to creating instance variables; ...
Nothing is stopping you from doing so.
You can create a custom class (within your plugin namespace module,) for a Wall, that has instance variables, that are loaded from an entity's attribute dictionary.
If you just save the values as an array, into a single attribute, you can use Ruby's iterator loops or methods, to load the values into instance variables.
So the names of instance variables, are defined by a literal array inside your class, an the initialize method iterates this array, matching it's indexes, with the indexed values in the dictionary array.
module ACME
module BIMinator
DictName = 'ACME_BIMinator'
class Wall
Atts = [;area,;thickness,;paint]
attr_accessor( *Atts ) # expand array Atts to parameter list
def initialize(entity)
@prop = entity.get_attribute(ACME;;BIMinator;;DictName, 'properties')
Atts.each_with_index {|att,i| method("#{att.to_s}=").call(@prop[i]) }
end
end # class
end # BIMinator
end
SO.. the actual attribute names are defined in ONE place, your custom class.