This commit is contained in:
Dion Moult
2025-01-12 22:43:41 +11:00
parent 04092d19be
commit 0eb987fc07
3 changed files with 26 additions and 12 deletions
+3 -1
View File
@@ -167,7 +167,9 @@ class BIMModelProperties(PropertyGroup):
rl2: bpy.props.FloatProperty(name="RL", default=1, subtype="DISTANCE", description="Z offset for windows")
# Used for plan calculation points such as in room generation
rl3: bpy.props.FloatProperty(name="RL", default=1, subtype="DISTANCE", description="Z offset for space calculation")
x_angle: bpy.props.FloatProperty(name="X Angle", default=0, subtype="ANGLE", min=math.radians(-180), max=math.radians(180), update=update_x_angle)
x_angle: bpy.props.FloatProperty(
name="X Angle", default=0, subtype="ANGLE", min=math.radians(-180), max=math.radians(180), update=update_x_angle
)
type_page: bpy.props.IntProperty(name="Type Page", default=1, update=update_type_page)
type_name: bpy.props.StringProperty(name="Name", default="TYPEX")
boundary_class: bpy.props.EnumProperty(items=get_boundary_class, name="Boundary Class")
@@ -20,7 +20,9 @@ import ifcopenshell.util.unit
from typing import Any, Optional
def add_derived_unit(file: ifcopenshell.file, unit_type: str, userdefinedtype : str, attributes: dict[ifcopenshell.entity_instance, int]) -> ifcopenshell.entity_instance:
def add_derived_unit(
file: ifcopenshell.file, unit_type: str, userdefinedtype: str, attributes: dict[ifcopenshell.entity_instance, int]
) -> ifcopenshell.entity_instance:
"""Add a new Derive unit
The supported types are ANGULARVELOCITYUNIT, AREADENSITYUNIT, COMPOUNDPLANEANGLEUNIT,
@@ -68,13 +70,14 @@ def add_derived_unit(file: ifcopenshell.file, unit_type: str, userdefinedtype :
"""
settings = {"unit_type": unit_type, "attributes": attributes}
derive_unit_elements = []
for named_unit in settings['attributes']:
derive_unit_elements.append(file.create_entity("IfcDerivedUnitElement", Unit=named_unit, Exponent = settings['attributes'][named_unit]))
return file.create_entity("IfcDerivedUnit",
Elements = derive_unit_elements,
UnitType=settings["unit_type"],
UserDefinedType=userdefinedtype)
for named_unit in settings["attributes"]:
derive_unit_elements.append(
file.create_entity("IfcDerivedUnitElement", Unit=named_unit, Exponent=settings["attributes"][named_unit])
)
return file.create_entity(
"IfcDerivedUnit", Elements=derive_unit_elements, UnitType=settings["unit_type"], UserDefinedType=userdefinedtype
)
+11 -2
View File
@@ -998,8 +998,17 @@ class Restriction:
for constraint, value in self.options.items():
value = [value] if not isinstance(value, list) else value
for v in value:
if constraint in ["length", "minLength", "maxLength", "maxExclusive", "maxInclusive",
"minExclusive", "minInclusive", "totalDigits", "fractionDigits"]:
if constraint in [
"length",
"minLength",
"maxLength",
"maxExclusive",
"maxInclusive",
"minExclusive",
"minInclusive",
"totalDigits",
"fractionDigits",
]:
value_dict = {"@value": v}
else:
value_dict = {"@value": str(v)}