diff --git a/src/ifccityjson/README.md b/src/ifccityjson/README.md index 5bca24f4bd..58fb62bf31 100644 --- a/src/ifccityjson/README.md +++ b/src/ifccityjson/README.md @@ -1,35 +1,4 @@ # IFCCityJSON -Converter for CityJSON files and IFC. Currently only supports one-way conversion from CityJSON to IFC. -## Dependencies -- [IfcOpenShell](https://github.com/IfcOpenShell/IfcOpenShell) (also IfcOpenShell api is needed) -- [CJIO](https://github.com/cityjson/cjio) (>=0.8, <1.0) - -## Usage of IFCCityJSON -An extended ifccityjson tutorial can be found on [the OSARCH wiki](https://wiki.osarch.org/index.php?title=Ifccityjson) -Following command will execute a conversion from CityJSON to IFC - - python ifccityjson.py [-i input file] [-o output file] [-n name of identification attribute] - -The example file that could be used is example/3D_BAG_example.json - - python ifccityjson.py -i example/3DBAG_example.json -o example/3DBAG_example.ifc -n identificatie - -## Implemented geometries -- [x] "MultiPoint" -- [x] "MultiLineString" -- [x] "MultiSurface" -- [x] "CompositeSurface" -- [x] "Solid": exterior shell -- [ ] "Solid": interior shell -- [x] "MultiSolid" -- [x] "CompositeSolid" -- [ ] "GeometryInstance" - -## TODO -- [x] CityJSON Attributes as IFC properties in 'CityJSON_attributes' pset -- [x] Implement georeferencing -- [x] Do not use template IFC for new IFC file, but make IFC file from scratch -- [x] Create mapping to IFC for all CityJSON object types & semantic surfaces -- [ ] Implement conversion of all CitYJSON geometries -- [x] Implement conversion of all LODs instead of only the most detailed +IfcCityJSON is a converter for CityJSON files and IFC. It currently only +supports one-way conversion from CityJSON to IFC. diff --git a/src/ifccityjson/ifccityjson/ifccityjson.py b/src/ifccityjson/ifccityjson/__main__.py similarity index 97% rename from src/ifccityjson/ifccityjson/ifccityjson.py rename to src/ifccityjson/ifccityjson/__main__.py index 562c2dc7e0..90361bb894 100644 --- a/src/ifccityjson/ifccityjson/ifccityjson.py +++ b/src/ifccityjson/ifccityjson/__main__.py @@ -18,7 +18,7 @@ import argparse from cjio import cityjson -from cityjson2ifc.cityjson2ifc import Cityjson2ifc +from .cityjson2ifc import Cityjson2ifc def cmdline(): # Example: @@ -51,4 +51,4 @@ def cmdline(): converter.convert(city_model) if __name__ == '__main__': - cmdline() \ No newline at end of file + cmdline() diff --git a/src/ifccityjson/ifccityjson/cityjson2ifc/cityjson2ifc.py b/src/ifccityjson/ifccityjson/cityjson2ifc/cityjson2ifc.py index d1344aa65d..7200ec9d7e 100644 --- a/src/ifccityjson/ifccityjson/cityjson2ifc/cityjson2ifc.py +++ b/src/ifccityjson/ifccityjson/cityjson2ifc/cityjson2ifc.py @@ -146,7 +146,7 @@ class Cityjson2ifc: # Georeferencing self.properties["local_translation"] = None self.properties["local_scale"] = None - if not self.city_model.is_transformed: + if self.city_model.is_transformed: self.properties["local_scale"] = self.city_model.transform["scale"] local_translation = self.city_model.transform["translate"] self.properties["local_translation"] = { diff --git a/src/ifcopenshell-python/docs/ifccityjson.rst b/src/ifcopenshell-python/docs/ifccityjson.rst index df4c7a209b..a5b968aaf5 100644 --- a/src/ifcopenshell-python/docs/ifccityjson.rst +++ b/src/ifcopenshell-python/docs/ifccityjson.rst @@ -3,3 +3,62 @@ IfcCityJSON IfcCityJSON is a converter for CityJSON files and IFC. It currently only supports one-way conversion from CityJSON to IFC. + +Source installation +------------------- + +1. :doc:`Install IfcOpenShell ` +2. `Clone the source code `_. +3. ``cd /path/to/IfcOpenShell/src/ifccityjson`` +4. ``pip install .`` + +Usage +----- + +An extended ifccityjson tutorial can be found on `the OSARCH wiki +`_. Here's the built-in +documentation: + +.. code-block:: console + + $ python -m ifccityjson -h + + usage: __main__.py [-h] -i INPUT [-o OUTPUT] [-n NAME] [--split-lod] [--no-split-lod] [--lod LOD] + + options: + -h, --help show this help message and exit + -i INPUT, --input INPUT + input CityJSON file + -o OUTPUT, --output OUTPUT + output IFC file. Standard is output.ifc + -n NAME, --name NAME Attribute containing the name + --split-lod Split the file in multiple LoDs + --no-split-lod Do not split the file in multiple LoDs + --lod LOD extract LOD value (example: 1.2) + +The example file that could be used is example/3D_BAG_example.json + +.. code-block:: console + + python ifccityjson.py -i example/geometries.json -o output.ifc -n identificatie + +The following geometries are implemented: + +- [x] "MultiPoint" +- [x] "MultiLineString" +- [x] "MultiSurface" +- [x] "CompositeSurface" +- [x] "Solid": exterior shell +- [ ] "Solid": interior shell +- [x] "MultiSolid" +- [x] "CompositeSolid" +- [ ] "GeometryInstance" + +TODO: + +- [x] CityJSON Attributes as IFC properties in 'CityJSON_attributes' pset +- [x] Implement georeferencing +- [x] Do not use template IFC for new IFC file, but make IFC file from scratch +- [x] Create mapping to IFC for all CityJSON object types & semantic surfaces +- [ ] Implement conversion of all CitYJSON geometries +- [x] Implement conversion of all LODs instead of only the most detailed