Support material layer set usage negative direction sense for parametric walls

This commit is contained in:
Dion Moult
2022-10-28 22:32:15 +11:00
parent 4408a23873
commit 08afec3461
2 changed files with 12 additions and 4 deletions
@@ -188,14 +188,17 @@ class AuthoringData:
if not ifc_class and ifc_classes: if not ifc_class and ifc_classes:
ifc_class = ifc_classes[0][0] ifc_class = ifc_classes[0][0]
if ifc_class: if ifc_class:
elements = sorted(tool.Ifc.get().by_type(ifc_class), key=lambda s: s.Name) elements = sorted(tool.Ifc.get().by_type(ifc_class), key=lambda s: s.Name or "Unnamed")
results.extend(elements) results.extend(elements)
return results return results
return [] return []
@classmethod @classmethod
def relating_types(cls, ifc_class=None): def relating_types(cls, ifc_class=None):
return [(str(e.id()), e.Name, e.Description or "") for e in cls.constr_class_entities(ifc_class=ifc_class)] return [
(str(e.id()), e.Name or "Unnamed", e.Description or "")
for e in cls.constr_class_entities(ifc_class=ifc_class)
]
@classmethod @classmethod
def relating_types_browser(cls): def relating_types_browser(cls):
@@ -331,7 +334,7 @@ class ArrayData:
@classmethod @classmethod
def load(cls): def load(cls):
cls.is_loaded = True cls.is_loaded = True
cls.data = { "parameters": cls.parameters() } cls.data = {"parameters": cls.parameters()}
@classmethod @classmethod
def parameters(cls): def parameters(cls):
+6 -1
View File
@@ -92,14 +92,19 @@ class Model(blenderbim.core.tool.Model):
unit_scale = ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get()) unit_scale = ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get())
offset = 0.0 offset = 0.0
thickness = 0.0 thickness = 0.0
direction_sense = "POSITIVE"
material = ifcopenshell.util.element.get_material(element) material = ifcopenshell.util.element.get_material(element)
if material: if material:
if material.is_a("IfcMaterialLayerSetUsage"): if material.is_a("IfcMaterialLayerSetUsage"):
offset = material.OffsetFromReferenceLine * unit_scale offset = material.OffsetFromReferenceLine * unit_scale
direction_sense = material.DirectionSense
material = material.ForLayerSet material = material.ForLayerSet
if material.is_a("IfcMaterialLayerSet"): if material.is_a("IfcMaterialLayerSet"):
thickness = sum([l.LayerThickness for l in material.MaterialLayers]) * unit_scale thickness = sum([l.LayerThickness for l in material.MaterialLayers]) * unit_scale
return {"thickness": thickness, "offset": offset} if direction_sense == "NEGATIVE":
thickness *= -1
offset *= -1
return {"thickness": thickness, "offset": offset, "direction_sense": direction_sense}
@classmethod @classmethod
def get_manual_booleans(cls, element): def get_manual_booleans(cls, element):