OSArch Community

[IfcOpenShell] Cityjson to IFC

  1. M

    This makes dutch NL 3DBAG data so much more usable! I think kadaster more or less forget to serve BIM. One thing catches my attention. It seems that the geo location is not stored in IFC. That can't be the case.. can it?? I am certainly not a ifc file spec specialist but this kind of crucial information should be stored IN ifc.

    Tile 4278

  2. M

    @LaurensJN [EDIT]

    RD notations in NL always contain 2x6 digits [m] in X & Y

    Epsg7415 IFC georeferencing, Shouldn't that be epsg:28992 ?

  3. L

    epsg:28992 is for Amersfoort / RD New.

    epsg:7415 is a compound coordinate system with Amersfoort / RD New + NAP height.

    See https://epsg.io/7415

  4. L

    @magicalcloud_75 said:

    This makes dutch NL 3DBAG data so much more usable! I think kadaster more or less forget to serve BIM. One thing catches my attention. It seems that the geo location is not stored in IFC. That can't be the case.. can it?? I am certainly not a ifc file spec specialist but this kind of crucial information should be stored IN ifc.

    Tile 4278

    I'm not exactly sure what you mean. It has the northings/eastings/OrthogonalHeight of the project center and an EPSG, do you need more?

  5. C

    This is so convenient, just a matter of clicking two or three buttons. What does the Identifier do by the way?

  6. L

    @Coen said:

    This is so convenient, just a matter of clicking two or three buttons. What does the Identifier do by the way?

    If you want the building to have a specified attribute as building/entity name instead of its CityJSON identifier, you could use that instead. If you take a look at the CityJSON_attributes pset under 'Object properties' --> 'IFC Object Property Sets', you could choose any of these properties. In the previous version of 3D BAG, the object ID was not the same as the BAG ID, so you would put 'identificatie' in the 'Identifier' to get the actual BAG ID. I didn't really test it thoroughly though, because the new 3D BAG identifier is the BAG ID anyway. Another use case would be for example if the building address is specified in the CityJSON file, you could use that instead of the BAG ID. This is right now not the case for the 3D BAG dataset but might be useful for similar datasets in other countries?

  7. M

    In Revit the ifcRoof become 'walls' after Blender conversion to IFC

    In BricsCAD BIM no data result after importing.

  8. L

    If you are talking about the green selected spaces, this is classified as 'wall' in the CityJSON file, therefore is a wall in the IFC file. The 3D BAG is an automatically generated dataset based on LiDAR and 2D BAG data (thus vertical spaces are always walls, regardless where they are), so if you have any problems with wrong classifications you should ask those guys :)

  9. C

    Slightly related,

    Managed with the Blender-osm add-on and BlenderBIM add-on to export the city centre of Moscow to IFC.

  10. M

    @LaurensJN said:

    If you are talking about the green selected spaces, this is classified as 'wall' in the CityJSON file, therefore is a wall in the IFC file. The 3D BAG is an automatically generated dataset based on LiDAR and 2D BAG data (thus vertical spaces are always walls, regardless where they are), so if you have any problems with wrong classifications you should ask those guys :)

    I mean. "ifcroofs" are not shown. With the same data i can make ifc with FZKviewer that does show them after import. I'm not so into ifc what to ask them :) but i think this has something to do with how Blender writes down ifcroof... regards Hans

  11. C

    In Blender 3.1.0 with BlenderBIM version 0.0.220327 I get the following error after clicking Convert CityJSON to IFC:

    
    location: <unknown location>:-1
    
    Error: Python: Traceback (most recent call last):
    
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\3.1\scripts\addons\blenderbim\bim\module\gis\operator.py", line 44, in execute
    
        converter.convert(city_model)
    
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\3.1\scripts\addons\blenderbim\libs\site\packages\ifccityjson\cityjson2ifc\cityjson2ifc.py", line 87, in convert
    
        self.create_new_file()
    
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\3.1\scripts\addons\blenderbim\libs\site\packages\ifccityjson\cityjson2ifc\cityjson2ifc.py", line 132, in create_new_file
    
        self.city_model.update_metadata()
    
    AttributeError: 'CityJSON' object has no attribute 'update_metadata'. Did you mean: 'get_metadata'?
    
    
    location: <unknown location>:-1
    
    

    Should I make an IfcProject first? Do I have all the settings correct? Am I missing a step?

  12. C

    Is IfcCityJson still being maintained? I get the following message when I try to convert CityJson to IFC:

    I'm on the latest stable release of BlenderBIM with Blender 3.4.1

    
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\blenderbim\libs\site\packages\ifccityjson\cityjson2ifc\cityjson2ifc.py", line 128, in create_new_file
    
        self.IFC_representation_context = ifcopenshell.api.run("context.add_context", self.IFC_model,
    
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\blenderbim\libs\site\packages\ifcopenshell\api\__init__.py", line 66, in run
    
        result = usecase_class(ifc_file, **settings).execute()
    
    TypeError: Usecase.__init__() got an unexpected keyword argument 'context'
    
    Error: Python: Traceback (most recent call last):
    
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\blenderbim\bim\module\gis\operator.py", line 44, in execute
    
        converter.convert(city_model)
    
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\blenderbim\libs\site\packages\ifccityjson\cityjson2ifc\cityjson2ifc.py", line 87, in convert
    
        self.create_new_file()
    
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\blenderbim\libs\site\packages\ifccityjson\cityjson2ifc\cityjson2ifc.py", line 128, in create_new_file
    
        self.IFC_representation_context = ifcopenshell.api.run("context.add_context", self.IFC_model,
    
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\blenderbim\libs\site\packages\ifcopenshell\api\__init__.py", line 66, in run
    
        result = usecase_class(ifc_file, **settings).execute()
    
    TypeError: Usecase.__init__() got an unexpected keyword argument 'context'
    
    

    Which parameters should I provide?

  13. C

    I have the feeling this is not maintained anymore? Is there anything I can do to contribute?, this tool is so extremely useful.

  14. L

    Hi Coen, I am not maintaining this anymore no, sorry.

    I changed jobs & my focus is not on BIM anymore unfortunately. The error you get seems like an IfcOpenShell error? Probably because the version that IfcOpenShell that was used before had some other way of handling the context parameters. If you would like to we can do some debug session sometime & see if we could fix it? I think I can refresh my memory about CityJSON and if you know how to handle newer versions of IfcOpenShell, I'm sure we're going to get somewhere!

  15. C

    @LaurensJN said:

    Hi Coen, I am not maintaining this anymore no, sorry.

    That's unfortunate :-(

    I changed jobs & my focus is not on BIM anymore unfortunately. The error you get seems like an IfcOpenShell error? Probably because the version that IfcOpenShell that was used before had some other way of handling the context parameters. If you would like to we can do some debug session sometime & see if we could fix it? I think I can refresh my memory about CityJSON and if you know how to handle newer versions of IfcOpenShell, I'm sure we're going to get somewhere!

    Would be amazing, let's get in touch on some other private means of communication :-). I need to dive into IFC json a bit before I can ask you specific questions.

  16. C

    I tried diving into it, but I have no idea what I'm doing, I gives this message:

    
    Traceback (most recent call last):
    
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\blenderbim\bim\module\gis\operator.py", line 44, in execute
    
        converter.convert(city_model)
    
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\blenderbim\libs\site\packages\ifccityjson\cityjson2ifc\cityjson2ifc.py", line 87, in convert
    
        self.create_new_file()
    
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\blenderbim\libs\site\packages\ifccityjson\cityjson2ifc\cityjson2ifc.py", line 128, in create_new_file
    
        self.IFC_representation_context = ifcopenshell.api.run("context.add_context", self.IFC_model,
    
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\blenderbim\libs\site\packages\ifcopenshell\api\__init__.py", line 66, in run
    
        result = usecase_class(ifc_file, **settings).execute()
    
    TypeError: Usecase.__init__() got an unexpected keyword argument 'context'
    
    Error: Python: Traceback (most recent call last):
    
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\blenderbim\bim\module\gis\operator.py", line 44, in execute
    
        converter.convert(city_model)
    
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\blenderbim\libs\site\packages\ifccityjson\cityjson2ifc\cityjson2ifc.py", line 87, in convert
    
        self.create_new_file()
    
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\blenderbim\libs\site\packages\ifccityjson\cityjson2ifc\cityjson2ifc.py", line 128, in create_new_file
    
        self.IFC_representation_context = ifcopenshell.api.run("context.add_context", self.IFC_model,
    
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\3.4\scripts\addons\blenderbim\libs\site\packages\ifcopenshell\api\__init__.py", line 66, in run
    
        result = usecase_class(ifc_file, **settings).execute()
    
    TypeError: Usecase.__init__() got an unexpected keyword argument 'context'
    
    

    So I went to take a look at file blenderbim\libs\site\packages\ifccityjson\cityjson2ifc\cityjson2ifc.py on line 128:

    
            self.IFC_representation_context = ifcopenshell.api.run("context.add_context", self.IFC_model,
    
                                                                   **{"context": "Model"})
    

    Took a look in the documentation:

    https://blenderbim.org/docs-python/autoapi/ifcopenshell/api/context/add_context/index.html

    Asked chatGPT:

    Literally no idea what I should do to make IfcCityJson work

  17. L
  18. C

    @LaurensJN

    @pstrokap

    I this file on line 128

    C:\Users\cclaus\AppData\Roaming\BlenderFoundation\Blender\3.5\scripts\addons\blenderbim\libs\site\packages\ifccityjson\cityjson2ifc\cityjson2ifc.py

    I replaced

    #self.IFC_representation_context = ifcopenshell.api.run("context.add_context", self.IFC_model **{"context": "Model"})

    with

    self.IFC_representation_context = ifcopenshell.api.run("context.add_context", self.IFC_model, context_type="Model")

    Saved the script, started Blender again. Tried to convert cityJson to IFC again:

    Now I have another error which says:

    
    Traceback (most recent call last):
    
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\3.5\scripts\addons\blenderbim\bim\module\gis\operator.py", line 44, in execute
    
        converter.convert(city_model)
    
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\3.5\scripts\addons\blenderbim\libs\site\packages\ifccityjson\cityjson2ifc\cityjson2ifc.py", line 88, in convert
    
        self.create_metadata()
    
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\3.5\scripts\addons\blenderbim\libs\site\packages\ifccityjson\cityjson2ifc\cityjson2ifc.py", line 115, in create_metadata
    
        epsg = self.city_model.get_epsg()
    
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\3.5\scripts\addons\blenderbim\libs\site\packages\cjio\cityjson.py", line 442, in get_epsg
    
        raise ValueError(f"Invalid CRS string '{s}'. CRS needs to be formatted according to the OGC Name Type Specification: 'http://www.opengis.net/def/crs/{{authority}}/{{version}}/{{code}}'")
    
    ValueError: Invalid CRS string 'urn:ogc:def:crs:EPSG::7415'. CRS needs to be formatted according to the OGC Name Type Specification: 'http://www.opengis.net/def/crs/{authority}/{version}/{code}'
    
    Error: Python: Traceback (most recent call last):
    
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\3.5\scripts\addons\blenderbim\bim\module\gis\operator.py", line 44, in execute
    
        converter.convert(city_model)
    
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\3.5\scripts\addons\blenderbim\libs\site\packages\ifccityjson\cityjson2ifc\cityjson2ifc.py", line 88, in convert
    
        self.create_metadata()
    
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\3.5\scripts\addons\blenderbim\libs\site\packages\ifccityjson\cityjson2ifc\cityjson2ifc.py", line 115, in create_metadata
    
        epsg = self.city_model.get_epsg()
    
      File "C:\Users\cclaus\AppData\Roaming\Blender Foundation\Blender\3.5\scripts\addons\blenderbim\libs\site\packages\cjio\cityjson.py", line 442, in get_epsg
    
        raise ValueError(f"Invalid CRS string '{s}'. CRS needs to be formatted according to the OGC Name Type Specification: 'http://www.opengis.net/def/crs/{{authority}}/{{version}}/{{code}}'")
    
    ValueError: Invalid CRS string 'urn:ogc:def:crs:EPSG::7415'. CRS needs to be formatted according to the OGC Name Type Specification: 'http://www.opengis.net/def/crs/{authority}/{version}/{code}'
    

    I don't know how to fix this error:

    raise ValueError(f"Invalid CRS string '{s}'. CRS needs to be formatted according to the OGC Name Type Specification: 'http://www.opengis.net/def/crs/{{authority}}/{{version}}/{{code}}'")

  19. L

    It might be because of this line here in CJIO, that was added last year: cjio/cityjson.py#L441. I think the CityJSON file might be invalid according to this version of CJIO (the CityJSON parser).

    So, your Coordinate Reference System (CRS) is defined as urn:ogc:def:crs:EPSG::7415. But it should be defined using the opengis URL. I think this is the correct one: https://www.opengis.net/def/crs/EPSG/0/7415. If you replace this in your CityJSON file, what happens?

  20. C

    After upgrading the cjio module stille the same error :-(

  21. L

    I don't think upgrading helps. I think you have to change the line where the CRS is defined.

    Could I ask you where you got the CityJSON from? We should post an issue, that it should be possible to use the URN:OGC format too

  22. L
  23. L
  24. C

    Could I ask you where you got the CityJSON from? We should post an issue, that it should be possible to use the URN:OGC format too

    The file you mean?

    Downloaded them from here:

    https://3dbag.nl/en/download?tid=2932

  25. C

    @LaurensJN said:

    Also, if your file is 3D BAG, make sure to update them to V1.1 (see https://github.com/cityjson/cjio/issues/155)

    I don't really understand how to upgrade a json file, I have installed cjio on my local python installation, but absolute lost on how to use the module.

  1. Page 1
  2. 2
  3. 3

Login or Register to reply.