See #2887. Experimental edit mode toggle override to ensure mesh changes stay in sync and so that you can edit meshes without openings applied.

This commit is contained in:
Dion Moult
2023-03-23 21:50:50 +11:00
parent ef2cec7435
commit 0a22714fb8
8 changed files with 144 additions and 10 deletions
@@ -20,7 +20,7 @@ Scenario: Add representation
And the object "IfcWall/Cube" is selected
Then the object "IfcWall/Cube" data is a "Tessellation" representation of "Model/Body/MODEL_VIEW"
When the variable "context" is "[c for c in {ifc}.by_type('IfcGeometricRepresentationSubContext') if c.ContextType == 'Plan' and c.ContextIdentifier == 'Body' and c.TargetView == 'PLAN_VIEW'][0].id()"
And I set "scene.BIMRootProperties.contexts" to "{context}"
And I set "active_object.BIMGeometryProperties.contexts" to "{context}"
And I press "bim.add_representation"
Then the object "IfcWall/Cube" data is a "Annotation2D" representation of "Plan/Body/PLAN_VIEW"
@@ -37,7 +37,7 @@ Scenario: Add representation - add a new representation to a typed instance
And the object "IfcWall/Wall.001" data is a "Tessellation" representation of "Model/Body/MODEL_VIEW"
When the object "IfcWall/Wall" is selected
And the variable "context" is "[c for c in {ifc}.by_type('IfcGeometricRepresentationSubContext') if c.ContextType == 'Plan' and c.ContextIdentifier == 'Body' and c.TargetView == 'PLAN_VIEW'][0].id()"
And I set "scene.BIMRootProperties.contexts" to "{context}"
And I set "active_object.BIMGeometryProperties.contexts" to "{context}"
And I press "bim.add_representation"
Then the object "IfcWall/Wall" data is a "Annotation2D" representation of "Plan/Body/PLAN_VIEW"
And the object "IfcWall/Wall.001" data is a "Annotation2D" representation of "Plan/Body/PLAN_VIEW"
@@ -80,7 +80,7 @@ Scenario: Switch representation - current edited representation is updated prior
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And the variable "context" is "[c for c in {ifc}.by_type('IfcGeometricRepresentationSubContext') if c.ContextType == 'Plan' and c.ContextIdentifier=='Annotation'][0].id()"
And I set "scene.BIMRootProperties.contexts" to "{context}"
And I set "active_object.BIMGeometryProperties.contexts" to "{context}"
And I press "bim.add_representation"
When the object "IfcWall/Cube" is scaled to "2"
And the variable "representation" is "[r for r in {ifc}.by_type('IfcShapeRepresentation') if r.RepresentationType=='Tessellation'][0].id()"
@@ -41,7 +41,7 @@ Scenario: Add type instance - add a mesh where existing instances have changed c
And the object "IfcWall/Wall" data is a "Tessellation" representation of "Model/Body/MODEL_VIEW"
And the object "IfcWall/Wall" is selected
And the variable "context" is "[c for c in {ifc}.by_type('IfcGeometricRepresentationSubContext') if c.ContextType == 'Plan' and c.ContextIdentifier == 'Body' and c.TargetView == 'PLAN_VIEW'][0].id()"
And I set "scene.BIMRootProperties.contexts" to "{context}"
And I set "active_object.BIMGeometryProperties.contexts" to "{context}"
And I press "bim.add_representation"
And the object "IfcWall/Wall" data is a "Annotation2D" representation of "Plan/Body/PLAN_VIEW"
When I press "bim.add_constr_type_instance"
@@ -524,4 +524,4 @@ Scenario: Create a door, undo and create a new door
And I undo
And I press "mesh.add_door()"
Then nothing happens
And the object "IfcDoor/IfcDoor" exists
And the object "IfcDoor/IfcDoor" exists
+4 -2
View File
@@ -194,7 +194,7 @@ class TestSwitchRepresentation:
geometry.is_edited("obj").should_be_called().will_return(False)
geometry.resolve_mapped_representation("mapped_rep").should_be_called().will_return("representation")
geometry.get_representation_data("representation").should_be_called().will_return(None)
geometry.import_representation("obj", "representation").should_be_called().will_return("new_data")
geometry.import_representation("obj", "representation", apply_openings=True).should_be_called().will_return("new_data")
geometry.get_representation_name("representation").should_be_called().will_return("name")
geometry.rename_object("new_data", "name").should_be_called()
geometry.link("representation", "new_data").should_be_called()
@@ -210,13 +210,14 @@ class TestSwitchRepresentation:
should_reload=True,
is_global=True,
should_sync_changes_first=True,
apply_openings=True,
)
def test_switching_to_a_reloaded_representation_and_deleting_the_existing_data(self, ifc, geometry):
geometry.is_edited("obj").should_be_called().will_return(False)
geometry.resolve_mapped_representation("mapped_rep").should_be_called().will_return("representation")
geometry.get_representation_data("representation").should_be_called().will_return("existing_data")
geometry.import_representation("obj", "representation").should_be_called().will_return("new_data")
geometry.import_representation("obj", "representation", apply_openings=True).should_be_called().will_return("new_data")
geometry.get_representation_name("representation").should_be_called().will_return("name")
geometry.rename_object("new_data", "name").should_be_called()
geometry.link("representation", "new_data").should_be_called()
@@ -233,6 +234,7 @@ class TestSwitchRepresentation:
should_reload=True,
is_global=True,
should_sync_changes_first=True,
apply_openings=True,
)
def test_switching_to_an_existing_representation(self, ifc, geometry):