Fix bug where editing then switching to the current representation crashes.

This commit is contained in:
Dion Moult
2022-01-30 14:46:05 +11:00
parent c7428dd160
commit e9670a6906
6 changed files with 74 additions and 25 deletions
@@ -33,14 +33,14 @@ Scenario: Add representation - add a new representation to a typed instance
And I press "bim.assign_class"
And I press "bim.add_type_instance"
And I press "bim.add_type_instance"
Then the object "IfcWall/Instance" data is a "Tessellation" representation of "Model/Body/MODEL_VIEW"
And the object "IfcWall/Instance.001" data is a "Tessellation" representation of "Model/Body/MODEL_VIEW"
When the object "IfcWall/Instance" is selected
Then the object "IfcWall/Wall" data is a "Tessellation" representation of "Model/Body/MODEL_VIEW"
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 "{ifc}.by_type('IfcGeometricRepresentationSubContext')[-1].id()"
And I set "scene.BIMRootProperties.contexts" to "{context}"
And I press "bim.add_representation"
Then the object "IfcWall/Instance" data is a "Annotation2D" representation of "Plan/Annotation/PLAN_VIEW"
And the object "IfcWall/Instance.001" data is a "Annotation2D" representation of "Plan/Annotation/PLAN_VIEW"
Then the object "IfcWall/Wall" data is a "Annotation2D" representation of "Plan/Annotation/PLAN_VIEW"
And the object "IfcWall/Wall.001" data is a "Annotation2D" representation of "Plan/Annotation/PLAN_VIEW"
Scenario: Add representation - add a representation with a scale factor applied
Given an empty IFC project
@@ -79,14 +79,14 @@ Scenario: Switch representation - current edited representation is updated prior
And the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And the variable "context" is "{ifc}.by_type('IfcGeometricRepresentationSubContext')[-1].id()"
And the variable "context" is "[c for c in {ifc}.by_type('IfcGeometricRepresentationSubContext') if c.ContextIdentifier=='Annotation'][0].id()"
And I set "scene.BIMRootProperties.contexts" to "{context}"
And I press "bim.add_representation"
When the object "IfcWall/Cube" is scaled to "2"
And the variable "representation" is "{ifc}.by_type('IfcShapeRepresentation')[0].id()"
And I press "bim.switch_representation(obj='IfcWall/Cube', ifc_definition_id={representation}, should_reload=True)"
And the variable "representation" is "{ifc}.by_type('IfcShapeRepresentation')[-1].id()"
And I press "bim.switch_representation(obj='IfcWall/Cube', ifc_definition_id={representation}, should_reload=True)"
And the variable "representation" is "[r for r in {ifc}.by_type('IfcShapeRepresentation') if r.RepresentationType=='Tessellation'][0].id()"
And I press "bim.switch_representation(ifc_definition_id={representation}, should_reload=True)"
And the variable "representation" is "[r for r in {ifc}.by_type('IfcShapeRepresentation') if r.RepresentationType=='Annotation2D'][0].id()"
And I press "bim.switch_representation(ifc_definition_id={representation}, should_reload=True)"
When I press "export_ifc.bim(filepath='{cwd}/test/files/export.ifc')"
Then the object "IfcWall/Cube" dimensions are "4,4,0"
@@ -153,8 +153,8 @@ Scenario: Remove representation - remove an instanced representation from an act
When the variable "representation" is "{ifc}.by_type('IfcWallType')[0].RepresentationMaps[1].MappedRepresentation.id()"
And I press "bim.remove_representation(representation_id={representation})"
Then the object "IfcWallType/Cube" has no data
Then the object "IfcWall/Instance" has no data
Then the object "IfcWall/Instance.001" has no data
Then the object "IfcWall/Wall" has no data
Then the object "IfcWall/Wall.001" has no data
Scenario: Remove representation - remove an instanced representation from an active instance object
Given an empty IFC project
@@ -168,12 +168,12 @@ Scenario: Remove representation - remove an instanced representation from an act
And I set "scene.BIMModelProperties.relating_type" to "{cube}"
And I press "bim.add_type_instance"
And I press "bim.add_type_instance"
And the object "IfcWall/Instance" is selected
And the object "IfcWall/Wall" is selected
When the variable "representation" is "{ifc}.by_type('IfcWall')[0].Representation.Representations[1].id()"
And I press "bim.remove_representation(representation_id={representation})"
Then the object "IfcWallType/Cube" has no data
Then the object "IfcWall/Instance" has no data
Then the object "IfcWall/Instance.001" has no data
Then the object "IfcWall/Wall" has no data
Then the object "IfcWall/Wall.001" has no data
Scenario: Update representation - updating a tessellation
Given an empty IFC project
@@ -341,10 +341,10 @@ Scenario: Override duplicate move - copying a type instance with a representatio
And the variable "cube" is "{ifc}.by_type('IfcWallType')[0].id()"
And I set "scene.BIMModelProperties.relating_type" to "{cube}"
And I press "bim.add_type_instance"
And the object "IfcWall/Instance" is selected
And the object "IfcWall/Wall" is selected
When I press "object.duplicate_move"
Then the object "IfcWall/Instance.001" exists
And the object "IfcWall/Instance.001" has a "MappedRepresentation" representation of "Model/Body/MODEL_VIEW"
Then the object "IfcWall/Wall.001" exists
And the object "IfcWall/Wall.001" has a "MappedRepresentation" representation of "Model/Body/MODEL_VIEW"
Scenario: Override duplicate move - copying a layered extrusion
Given an empty IFC project
@@ -12,7 +12,7 @@ Scenario: Add type instance - add from a mesh
And the variable "cube" is "{ifc}.by_type('IfcWallType')[0].id()"
And I set "scene.BIMModelProperties.relating_type" to "{cube}"
When I press "bim.add_type_instance"
Then the object "IfcWall/Instance" exists
Then the object "IfcWall/Wall" exists
Scenario: Add type instance - add from an empty
Given an empty IFC project
@@ -25,7 +25,7 @@ Scenario: Add type instance - add from an empty
And the variable "empty" is "{ifc}.by_type('IfcWallType')[0].id()"
And I set "scene.BIMModelProperties.relating_type" to "{empty}"
When I press "bim.add_type_instance"
Then the object "IfcWall/Instance" exists
Then the object "IfcWall/Wall" exists
Scenario: Add type instance - add a mesh where existing instances have changed context
Given an empty IFC project
@@ -38,15 +38,15 @@ Scenario: Add type instance - add a mesh where existing instances have changed c
And the variable "cube" is "{ifc}.by_type('IfcWallType')[0].id()"
And I set "scene.BIMModelProperties.relating_type" to "{cube}"
And I press "bim.add_type_instance"
And the object "IfcWall/Instance" data is a "Tessellation" representation of "Model/Body/MODEL_VIEW"
And the object "IfcWall/Instance" is selected
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 "{ifc}.by_type('IfcGeometricRepresentationSubContext')[-1].id()"
And I set "scene.BIMRootProperties.contexts" to "{context}"
And I press "bim.add_representation"
And the object "IfcWall/Instance" data is a "Annotation2D" representation of "Plan/Annotation/PLAN_VIEW"
And the object "IfcWall/Wall" data is a "Annotation2D" representation of "Plan/Annotation/PLAN_VIEW"
When I press "bim.add_type_instance"
Then the object "IfcWall/Instance" data is a "Annotation2D" representation of "Plan/Annotation/PLAN_VIEW"
And the object "IfcWall/Instance.001" data is a "Annotation2D" representation of "Plan/Annotation/PLAN_VIEW"
Then the object "IfcWall/Wall" data is a "Annotation2D" representation of "Plan/Annotation/PLAN_VIEW"
And the object "IfcWall/Wall.001" data is a "Annotation2D" representation of "Plan/Annotation/PLAN_VIEW"
Scenario: Add grid
Given an empty IFC project