mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-11 22:31:55 +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):
|
def execute(self, context):
|
||||||
self.file = IfcStore.get_file()
|
self.file = IfcStore.get_file()
|
||||||
relating_type = bpy.data.objects.get(self.relating_type) if self.relating_type else context.active_object
|
relating_type = bpy.data.objects.get(self.relating_type) if self.relating_type else context.active_object
|
||||||
oprops = relating_type.BIMObjectProperties
|
for element in ifcopenshell.util.element.get_types(tool.Ifc.get_entity(relating_type)):
|
||||||
related_objects = Data.types[oprops.ifc_definition_id]
|
obj = tool.Ifc.get_object(element)
|
||||||
for obj in context.visible_objects:
|
if obj:
|
||||||
if obj.BIMObjectProperties.ifc_definition_id in related_objects:
|
|
||||||
obj.select_set(True)
|
obj.select_set(True)
|
||||||
return {"FINISHED"}
|
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()"
|
When the variable "type" is "{ifc}.by_type('IfcWallType')[0].id()"
|
||||||
And I press "bim.assign_type(relating_type={type}, related_object='IfcWall/Cube')"
|
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"
|
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)
|
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}"'))
|
@given(parsers.parse('the object "{name}" is moved to "{location}"'))
|
||||||
@when(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):
|
def the_object_name_is_moved_to_location(name, location):
|
||||||
|
|||||||
Reference in New Issue
Block a user