Skip to content

Convert IFC to IfcJSON

Feature Group(s): Convert | IfcOpenShell / IfcJSON

Submit the processing request

#
# Convert an IFC to IFCJSON with IFC2JSON
#
class ConvertIfcToIfcJson_Instruction(BaseModel):
    sourceFileURL: str | None = "http://localhost:8002/IFC_SOURCE_FILES/Duplex_A_20110907_optimized.ifc"
    mode: Literal ['NO_INVERSE', 'INVERSE', 'STYLED'] | None = 'STYLED'

class ConvertIfcToIfcJson_Result(BaseModel):
    rootObjectId: str
    rootObjectType: str
    rootObjectName: str 
    resultPath: str # relative path of the result file (json)
    runtime: float | None = 0.0 # in seconds

Create the ifcJSON with IFC2JSON

There are 3 modes:

  • NO_INVERSE: does not add inverse relationships; does not keep the styles
  • INVERSE: adds inverse relationships; does not keep the styles
  • STYLED: same as NO_INVERSE but keeps the styles defined in the IFC; this ensures rendition fidelity but has a processing cost that is not always useful.

The result provides information on the rootObject which expectedly is an IfcProject.

Issues (non blocking; but will need a follow-up)

Note

Error with IfcExternalReference not supported. When present, I get the following error: 'AttributeError("entity instance of type 'IFC4.IfcExternalReference' has no attribute 'wrappedValue'")

Note

with NO_INVERSE = False for LARGE_MODEL_20210219Architecture.ifc, the program got stuck somewhere. I stopped after 23m 53.2s