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
@@ -1,10 +1,11 @@
import ifcopenshell
import ifcopenshell.api
class Usecase:
def __init__(self, file, **settings):
self.file = file
self.settings = {"product": None, "Name": None}
self.settings = {"product": None, "name": None}
for key, value in settings.items():
self.settings[key] = value
@@ -13,18 +14,18 @@ class Usecase:
for rel in self.settings["product"].IsDefinedBy or []:
if (
rel.is_a("IfcRelDefinesByProperties")
and rel.RelatingPropertyDefinition.Name == self.settings["Name"]
and rel.RelatingPropertyDefinition.Name == self.settings["name"]
):
return rel.RelatingPropertyDefinition
qto = self.file.create_entity(
"IfcElementQuantity", **{"GlobalId": ifcopenshell.guid.new(), "Name": self.settings["Name"]}
"IfcElementQuantity", **{"GlobalId": ifcopenshell.guid.new(), "Name": self.settings["name"]}
)
self.file.create_entity(
"IfcRelDefinesByProperties",
**{
"GlobalId": ifcopenshell.guid.new(),
# TODO: owner history
"OwnerHistory": ifcopenshell.api.run("owner.create_owner_history", self.file),
"RelatedObjects": [self.settings["product"]],
"RelatingPropertyDefinition": qto,
}