I am running into a new question and I wonder about your thoughts?
Scenario:
A user builds a Rhino / Honeybee Model in IP units and writes out the model to HBJSON. Outside Rhino the user reads the file in, and then calls convert_to_units() or scale to change the model units to SI. At that point, if any extensions (such as Honeybee-PH) include any dimensional values, these do not get changed. So the user might end up with a Model in meters, but extension elements still in inches (or whatever they were built in).
So: I wonder how you would feel about adding a scale() function to model.properties, which then only calls out to any property extensions whenever Model's scale / rotate / reflect functions get called? So maybe roughly something like:
def scale(self, factor, origin=None)
for extension_prefix in self._extension_attributes:
ext = getattr(self, extension_prefix)
try:
ext.scale()
except AttributeError:
pass
The goal being just to ping any extensions and say "hey: we're scaling" (or rotating, or reflecting, ...) and then if the extension wants to do anything with that, fine, or if not: fine. But at least to let them know somehow? So kind of similar to the way that properties' to_dict and from_dict call out to extensions during their operation?
Alternatively, perhaps there is a way to let extensions subscribe to a messaging protocol to get informed about these types of changes?
I am running into a new question and I wonder about your thoughts?
Scenario:
A user builds a Rhino / Honeybee Model in IP units and writes out the model to HBJSON. Outside Rhino the user reads the file in, and then calls
convert_to_units()
orscale
to change the model units to SI. At that point, if any extensions (such as Honeybee-PH) include any dimensional values, these do not get changed. So the user might end up with a Model in meters, but extension elements still in inches (or whatever they were built in).So: I wonder how you would feel about adding a
scale()
function tomodel.properties
, which then only calls out to any property extensions whenever Model's scale / rotate / reflect functions get called? So maybe roughly something like:model:
model.properties:
The goal being just to ping any extensions and say "hey: we're scaling" (or rotating, or reflecting, ...) and then if the extension wants to do anything with that, fine, or if not: fine. But at least to let them know somehow? So kind of similar to the way that properties'
to_dict
andfrom_dict
call out to extensions during their operation?Alternatively, perhaps there is a way to let extensions subscribe to a messaging protocol to get informed about these types of changes?