mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-16 02:24:30 +00:00
Door - added 2d representation
This commit is contained in:
@@ -48,7 +48,7 @@ def update_door_modifier_representation(context):
|
||||
props = obj.BIMDoorProperties
|
||||
ifc_file = tool.Ifc.get()
|
||||
representation_data = {
|
||||
"partition_type": props.door_type,
|
||||
"operation_type": props.door_type,
|
||||
"overall_height": props.overall_height,
|
||||
"overall_width": props.overall_width,
|
||||
"lining_properties": {
|
||||
@@ -75,19 +75,30 @@ def update_door_modifier_representation(context):
|
||||
},
|
||||
}
|
||||
|
||||
# ELEVATION_VIEW representation
|
||||
ifc_context = ifcopenshell.util.representation.get_context(ifc_file, "Model", "Profile", "ELEVATION_VIEW")
|
||||
if not ifc_context:
|
||||
model_context = ifcopenshell.util.representation.get_context(ifc_file, "Model")
|
||||
ifc_context = ifcopenshell.api.run(
|
||||
"context.add_context",
|
||||
ifc_file,
|
||||
context_type="Model",
|
||||
context_identifier="Profile",
|
||||
target_view="ELEVATION_VIEW",
|
||||
parent=model_context,
|
||||
)
|
||||
def get_context_or_create(context_type, context_identifier, target_view):
|
||||
ifc_context = ifcopenshell.util.representation.get_context(ifc_file, context_type, context_identifier, target_view)
|
||||
if not ifc_context:
|
||||
parent_context = ifcopenshell.util.representation.get_context(ifc_file, context_type)
|
||||
ifc_context = ifcopenshell.api.run(
|
||||
"context.add_context",
|
||||
ifc_file,
|
||||
context_type=context_type,
|
||||
context_identifier=context_identifier,
|
||||
target_view=target_view,
|
||||
parent=model_context,
|
||||
)
|
||||
return ifc_context
|
||||
|
||||
# ELEVATION_VIEW representation
|
||||
ifc_context = get_context_or_create("Model", "Profile", "ELEVATION_VIEW")
|
||||
representation_data["context"] = ifc_context
|
||||
elevation_representation = ifcopenshell.api.run(
|
||||
"geometry.add_door_representation", ifc_file, **representation_data
|
||||
)
|
||||
replace_representation_for_object(ifc_file, ifc_context, obj, elevation_representation)
|
||||
|
||||
# PLAN_VIEW representation
|
||||
ifc_context = get_context_or_create("Plan", "Annotation", "PLAN_VIEW")
|
||||
representation_data["context"] = ifc_context
|
||||
elevation_representation = ifcopenshell.api.run(
|
||||
"geometry.add_door_representation", ifc_file, **representation_data
|
||||
|
||||
@@ -433,14 +433,14 @@ class BIMWindowProperties(PropertyGroup):
|
||||
|
||||
class BIMDoorProperties(PropertyGroup):
|
||||
door_types = (
|
||||
("DOUBLE_SWING_LEFT", "DOUBLE_SWING_LEFT", ""),
|
||||
("DOUBLE_SWING_RIGHT", "DOUBLE_SWING_RIGHT", ""),
|
||||
("SINGLE_SWING_LEFT", "SINGLE_SWING_LEFT", ""),
|
||||
("SINGLE_SWING_RIGHT", "SINGLE_SWING_RIGHT", ""),
|
||||
)
|
||||
|
||||
door_added_previously: bpy.props.BoolProperty(default=False)
|
||||
is_editing: bpy.props.IntProperty(default=-1)
|
||||
door_type: bpy.props.EnumProperty(
|
||||
name="Door Operation Type", items=door_types, default="DOUBLE_SWING_LEFT"
|
||||
name="Door Operation Type", items=door_types, default="SINGLE_SWING_LEFT"
|
||||
)
|
||||
overall_height: bpy.props.FloatProperty(name="Overall Height", default=1.2)
|
||||
overall_width: bpy.props.FloatProperty(name="Overall Width", default=0.6)
|
||||
|
||||
Reference in New Issue
Block a user