Copying parametric geometry from any source now attempts to preserve parametric geometry when possible.

This commit is contained in:
Dion Moult
2021-10-22 18:07:34 +11:00
parent c551275db2
commit 6d817703aa
13 changed files with 326 additions and 103 deletions
@@ -44,7 +44,7 @@ Scenario: Switch representation - existing Blender modifiers must be purged
And I press "bim.switch_representation(obj='IfcWall/Cube', ifc_definition_id={representation})"
Then the object "IfcWall/Cube" has no modifiers
Scenario: Update representation
Scenario: Update representation - updating a tessellation
Given an empty IFC project
And I add a cube
And the object "Cube" is selected
@@ -53,6 +53,63 @@ Scenario: Update representation
And I press "bim.update_representation(obj='IfcWall/Cube')"
Then the object "IfcWall/Cube" has a "Tessellation" representation of "Model/Body/MODEL_VIEW"
Scenario: Update representation - updating a layered extrusion
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_default_material"
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 "layer_set" is "{ifc}.by_type("IfcMaterialLayerSet")[0].id()"
And I press "bim.add_layer(layer_set={layer_set})"
And the variable "layer" is "{ifc}.by_type("IfcMaterialLayer")[0].id()"
And I press "bim.enable_editing_material_set_item(material_set_item={layer})"
And I set "active_object.BIMObjectMaterialProperties.material_set_item_attributes[0].float_value" to "0.1"
And I press "bim.edit_material_set_item(material_set_item={layer})"
And I press "bim.edit_assigned_material(material_set={layer_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: Update representation - updating a profiled extrusion
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_default_material"
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")[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: Copy representation
Given an empty IFC project
And I add a cube
@@ -126,3 +183,64 @@ Scenario: Override duplicate move - copying a type instance with a representatio
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"
Scenario: Override duplicate move - copying a layered extrusion
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_default_material"
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 "layer_set" is "{ifc}.by_type("IfcMaterialLayerSet")[0].id()"
And I press "bim.add_layer(layer_set={layer_set})"
And the variable "layer" is "{ifc}.by_type("IfcMaterialLayer")[0].id()"
And I press "bim.enable_editing_material_set_item(material_set_item={layer})"
And I set "active_object.BIMObjectMaterialProperties.material_set_item_attributes[0].float_value" to "0.1"
And I press "bim.edit_material_set_item(material_set_item={layer})"
And I press "bim.edit_assigned_material(material_set={layer_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')"
And the object "IfcWall/Cube" is selected
When I press "object.duplicate_move"
Then the object "IfcWall/Cube.001" exists
Then the object "IfcWall/Cube.001" has a "SweptSolid" representation of "Model/Body/MODEL_VIEW"
Scenario: Override duplicate move - copying a profiled extrusion
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_default_material"
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")[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')"
And the object "IfcWall/Cube" is selected
When I press "object.duplicate_move"
Then the object "IfcWall/Cube.001" exists
Then the object "IfcWall/Cube.001" has a "SweptSolid" representation of "Model/Body/MODEL_VIEW"
+4 -4
View File
@@ -13,7 +13,7 @@ Scenario: Assign type - assign to an empty type
And I set "scene.BIMRootProperties.ifc_class" to "IfcWallType"
And I press "bim.assign_class"
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 "Tessellation" representation of "Model/Body/MODEL_VIEW"
Scenario: Assign type - assign to a type with representation maps
@@ -28,7 +28,7 @@ Scenario: Assign type - assign to a type with representation maps
And I set "scene.BIMRootProperties.ifc_class" to "IfcWallType"
And I press "bim.assign_class"
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 "MappedRepresentation" representation of "Model/Body/MODEL_VIEW"
Scenario: Assign type - assign to a type with a material layer set
@@ -54,7 +54,7 @@ Scenario: Assign type - assign to a type with a material layer set
And I press "bim.edit_material_set_item(material_set_item={layer})"
And I press "bim.edit_assigned_material(material_set={layer_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")"
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: Assign type - assign to a type with a material profile set
@@ -83,5 +83,5 @@ Scenario: Assign type - assign to a type with a material profile set
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")"
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"
+31 -19
View File
@@ -18,13 +18,13 @@
import blenderbim.core.root as subject
import test.core.test_geometry
from test.core.bootstrap import ifc, collector, root
from test.core.bootstrap import ifc, collector, geometry, root
class TestCopyClass:
def test_doing_nothing_if_not_an_ifc_element(self, ifc, collector, root):
ifc.get_entity("obj").should_be_called().will_return(None)
subject.copy_class(ifc, collector, root, obj="obj")
subject.copy_class(ifc, collector, geometry, root, obj="obj")
def test_copy_with_new_geometry_derived_from_the_type(self, ifc, collector, root):
ifc.get_entity("obj").should_be_called().will_return("original_element")
@@ -35,31 +35,43 @@ class TestCopyClass:
ifc.run("type.map_type_representations", related_object="element", relating_type="type").should_be_called()
collector.assign("obj").should_be_called()
root.is_opening_element("element").should_be_called().will_return(False)
subject.copy_class(ifc, collector, root, obj="obj")
subject.copy_class(ifc, collector, geometry, root, obj="obj")
def test_copy_with_new_geometry_added_afresh_for_speed(
self,
ifc,
collector,
root,
):
def test_copy_with_new_geometry_added_afresh_for_speed(self, ifc, collector, geometry, root):
ifc.get_entity("obj").should_be_called().will_return("original_element")
ifc.run("root.copy_class", product="original_element").should_be_called().will_return("element")
ifc.link("element", "obj").should_be_called()
root.get_element_type("element").should_be_called().will_return("type")
root.does_type_have_representations("type").should_be_called().will_return(False)
root.get_object_context("obj").should_be_called().will_return("context")
root.run_geometry_add_representation(obj="obj", context="context").should_be_called()
root.get_object_representation("obj").should_be_called().will_return("representation")
root.get_representation_context("representation").should_be_called().will_return("context")
geometry.get_ifc_representation_class("element", "representation").should_be_called().will_return(
"ifc_representation_class"
)
geometry.get_profile_set_usage("element").should_be_called().will_return("profile_set_usage")
root.run_geometry_add_representation(
obj="obj",
context="context",
ifc_representation_class="ifc_representation_class",
profile_set_usage="profile_set_usage",
).should_be_called()
collector.assign("obj").should_be_called()
root.is_opening_element("element").should_be_called().will_return(False)
subject.copy_class(ifc, collector, root, obj="obj")
subject.copy_class(ifc, collector, geometry, root, obj="obj")
def test_copied_openings_have_dynamic_voids_added(
self,
ifc,
collector,
root,
):
def test_copy_with_no_new_geometry(self, ifc, collector, geometry, root):
ifc.get_entity("obj").should_be_called().will_return("original_element")
ifc.run("root.copy_class", product="original_element").should_be_called().will_return("element")
ifc.link("element", "obj").should_be_called()
root.get_element_type("element").should_be_called().will_return("type")
root.does_type_have_representations("type").should_be_called().will_return(False)
root.get_object_representation("obj").should_be_called().will_return(None)
collector.assign("obj").should_be_called()
root.is_opening_element("element").should_be_called().will_return(False)
subject.copy_class(ifc, collector, geometry, root, obj="obj")
def test_copied_openings_have_dynamic_voids_added(self, ifc, collector, root):
ifc.get_entity("obj").should_be_called().will_return("original_element")
ifc.run("root.copy_class", product="original_element").should_be_called().will_return("element")
ifc.link("element", "obj").should_be_called()
@@ -69,4 +81,4 @@ class TestCopyClass:
collector.assign("obj").should_be_called()
root.is_opening_element("element").should_be_called().will_return(True)
root.add_dynamic_opening_voids("element", "obj").should_be_called()
subject.copy_class(ifc, collector, root, obj="obj")
subject.copy_class(ifc, collector, geometry, root, obj="obj")
+74 -21
View File
@@ -20,20 +20,20 @@ import bpy
import math
import numpy
import ifcopenshell
import test.bim.bootstrap
import blenderbim.core.tool
import blenderbim.tool as tool
from mathutils import Vector
from test.bim.bootstrap import NewFile
from blenderbim.tool.geometry import Geometry as subject
from blenderbim.bim.ifc import IfcStore
class TestImplementsTool(test.bim.bootstrap.NewFile):
class TestImplementsTool(NewFile):
def test_run(self):
assert isinstance(subject(), blenderbim.core.tool.Geometry)
class TestChangeObjectData(test.bim.bootstrap.NewFile):
class TestChangeObjectData(NewFile):
def test_change_single_object_data(self):
data1 = bpy.data.meshes.new("Mesh")
data2 = bpy.data.meshes.new("Mesh")
@@ -53,7 +53,7 @@ class TestChangeObjectData(test.bim.bootstrap.NewFile):
assert obj2.data == data2
class TestClearModifiers(test.bim.bootstrap.NewFile):
class TestClearModifiers(NewFile):
def test_run(self):
obj = bpy.data.objects.new("Object", bpy.data.meshes.new("Mesh"))
obj.modifiers.new("IfcOpeningElement", "BOOLEAN")
@@ -61,7 +61,7 @@ class TestClearModifiers(test.bim.bootstrap.NewFile):
assert len(obj.modifiers) == 0
class TestCreateDynamicVoids(test.bim.bootstrap.NewFile):
class TestCreateDynamicVoids(NewFile):
def test_run(self):
ifc = ifcopenshell.file()
tool.Ifc.set(ifc)
@@ -82,7 +82,7 @@ class TestCreateDynamicVoids(test.bim.bootstrap.NewFile):
assert modifier.use_self is True
class TestDoesObjectHaveMeshWithFaces(test.bim.bootstrap.NewFile):
class TestDoesObjectHaveMeshWithFaces(NewFile):
def test_empties_return_false(self):
obj = bpy.data.objects.new("Object", None)
assert subject.does_object_have_mesh_with_faces(obj) is False
@@ -101,7 +101,7 @@ class TestDoesObjectHaveMeshWithFaces(test.bim.bootstrap.NewFile):
assert subject.does_object_have_mesh_with_faces(obj) is True
class TestDuplicateObjectData(test.bim.bootstrap.NewFile):
class TestDuplicateObjectData(NewFile):
def test_run(self):
data = bpy.data.meshes.new("Mesh")
obj = bpy.data.objects.new("Object", data)
@@ -110,14 +110,14 @@ class TestDuplicateObjectData(test.bim.bootstrap.NewFile):
assert isinstance(obj.data, bpy.types.Mesh)
class TestGetObjectData(test.bim.bootstrap.NewFile):
class TestGetObjectData(NewFile):
def test_run(self):
data = bpy.data.meshes.new("Mesh")
obj = bpy.data.objects.new("Object", data)
assert subject.get_object_data(obj) == obj.data
class TestGetObjectMaterialsWithoutStyles(test.bim.bootstrap.NewFile):
class TestGetObjectMaterialsWithoutStyles(NewFile):
def test_run(self):
material1 = bpy.data.materials.new("Material")
material2 = bpy.data.materials.new("Material")
@@ -130,7 +130,7 @@ class TestGetObjectMaterialsWithoutStyles(test.bim.bootstrap.NewFile):
assert subject.get_object_materials_without_styles(obj) == [material1, material2]
class TestGetRepresentationData(test.bim.bootstrap.NewFile):
class TestGetRepresentationData(NewFile):
def test_run(self):
ifc = ifcopenshell.file()
context = ifc.createIfcGeometricRepresentationContext()
@@ -140,7 +140,7 @@ class TestGetRepresentationData(test.bim.bootstrap.NewFile):
assert subject.get_representation_data(representation) == data
class TestGetRepresentationName(test.bim.bootstrap.NewFile):
class TestGetRepresentationName(NewFile):
def test_run(self):
ifc = ifcopenshell.file()
context = ifc.createIfcGeometricRepresentationContext()
@@ -149,7 +149,7 @@ class TestGetRepresentationName(test.bim.bootstrap.NewFile):
assert subject.get_representation_name(representation) == f"{context.id()}/{representation.id()}"
class TestGetCartesianPointCoordinateOffset(test.bim.bootstrap.NewFile):
class TestGetCartesianPointCoordinateOffset(NewFile):
def test_run(self):
obj = bpy.data.objects.new("Object", None)
obj.BIMObjectProperties.blender_offset_type = "CARTESIAN_POINT"
@@ -177,7 +177,7 @@ class TestGetCartesianPointCoordinateOffset(test.bim.bootstrap.NewFile):
assert subject.get_cartesian_point_coordinate_offset(obj) is None
class TestGetTotalRepresentationItems(test.bim.bootstrap.NewFile):
class TestGetTotalRepresentationItems(NewFile):
def test_run(self):
material1 = bpy.data.materials.new("Material")
material2 = bpy.data.materials.new("Material")
@@ -187,7 +187,7 @@ class TestGetTotalRepresentationItems(test.bim.bootstrap.NewFile):
assert subject.get_total_representation_items(obj) == 2
class TestImportRepresentation(test.bim.bootstrap.NewFile):
class TestImportRepresentation(NewFile):
def test_importing_a_normal_shape(self):
ifc = ifcopenshell.open("test/files/basic.ifc")
tool.Ifc.set(ifc)
@@ -213,7 +213,7 @@ class TestImportRepresentation(test.bim.bootstrap.NewFile):
assert len(mesh.edges) == 4
class TestIsBodyRepresentation(test.bim.bootstrap.NewFile):
class TestIsBodyRepresentation(NewFile):
def test_run(self):
ifc = ifcopenshell.file()
context = ifc.createIfcGeometricRepresentationContext()
@@ -225,7 +225,7 @@ class TestIsBodyRepresentation(test.bim.bootstrap.NewFile):
assert subject.is_body_representation(representation) is False
class TestLink(test.bim.bootstrap.NewFile):
class TestLink(NewFile):
def test_run(self):
ifc = ifcopenshell.file()
element = ifc.createIfcShapeRepresentation()
@@ -234,14 +234,14 @@ class TestLink(test.bim.bootstrap.NewFile):
assert obj.BIMMeshProperties.ifc_definition_id == element.id()
class TestRenameObjectData(test.bim.bootstrap.NewFile):
class TestRenameObjectData(NewFile):
def test_run(self):
obj = bpy.data.meshes.new("Mesh")
subject.rename_object(obj, "name")
assert obj.name == "name"
class TestResolveMappedRepresentation(test.bim.bootstrap.NewFile):
class TestResolveMappedRepresentation(NewFile):
def test_run(self):
ifc = ifcopenshell.file()
mapped_representation = ifc.createIfcShapeRepresentation()
@@ -258,19 +258,72 @@ class TestResolveMappedRepresentation(test.bim.bootstrap.NewFile):
assert subject.resolve_mapped_representation(representation) == representation
class TestShouldForceFacetedBrep(test.bim.bootstrap.NewFile):
class TestShouldForceFacetedBrep(NewFile):
def test_run(self):
result = bpy.context.scene.BIMGeometryProperties.should_force_faceted_brep
assert subject.should_force_faceted_brep() is result
class TestShouldForceTriangulation(test.bim.bootstrap.NewFile):
class TestShouldForceTriangulation(NewFile):
def test_run(self):
result = bpy.context.scene.BIMGeometryProperties.should_force_triangulation
assert subject.should_force_triangulation() is result
class TestShouldUsePresentationStyleAssignment(test.bim.bootstrap.NewFile):
class TestShouldUsePresentationStyleAssignment(NewFile):
def test_run(self):
result = bpy.context.scene.BIMGeometryProperties.should_use_presentation_style_assignment
assert subject.should_use_presentation_style_assignment() is result
class TestGetProfileSetUsage(NewFile):
def test_getting_a_profile_set_usage(self):
ifc = ifcopenshell.file()
element = ifc.createIfcColumn()
assert subject.get_profile_set_usage(element) is None
usage = ifc.createIfcMaterialProfileSetUsage()
ifc.createIfcRelAssociatesMaterial(RelatingMaterial=usage, RelatedObjects=[element])
assert subject.get_profile_set_usage(element) == usage
class TestGetIfcRepresentationClass(NewFile):
def test_detecting_profile_set_representations(self):
ifc = ifcopenshell.file()
tool.Ifc.set(ifc)
element = ifc.createIfcColumn()
ifc.createIfcRelAssociatesMaterial(
RelatingMaterial=ifc.createIfcMaterialProfileSetUsage(), RelatedObjects=[element]
)
representation = ifc.createIfcShapeRepresentation()
assert (
subject.get_ifc_representation_class(element, representation)
== "IfcExtrudedAreaSolid/IfcMaterialProfileSetUsage"
)
def test_detecting_rectangular_extrusions(self):
ifc = ifcopenshell.file()
tool.Ifc.set(ifc)
element = ifc.createIfcColumn()
representation = ifc.createIfcShapeRepresentation(
Items=[ifc.createIfcExtrudedAreaSolid(SweptArea=ifc.createIfcRectangleProfileDef())]
)
assert (
subject.get_ifc_representation_class(element, representation)
== "IfcExtrudedAreaSolid/IfcRectangleProfileDef"
)
def test_detecting_circle_extrusions(self):
ifc = ifcopenshell.file()
tool.Ifc.set(ifc)
element = ifc.createIfcColumn()
representation = ifc.createIfcShapeRepresentation(
Items=[ifc.createIfcExtrudedAreaSolid(SweptArea=ifc.createIfcCircleProfileDef())]
)
assert (
subject.get_ifc_representation_class(element, representation) == "IfcExtrudedAreaSolid/IfcCircleProfileDef"
)
def test_returning_null_for_non_parametric_representations(self):
ifc = ifcopenshell.file()
tool.Ifc.set(ifc)
assert subject.get_ifc_representation_class(ifc.createIfcColumn(), ifc.createIfcShapeRepresentation()) is None
+12 -4
View File
@@ -74,15 +74,23 @@ class TestGetElementType(NewFile):
assert subject.get_element_type(element) == type
class TestGetElementType(NewFile):
class TestGetObjectRepresentation(NewFile):
def test_run(self):
ifc = ifcopenshell.file()
tool.Ifc.set(ifc)
representation = ifc.createIfcShapeRepresentation()
obj = bpy.data.objects.new("Object", bpy.data.meshes.new("Mesh"))
obj.data.BIMMeshProperties.ifc_definition_id = representation.id()
assert subject.get_object_representation(obj) == representation
class TestGetRepresentationContext(NewFile):
def test_run(self):
ifc = ifcopenshell.file()
tool.Ifc.set(ifc)
context = ifc.createIfcGeometricRepresentationContext()
representation = ifc.createIfcShapeRepresentation(ContextOfItems=context)
obj = bpy.data.objects.new("Object", bpy.data.meshes.new("Mesh"))
obj.data.BIMMeshProperties.ifc_definition_id = representation.id()
assert subject.get_object_context(obj) == context
assert subject.get_representation_context(representation) == context
class TestIsOpeningElement(NewFile):