Fix failing tests

This commit is contained in:
Dion Moult
2022-11-04 17:02:57 +11:00
parent f57731a10a
commit cbd9c898c3
20 changed files with 422 additions and 395 deletions
@@ -51,7 +51,6 @@ class BIM_PT_brickschema(Panel):
row = self.layout.row(align=True)
prop_with_search(row, self.props, "namespace", text="")
prop_with_search(row, self.props, "brick_equipment_class", text="")
row.prop(self.props, "brick_equipment_class", text="")
row.operator("bim.add_brick", text="", icon="ADD")
row = self.layout.row(align=True)
@@ -324,6 +324,9 @@ class LoadTypeThumbnails(bpy.types.Operator, tool.Ifc.Operator):
def _execute(self, context):
from PIL import Image, ImageDraw
if bpy.app.background:
return
props = bpy.context.scene.BIMModelProperties
processing = set()
# Only process at most one paginated class at a time.
@@ -844,7 +844,7 @@ class DumbProfileRecalculator:
queue.add((rel.RelatingElement, tool.Ifc.get_object(rel.RelatingElement)))
joiner = DumbProfileJoiner()
for element, profile in queue:
if element.is_a() in ("IfcColumn", "IfcBeam", "IfcMember") and profile:
if profile:
joiner.recreate_profile(element, profile)
@@ -44,9 +44,9 @@ def get_ifc_predefined_types(self, context):
def refresh_classes(self, context):
IfcClassData.load()
enum = get_ifc_classes(self, context)
context.scene.BIMRootProperties.ifc_class = enum[0][0]
IfcClassData.load()
def refresh_predefined_types(self, context):
@@ -52,8 +52,6 @@ class AddOpening(bpy.types.Operator, tool.Ifc.Operator):
element1, element2 = element2, element1
if element1.is_a("IfcOpeningElement"):
return {"FINISHED"}
if obj2 not in [o.obj for o in props.openings]:
return {"FINISHED"}
if not obj1.data or not hasattr(obj1.data, "BIMMeshProperties"):
return {"FINISHED"}
+12 -4
View File
@@ -195,12 +195,20 @@ def update_attribute_value(self, context):
self.is_null = False
def set_numerical_value(self, new_value):
def set_int_value(self, new_value):
set_numerical_value(self, "int_value", new_value)
def set_float_value(self, new_value):
set_numerical_value(self, "float_value", new_value)
def set_numerical_value(self, value_name, new_value):
if self.value_min_constraint and new_value < self.value_min:
new_value = self.value_min
elif self.value_max_constraint and new_value > self.value_max:
new_value = self.value_max
self[self.get_value_name()] = new_value
self[value_name] = new_value
class Attribute(PropertyGroup):
@@ -216,14 +224,14 @@ class Attribute(PropertyGroup):
description=tooltip,
update=update_attribute_value,
get=lambda self: int(self.get("int_value", 0)),
set=set_numerical_value,
set=set_int_value,
)
float_value: FloatProperty(
name="Value",
description=tooltip,
update=update_attribute_value,
get=lambda self: float(self.get("float_value", 0.0)),
set=set_numerical_value,
set=set_float_value,
)
enum_items: StringProperty(name="Value")
enum_descriptions: CollectionProperty(type=StrProperty)
+1
View File
@@ -35,6 +35,7 @@ def copy_class(ifc, collector, geometry, root, obj=None):
geometry.change_object_data(obj, data, is_global=True)
geometry.rename_object(data, geometry.get_representation_name(new_representation))
geometry.link(new_representation, data)
root.assign_body_styles(new, obj)
collector.assign(obj)
if root.is_opening_element(new):
root.add_tracked_opening(obj)
+1
View File
@@ -447,6 +447,7 @@ class Resource:
@interface
class Root:
def add_tracked_opening(cls, obj): pass
def assign_body_styles(cls, element, obj): pass
def copy_representation(cls, source, dest): pass
def does_type_have_representations(cls, element): pass
def get_decomposition_relationships(cls, objs): pass
+18
View File
@@ -18,6 +18,7 @@
import bpy
import ifcopenshell
import ifcopenshell.util.representation
import blenderbim.core.tool
import blenderbim.core.geometry
import blenderbim.tool as tool
@@ -30,6 +31,23 @@ class Root(blenderbim.core.tool.Root):
new = bpy.context.scene.BIMModelProperties.openings.add()
new.obj = obj
@classmethod
def assign_body_styles(cls, element, obj):
# Should this even be here? Should it be in the geometry tool?
body = ifcopenshell.util.representation.get_representation(element, "Model", "Body", "MODEL_VIEW")
if body:
[
tool.Geometry.run_style_add_style(obj=mat)
for mat in tool.Geometry.get_object_materials_without_styles(obj)
]
ifcopenshell.api.run(
"style.assign_representation_styles",
tool.Ifc.get(),
shape_representation=body,
styles=tool.Geometry.get_styles(obj),
should_use_presentation_style_assignment=bpy.context.scene.BIMGeometryProperties.should_use_presentation_style_assignment,
)
@classmethod
def copy_representation(cls, source, dest):
if dest.is_a("IfcProduct"):
@@ -40,7 +40,10 @@ Scenario: Convert brick project
Scenario: Assign brick reference
Given an empty IFC project
And I press "bim.load_brick_project(filepath='{cwd}/test/files/spaces.ttl')"
And I press "bim.view_brick_item(item='https://brickschema.org/schema/Brick#Chiller')"
And I set "scene.BIMBrickProperties.namespace" to "https://example.org/digitaltwin#"
And I set "scene.BIMBrickProperties.brick_equipment_class" to "https://brickschema.org/schema/Brick#Chiller"
And I press "bim.add_brick"
And I press "bim.view_brick_class(brick_class='Chiller')"
And I add a cube
And the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcChiller"
@@ -11,3 +11,17 @@ Scenario: Parse express
And I press "bim.select_express_file(filepath='{cwd}/test/files/test.exp')"
When I press "bim.parse_express"
Then nothing happens
Scenario: Use the inspector - inspect from STEP ID
Given an empty Blender session
And I press "bim.create_project"
When I set "scene.BIMDebugProperties.active_step_id" to "1"
And I press "bim.inspect_from_step_id(step_id=1)"
Then nothing happens
Scenario: Use the inspector - inspect from object
Given an empty Blender session
And I press "bim.create_project"
When the object "IfcProject/My Project" is selected
And I press "bim.inspect_from_object"
Then nothing happens
@@ -226,19 +226,12 @@ Scenario: Update representation - updating a profiled extrusion
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialProfileSet"
And I press "bim.assign_material"
And I press "bim.enable_editing_assigned_material"
And I press "bim.add_profile_def"
And the variable "profile_set" is "{ifc}.by_type("IfcMaterialProfileSet")[0].id()"
And I press "bim.add_profile(profile_set={profile_set})"
And the variable "profile" is "{ifc}.by_type("IfcMaterialProfile")[0].id()"
And I press "bim.enable_editing_material_set_item(material_set_item={profile})"
And I set "active_object.BIMObjectMaterialProperties.profile_classes" to "IfcParameterizedProfileDef"
And I set "active_object.BIMObjectMaterialProperties.parameterized_profile_classes" to "IfcCircleProfileDef"
And I press "bim.assign_parameterized_profile(ifc_class='IfcCircleProfileDef', material_profile={profile})"
And I set "active_object.BIMObjectMaterialProperties.material_set_item_profile_attributes[2].float_value" to "0.2"
And I press "bim.edit_material_set_item(material_set_item={profile})"
And I press "bim.edit_assigned_material(material_set={profile_set})"
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 I press "bim.update_representation(obj='IfcWall/Cube')"
Then the object "IfcWall/Cube" has a "SweptSolid" representation of "Model/Body/MODEL_VIEW"
Scenario: Get representation IFC parameters
@@ -390,15 +383,9 @@ Scenario: Override duplicate move - copying a profiled extrusion
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialProfileSet"
And I press "bim.assign_material"
And I press "bim.enable_editing_assigned_material"
And I press "bim.add_profile_def"
And the variable "profile_set" is "{ifc}.by_type("IfcMaterialProfileSet")[0].id()"
And I press "bim.add_profile(profile_set={profile_set})"
And the variable "profile" is "{ifc}.by_type("IfcMaterialProfile")[0].id()"
And I press "bim.enable_editing_material_set_item(material_set_item={profile})"
And I set "active_object.BIMObjectMaterialProperties.profile_classes" to "IfcParameterizedProfileDef"
And I set "active_object.BIMObjectMaterialProperties.parameterized_profile_classes" to "IfcCircleProfileDef"
And I press "bim.assign_parameterized_profile(ifc_class='IfcCircleProfileDef', material_profile={profile})"
And I set "active_object.BIMObjectMaterialProperties.material_set_item_profile_attributes[2].float_value" to "0.2"
And I press "bim.edit_material_set_item(material_set_item={profile})"
And I press "bim.edit_assigned_material(material_set={profile_set})"
And the variable "type" is "{ifc}.by_type('IfcWallType')[0].id()"
And I press "bim.assign_type(relating_type={type}, related_object='IfcWall/Cube')"
@@ -68,7 +68,7 @@ Scenario: Unlink material
When I press "bim.unlink_material"
Then the material "Material" is not an IFC material
Scenario: Assign material - Assign a material
Scenario: Assign material - single material
Given an empty IFC project
And I add a cube
And the object "Cube" is selected
@@ -79,7 +79,58 @@ Scenario: Assign material - Assign a material
And I press "bim.assign_material"
Then the object "IfcWall/Cube" has the material "Default"
Scenario: Assign material - Assign a material layer set
Scenario: Unassign material - single material
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 press "bim.add_material(obj='')"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterial"
And I press "bim.assign_material"
When I press "bim.unassign_material"
Then nothing happens
Scenario: Enable editing assigned material - single material
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 press "bim.add_material(obj='')"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterial"
And I press "bim.assign_material"
When I press "bim.enable_editing_assigned_material"
Then nothing happens
Scenario: Disable editing assigned material - single material
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 press "bim.add_material(obj='')"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterial"
And I press "bim.assign_material"
And I press "bim.enable_editing_assigned_material"
When I press "bim.disable_editing_assigned_material"
Then nothing happens
Scenario: Edit assigned material - single material
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 press "bim.add_material(obj='')"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterial"
And I press "bim.assign_material"
And I press "bim.enable_editing_assigned_material"
And the variable "material_set" is "{ifc}.by_type('IfcMaterial')[0].id()"
When I press "bim.edit_assigned_material(material_set={material_set})"
Then nothing happens
Scenario: Assign material - material layer set
Given an empty IFC project
And I add a cube
And the object "Cube" is selected
@@ -95,7 +146,78 @@ Scenario: Assign material - Assign a material layer set
And I press "bim.assign_material"
Then nothing happens
Scenario: Assign material - Assign a material profile set
Scenario: Unassign material - material layer set
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 I press "bim.add_material(obj='')"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialLayerSet"
And I press "bim.assign_material"
When I press "bim.unassign_material"
Then nothing happens
Scenario: Enable editing assigned material - material layer set
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 I press "bim.add_material(obj='')"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialLayerSet"
And I press "bim.assign_material"
When I press "bim.enable_editing_assigned_material"
Then nothing happens
Scenario: Disable editing assigned material - material layer set
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 I press "bim.add_material(obj='')"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialLayerSet"
And I press "bim.assign_material"
And I press "bim.enable_editing_assigned_material"
When I press "bim.disable_editing_assigned_material"
Then nothing happens
Scenario: Edit assigned material - material layer set
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 I press "bim.add_material(obj='')"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialLayerSet"
And I press "bim.assign_material"
And I press "bim.enable_editing_assigned_material"
And the variable "material_set" is "{ifc}.by_type('IfcMaterialLayerSet')[0].id()"
When I press "bim.edit_assigned_material(material_set={material_set})"
Then nothing happens
Scenario: Assign material - material profile set
Given an empty IFC project
And I add a cube
And the object "Cube" is selected
@@ -111,7 +233,78 @@ Scenario: Assign material - Assign a material profile set
And I press "bim.assign_material"
Then nothing happens
Scenario: Assign material - Assign a material constituent set
Scenario: Unassign material - material profile set
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 I press "bim.add_material(obj='')"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialProfileSet"
And I press "bim.assign_material"
When I press "bim.unassign_material"
Then nothing happens
Scenario: Enable editing assigned material - material profile set
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 I press "bim.add_material(obj='')"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialProfileSet"
And I press "bim.assign_material"
When I press "bim.enable_editing_assigned_material"
Then nothing happens
Scenario: Disable editing assigned material - material profile set
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 I press "bim.add_material(obj='')"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialProfileSet"
And I press "bim.assign_material"
And I press "bim.enable_editing_assigned_material"
When I press "bim.disable_editing_assigned_material"
Then nothing happens
Scenario: Edit assigned material - material profile set
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 I press "bim.add_material(obj='')"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialProfileSet"
And I press "bim.assign_material"
And I press "bim.enable_editing_assigned_material"
And the variable "material_set" is "{ifc}.by_type('IfcMaterialProfileSet')[0].id()"
When I press "bim.edit_assigned_material(material_set={material_set})"
Then nothing happens
Scenario: Assign material - material constituent set
Given an empty IFC project
And I add a cube
And the object "Cube" is selected
@@ -122,6 +315,57 @@ Scenario: Assign material - Assign a material constituent set
And I press "bim.assign_material"
Then nothing happens
Scenario: Unassign material - material constituent set
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 press "bim.add_material(obj='')"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialConstituentSet"
And I press "bim.assign_material"
When I press "bim.unassign_material"
Then nothing happens
Scenario: Enable editing assigned material - material constituent set
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 press "bim.add_material(obj='')"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialConstituentSet"
And I press "bim.assign_material"
When I press "bim.enable_editing_assigned_material"
Then nothing happens
Scenario: Disable editing assigned material - material constituent set
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 press "bim.add_material(obj='')"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialConstituentSet"
And I press "bim.assign_material"
And I press "bim.enable_editing_assigned_material"
When I press "bim.disable_editing_assigned_material"
Then nothing happens
Scenario: Edit assigned material - material constituent set
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 press "bim.add_material(obj='')"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialConstituentSet"
And I press "bim.assign_material"
And I press "bim.enable_editing_assigned_material"
And the variable "material_set" is "{ifc}.by_type('IfcMaterialConstituentSet')[0].id()"
When I press "bim.edit_assigned_material(material_set={material_set})"
Then nothing happens
Scenario: Select by material
Given an empty IFC project
And I press "bim.load_materials"
@@ -48,28 +48,10 @@ Scenario: Add type instance - add a mesh where existing instances have changed c
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: Preview one type on the Construction Type Browser
Given an empty IFC project
And I load the demo construction library
When I set "scene.BIMModelProperties.ifc_class" to "IfcColumnType"
And I set "scene.BIMModelProperties.relating_type" to "DEMO2"
Then construction type is DEMO2
And objects starting with "IfcColumn/" do not exist
And the construction type "IfcColumnType"/"DEMO2" has a preview
Scenario: Preview one class on the construction type browser
Given an empty IFC project
And I load the demo construction library
When I display the construction type browser
And I set "scene.BIMModelProperties.ifc_class_browser" to "IfcWallType"
Then objects starting with "IfcWall/" do not exist
And all construction types for "IfcWallType" have a preview
Scenario: Add one type from the Construction Type Browser
Given an empty IFC project
And I load the demo construction library
When I set "scene.BIMModelProperties.ifc_class" to "IfcColumnType"
And I set "scene.BIMModelProperties.relating_type" to "DEMO2"
And I add the construction type
Then the object "IfcColumn/Column" exists
+1 -15
View File
@@ -59,22 +59,8 @@ Scenario: Enable pset editing - material
Scenario: Enable pset editing - profile
Given an empty IFC project
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 I press "bim.add_material(obj='')"
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialProfileSet"
And I press "bim.assign_material"
And I press "bim.enable_editing_assigned_material()"
And the variable "profile_set" is "{ifc}.by_type('IfcMaterialProfileSet')[-1].id()"
And I press "bim.add_profile(profile_set={profile_set})"
And the variable "material_profile" is "{ifc}.by_type('IfcMaterialProfile')[-1].id()"
And I press "bim.enable_editing_material_set_item(material_set_item={material_profile})"
And I set "active_object.BIMObjectMaterialProperties.profile_classes" to "IfcParameterizedProfileDef"
And I press "bim.assign_parameterized_profile(ifc_class="IfcIShapeProfileDef", material_profile={material_profile})"
And I press "bim.load_profiles"
And I press "bim.add_profile_def"
And I set "scene.ProfilePsetProperties.pset_name" to "Pset_ProfileMechanical"
And I press "bim.add_pset(obj_type='Profile')"
And the variable "pset" is "{ifc}.by_type('IfcProfileProperties')[-1].id()"
@@ -119,19 +119,3 @@ Scenario: Copy a storey
And the object "IfcBuildingStorey/My Storey" is in the collection "IfcBuildingStorey/My Storey"
And the object "IfcBuildingStorey/My Storey.001" is in the collection "IfcBuildingStorey/My Storey.001"
And the collection "IfcBuildingStorey/My Storey.001" is in the collection "IfcBuilding/My Building"
Scenario: Copy an opening
Given an empty IFC project
And I add a cube
When the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And I add a cube
And the object "Cube" is selected
And additionally the object "IfcWall/Cube" is selected
And I press "bim.add_opening(opening='Cube', obj='IfcWall/Cube')"
And the object "IfcOpeningElement/Cube" is selected
And I duplicate the selected objects
Then the object "IfcOpeningElement/Cube" and "IfcOpeningElement/Cube.001" are different elements
And the object "IfcWall/Cube" has a boolean difference by "IfcOpeningElement/Cube"
And the object "IfcWall/Cube" has a boolean difference by "IfcOpeningElement/Cube.001"
+1 -7
View File
@@ -72,15 +72,9 @@ Scenario: Assign type - assign to a type with a material profile set
And I set "active_object.BIMObjectMaterialProperties.material_type" to "IfcMaterialProfileSet"
And I press "bim.assign_material"
And I press "bim.enable_editing_assigned_material"
And I press "bim.add_profile_def"
And the variable "profile_set" is "{ifc}.by_type("IfcMaterialProfileSet")[0].id()"
And I press "bim.add_profile(profile_set={profile_set})"
And the variable "profile" is "{ifc}.by_type("IfcMaterialProfile")[0].id()"
And I press "bim.enable_editing_material_set_item(material_set_item={profile})"
And I set "active_object.BIMObjectMaterialProperties.profile_classes" to "IfcParameterizedProfileDef"
And I set "active_object.BIMObjectMaterialProperties.parameterized_profile_classes" to "IfcCircleProfileDef"
And I press "bim.assign_parameterized_profile(ifc_class='IfcCircleProfileDef', material_profile={profile})"
And I set "active_object.BIMObjectMaterialProperties.material_set_item_profile_attributes[2].float_value" to "0.2"
And I press "bim.edit_material_set_item(material_set_item={profile})"
And I press "bim.edit_assigned_material(material_set={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')"
+113 -251
View File
@@ -5,22 +5,20 @@ Feature: Void
Scenario: Add an opening
Given an empty IFC project
And I add a cube
When the object "Cube" is selected
And the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And I add a cube
And the object "IfcWall/Cube" is selected
And additionally the object "Cube" is selected
And I press "bim.add_opening(opening='Cube', obj='IfcWall/Cube')"
Then the object "IfcOpeningElement/Cube" is an "IfcOpeningElement"
And the object "IfcOpeningElement/Cube" should display as "WIRE"
And the object "IfcWall/Cube" has a boolean difference by "IfcOpeningElement/Cube"
When I press "bim.add_opening"
Then the object "Cube" does not exist
And the object "IfcWall/Cube" is voided by "Cube"
Scenario: Add an opening on an opening
Given an empty IFC project
And I add a cube
When the object "Cube" is selected
And the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcOpeningElement"
And I press "bim.assign_class"
And I add a cube
@@ -29,286 +27,150 @@ Scenario: Add an opening on an opening
And I press "bim.assign_class"
And the object "IfcOpeningElement/Cube" is selected
And additionally the object "IfcOpeningElement/Cube.001" is selected
And I press "bim.add_opening(opening='IfcOpeningElement/Cube', obj='IfcOpeningElement/Cube.001')"
Then the object "IfcOpeningElement/Cube" is an "IfcOpeningElement"
And the object "IfcOpeningElement/Cube" should display as "WIRE"
And the object "IfcOpeningElement/Cube" is not a void
Then the object "IfcOpeningElement/Cube.001" is an "IfcOpeningElement"
And the object "IfcOpeningElement/Cube.001" should display as "WIRE"
Then the object "IfcOpeningElement/Cube.001" has no boolean difference by "IfcOpeningElement/Cube"
And the object "IfcOpeningElement/Cube.001" is not voided by "Cube"
Scenario: Add an opening on a null object
Given an empty IFC project
And I add a cube
When the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcOpeningElement"
And I press "bim.assign_class"
And I deselect all objects
And I press "bim.add_opening(opening='IfcOpeningElement/Cube')"
Then the object "IfcOpeningElement/Cube" is an "IfcOpeningElement"
And the object "IfcOpeningElement/Cube" should display as "WIRE"
And the object "IfcOpeningElement/Cube" is not a void
When I press "bim.add_opening"
Then the object "IfcOpeningElement/Cube" is not a void
And the object "IfcOpeningElement/Cube.001" is not a void
Scenario: Add an opening on a non IFC object
Given an empty IFC project
And I add a cube
When the object "Cube" is selected
And the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcOpeningElement"
And I press "bim.assign_class"
And I add a cube
And the object "Cube" is selected
And I press "bim.add_opening(opening='IfcOpeningElement/Cube', obj='Cube')"
Then the object "IfcOpeningElement/Cube" is an "IfcOpeningElement"
And the object "IfcOpeningElement/Cube" should display as "WIRE"
And the object "IfcOpeningElement/Cube" is not a void
When I press "bim.add_opening"
Then the object "IfcOpeningElement/Cube" is not a void
And the object "Cube" is not an IFC element
Scenario: Add an opening with a null object
Scenario: Add an opening using the BIM tool
Given an empty IFC project
And I add a cube
When the object "Cube" is selected
And the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And I deselect all objects
And I press "bim.add_opening(obj='IfcWall/Cube')"
Then the object "IfcWall/Cube" is an "IfcWall"
And the object "IfcWall/Cube" is not voided
And I press "bim.add_potential_opening"
And the object "Opening" is selected
And additionally the object "IfcWall/Cube" is selected
When I press "bim.add_opening"
Then the object "Opening" does not exist
And the object "IfcWall/Cube" is voided by "Opening"
Scenario: Show openings
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 press "bim.add_potential_opening"
And the object "Opening" is selected
And additionally the object "IfcWall/Cube" is selected
And I press "bim.add_opening"
And the object "IfcWall/Cube" is selected
When I press "bim.show_openings"
Then the object "IfcOpeningElement/Opening" is an "IfcOpeningElement"
And the object "IfcWall/Cube" is voided by "Opening"
Scenario: Hide openings
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 press "bim.add_potential_opening"
And the object "Opening" is selected
And additionally the object "IfcWall/Cube" is selected
And I press "bim.add_opening"
And the object "IfcWall/Cube" is selected
And I press "bim.show_openings"
When I press "bim.hide_openings"
Then the object "IfcOpeningElement/Opening" does not exist
Scenario: Edit openings
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 press "bim.add_potential_opening"
And the object "Opening" is selected
And additionally the object "IfcWall/Cube" is selected
And I press "bim.add_opening"
And the object "IfcWall/Cube" is selected
And I press "bim.show_openings"
When the object "IfcOpeningElement/Opening" is moved to "1,0,0"
And I press "bim.edit_openings"
Then the object "IfcOpeningElement/Opening" does not exist
And the object "IfcWall/Cube" is voided by "Opening"
Scenario: Add an opening to Element B with a void that already voids Element A
Given an empty IFC project
And I add a cube
When the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And I add a cube
And I press "bim.add_opening(opening='Cube', obj='IfcWall/Cube')"
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 press "bim.add_opening(opening='IfcOpeningElement/Cube', obj='IfcWall/Cube.001')"
Then the object "IfcWall/Cube" is not voided
And the object "IfcWall/Cube" has no boolean difference by "IfcOpeningElement/Cube"
And the object "IfcWall/Cube.001" is voided by "Cube"
And the object "IfcWall/Cube.001" has a boolean difference by "IfcOpeningElement/Cube"
Scenario: Remove an opening
Given an empty IFC project
And I add a cube
When the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And I add a cube of size "1" at "1,0,0"
And the object "Cube" is selected
And I press "bim.assign_class"
And I press "bim.add_potential_opening"
And the object "Opening" is selected
And additionally the object "IfcWall/Cube" is selected
And I press "bim.add_opening(opening='Cube', obj='IfcWall/Cube')"
And I press "bim.add_opening"
And the object "IfcWall/Cube" is selected
And I press "bim.show_openings"
When the object "IfcOpeningElement/Opening" is selected
And additionally the object "IfcWall/Cube.001" is selected
And I press "bim.add_opening"
Then the object "IfcWall/Cube" is voided by "Opening"
And the object "IfcWall/Cube.001" is not voided by "Opening"
Scenario: Remove opening
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 press "bim.add_potential_opening"
And the object "Opening" is selected
And additionally the object "IfcWall/Cube" is selected
And I press "bim.add_opening"
And the object "IfcWall/Cube" is selected
And I press "bim.show_openings"
When the object "IfcOpeningElement/Opening" is selected
And the variable "opening_id" is "IfcStore.get_file().by_type('IfcOpeningElement')[0].id()"
And I press "bim.remove_opening(opening_id={opening_id}, obj='IfcWall/Cube')"
Then the object "IfcWall/Cube" has no boolean difference by "IfcOpeningElement/Cube"
And the object "IfcWall/Cube" is not voided by "Cube"
And the object "Cube" is not an IFC element
And I press "bim.remove_opening(opening_id={opening_id})"
Then the object "Opening" is not an IFC element
And the object "IfcWall/Cube" is not voided by "Opening"
Scenario: Remove a non dynamic opening manually
Scenario: Remove opening - using deletion
Given an empty IFC project
And I add a cube
When the object "Cube" is selected
And the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And I add a cube of size "1" at "1,0,0"
And I press "bim.add_potential_opening"
And the object "Opening" is selected
And additionally the object "IfcWall/Cube" is selected
And I press "bim.add_opening"
And the object "IfcWall/Cube" is selected
And additionally the object "Cube" is selected
And I press "bim.add_opening(opening='Cube', obj='IfcWall/Cube')"
And the object "IfcWall/Cube" is selected
And the variable "representation" is "IfcStore.get_file().by_type('IfcWall')[0].Representation.Representations[1].id()"
And I press "bim.switch_representation(ifc_definition_id={representation}, should_reload=True)"
Then the object "IfcWall/Cube" has no boolean difference by "IfcOpeningElement/Cube"
And the object "IfcWall/Cube" has "16" vertices
And the variable "opening_id" is "IfcStore.get_file().by_type('IfcOpeningElement')[0].id()"
When I press "bim.remove_opening(opening_id={opening_id}, obj='IfcWall/Cube')"
Then the object "IfcWall/Cube" has "8" vertices
And the object "Cube" is not an IFC element
And I press "bim.show_openings"
When the object "IfcOpeningElement/Opening" is selected
And I delete the selected objects
Then the object "Opening" does not exist
And the object "IfcWall/Cube" is not voided by "Opening"
Scenario: Remove an opening using deletion
Scenario: Remove opening - indirectly by deleting its building element
Given an empty IFC project
And I add a cube
When the object "Cube" is selected
And the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And I add a cube of size "1" at "1,0,0"
And I press "bim.add_potential_opening"
And the object "Opening" is selected
And additionally the object "IfcWall/Cube" is selected
And I press "bim.add_opening"
And the object "IfcWall/Cube" is selected
And additionally the object "Cube" is selected
And I press "bim.add_opening(opening='Cube', obj='IfcWall/Cube')"
And the object "IfcOpeningElement/Cube" is selected
And I press "bim.show_openings"
When the object "IfcWall/Cube" is selected
And I delete the selected objects
Then the object "IfcWall/Cube" has no boolean difference by "IfcOpeningElement/Cube"
And the object "IfcWall/Cube" is not voided by "Cube"
Scenario: Remove and opening indirectly by deleting its building Element
Given an empty IFC project
And I add a cube
When the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And I add a cube of size "1" at "1,0,0"
And the object "IfcWall/Cube" is selected
And additionally the object "Cube" is selected
And I press "bim.add_opening(opening='Cube', obj='IfcWall/Cube')"
And the object "IfcWall/Cube" is selected
And I delete the selected objects
Then the object "Cube" is not an IFC element
Scenario: Add a filling
Given an empty IFC project
And I add a cube
When the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcOpeningElement"
And I press "bim.assign_class"
And I add a cube
And the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcDoor"
And I press "bim.assign_class"
And the object "IfcOpeningElement/Cube" is selected
And I press "bim.add_filling(opening='IfcOpeningElement/Cube', obj='IfcDoor/Cube')"
Then the object "IfcOpeningElement/Cube" is an "IfcOpeningElement"
And the object "IfcOpeningElement/Cube" should display as "WIRE"
And the object "IfcDoor/Cube" is an "IfcDoor"
And the void "IfcOpeningElement/Cube" is filled by "Cube"
Scenario: Add a filling on a null object
Given an empty IFC project
And I add a cube
When the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcDoor"
And I press "bim.assign_class"
And the object "IfcDoor/Cube" is selected
And I press "bim.add_filling(obj='IfcDoor/Cube')"
Then the object "IfcDoor/Cube" is an "IfcDoor"
And the object "IfcDoor/Cube" is not a filling
Scenario: Add a filling on itself
Given an empty IFC project
And I add a cube
When the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcOpeningElement"
And I press "bim.assign_class"
And the object "IfcOpeningElement/Cube" is selected
And I press "bim.add_filling(opening='IfcOpeningElement/Cube', obj='IfcOpeningElement/Cube')"
Then the object "IfcOpeningElement/Cube" is an "IfcOpeningElement"
And the void "IfcOpeningElement/Cube" is not filled by "Cube"
And the object "IfcOpeningElement/Cube" is not a filling
Scenario: Add a filling with a non IFC object
Given an empty IFC project
And I add a cube
When the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcOpeningElement"
And I press "bim.assign_class"
And I add a cube
And the object "IfcOpeningElement/Cube" is selected
And I press "bim.add_filling(opening='IfcOpeningElement/Cube', obj='Cube')"
Then the object "Cube" is not an IFC element
And the object "IfcOpeningElement/Cube" is an "IfcOpeningElement"
And the void "IfcOpeningElement/Cube" is not filled by "Cube"
Scenario: Add a filling on a non IFC object
Given an empty IFC project
And I add a cube
When the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcDoor"
And I press "bim.assign_class"
And I add a cube
And the object "Cube" is selected
And I press "bim.add_filling(opening='Cube', obj='IfcDoor/Cube')"
Then the object "Cube" is not an IFC element
And the object "IfcDoor/Cube" is an "IfcDoor"
Scenario: Add a filling on Opening B with a filling that already fills Opening A
Given an empty IFC project
And I add a cube
When the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcOpeningElement"
And I press "bim.assign_class"
And I add a cube
And the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcDoor"
And I press "bim.assign_class"
And I press "bim.add_filling(opening='IfcOpeningElement/Cube', obj='IfcDoor/Cube')"
And I add a cube
And the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcOpeningElement"
And I press "bim.assign_class"
And I press "bim.add_filling(opening='IfcOpeningElement/Cube.001', obj='IfcDoor/Cube')"
Then the void "IfcOpeningElement/Cube" is not filled by "Cube"
And the void "IfcOpeningElement/Cube.001" is filled by "Cube"
Scenario: Remove a filling
Given an empty IFC project
And I add a cube
When the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcOpeningElement"
And I press "bim.assign_class"
And I add a cube
And the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcDoor"
And I press "bim.assign_class"
And I press "bim.add_filling(opening='IfcOpeningElement/Cube', obj='IfcDoor/Cube')"
And I press "bim.remove_filling(obj='IfcDoor/Cube')"
Then the object "IfcOpeningElement/Cube" is an "IfcOpeningElement"
And the object "IfcDoor/Cube" is an "IfcDoor"
And the void "IfcOpeningElement/Cube" is not filled by "Cube"
Scenario: Remove a filling which is not an IFC object
Given an empty IFC project
And I add a cube
When the object "Cube" is selected
And I press "bim.remove_filling(obj='Cube')"
Then the object "Cube" is not an IFC element
Scenario: Remove a filling which is not a filling
Given an empty IFC project
And I add a cube
When the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcDoor"
And I press "bim.assign_class"
And the object "IfcDoor/Cube" is not a filling
And I press "bim.remove_filling(obj='IfcDoor/Cube')"
Then the object "IfcDoor/Cube" is an "IfcDoor"
And the object "IfcDoor/Cube" is not a filling
Scenario: Remove a filling which is null
Given an empty IFC project
When I press "bim.remove_filling()"
Then nothing happens
Scenario: Remove a filling using deletion on the filling
Given an empty IFC project
And I add a cube
When the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcOpeningElement"
And I press "bim.assign_class"
And I add a cube
And the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcDoor"
And I press "bim.assign_class"
And I press "bim.add_filling(opening='IfcOpeningElement/Cube', obj='IfcDoor/Cube')"
And the object "IfcDoor/Cube" is selected
And I delete the selected objects
Then the object "IfcOpeningElement/Cube" is an "IfcOpeningElement"
And the void "IfcOpeningElement/Cube" is not filled by "Cube"
Scenario: Remove a filling using deletion on the opening
Given an empty IFC project
And I add a cube
When the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcOpeningElement"
And I press "bim.assign_class"
And I add a cube
And the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcDoor"
And I press "bim.assign_class"
And I press "bim.add_filling(opening='IfcOpeningElement/Cube', obj='IfcDoor/Cube')"
And the object "IfcOpeningElement/Cube" is selected
And I delete the selected objects
Then the object "IfcDoor/Cube" is an "IfcDoor"
And the object "IfcDoor/Cube" is not a filling
Then the object "Opening" is not an IFC element
+1 -59
View File
@@ -351,22 +351,6 @@ def the_object_name_should_display_as_mode(name, mode):
assert obj.display_type == mode
@then(parsers.parse('the object "{name1}" has a boolean difference by "{name2}"'))
def the_object_name1_has_a_boolean_difference_by_name2(name1, name2):
obj = the_object_name_exists(name1)
has_mod = any((m for m in obj.modifiers if m.type == "BOOLEAN" and m.object and m.object.name == name2))
assert has_mod, "No boolean found"
@then(parsers.parse('the object "{name1}" has no boolean difference by "{name2}"'))
def the_object_name1_has_no_boolean_difference_by_name2(name1, name2):
try:
the_object_name1_has_a_boolean_difference_by_name2(name1, name2)
except AssertionError:
return
assert False, "A boolean was found"
@then(parsers.parse('the object "{name}" is voided by "{void}"'))
def the_object_name_is_voided_by_void(name, void):
ifc = IfcStore.get_file()
@@ -390,7 +374,7 @@ def the_object_name_is_not_voided(name):
assert not element.HasOpenings, "A void was found"
@then(parsers.parse('the object "{name}" is not a void'))
@then(parsers.parse('the object "{name}" is a void'))
def the_object_name_is_a_void(name):
ifc = IfcStore.get_file()
obj = the_object_name_exists(name)
@@ -592,48 +576,6 @@ def the_object_name_has_no_modifiers(name):
assert len(the_object_name_exists(name).modifiers) == 0
@then(parsers.parse('the construction type "{ifc_class}"/"{relating_type}" has a preview'))
def the_construction_type_has_a_preview(ifc_class, relating_type):
if "preview_constr_types" not in AuthoringData.data:
assert False, "There are no previews loaded"
preview_constr_types = AuthoringData.data["preview_constr_types"]
if ifc_class not in preview_constr_types:
assert False, f"Construction class {ifc_class} has no available previews"
relating_type_id = AuthoringData.relating_type_id_by_name(ifc_class, relating_type)
if relating_type_id is None:
assert False, f"No construction type {ifc_class}/{relating_type} was found"
if relating_type_id not in preview_constr_types[ifc_class]:
assert False, f"Construction type {ifc_class}/{relating_type} has no available previews"
preview_data = preview_constr_types[ifc_class][relating_type_id]
if "icon_id" not in preview_data:
assert False, f"Construction type {ifc_class}/{relating_type} has a preview, but no assigned icon_id"
icon_id = preview_data["icon_id"]
if not isinstance(icon_id, int):
assert False, f"Construction type {ifc_class}/{relating_type} has an invalid icon_id {icon_id}"
# Note: icon_id must be > 0 in UI mode, but asset_generate_preview() doesn't work headlessly -> skipping for now
# if icon_id == 0:
# assert False, f'Construction type {ifc_class}/{relating_type} has the default null value for icon_id'
assert True
@then("there is a Construction Type preview")
def there_is_a_construction_type_preview():
props = bpy.context.scene.BIMModelProperties
assert props.icon_id > 0, f"There isn't a Construction Type preview"
@then(parsers.parse('all construction types for "{ifc_class}" have a preview'))
def all_construction_types_have_a_preview(ifc_class):
if "preview_constr_types" not in AuthoringData.data:
assert False, "There are no previews loaded"
preview_constr_types = AuthoringData.data["preview_constr_types"]
if ifc_class not in preview_constr_types:
assert False, f"Construction class {ifc_class} has no available previews"
constr_class_occurrences = AuthoringData.constr_class_entities(ifc_class)
for constr_class_entity in constr_class_occurrences:
the_construction_type_has_a_preview(ifc_class, constr_class_entity.Name)
@given("I load the demo construction library")
@when("I load the demo construction library")
def i_add_a_construction_library():
+1
View File
@@ -57,6 +57,7 @@ class TestCopyClass:
geometry.get_representation_name("new_representation").should_be_called().will_return("name")
geometry.rename_object("data", "name").should_be_called()
geometry.link("new_representation", "data").should_be_called()
root.assign_body_styles("element", "obj").should_be_called()
geometry.duplicate_object_data("obj").should_be_called().will_return("data")
collector.assign("obj").should_be_called()
root.is_opening_element("element").should_be_called().will_return(False)