ifc
Interop helpers for Revit IFC export.
This module: - Loads the IFC.Net assembly to provide IFC schema types (e.g. Ifc4). - Parses Revit IFC exporter JSON configuration files and maps them to Autodesk.Revit.DB.IFCExportOptions. - Exposes high-level helpers (e.g. IFCExporter) around Document.Export for IFC exports.
Attributes
mlogger = get_logger(__name__)
module-attribute
IFC_VERSION_MAP = {(int(v)): v for v in (DB.IFCVersion.GetValues(DB.IFCVersion))}
module-attribute
DIRECT_PROPERTY_KEYS = {'SpaceBoundaries', 'SplitWallsAndColumns', 'ExportBaseQuantities', 'ExportUserDefinedParameterMappingFileName'}
module-attribute
SKIP_ADDOPTION_KEYS = DIRECT_PROPERTY_KEYS | {'IFCVersion', 'Name', 'ActivePhaseId', 'IFCFileType', 'ExchangeRequirement', 'ClassificationSettings', 'ProjectAddress'}
module-attribute
Classes
IFCExporter(doc)
Bases: object
High-level wrapper around Revit's Document.Export IFC pipeline.
Parameters
doc : Autodesk.Revit.DB.Document The active Revit document.
Attributes
doc = doc
instance-attribute
Functions
export(folder, filename, config_path=None, overrides=None, filter_view_id=None)
Export the document to IFC.
Parameters
folder : str Output directory. filename : str Output file name, e.g. 'MyModel.ifc'. config_path : str, optional Path to a Revit IFC JSON configuration file. overrides : dict, optional Option keys to override (or supplement) the config file. filter_view_id : Autodesk.Revit.DB.ElementId, optional View to use for visibility-based filtering.
Returns
bool True if Revit reported success.
Raises
IOError : if config_path is given but the file is missing. Exception : re-raises any Revit API error.
Source code in pyrevitlib/pyrevit/interop/ifc.py
Functions
load_config(config_path)
Load a Revit IFC configuration JSON file.
Parameters
config_path : str Absolute path to the .json file exported by Revit's IFC exporter.
Returns
dict Parsed configuration dictionary.
Raises
IOError : if the file does not exist. ValueError : if the file is not valid JSON.
Source code in pyrevitlib/pyrevit/interop/ifc.py
build_export_options(config=None, overrides=None, filter_view_id=None)
Build an IFCExportOptions object from a config dict and/or keyword overrides.
Parameters
config : dict, optional Parsed JSON config (from load_config or a hand-crafted dict). overrides : dict, optional Key/value pairs that override or supplement config values. Accepts the same keys as the JSON config file. filter_view_id : Autodesk.Revit.DB.ElementId, optional If provided, only elements visible in this view are exported.
Returns
Autodesk.Revit.DB.IFCExportOptions
Source code in pyrevitlib/pyrevit/interop/ifc.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | |