Example #1
0
 def test_unlink_a_style_and_material(self):
     ifc = ifcopenshell.file()
     subject.set(ifc)
     style = ifc.createIfcSurfaceStyle()
     material = ifc.createIfcMaterial()
     obj = bpy.data.materials.new("Material")
     subject.link(style, obj)
     subject.link(material, obj)
     subject.unlink(element=style, obj=obj)
     assert subject.get_entity(obj) == material
     assert subject.get_object(material) == obj
     assert subject.get_object(style) is None
     subject.unlink(element=material, obj=obj)
     assert subject.get_entity(obj) is None
     assert subject.get_object(material) is None
Example #2
0
 def test_run(self):
     ifc = ifcopenshell.file()
     subject.set(ifc)
     obj = bpy.data.objects.new("Object", None)
     element = ifc.createIfcWall()
     obj.BIMObjectProperties.ifc_definition_id = element.id()
     assert subject.get_entity(obj) == element
Example #3
0
 def test_link_a_material(self):
     ifc = ifcopenshell.file()
     subject.set(ifc)
     element = ifc.createIfcMaterial()
     obj = bpy.data.materials.new("Material")
     subject.link(element, obj)
     assert subject.get_entity(obj) == element
     assert subject.get_object(element) == obj
Example #4
0
 def test_link_an_object(self):
     ifc = ifcopenshell.file()
     subject.set(ifc)
     element = ifc.createIfcWall()
     obj = bpy.data.objects.new("Object", None)
     subject.link(element, obj)
     assert subject.get_entity(obj) == element
     assert subject.get_object(element) == obj
Example #5
0
 def test_unlinking_using_an_element(self):
     ifc = ifcopenshell.file()
     subject.set(ifc)
     element = ifc.createIfcWall()
     obj = bpy.data.objects.new("Object", None)
     subject.link(element, obj)
     subject.unlink(element=element)
     assert subject.get_entity(obj) is None
     assert subject.get_object(element) is None
Example #6
0
 def test_attempting_to_get_an_invalidly_linked_object(self):
     ifc = ifcopenshell.file()
     subject.set(ifc)
     obj = bpy.data.objects.new("Object", None)
     obj.BIMObjectProperties.ifc_definition_id = 1
     assert subject.get_entity(obj) is None
Example #7
0
 def test_attempting_without_a_file(self):
     obj = bpy.data.objects.new("Object", None)
     obj.BIMObjectProperties.ifc_definition_id = 1
     assert subject.get_entity(obj) is None
Example #8
0
 def test_attempting_to_get_an_unlinked_object(self):
     obj = bpy.data.objects.new("Object", None)
     assert subject.get_entity(obj) is None