Skip to content

Commit 5ad7d4b

Browse files
balazsdukaiMoult
authored andcommitted
Update to ifcopenshell 0.7.0 and cjio 0.8
LoD is string in v1.1
1 parent 3803942 commit 5ad7d4b

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/ifccityjson/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Converter for CityJSON files and IFC. Currently only supports one-way conversion
33

44
## Dependencies
55
- [IfcOpenShell](https://github.com/IfcOpenShell/IfcOpenShell) (also IfcOpenShell api is needed)
6-
- [CJIO](https://github.com/cityjson/cjio)
6+
- [CJIO](https://github.com/cityjson/cjio) (>=0.8, <1.0)
77

88
## Usage of IFCCityJSON
99
An extended ifccityjson tutorial can be found on [the OSARCH wiki](https://wiki.osarch.org/index.php?title=Ifccityjson)

src/ifccityjson/cityjson2ifc/cityjson2ifc.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"SolitaryVegetationObject": ["IfcGeographicElement", {"PredefinedType": "USERDEFINED",
4646
"ObjectType": "SolitaryVegetationObject"}],
4747
"CityFurniture": ["IfcFurnishingElement"],
48-
"GenericCityObject": ["IfcCivilElement"],
48+
"OtherConstruction": ["IfcCivilElement"],
4949
"Bridge": ["IfcCivilElement"], # Update for IFC4.3
5050
"BridgePart": ["IfcCivilElement"], # Update for IFC4.3
5151
"BridgeInstallation": ["IfcCivilElement"], # Update for IFC4.3
@@ -118,9 +118,9 @@ def create_metadata(self):
118118
# Georeferencing
119119
self.properties["local_translation"] = None
120120
self.properties["local_scale"] = None
121-
if self.city_model.is_transform():
122-
self.properties["local_scale"] = self.city_model.j['transform']['scale']
123-
local_translation = self.city_model.j['transform']['translate']
121+
if not self.city_model.is_transformed:
122+
self.properties["local_scale"] = self.city_model.transform['scale']
123+
local_translation = self.city_model.transform['translate']
124124
self.properties["local_translation"] = {
125125
"Eastings": local_translation[0],
126126
"Northings": local_translation[1],
@@ -141,7 +141,7 @@ def create_new_file(self):
141141
ifcopenshell.api.run("unit.assign_unit", self.IFC_model, length={"is_metric": True, "raw": "METERS"})
142142
self.properties["owner_history"] = self.create_owner_history()
143143
self.IFC_representation_context = ifcopenshell.api.run("context.add_context", self.IFC_model,
144-
**{"context": "Model"})
144+
**{"context_type": "Model"})
145145

146146
if not self.city_model.has_metadata() or "presentLoDs" not in self.city_model.j["metadata"]:
147147
self.city_model.update_metadata()
@@ -174,7 +174,7 @@ def create_representation_sub_context(self, lod):
174174
"ContextIdentifier": "Body",
175175
"TargetView": "USERDEFINED",
176176
"ParentContext": self.IFC_representation_context,
177-
"UserDefinedTargetView": "LOD" + str(lod)})
177+
"UserDefinedTargetView": "LOD" + lod})
178178

179179
def create_owner_history(self):
180180
actor = self.IFC_model.createIfcActorRole("ENGINEER", None, None)
@@ -246,10 +246,10 @@ def create_IFC_classes(self):
246246
IFC_shape_representations = []
247247
for geometry in obj.geometry:
248248
lod = geometry.lod
249-
if self.properties["lod"] is not None and str(lod) != self.properties["lod"]:
249+
if self.properties["lod"] is not None and lod != self.properties["lod"]:
250250
continue
251-
if str(lod) not in self.IFC_representation_sub_contexts:
252-
self.IFC_representation_sub_contexts[str(lod)] = self.create_representation_sub_context(lod)
251+
if lod not in self.IFC_representation_sub_contexts:
252+
self.IFC_representation_sub_contexts[lod] = self.create_representation_sub_context(lod)
253253

254254
IFC_geometry, shape_representation_type = None, None
255255

@@ -325,7 +325,7 @@ def create_IFC_shape_representation(self, IFC_geometry, shape_representation_typ
325325
IFC_geometry = [IFC_geometry]
326326

327327
shape_representation = self.IFC_model.create_entity("IfcShapeRepresentation",
328-
self.IFC_representation_sub_contexts[str(lod)], 'Body',
328+
self.IFC_representation_sub_contexts[lod], 'Body',
329329
shape_representation_type,
330330
IFC_geometry)
331331
return shape_representation

0 commit comments

Comments
 (0)