mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 18:21:59 +00:00
Fix #1547.
This commit is contained in:
@@ -141,14 +141,12 @@ def get_application(ifc):
|
|||||||
for element in ifc.by_type("IfcApplication"):
|
for element in ifc.by_type("IfcApplication"):
|
||||||
if element.ApplicationIdentifier == "BlenderBIM" and element.Version == version:
|
if element.ApplicationIdentifier == "BlenderBIM" and element.Version == version:
|
||||||
return element
|
return element
|
||||||
return ifc.create_entity(
|
return ifcopenshell.api.run(
|
||||||
"IfcApplication",
|
"owner.add_application",
|
||||||
**{
|
ifc,
|
||||||
"ApplicationDeveloper": create_application_organisation(ifc),
|
version=get_application_version(),
|
||||||
"Version": get_application_version(),
|
application_full_name="BlenderBIM Add-on",
|
||||||
"ApplicationFullName": "BlenderBIM Add-on",
|
application_identifier="BlenderBIM",
|
||||||
"ApplicationIdentifier": "BlenderBIM",
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -165,46 +163,6 @@ def get_application_version():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def create_application_organisation(ifc):
|
|
||||||
return ifc.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.",
|
|
||||||
"Roles": [ifc.create_entity("IfcActorRole", **{"Role": "USERDEFINED", "UserDefinedRole": "CONTRIBUTOR"})],
|
|
||||||
"Addresses": [
|
|
||||||
ifc.create_entity(
|
|
||||||
"IfcTelecomAddress",
|
|
||||||
**{
|
|
||||||
"Purpose": "USERDEFINED",
|
|
||||||
"UserDefinedPurpose": "WEBPAGE",
|
|
||||||
"Description": "The main webpage of the software collection.",
|
|
||||||
"WWWHomePageURL": "https://ifcopenshell.org",
|
|
||||||
},
|
|
||||||
),
|
|
||||||
ifc.create_entity(
|
|
||||||
"IfcTelecomAddress",
|
|
||||||
**{
|
|
||||||
"Purpose": "USERDEFINED",
|
|
||||||
"UserDefinedPurpose": "WEBPAGE",
|
|
||||||
"Description": "The BlenderBIM Add-on webpage of the software collection.",
|
|
||||||
"WWWHomePageURL": "https://blenderbim.org",
|
|
||||||
},
|
|
||||||
),
|
|
||||||
ifc.create_entity(
|
|
||||||
"IfcTelecomAddress",
|
|
||||||
**{
|
|
||||||
"Purpose": "USERDEFINED",
|
|
||||||
"UserDefinedPurpose": "REPOSITORY",
|
|
||||||
"Description": "The source code repository of the software collection.",
|
|
||||||
"WWWHomePageURL": "https://github.com/IfcOpenShell/IfcOpenShell.git",
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@persistent
|
@persistent
|
||||||
def setDefaultProperties(scene):
|
def setDefaultProperties(scene):
|
||||||
global global_subscription_owner
|
global global_subscription_owner
|
||||||
|
|||||||
@@ -1,9 +1,68 @@
|
|||||||
|
import ifcopenshell.api
|
||||||
|
|
||||||
|
|
||||||
class Usecase:
|
class Usecase:
|
||||||
def __init__(self, file, **settings):
|
def __init__(self, file, **settings):
|
||||||
self.file = file
|
self.file = file
|
||||||
self.settings = {"attributes": None}
|
self.settings = {
|
||||||
|
"application_developer": None,
|
||||||
|
"version": "0.6.0",
|
||||||
|
"application_full_name": "IfcOpenShell",
|
||||||
|
"application_identifier": "IfcOpenShell",
|
||||||
|
}
|
||||||
for key, value in settings.items():
|
for key, value in settings.items():
|
||||||
self.settings[key] = value
|
self.settings[key] = value
|
||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
return self.file.create_entity("IfcApplication", **self.settings["attributes"])
|
if not self.settings["application_developer"]:
|
||||||
|
self.settings["application_developer"] = self.create_application_organisation()
|
||||||
|
return self.file.create_entity(
|
||||||
|
"IfcApplication",
|
||||||
|
**{
|
||||||
|
"ApplicationDeveloper": self.settings["application_developer"],
|
||||||
|
"Version": self.settings["version"],
|
||||||
|
"ApplicationFullName": self.settings["application_full_name"],
|
||||||
|
"ApplicationIdentifier": self.settings["application_identifier"],
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
def create_application_organisation(self):
|
||||||
|
return 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.",
|
||||||
|
"Roles": [
|
||||||
|
self.file.create_entity("IfcActorRole", **{"Role": "USERDEFINED", "UserDefinedRole": "CONTRIBUTOR"})
|
||||||
|
],
|
||||||
|
"Addresses": [
|
||||||
|
self.file.create_entity(
|
||||||
|
"IfcTelecomAddress",
|
||||||
|
**{
|
||||||
|
"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",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|||||||
@@ -2,12 +2,15 @@
|
|||||||
|
|
||||||
|
|
||||||
def get_person(ifc):
|
def get_person(ifc):
|
||||||
return ifc.by_type("IfcPerson")[0]
|
people = ifc.by_type("IfcPerson") or [None]
|
||||||
|
return people [0]
|
||||||
|
|
||||||
|
|
||||||
def get_organisation(ifc):
|
def get_organisation(ifc):
|
||||||
return ifc.by_type("IfcOrganization")[0]
|
organisations = ifc.by_type("IfcOrganization") or [None]
|
||||||
|
return organisations[0]
|
||||||
|
|
||||||
|
|
||||||
def get_application(ifc):
|
def get_application(ifc):
|
||||||
return ifc.by_type("IfcApplication")[0]
|
applications = ifc.by_type("IfcApplication") or [None]
|
||||||
|
return applications[0]
|
||||||
|
|||||||
Reference in New Issue
Block a user