forked from ladybug-tools/honeybee-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproperties.py
764 lines (618 loc) · 29.7 KB
/
properties.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
# coding: utf-8
"""Extension properties for Model, Room, Face, Shade, Aperture, Door.
These objects hold all attributes assigned by extensions like honeybee-radiance
and honeybee-energy. Note that these Property objects are not intended to exist
on their own but should have a host object.
"""
class _Properties(object):
"""Base class for all Properties classes.
Args:
host: A honeybee-core geometry object that hosts these properties
(ie. Model, Room, Face, Shade, Aperture, Door).
"""
_exclude = set(
('host', 'move', 'rotate', 'rotate_xy', 'reflect', 'scale', 'is_equivalent',
'add_prefix', 'reset_to_default', 'to_dict', 'apply_properties_from_dict',
'ToString'))
def __init__(self, host):
"""Initialize properties."""
self._host = host
@property
def host(self):
"""Get the object hosting these properties."""
return self._host
@property
def _extension_attributes(self):
return (atr for atr in dir(self) if not atr.startswith('_')
and atr not in self._exclude)
def move(self, moving_vec):
"""Apply a move transform to extension attributes.
This is useful in cases where extension attributes possess geometric data
that should be moved alongside the host object. For example, dynamic
geometry within the honeybee-radiance state of an aperture should be
moved if the host aperture is moved.
Args:
moving_vec: A ladybug_geometry Vector3D with the direction and distance
to move the face.
"""
for atr in self._extension_attributes:
var = getattr(self, atr)
if not hasattr(var, 'move'):
continue
try:
var.move(moving_vec)
except Exception as e:
import traceback
traceback.print_exc()
raise Exception('Failed to move {}: {}'.format(var, e))
def rotate(self, axis, angle, origin):
"""Apply a rotation transform to extension attributes.
This is useful in cases where extension attributes possess geometric data
that should be rotated alongside the host object. For example, dynamic
geometry within the honeybee-radiance state of an aperture should be
rotated if the host aperture is rotated.
Args:
axis: A ladybug_geometry Vector3D axis representing the axis of rotation.
angle: An angle for rotation in degrees.
origin: A ladybug_geometry Point3D for the origin around which the
object will be rotated.
"""
for atr in self._extension_attributes:
var = getattr(self, atr)
if not hasattr(var, 'rotate'):
continue
try:
var.rotate(axis, angle, origin)
except Exception as e:
import traceback
traceback.print_exc()
raise Exception('Failed to rotate {}: {}'.format(var, e))
def rotate_xy(self, angle, origin):
"""Apply a rotation in the XY plane to extension attributes.
This is useful in cases where extension attributes possess geometric data
that should be rotated alongside the host object. For example, dynamic
geometry within the honeybee-radiance state of an aperture should be
rotated if the host aperture is rotated.
Args:
angle: An angle in degrees.
origin: A ladybug_geometry Point3D for the origin around which the
object will be rotated.
"""
for atr in self._extension_attributes:
var = getattr(self, atr)
if not hasattr(var, 'rotate_xy'):
continue
try:
var.rotate_xy(angle, origin)
except Exception as e:
import traceback
traceback.print_exc()
raise Exception('Failed to rotate {}: {}'.format(var, e))
def reflect(self, plane):
"""Apply a reflection transform to extension attributes.
This is useful in cases where extension attributes possess geometric data
that should be reflected alongside the host object. For example, dynamic
geometry within the honeybee-radiance state of an aperture should be
reflected if the host aperture is reflected.
Args:
plane: A ladybug_geometry Plane across which the object will
be reflected.
"""
for atr in self._extension_attributes:
var = getattr(self, atr)
if not hasattr(var, 'reflect'):
continue
try:
var.reflect(plane)
except Exception as e:
import traceback
traceback.print_exc()
raise Exception('Failed to reflect {}: {}'.format(var, e))
def scale(self, factor, origin=None):
"""Apply a scale transform to extension attributes.
This is useful in cases where extension attributes possess geometric data
that should be scaled alongside the host object. For example, dynamic
geometry within the honeybee-radiance state of an aperture should be
scaled if the host aperture is scaled.
Args:
factor: A number representing how much the object should be scaled.
origin: A ladybug_geometry Point3D representing the origin from which
to scale. If None, it will be scaled from the World origin (0, 0, 0).
"""
for atr in self._extension_attributes:
var = getattr(self, atr)
if not hasattr(var, 'scale'):
continue
try:
var.scale(factor, origin)
except Exception as e:
import traceback
traceback.print_exc()
raise Exception('Failed to scale {}: {}'.format(var, e))
def is_equivalent(self, other_properties):
"""Get a dictionary noting the equivalency of these properties to other ones.
The keys of this dictionary will note the name of each extension (eg.
energy, radiance) and the values will be a boolean for whether the
extension properties are equivalent or not.
Args:
other_properties: Properties of another object for which equivalency
will be tested.
"""
eq_dict = {}
for atr in self._extension_attributes:
var = getattr(self, atr)
if not hasattr(var, 'is_equivalent'):
continue
other_var = getattr(other_properties, atr)
try:
eq_dict[atr] = var.is_equivalent(other_var)
except Exception as e:
import traceback
traceback.print_exc()
raise Exception('Failed test is_equivalent for {}: {}'.format(var, e))
return eq_dict
def _update_by_sync(self, change, existing_prop, updated_prop):
"""Update properties using change instructions and existing/updated objects."""
for atr in self._extension_attributes:
up_atr = 'update_{}'.format(atr)
if up_atr in change:
var = getattr(updated_prop, atr) if change[up_atr] \
else getattr(existing_prop, atr)
if not hasattr(var, 'duplicate'):
continue
try:
setattr(self, '_' + atr, var.duplicate(self.host))
except Exception as e:
import traceback
traceback.print_exc()
raise Exception('Failed to duplicate {}: {}'.format(var, e))
def _duplicate_extension_attr(self, original_properties):
"""Duplicate the attributes added by extensions.
This method should be called within the duplicate or __copy__ methods of
each honeybee-core geometry object after the core object has been duplicated.
This method only needs to be called on the new (duplicated) core object and
the extension properties of the original core object should be passed to
this method as the original_properties.
Args:
original_properties: The properties object of the original core
object from which the duplicate was derived.
"""
for atr in self._extension_attributes:
var = getattr(original_properties, atr)
if not hasattr(var, 'duplicate'):
continue
try:
setattr(self, '_' + atr, var.duplicate(self.host))
except Exception as e:
import traceback
traceback.print_exc()
raise Exception('Failed to duplicate {}: {}'.format(var, e))
def _add_prefix_extension_attr(self, prefix):
"""Change the name extension attributes unique to this object by adding a prefix.
This is particularly useful in workflows where you duplicate and edit
a starting object and then want to combine it with the original object
into one Model (like making a model of repeated rooms).
Notably, this method only adds the prefix to extension attributes that must
be unique to the object and does not add the prefix to attributes that are
shared across several objects.
Args:
prefix: Text that will be inserted at the start of the extension attributes'
name. It is recommended that this name be short to avoid maxing
out the 100 allowable characters for honeybee names.
"""
for atr in self._extension_attributes:
var = getattr(self, atr)
if not hasattr(var, 'add_prefix'):
continue
try:
var.add_prefix(prefix)
except Exception as e:
import traceback
traceback.print_exc()
raise Exception('Failed to add prefix to {}: {}'.format(var, e))
def _reset_extension_attr_to_default(self):
"""Reset all extension attributes for the object to be default.
This is useful in cases where properties that are hard-assigned to a specific
object might be illegal in combination with other properties and so they
should be reset upon the setting of the other properties. For example,
setting a Face type to AirBoundary typically makes certain types of energy
and radiance properties illegal. So calling this function whenever setting
Face type to AirBoundary will reset the extension attributes to the legal
default values.
"""
for atr in self._extension_attributes:
var = getattr(self, atr)
if not hasattr(var, 'reset_to_default'):
continue
try:
var.reset_to_default()
except Exception as e:
import traceback
traceback.print_exc()
raise Exception('Failed to reset_to_default for {}: {}'.format(var, e))
def _add_extension_attr_to_dict(self, base, abridged, include):
"""Add attributes for extensions to the base dictionary.
This method should be called within the to_dict method of each honeybee-core
geometry object.
Args:
base: The dictionary of the core object without any extension attributes.
This method will add extension attributes to this dictionary. For
example, energy properties will appear under base['properties']['energy'].
abridged: Boolean to note whether the attributes of the extensions should
be abridged (True) or full (False). For example, if a Room's energy
properties are abridged, the program_type attribute under the energy
properties dictionary will just be the identifier of the program_type. If
it is full (not abridged), the program_type will be a complete
dictionary following the ProgramType schema. Abridged dictionaries
should be used within the Model.to_dict but full dictionaries should
be used within the to_dict methods of individual objects.
include: List of properties to filter keys that must be included in
output dictionary. For example ['energy'] will include 'energy' key if
available in properties to_dict. By default all the keys will be
included. To exclude all the keys from extensions use an empty list.
"""
attr = include if include is not None else self._extension_attributes
for atr in attr:
var = getattr(self, atr)
if not hasattr(var, 'to_dict'):
continue
try:
base.update(var.to_dict(abridged))
except Exception as e:
import traceback
traceback.print_exc()
raise Exception('Failed to convert {} to a dict: {}'.format(var, e))
return base
def _load_extension_attr_from_dict(self, property_dict):
"""Get attributes for extensions from a dictionary of the properties.
This method should be called within the from_dict method of each honeybee-core
geometry object. Specifically, this method should be called on the core
object after it has been created from a dictionary but lacks any of the
extension attributes in the dictionary.
Args:
property_dict: A dictionary of properties for the object (ie.
FaceProperties, RoomProperties). These will be used to load
attributes from the dictionary and assign them to the object on
which this method is called.
"""
for atr in self._extension_attributes:
var = getattr(self, atr)
if not hasattr(var, 'from_dict'):
continue
try:
setattr(self, '_' + atr, var.__class__.from_dict(
property_dict[atr], self.host))
except KeyError:
pass # the property_dict possesses no properties for that extension
def ToString(self):
"""Overwrite .NET ToString method."""
return self.__repr__()
def __repr__(self):
"""Properties representation."""
return 'BaseProperties'
class ModelProperties(_Properties):
"""Honeybee Model Properties.
This class will be extended by extensions.
Usage:
.. code-block:: python
model = Model('New Elementary School', list_of_rooms)
model.properties -> ModelProperties
model.properties.radiance -> ModelRadianceProperties
model.properties.energy -> ModelEnergyProperties
"""
def to_dict(self, include=None):
"""Convert properties to dictionary.
Args:
include: A list of keys to be included in dictionary.
If None all the available keys will be included.
"""
base = {'type': 'ModelProperties'}
attr = include if include is not None else self._extension_attributes
for atr in attr:
var = getattr(self, atr)
if not hasattr(var, 'to_dict'):
continue
try:
base.update(var.to_dict()) # no abridged dictionary for model
except Exception as e:
import traceback
traceback.print_exc()
raise Exception('Failed to convert {} to a dict: {}'.format(var, e))
return base
def apply_properties_from_dict(self, data):
"""Apply extension properties from a Model dictionary to the host Model.
Args:
data: A dictionary representation of an entire honeybee-core Model.
"""
for atr in self._extension_attributes:
if atr not in data['properties'] or data['properties'][atr] is None:
continue
var = getattr(self, atr)
if var and not hasattr(var, 'apply_properties_from_dict'):
continue
try:
var.apply_properties_from_dict(data)
except Exception as e:
import traceback
traceback.print_exc()
raise Exception(
'Failed to apply {} properties to the Model: {}'.format(atr, e))
def _check_extension_attr(self, detailed=False):
"""Check the attributes of extensions.
This method should be called within the check_all method of the Model object
to ensure that the check_all functions of any extension model properties
are also called.
Args:
detailed: Boolean for whether the returned object is a detailed list of
dicts with error info or a string with a message. (Default: False).
"""
msgs = []
for atr in self._extension_attributes:
check_msg = None
var = getattr(self, atr)
if not hasattr(var, 'check_all'):
continue
try:
try:
check_msg = var.check_all(raise_exception=False, detailed=detailed)
except TypeError: # no option available for detailed error message
check_msg = var.check_all(raise_exception=False)
if detailed and check_msg is not None:
msgs.append(check_msg)
elif check_msg != '':
f_msg = 'Attributes for {} are invalid.\n{}'.format(atr, check_msg)
msgs.append(f_msg)
except Exception as e:
import traceback
traceback.print_exc()
raise Exception('Failed to check_all for {}: {}'.format(var, e))
return msgs
def __repr__(self):
"""Properties representation."""
return 'ModelProperties: {}'.format(self.host.display_name)
class RoomProperties(_Properties):
"""Honeybee Room Properties.
This class will be extended by extensions.
Usage:
.. code-block:: python
room = Room('Bedroom', geometry)
room.properties -> RoomProperties
room.properties.radiance -> RoomRadianceProperties
room.properties.energy -> RoomEnergyProperties
"""
def to_dict(self, abridged=False, include=None):
"""Convert properties to dictionary.
Args:
abridged: Boolean to note whether the full dictionary describing the
object should be returned (False) or just an abridged version (True).
Default: False.
include: A list of keys to be included in dictionary.
If None all the available keys will be included.
"""
base = {'type': 'RoomProperties'} if not abridged else \
{'type': 'RoomPropertiesAbridged'}
base = self._add_extension_attr_to_dict(base, abridged, include)
return base
def add_prefix(self, prefix):
"""Change the identifier extension attributes unique to this object by adding a prefix.
Notably, this method only adds the prefix to extension attributes that must
be unique to the Room (eg. single-room HVAC systems) and does not add the
prefix to attributes that are shared across several Rooms (eg. ConstructionSets).
Args:
prefix: Text that will be inserted at the start of extension attribute identifiers.
"""
self._add_prefix_extension_attr(prefix)
def reset_to_default(self):
"""Reset the extension properties assigned at the level of this Room to default.
This typically means erasing any ConstructionSets or ModifierSets assigned
to this Room among other properties.
"""
self._reset_extension_attr_to_default()
def __repr__(self):
"""Properties representation."""
return 'RoomProperties: {}'.format(self.host.display_name)
class FaceProperties(_Properties):
"""Honeybee Face Properties.
This class will be extended by extensions.
Usage:
.. code-block:: python
face = Face('South Bedroom Wall', geometry)
face.properties -> FaceProperties
face.properties.radiance -> FaceRadianceProperties
face.properties.energy -> FaceEnergyProperties
"""
def to_dict(self, abridged=False, include=None):
"""Convert properties to dictionary.
Args:
abridged: Boolean to note whether the full dictionary describing the
object should be returned (False) or just an abridged version (True).
Default: False.
include: A list of keys to be included in dictionary besides Face type
and boundary_condition. If None all the available keys will be included.
"""
base = {'type': 'FaceProperties'} if not abridged else \
{'type': 'FacePropertiesAbridged'}
base = self._add_extension_attr_to_dict(base, abridged, include)
return base
def add_prefix(self, prefix):
"""Change the identifier extension attributes unique to this object by adding a prefix.
Notably, this method only adds the prefix to extension attributes that must
be unique to the Face and does not add the prefix to attributes that are
shared across several Faces.
Args:
prefix: Text that will be inserted at the start of extension attribute identifiers.
"""
self._add_prefix_extension_attr(prefix)
def reset_to_default(self):
"""Reset the extension properties assigned at the level of this Face to default.
This typically means erasing any Constructions or Modifiers assigned to this
Face (having them instead assigned by ConstructionSets and ModifierSets).
"""
self._reset_extension_attr_to_default()
def __repr__(self):
"""Properties representation."""
return 'FaceProperties: {}'.format(self.host.display_name)
class ApertureProperties(_Properties):
"""Honeybee Aperture Properties.
This class will be extended by extensions.
Usage:
.. code-block:: python
aperture = Aperture('Window to My Soul', geometry)
aperture.properties -> ApertureProperties
aperture.properties.radiance -> ApertureRadianceProperties
aperture.properties.energy -> ApertureEnergyProperties
"""
def to_dict(self, abridged=False, include=None):
"""Convert properties to dictionary.
Args:
abridged: Boolean to note whether the full dictionary describing the
object should be returned (False) or just an abridged version (True).
Default: False.
include: A list of keys to be included in dictionary.
If None all the available keys will be included.
"""
base = {'type': 'ApertureProperties'} if not abridged else \
{'type': 'AperturePropertiesAbridged'}
base = self._add_extension_attr_to_dict(base, abridged, include)
return base
def add_prefix(self, prefix):
"""Change the identifier extension attributes unique to this object by adding a prefix.
Notably, this method only adds the prefix to extension attributes that must
be unique to the Aperture and does not add the prefix to attributes that are
shared across several Apertures.
Args:
prefix: Text that will be inserted at the start of extension attribute identifiers.
"""
self._add_prefix_extension_attr(prefix)
def reset_to_default(self):
"""Reset the extension properties assigned to this Aperture to default.
This typically means erasing any Constructions or Modifiers assigned to this
Aperture (having them instead assigned by ConstructionSets and ModifierSets).
"""
self._reset_extension_attr_to_default()
def __repr__(self):
"""Properties representation."""
return 'ApertureProperties: {}'.format(self.host.display_name)
class DoorProperties(_Properties):
"""Honeybee Door Properties.
This class will be extended by extensions.
Usage:
.. code-block:: python
door = Door('Front Door', geometry)
door.properties -> DoorProperties
door.properties.radiance -> DoorRadianceProperties
door.properties.energy -> DoorEnergyProperties
"""
def to_dict(self, abridged=False, include=None):
"""Convert properties to dictionary.
Args:
abridged: Boolean to note whether the full dictionary describing the
object should be returned (False) or just an abridged version (True).
Default: False.
include: A list of keys to be included in dictionary.
If None all the available keys will be included.
"""
base = {'type': 'DoorProperties'} if not abridged else \
{'type': 'DoorPropertiesAbridged'}
base = self._add_extension_attr_to_dict(base, abridged, include)
return base
def add_prefix(self, prefix):
"""Change the identifier extension attributes unique to this object by adding a prefix.
Notably, this method only adds the prefix to extension attributes that must
be unique to the Door and does not add the prefix to attributes that are
shared across several Doors.
Args:
prefix: Text that will be inserted at the start of extension attribute identifiers.
"""
self._add_prefix_extension_attr(prefix)
def reset_to_default(self):
"""Reset the extension properties assigned to this Door to default.
This typically means erasing any Constructions or Modifiers assigned to this
Door (having them instead assigned by ConstructionSets and ModifierSets).
"""
self._reset_extension_attr_to_default()
def __repr__(self):
"""Properties representation."""
return 'DoorProperties: {}'.format(self.host.display_name)
class ShadeProperties(_Properties):
"""Honeybee Shade Properties.
This class will be extended by extensions.
Usage:
.. code-block:: python
shade = Shade('Deep Overhang', geometry)
shade.properties -> ShadeProperties
shade.properties.radiance -> ShadeRadianceProperties
shade.properties.energy -> ShadeEnergyProperties
"""
def to_dict(self, abridged=False, include=None):
"""Convert properties to dictionary.
Args:
abridged: Boolean to note whether the full dictionary describing the
object should be returned (False) or just an abridged version (True).
Default: False.
include: A list of keys to be included in dictionary.
If None all the available keys will be included.
"""
base = {'type': 'ShadeProperties'} if not abridged else \
{'type': 'ShadePropertiesAbridged'}
base = self._add_extension_attr_to_dict(base, abridged, include)
return base
def add_prefix(self, prefix):
"""Change the identifier extension attributes unique to this object by adding a prefix.
Notably, this method only adds the prefix to extension attributes that must
be unique to the Shade and does not add the prefix to attributes that are
shared across several Shades.
Args:
prefix: Text that will be inserted at the start of extension attribute identifiers.
"""
self._add_prefix_extension_attr(prefix)
def reset_to_default(self):
"""Reset the extension properties assigned at the level of this Shade to default.
This typically means erasing any Constructions or Modifiers assigned to this
Shade (having them instead assigned by ConstructionSets and ModifierSets).
"""
self._reset_extension_attr_to_default()
def __repr__(self):
"""Properties representation."""
return 'ShadeProperties: {}'.format(self.host.display_name)
class ShadeMeshProperties(_Properties):
"""Honeybee ShadeMesh Properties.
This class will be extended by extensions.
Usage:
.. code-block:: python
shade = ShadeMesh('Hilly Terrain', geometry)
shade.properties -> ShadeMeshProperties
shade.properties.radiance -> ShadeMeshRadianceProperties
shade.properties.energy -> ShadeMeshEnergyProperties
"""
def to_dict(self, abridged=False, include=None):
"""Convert properties to dictionary.
Args:
abridged: Boolean to note whether the full dictionary describing the
object should be returned (False) or just an abridged version (True).
Default: False.
include: A list of keys to be included in dictionary.
If None all the available keys will be included.
"""
base = {'type': 'ShadeMeshProperties'} if not abridged else \
{'type': 'ShadeMeshPropertiesAbridged'}
base = self._add_extension_attr_to_dict(base, abridged, include)
return base
def add_prefix(self, prefix):
"""Change the identifier extension attributes unique to this object by adding a prefix.
Notably, this method only adds the prefix to extension attributes that must
be unique to the ShadeMesh and does not add the prefix to attributes that are
shared across several ShadeMeshes (eg. modifier).
Args:
prefix: Text that will be inserted at the start of extension attribute identifiers.
"""
self._add_prefix_extension_attr(prefix)
def reset_to_default(self):
"""Reset the extension properties assigned to this ShadeMesh to default.
This typically means erasing any Constructions or Modifiers assigned to this
ShadeMesh.
"""
self._reset_extension_attr_to_default()
def __repr__(self):
"""Properties representation."""
return 'ShadeMeshProperties: {}'.format(self.host.display_name)