mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 18:16:40 +00:00
Add basic parametric objects tests #7355
This commit is contained in:
@@ -478,7 +478,7 @@ def update_door_modifier_bmesh(context: bpy.types.Context) -> None:
|
||||
|
||||
class BIM_OT_add_door(bpy.types.Operator, tool.Ifc.Operator):
|
||||
bl_idname = "mesh.add_door"
|
||||
bl_label = "Door"
|
||||
bl_label = "Add Door"
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -131,7 +131,7 @@ def update_ifc_stair_props(obj: bpy.types.Object) -> None:
|
||||
|
||||
class BIM_OT_add_stair(bpy.types.Operator, tool.Ifc.Operator):
|
||||
bl_idname = "mesh.add_stair"
|
||||
bl_label = "Stair"
|
||||
bl_label = "Add Stair"
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -399,7 +399,7 @@ def update_window_modifier_bmesh(context: bpy.types.Context) -> None:
|
||||
|
||||
class BIM_OT_add_window(bpy.types.Operator, tool.Ifc.Operator):
|
||||
bl_idname = "mesh.add_window"
|
||||
bl_label = "Window"
|
||||
bl_label = "Add Window"
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -755,3 +755,48 @@ Scenario: Generate a space from cursor location
|
||||
And I press "bim.generate_space"
|
||||
Then the object "IfcSpace/Space" exists
|
||||
And the object "IfcSpace/Space" dimensions are "1,0.8,3"
|
||||
|
||||
Scenario: Add and edit parametric stair
|
||||
Given an empty IFC project
|
||||
And I add a cube
|
||||
And the object "Cube" is selected
|
||||
And I look at the "Class" panel
|
||||
And I set the "Products" property to "IfcElement"
|
||||
And I set the "Class" property to "IfcStairFlight"
|
||||
And I click "Assign IFC Class"
|
||||
And I look at the "Stair" panel
|
||||
And I click "ADD"
|
||||
And I look at the "Stair" panel
|
||||
And I click "GREASEPENCIL"
|
||||
And I look at the "Stair" panel
|
||||
And I click "CHECKMARK"
|
||||
|
||||
Scenario: Add and edit parametric window
|
||||
Given an empty IFC project
|
||||
And I add a cube
|
||||
And the object "Cube" is selected
|
||||
And I look at the "Class" panel
|
||||
And I set the "Products" property to "IfcElement"
|
||||
And I set the "Class" property to "IfcWindow"
|
||||
And I click "Assign IFC Class"
|
||||
And I look at the "BIM_PT_window" panel
|
||||
And I click "ADD"
|
||||
And I look at the "BIM_PT_window" panel
|
||||
And I click "GREASEPENCIL"
|
||||
And I look at the "BIM_PT_window" panel
|
||||
And I click "CHECKMARK"
|
||||
|
||||
Scenario: Add and edit parametric door
|
||||
Given an empty IFC project
|
||||
And I add a cube
|
||||
And the object "Cube" is selected
|
||||
And I look at the "Class" panel
|
||||
And I set the "Products" property to "IfcElement"
|
||||
And I set the "Class" property to "IfcDoor"
|
||||
And I click "Assign IFC Class"
|
||||
And I look at the "Door" panel
|
||||
And I click "ADD"
|
||||
And I look at the "Door" panel
|
||||
And I click "GREASEPENCIL"
|
||||
And I look at the "Door" panel
|
||||
And I click "CHECKMARK"
|
||||
|
||||
@@ -351,13 +351,19 @@ def the_brickschema_is_stubbed():
|
||||
@given(parsers.parse('I look at the "{panel}" panel'))
|
||||
@when(parsers.parse('I look at the "{panel}" panel'))
|
||||
@then(parsers.parse('I look at the "{panel}" panel'))
|
||||
def i_look_at_the_panel_panel(panel):
|
||||
global ui_name_cache
|
||||
def i_look_at_the_panel_panel(panel: str) -> None:
|
||||
# Option to provide explicit panel name if panel names overlap.
|
||||
panel_class = getattr(bpy.types, panel, None)
|
||||
|
||||
if panel_class is None:
|
||||
global ui_name_cache
|
||||
create_ui_name_cache()
|
||||
if panel not in ui_name_cache:
|
||||
assert False, f"Panel '{panel}' not found in `bpy.types` and in {ui_name_cache}"
|
||||
panel_class = getattr(bpy.types, ui_name_cache[panel])
|
||||
|
||||
global panel_spy
|
||||
create_ui_name_cache()
|
||||
if panel not in ui_name_cache:
|
||||
assert False, f"Panel {panel} not found in {ui_name_cache}"
|
||||
panel_spy = PanelSpy(getattr(bpy.types, ui_name_cache[panel]))
|
||||
panel_spy = PanelSpy(panel_class)
|
||||
panel_spy.refresh_spy()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user