@@ -88,3 +88,60 @@ mapping with the following goals:
88884. Prioritise bSI standardised property sets over custom ones.
89895. Prevent needless repetition of data / fallback defaults that may result in
9090 invalid or unexpected data in obscure edge cases.
91+
92+
93+ Usage
94+ --------------------
95+
96+ Here is a minimal example of how to use IfcFm as a Python module or CLI
97+ utility:
98+
99+ .. code-block :: console
100+
101+ $ python -m ifcfm -h
102+
103+ usage: __main__.py [-h] [-p PRESET] -i IFC [-s SPREADSHEET] [-f FORMAT] [-d DELIMITER] [-n NULL] [-e EMPTY] [--bool_true BOOL_TRUE] [--bool_false BOOL_FALSE]
104+
105+ Extracts FM data from IFC to spreadsheets
106+
107+ options:
108+ -h, --help show this help message and exit
109+ -p PRESET, --preset PRESET
110+ The FM standard to extract. Built-in preset standards include cobie24, cobie3, aohbsem, and basic.
111+ -i IFC, --ifc IFC The IFC file
112+ -s SPREADSHEET, --spreadsheet SPREADSHEET
113+ The spreadsheet file, or directory if the format is csv. Defaults to output.ods
114+ -f FORMAT, --format FORMAT
115+ The format, chosen from csv, ods, or xlsx. Defaults to ods.
116+ -d DELIMITER, --delimiter DELIMITER
117+ The delimiter in CSV. Defaults to a comma.
118+ -n NULL, --null NULL How to represent null values. Defaults to N/A.
119+ -e EMPTY, --empty EMPTY
120+ How to represent empty strings. Defaults to a hyphen.
121+ --bool_true BOOL_TRUE
122+ How to represent true values. Defaults to YES.
123+ --bool_false BOOL_FALSE
124+ How to represent false values. Defaults to NO.
125+
126+
127+ A minimal example on how to use IfcFm as a library:
128+
129+ .. code-block :: python
130+
131+ import ifcfm
132+ import ifcopenshell
133+ from pathlib import Path
134+
135+ filepath = Path(" cobie/test.ifc" )
136+ ifc_file = ifcopenshell.open(filepath)
137+
138+ parser = ifcfm.Parser(preset = " cobie24" )
139+ parser.parse(ifc_file)
140+
141+ writer = ifcfm.Writer(parser)
142+ writer.write()
143+
144+ # Save the results in the format you need.
145+ writer.write_csv(str (filepath.parent / " csv" )) # Need to provide a folder, not filepath.
146+ writer.write_ods(str (filepath.with_suffix(" .ods" )))
147+ writer.write_xlsx(str (filepath.with_suffix(" .xlsx" )))
0 commit comments