diff --git a/src/ifccityjson/cityjson2ifc.py b/src/ifccityjson/cityjson2ifc.py index 1dbbeedc67..bdb10c8466 100644 --- a/src/ifccityjson/cityjson2ifc.py +++ b/src/ifccityjson/cityjson2ifc.py @@ -77,10 +77,11 @@ class Cityjson2ifc: self.geometry = GeometryIO() self.configuration() - def configuration(self, file_destination="output.ifc", name_attribute=None, split=True): + def configuration(self, file_destination="output.ifc", name_attribute=None, split=True, lod=None): self.properties["file_destination"], self.properties["file_extension"] = os.path.splitext(file_destination) self.properties["name_attribute"] = name_attribute self.properties["split"] = split + self.properties["lod"] = lod def convert(self, city_model): self.city_model = city_model @@ -92,7 +93,9 @@ class Cityjson2ifc: # scale=self.properties["local_scale"]) # self.build_vertices() self.create_IFC_classes() - if self.properties["split"]: + if self.properties["lod"]: + self.write_file() + elif self.properties["split"]: self.write_files() else: self.write_file() @@ -190,7 +193,6 @@ class Cityjson2ifc: IFC_copied_model = ifcopenshell.open(file) IFC_copied_model_sub_contexts = IFC_copied_model.by_type('IfcGeometricRepresentationSubContext') for sub_context in IFC_copied_model_sub_contexts: - print(sub_context) if sub_context.id() == sub_context_id: continue @@ -230,7 +232,7 @@ class Cityjson2ifc: IFC_shape_representations = [] for geometry in obj.geometry: lod = geometry.lod - if str(lod) != '1.3': # TODO: split LODS + if self.properties["lod"] is not None and str(lod) != self.properties["lod"]: continue if str(lod) not in self.IFC_representation_sub_contexts: self.IFC_representation_sub_contexts[str(lod)] = self.create_representation_sub_context(lod) diff --git a/src/ifccityjson/ifccityjson.py b/src/ifccityjson/ifccityjson.py index 704b400f1f..f567560d99 100644 --- a/src/ifccityjson/ifccityjson.py +++ b/src/ifccityjson/ifccityjson.py @@ -33,6 +33,7 @@ if __name__ == '__main__': help="Split the file in multiple LoDs") parser.add_argument('--no-split-lod', dest='split', action='store_false', help="Do not split the file in multiple LoDs") + parser.add_argument("--lod", type=str, help="extract LOD value (example: 1.2)") parser.set_defaults(split=True) args = parser.parse_args() @@ -42,6 +43,8 @@ if __name__ == '__main__': data["name_attribute"] = args.name if args.output: data["file_destination"] = args.output + if args.lod: + data["lod"] = args.lod data["split"] = args.split converter = Cityjson2ifc()