mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-05 23:41:44 +00:00
Black
This commit is contained in:
@@ -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
|
||||
)
|
||||
|
||||
@@ -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)}
|
||||
|
||||
Reference in New Issue
Block a user