Application data in IFC now reflects the latest IFC version tag

This commit is contained in:
Dion Moult
2021-10-01 10:10:45 +10:00
parent 42d321d553
commit 8bcec29429
5 changed files with 76 additions and 40 deletions
@@ -15,17 +15,14 @@ class Usecase:
if getattr(self.settings["context"], "ParentContext", None):
new = self.settings["context"].ParentContext
for inverse in self.file.get_inverse(self.settings["context"]):
ifcopenshell.util.element.replace_attribute(inverse, self.settings["context"], new)
representations_in_context = self.settings["context"].RepresentationsInContext
has_coordinate_operation = []
if self.settings["context"].is_a("IfcGeometricRepresentationSubContext"):
has_coordinate_operation = self.settings["context"].HasCoordinateOperation
self.file.remove(self.settings["context"])
for element in representations_in_context:
ifcopenshell.api.run("geometry.remove_representation", self.file, representation=element)
for element in has_coordinate_operation:
ifcopenshell.util.element.remove_deep(self.file, element)
if inverse.is_a("IfcCoordinateOperation"):
inverse.SourceCRS = inverse.TargetCRS
ifcopenshell.util.element.remove_deep(self.file, inverse)
else:
ifcopenshell.util.element.replace_attribute(inverse, self.settings["context"], new)
self.file.remove(self.settings["context"])
else:
representations_in_context = self.settings["context"].RepresentationsInContext
self.file.remove(self.settings["context"])
for element in representations_in_context:
ifcopenshell.api.run("geometry.remove_representation", self.file, representation=element)
@@ -6,7 +6,7 @@ class Usecase:
self.file = file
self.settings = {
"application_developer": None,
"version": "0.6.0",
"version": ifcopenshell.version,
"application_full_name": "IfcOpenShell",
"application_identifier": "IfcOpenShell",
}
@@ -27,11 +27,11 @@ class Usecase:
)
def create_application_organisation(self):
return self.file.create_entity(
result = self.file.create_entity(
"IfcOrganization",
**{
"Name": "IfcOpenShell",
"Description": "IfcOpenShell is an open source (LGPL) software library that helps users and software developers to work with the IFC file format.",
"Description": "IfcOpenShell is an open source software library that helps users and software developers to work with IFC data.",
"Roles": [
self.file.create_entity("IfcActorRole", **{"Role": "USERDEFINED", "UserDefinedRole": "CONTRIBUTOR"})
],
@@ -41,28 +41,11 @@ class Usecase:
**{
"Purpose": "USERDEFINED",
"UserDefinedPurpose": "WEBPAGE",
"Description": "The main webpage of the software collection.",
"WWWHomePageURL": "https://ifcopenshell.org",
},
),
self.file.create_entity(
"IfcTelecomAddress",
**{
"Purpose": "USERDEFINED",
"UserDefinedPurpose": "WEBPAGE",
"Description": "The BlenderBIM Add-on webpage of the software collection.",
"WWWHomePageURL": "https://blenderbim.org",
},
),
self.file.create_entity(
"IfcTelecomAddress",
**{
"Purpose": "USERDEFINED",
"UserDefinedPurpose": "REPOSITORY",
"Description": "The source code repository of the software collection.",
"WWWHomePageURL": "https://github.com/IfcOpenShell/IfcOpenShell.git",
},
),
],
},
)
result[0] = "IfcOpenShell"
return result