11# IFC2JSON_python
2+
23Python converter from IFC SPF to JSON
34
45# Getting Started
56
67## Requirements
8+
79- ifcopenshell (using conda or in folder ./ifcopenshell)
810
911## Installation ifcopenshell using Conda
1012
11- 1 . Download the Conda installer for your OS setup. https://docs.conda.io/en/latest/miniconda.html
13+ 1 . Download the Conda installer for your OS setup. < https://docs.conda.io/en/latest/miniconda.html >
12142 . After installing Conda, create an environment for IFC.JSON with:
15+
1316 ```
1417 conda create --name ifcjson
1518 ```
19+
16203. Then activate the new environment:
21+
1722 ```
1823 conda activate ifcjson
1924 ```
25+
20264. Install ifcopenshell from conda-forge:
27+
2128 ```
2229 conda install -c conda-forge ifcopenshell
2330 ```
2431
2532## Installation ifcopenshell from direct download
26- Download a recent copy of ifcopenshell from: https://builds.ifcopenshell.org/
33+
34+ Download a recent copy of ifcopenshell from: <https://builds.ifcopenshell.org/>
2735
2836## Usage
37+
2938```
3039python ifc2json.py -i model.ifc -o model_ -_ ifcjson4.json -v 4
3140```
41+
3242```
3343optional arguments:
3444 -h, --help show this help message and exit
@@ -37,6 +47,20 @@ optional arguments:
3747 -v V IFC.JSON version, options: "4"(default), "5a"
3848```
3949
50+ ## Importing as a Python package
51+
52+ ```bash
53+ pip install git+<https://github.com/IFCJSON-Team/IFC2JSON_python.git>
54+ ```
55+
56+ After installing with pip, you can import the package in your Python code:
57+
58+ ``` python
59+ from ifcjson import ifc2json4, ifc2json5a, mesh, reader, to_ifcopenshell, common
60+ # Example usage:
61+ # from ifcjson.ifc2json4 import some_function
62+ ```
63+
4064## Additional Requirements for Roundtrip and IFC.JSON → IFC SPF Conversion
4165
4266- The roundtrip tests and the conversion from IFC.JSON to IFC SPF require the ` pandas ` library.
@@ -63,7 +87,7 @@ This keeps the minimal install lightweight for users who only need IFC → JSON
6387
6488# Running Tests
6589
66- A test converting a set of sample files is provided to verify the roundtrip conversion from IFC to JSON and back.
90+ A test converting a set of sample files is provided to verify the roundtrip conversion from IFC to JSON and back.
6791This test will process all `.ifc` files in `samples/ input / ` , write results to `samples/ output/ ` , and check the validity of the conversion.
6892
6993To run the test, use the following command from your project root:
@@ -76,4 +100,4 @@ python -m unittest file_converters/tests/test_samples.py
76100- The test checks for required keys and schema version in the generated JSON files.
77101- Make sure your input files are placed in `samples/input/`.
78102
79- ---
103+ ---
0 commit comments