Files
IfcOpenShell/src/ifc5d/README.md
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

93 lines
2.5 KiB
Markdown
Raw Normal View History

# ifc5d
## Description
Ifc5D is a collection of utilities of manipulating cost-related data to and from
formats, reports, and optimisation engines.
Currently supported:
- CSV to IFC
- IFC to XLSX
- IFC to CSV
- IFC to ODS
Planned (would you like to contribute? Please reach out!):
- IFC to PDF
- ODS to CSV
- XLSX to CSV
- IFC to Graph
## Usage CSV to IFC
2025-04-16 11:09:50 +05:00
See example files as a CSV file format reference:
- `sample_cost_schedule_house_FR.csv` / `.ods`
- `schedule.csv`, `rates.csv` (schedule of rates example)
Some notes on the format:
- Empty lines are ignored.
- Importing ods/xlsx is not currently supported, only csv.
- 'Property', 'Query' columns are required only for non-schedule of rates cost schedules.
- Some older exports may have 'Description' field instead of 'Name', it is safe to just rename it.
- 'Hierarchy' is just an informational column that doesn't affect the import.
E.g. '1', '1.1', '1.1.1', etc.
- 'Index' column is a hierarchy depth that's used for building hierarchy during csv import, starting from 1.
E.g. root items of the same level have index '1', their children have '2', etc.
- 'Index' was preferred for import hierarchy source over 'Hierarchy' as it's easier to edit from the table view.
2025-04-16 11:09:50 +05:00
Simple example:
```python
import ifc5d.csv2ifc
csv2ifc = ifc5d.csv2ifc.Csv2Ifc(csv_filepath, ifc_file)
csv2ifc.execute()
```
## Usage IFC to CSV, ODS, XSLS
Simple example:
```python
import ifc5d.ifc5Dspreadsheet
# csv.
writer = ifc5d.ifc5Dspreadsheet.Ifc5DCsvWriter(ifc_file, temp_csv_dir)
writer.write()
```
2023-02-16 20:15:54 +01:00
### CLI app for converting IFC files to CSV, ODS or XLSX format.
Usage:
python ifc5Dspreadsheet.py input_file output_file [-l log_file] [-f format_type]
Arguments:
input_file (str): The path to the input IFC file to process.
output_file (str): The output directory for CSV or filename for other formats.
Options:
-l, --log log_file (str): The path to the file where errors should be logged. Default is process.log.
-f, --format format_type (str): The output format to export in (csv/ods/xlsx). Default is csv.
Examples:
2023-02-16 20:15:54 +01:00
python ifc5Dspreadsheet.py "C:\Users\Dev-Machine\Desktop\test_cost.ifc" rev_01_schedule -l error.log -f ODS
python ifc5Dspreadsheet.py "C:\Users\Username\Desktop\test_cost.ifc" "C:\Users\Username\Desktop" -l error.log -f CSV
### Scripting:
Example for ODS exports:
2023-02-16 20:15:54 +01:00
```
import ifcopenshell
from ifc5d.ifc5Dspreadsheet import Ifc5DOdsWriter
file = "path_to_file/file.ifc"
path = "directory/cost_schedule"
writer = Ifc5DOdsWriter(file=file, output=path)
writer.write()
2023-02-16 20:15:54 +01:00
```