def test_importing_a_telecom_address(self): ifc = ifcopenshell.file() tool.Ifc().set(ifc) address = ifc.createIfcTelecomAddress() address.Purpose = "USERDEFINED" address.Description = "Description" address.UserDefinedPurpose = "UserDefinedPurpose" address.TelephoneNumbers = ["Telephone", "Numbers"] address.FacsimileNumbers = ["Facsimile", "Numbers"] address.PagerNumber = "PagerNumber" address.ElectronicMailAddresses = ["Electronic", "Mail", "Addresses"] address.WWWHomePageURL = "WWWHomePageURL" address.MessagingIDs = ["Messaging", "IDs"] subject().set_address(address) subject().import_address_attributes() props = bpy.context.scene.BIMOwnerProperties assert props.address_attributes.get( "Purpose").enum_value == "USERDEFINED" assert props.address_attributes.get( "Description").string_value == "Description" assert props.address_attributes.get( "UserDefinedPurpose").string_value == "UserDefinedPurpose" assert [a.name for a in props.telephone_numbers] == ["Telephone", "Numbers"] assert [a.name for a in props.facsimile_numbers] == ["Facsimile", "Numbers"] assert [a.name for a in props.electronic_mail_addresses ] == ["Electronic", "Mail", "Addresses"] assert [a.name for a in props.messaging_ids] == ["Messaging", "IDs"]
def test_getting_empty_list_attributes_as_none(self): ifc = ifcopenshell.file() tool.Ifc().set(ifc) result = subject().export_person_attributes() assert result["MiddleNames"] is None assert result["PrefixTitles"] is None assert result["SuffixTitles"] is None
def test_run(self): ifc = ifcopenshell.file() tool.Ifc().set(ifc) person = ifc.createIfcPerson() person.Identification = "identification" person.GivenName = "given_name" person.FamilyName = "family_name" person.MiddleNames = ("middle", "names") person.PrefixTitles = ("prefix", "titles") person.SuffixTitles = ("suffix", "titles") subject().set_person(person) subject().import_person_attributes() props = bpy.context.scene.BIMOwnerProperties assert props.person_attributes.get( "Identification").string_value == "identification" assert props.person_attributes.get( "GivenName").string_value == "given_name" assert props.person_attributes.get( "FamilyName").string_value == "family_name" assert len(props.middle_names) == 2 assert props.middle_names[0].name == "middle" assert props.middle_names[1].name == "names" assert len(props.prefix_titles) == 2 assert props.prefix_titles[0].name == "prefix" assert props.prefix_titles[1].name == "titles" assert len(props.suffix_titles) == 2 assert props.suffix_titles[0].name == "suffix" assert props.suffix_titles[1].name == "titles"
def test_run(self): ifc = ifcopenshell.file() tool.Ifc().set(ifc) element = ifc.createIfcDuctSegment() port = ifc.createIfcDistributionPort() ifcopenshell.api.run("system.assign_port", ifc, element=element, port=port) subject.get_ports(element) == [port]
def test_run(self): ifc = ifcopenshell.file() tool.Ifc().set(ifc) obj = bpy.data.objects.new("Object", None) element = ifc.createIfcWall() tool.Ifc.link(element, obj) obj = subject.create_empty_at_cursor_with_element_orientation(element) assert obj.matrix_world == bpy.context.scene.cursor.matrix
def test_run(self): ifc = ifcopenshell.file() tool.Ifc().set(ifc) obj = bpy.data.objects.new("Object", None) element = ifc.createIfcWall() tool.Ifc.link(element, obj) subject.delete_element_objects([element]) assert not bpy.data.objects.get("Object")
def test_run(self): ifc = ifcopenshell.file() tool.Ifc().set(ifc) element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcPump") obj = bpy.data.objects.new("Object", None) bpy.context.scene.collection.objects.link(obj) tool.Ifc.link(element, obj) subject.select_elements([element]) assert obj in bpy.context.selected_objects
def test_importing_a_postal_address_twice(self): self.test_importing_a_postal_address() ifc = tool.Ifc().get() address = ifc.createIfcPostalAddress() address.Purpose = "OFFICE" subject().set_address(address) subject().import_address_attributes() props = bpy.context.scene.BIMOwnerProperties assert props.address_attributes.get("Purpose").enum_value == "OFFICE" assert len(props.address_lines) == 0
def test_importing_twice(self): ifc = ifcopenshell.file() tool.Ifc().set(ifc) role = ifc.createIfcActorRole() role.Role = "USERDEFINED" subject().set_role(role) subject().import_role_attributes() role.Role = "ARCHITECT" subject().import_role_attributes() props = bpy.context.scene.BIMOwnerProperties assert props.role_attributes.get("Role").enum_value == "ARCHITECT"
def test_run(self): ifc = ifcopenshell.file() tool.Ifc().set(ifc) system = ifc.createIfcDistributionSystem() zone = ifc.createIfcZone() subject.import_systems() props = bpy.context.scene.BIMSystemProperties assert len(props.systems) == 1 assert props.systems[0].ifc_definition_id == system.id() assert props.systems[0].name == "Unnamed" assert props.systems[0].ifc_class == "IfcDistributionSystem"
def test_run(self): ifc = ifcopenshell.api.run("project.create_file") ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcProject") ifcopenshell.api.run("unit.assign_unit", ifc) tool.Ifc().set(ifc) port = ifc.createIfcDistributionPort() subject.load_ports([port]) obj = tool.Ifc.get_object(port) assert obj assert obj.users_collection assert list(obj.location) == [0, 0, 0]
def test_run(self): ifc = ifcopenshell.file() tool.Ifc().set(ifc) element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcPump") system = ifcopenshell.api.run("system.add_system", ifc, ifc_class="IfcSystem") ifcopenshell.api.run("system.assign_system", ifc, product=element, system=system) obj = bpy.data.objects.new("Object", None) bpy.context.scene.collection.objects.link(obj) tool.Ifc.link(element, obj) subject.select_system_products(system) assert obj in bpy.context.selected_objects
def test_importing_a_telecom_address_twice(self): self.test_importing_a_telecom_address() ifc = tool.Ifc().get() address = ifc.createIfcTelecomAddress() address.Purpose = "OFFICE" subject().set_address(address) subject().import_address_attributes() props = bpy.context.scene.BIMOwnerProperties assert props.address_attributes.get("Purpose").enum_value == "OFFICE" assert len(props.telephone_numbers) == 0 assert len(props.facsimile_numbers) == 0 assert len(props.electronic_mail_addresses) == 0 assert len(props.messaging_ids) == 0
def test_run(self): ifc = ifcopenshell.file() tool.Ifc().set(ifc) role = ifc.createIfcActorRole() role.Role = "USERDEFINED" role.UserDefinedRole = "UserDefinedRole" role.Description = "Description" subject().set_role(role) subject().import_role_attributes() assert subject().export_role_attributes() == { "Role": "USERDEFINED", "UserDefinedRole": "UserDefinedRole", "Description": "Description", }
def test_importing_a_system(self): ifc = ifcopenshell.file() tool.Ifc().set(ifc) system = ifc.createIfcSystem() system.GlobalId = "GlobalId" system.Name = "Name" system.Description = "Description" system.ObjectType = "ObjectType" subject().import_system_attributes(system) props = bpy.context.scene.BIMSystemProperties assert props.system_attributes.get("GlobalId").string_value == "GlobalId" assert props.system_attributes.get("Name").string_value == "Name" assert props.system_attributes.get("Description").string_value == "Description" assert props.system_attributes.get("ObjectType").string_value == "ObjectType"
def test_run(self): ifc = ifcopenshell.file() tool.Ifc().set(ifc) role = ifc.createIfcActorRole() role.Role = "USERDEFINED" role.UserDefinedRole = "UserDefinedRole" role.Description = "Description" subject().set_role(role) subject().import_role_attributes() props = bpy.context.scene.BIMOwnerProperties assert props.role_attributes.get("Role").enum_value == "USERDEFINED" assert props.role_attributes.get( "UserDefinedRole").string_value == "UserDefinedRole" assert props.role_attributes.get( "Description").string_value == "Description"
def test_overwriting_a_previous_import(self): ifc = ifcopenshell.file() tool.Ifc().set(ifc) person = ifc.createIfcPerson() person.Identification = "identification" person.GivenName = "given_name" subject().set_person(person) subject().import_person_attributes() person.Identification = "identification2" person.GivenName = None subject().import_person_attributes() props = bpy.context.scene.BIMOwnerProperties assert props.person_attributes.get( "Identification").string_value == "identification2" assert props.person_attributes.get("GivenName").string_value == ""
def test_run(self): ifc = ifcopenshell.file() tool.Ifc().set(ifc) organisation = ifc.createIfcOrganization() organisation.Identification = "Identification" organisation.Name = "Name" organisation.Description = "Description" subject().set_organisation(organisation) subject().import_organisation_attributes() props = bpy.context.scene.BIMOwnerProperties assert props.organisation_attributes.get( "Identification").string_value == "Identification" assert props.organisation_attributes.get("Name").string_value == "Name" assert props.organisation_attributes.get( "Description").string_value == "Description"
def test_importing_an_actor(self): ifc = ifcopenshell.file() tool.Ifc().set(ifc) actor = ifc.createIfcActor() actor.GlobalId = "GlobalId" actor.Name = "Name" actor.Description = "Description" actor.ObjectType = "ObjectType" subject.set_actor(actor) subject.import_actor_attributes(actor) props = bpy.context.scene.BIMOwnerProperties assert props.actor_attributes.get( "GlobalId").string_value == "GlobalId" assert props.actor_attributes.get("Name").string_value == "Name" assert props.actor_attributes.get( "Description").string_value == "Description" assert props.actor_attributes.get( "ObjectType").string_value == "ObjectType"
def test_run(self): ifc = ifcopenshell.file() tool.Ifc().set(ifc) person = ifc.createIfcPerson() person.Identification = "identification" person.GivenName = "given_name" person.FamilyName = "family_name" person.MiddleNames = ("middle", "names") person.PrefixTitles = ("prefix", "titles") person.SuffixTitles = ("suffix", "titles") subject().set_person(person) subject().import_person_attributes() assert subject().export_person_attributes() == { "Identification": "identification", "GivenName": "given_name", "FamilyName": "family_name", "MiddleNames": ["middle", "names"], "PrefixTitles": ["prefix", "titles"], "SuffixTitles": ["suffix", "titles"], }
def test_importing_a_postal_address(self): ifc = ifcopenshell.file() tool.Ifc().set(ifc) address = ifc.createIfcPostalAddress() address.Purpose = "USERDEFINED" address.Description = "Description" address.UserDefinedPurpose = "UserDefinedPurpose" address.InternalLocation = "InternalLocation" address.AddressLines = ["Address", "Lines"] address.PostalBox = "PostalBox" address.Town = "Town" address.Region = "Region" address.PostalCode = "PostalCode" address.Country = "Country" subject().set_address(address) subject().import_address_attributes() props = bpy.context.scene.BIMOwnerProperties assert props.address_attributes.get( "Purpose").enum_value == "USERDEFINED" assert props.address_attributes.get( "Description").string_value == "Description" assert props.address_attributes.get( "UserDefinedPurpose").string_value == "UserDefinedPurpose" assert props.address_attributes.get( "InternalLocation").string_value == "InternalLocation" assert props.address_attributes.get( "PostalBox").string_value == "PostalBox" assert props.address_attributes.get("Town").string_value == "Town" assert props.address_attributes.get("Region").string_value == "Region" assert props.address_attributes.get( "PostalCode").string_value == "PostalCode" assert props.address_attributes.get( "Country").string_value == "Country" assert len(props.address_lines) == 2 assert props.address_lines[0].name == "Address" assert props.address_lines[1].name == "Lines"
def get_address(cls): return tool.Ifc().get().by_id( bpy.context.scene.BIMOwnerProperties.active_address_id)
def get_organisation(cls): return tool.Ifc().get().by_id( bpy.context.scene.BIMOwnerProperties.active_organisation_id)
def test_run(self): ifc = ifcopenshell.file() tool.Ifc().set(ifc) system = ifcopenshell.api.run("system.add_system", ifc, ifc_class="IfcSystem") subject.set_active_system(system) assert bpy.context.scene.BIMSystemProperties.active_system_id == system.id()
def get_role(cls): return tool.Ifc().get().by_id( bpy.context.scene.BIMOwnerProperties.active_role_id)
def test_run(self): ifc = ifcopenshell.file() tool.Ifc().set(ifc) role = ifc.createIfcActorRole() subject().set_role(role) assert subject().get_role() == role
def test_run(self): ifc = ifcopenshell.file() tool.Ifc().set(ifc) actor = ifc.createIfcActor() subject().set_actor(actor) assert subject().get_actor() == actor
def test_run(self): ifc = ifcopenshell.file() tool.Ifc().set(ifc) address = ifc.createIfcPostalAddress() subject().set_address(address) assert subject().get_address() == address
def test_run(self): ifc = ifcopenshell.file() tool.Ifc().set(ifc) organisation = ifc.createIfcOrganization() subject().set_organisation(organisation) assert subject().get_organisation() == organisation
def test_run(self): ifc = ifcopenshell.file() tool.Ifc().set(ifc) person = ifc.createIfcPerson() subject().set_person(person) assert subject().get_person() == person