Skip to content

Commit 24ea024

Browse files
balazsdukaiaothms
authored andcommitted
Add parameters
1 parent e90d7cc commit 24ea024

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

src/ifccityjson/ifccityjson/cityjson2ifc/cityjson2ifc.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,17 @@ def __init__(self):
9292
self.geometry = GeometryIO()
9393
self.configuration()
9494

95-
def configuration(self, file_destination="output.ifc", name_attribute=None, split=True, lod=None):
95+
def configuration(self, file_destination="output.ifc", name_attribute=None,
96+
split=True, lod=None, name_project=None, name_site=None,
97+
name_person_family=None, name_person_given=None):
9698
self.properties["file_destination"], self.properties["file_extension"] = os.path.splitext(file_destination)
9799
self.properties["name_attribute"] = name_attribute
98100
self.properties["split"] = split
99101
self.properties["lod"] = lod
102+
self.properties["name_project"] = name_project
103+
self.properties["name_site"] = name_site
104+
self.properties["name_person_family"] = name_person_family
105+
self.properties["name_person_given"] = name_person_given
100106

101107
def convert(self, city_model):
102108
self.city_model = city_model
@@ -138,7 +144,7 @@ def create_metadata(self):
138144

139145
def create_new_file(self):
140146
self.IFC_model = ifcopenshell.api.run("project.create_file")
141-
self.IFC_project = ifcopenshell.api.run("root.create_entity", self.IFC_model, **{"ifc_class": "IfcProject", "name": "My Project"})
147+
self.IFC_project = ifcopenshell.api.run("root.create_entity", self.IFC_model, **{"ifc_class": "IfcProject", "name": self.properties.get("name_project", "My Project")})
142148
ifcopenshell.api.run("unit.assign_unit", self.IFC_model, length={"is_metric": True, "raw": "METERS"})
143149
self.properties["owner_history"] = self.create_owner_history()
144150
self.IFC_representation_context = ifcopenshell.api.run("context.add_context", self.IFC_model,
@@ -152,7 +158,7 @@ def create_new_file(self):
152158

153159
self.IFC_site = ifcopenshell.api.run("root.create_entity", self.IFC_model,
154160
**{"ifc_class": "IfcSite",
155-
"name": "My Site"})
161+
"name": self.properties.get("name_site", "My Site")})
156162
self.IFC_model.create_entity("IfcRelAggregates",
157163
**{"GlobalId": ifcopenshell.guid.new(),
158164
"RelatedObjects": [self.IFC_site],
@@ -179,7 +185,10 @@ def create_representation_sub_context(self, lod):
179185

180186
def create_owner_history(self):
181187
actor = self.IFC_model.createIfcActorRole("ENGINEER", None, None)
182-
person = self.IFC_model.createIfcPerson("Oostwegel", None, "L.J.N.", None, None, None, (actor,))
188+
person = self.IFC_model.createIfcPerson(
189+
self.properties.get("name_person_family", "FamilyName"),
190+
self.properties.get("name_person_given", "GivenName"),
191+
None, None, None, None, (actor,))
183192
organization = self.IFC_model.createIfcOrganization(
184193
None,
185194
"IfcOpenShell",

0 commit comments

Comments
 (0)