mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 08:35:14 +00:00
See #7166. Only show total thickness for layer sets.
This commit is contained in:
@@ -323,20 +323,23 @@ class ObjectMaterialData:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def total_thickness(cls):
|
def total_thickness(cls):
|
||||||
if cls.material:
|
if not cls.material:
|
||||||
layers = []
|
return
|
||||||
if cls.material.is_a("IfcMaterialLayerSetUsage"):
|
layers = []
|
||||||
layers = cls.material.ForLayerSet.MaterialLayers
|
if cls.material.is_a("IfcMaterialLayerSetUsage"):
|
||||||
elif cls.material.is_a("IfcMaterialLayerSet"):
|
layers = cls.material.ForLayerSet.MaterialLayers
|
||||||
layers = cls.material.MaterialLayers
|
elif cls.material.is_a("IfcMaterialLayerSet"):
|
||||||
thickness = sum([l.LayerThickness for l in layers or []])
|
layers = cls.material.MaterialLayers
|
||||||
prefs = tool.Blender.get_addon_preferences()
|
if not layers:
|
||||||
assert bpy.context.scene
|
return
|
||||||
unit_system = bpy.context.scene.unit_settings.system
|
thickness = sum([l.LayerThickness for l in layers or []])
|
||||||
precision = None
|
prefs = tool.Blender.get_addon_preferences()
|
||||||
if unit_system == "IMPERIAL":
|
assert bpy.context.scene
|
||||||
precision = prefs.doc.imperial_precision
|
unit_system = bpy.context.scene.unit_settings.system
|
||||||
return format_distance(thickness, precision=precision, suppress_zero_inches=True, in_unit_length=True)
|
precision = None
|
||||||
|
if unit_system == "IMPERIAL":
|
||||||
|
precision = prefs.doc.imperial_precision
|
||||||
|
return format_distance(thickness, precision=precision, suppress_zero_inches=True, in_unit_length=True)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def set_item_name(cls) -> Union[str, None]:
|
def set_item_name(cls) -> Union[str, None]:
|
||||||
|
|||||||
Reference in New Issue
Block a user