mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
Fix bug where selecting type occurrences did not work
This commit is contained in:
@@ -161,9 +161,8 @@ class SelectTypeObjects(bpy.types.Operator):
|
||||
def execute(self, context):
|
||||
self.file = IfcStore.get_file()
|
||||
relating_type = bpy.data.objects.get(self.relating_type) if self.relating_type else context.active_object
|
||||
oprops = relating_type.BIMObjectProperties
|
||||
related_objects = Data.types[oprops.ifc_definition_id]
|
||||
for obj in context.visible_objects:
|
||||
if obj.BIMObjectProperties.ifc_definition_id in related_objects:
|
||||
for element in ifcopenshell.util.element.get_types(tool.Ifc.get_entity(relating_type)):
|
||||
obj = tool.Ifc.get_object(element)
|
||||
if obj:
|
||||
obj.select_set(True)
|
||||
return {"FINISHED"}
|
||||
|
||||
@@ -85,3 +85,20 @@ Scenario: Assign type - assign to a type with a material profile set
|
||||
When the variable "type" is "{ifc}.by_type('IfcWallType')[0].id()"
|
||||
And I press "bim.assign_type(relating_type={type}, related_object='IfcWall/Cube')"
|
||||
Then the object "IfcWall/Cube" has a "SweptSolid" representation of "Model/Body/MODEL_VIEW"
|
||||
|
||||
Scenario: Select type objects
|
||||
Given an empty IFC project
|
||||
And I add a cube
|
||||
And the object "Cube" is selected
|
||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
|
||||
And I press "bim.assign_class"
|
||||
And I add an empty
|
||||
And the object "Empty" is selected
|
||||
And I set "scene.BIMRootProperties.ifc_product" to "IfcElementType"
|
||||
And I set "scene.BIMRootProperties.ifc_class" to "IfcWallType"
|
||||
And I press "bim.assign_class"
|
||||
And the variable "type" is "{ifc}.by_type('IfcWallType')[0].id()"
|
||||
And I press "bim.assign_type(relating_type={type}, related_object='IfcWall/Cube')"
|
||||
When the object "IfcWallType/Empty" is selected
|
||||
And I press "bim.select_type_objects"
|
||||
Then the object "IfcWall/Cube" is selected
|
||||
|
||||
@@ -153,6 +153,12 @@ def the_object_name_is_selected(name):
|
||||
additionally_the_object_name_is_selected(name)
|
||||
|
||||
|
||||
@then(parsers.parse('the object "{name}" is selected'))
|
||||
def then_the_object_name_is_selected(name):
|
||||
obj = the_object_name_exists(name)
|
||||
assert obj in bpy.context.selected_objects
|
||||
|
||||
|
||||
@given(parsers.parse('the object "{name}" is moved to "{location}"'))
|
||||
@when(parsers.parse('the object "{name}" is moved to "{location}"'))
|
||||
def the_object_name_is_moved_to_location(name, location):
|
||||
|
||||
Reference in New Issue
Block a user