mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 10:33:20 +00:00
Fix #1462. Standardise IfcOpenShell API to use Pythonic argument names.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user