Fix #1462. Standardise IfcOpenShell API to use Pythonic argument names.

This commit is contained in:
Dion Moult
2021-05-28 10:59:20 +10:00
parent 0a2adbb632
commit 1cd243f13c
19 changed files with 119 additions and 114 deletions
@@ -2,14 +2,16 @@ class Usecase:
def __init__(self, file, **settings):
self.file = file
self.settings = {
"Identification": "APTR",
"Name": "Aperture Science",
"identification": "APTR",
"name": "Aperture Science",
}
for key, value in settings.items():
self.settings[key] = value
def execute(self):
if self.file.schema == "IFC2X3":
self.settings["Id"] = self.settings["Identification"]
del self.settings["Identification"]
return self.file.create_entity("IfcOrganization", **self.settings)
data = {"Name": self.settings["Name"]}
if self.file.schema == "IFC2X3":
data["Id"] = self.settings["identification"]
else:
data["Identification"] = self.settings["identification"]
return self.file.create_entity("IfcOrganization", **data)
@@ -2,15 +2,17 @@ class Usecase:
def __init__(self, file, **settings):
self.file = file
self.settings = {
"Identification": "HSeldon",
"FamilyName": "Seldon",
"GivenName": "Hari",
"identification": "HSeldon",
"family_name": "Seldon",
"given_name": "Hari",
}
for key, value in settings.items():
self.settings[key] = value
def execute(self):
if self.file.schema == "IFC2X3":
self.settings["Id"] = self.settings["Identification"]
del self.settings["Identification"]
return self.file.create_entity("IfcPerson", **self.settings)
data = {"FamilyName": self.settings["family_name"], "GivenName": self.settings["given_name"]}
if self.file.schema == "IFC2X3":
data["Id"] = self.settings["identification"]
else:
data["Identification"] = self.settings["identification"]
return self.file.create_entity("IfcPerson", **data)