georeference_ifc_model
Assign geographic coordinates to IFC building models by creating or updating coordinate reference systems and map conversions for accurate location positioning.
Instructions
Georeferences the IFC currently opened in Bonsai/BlenderBIM by creating or updating IfcProjectedCRS and IfcMapConversion. Optionally updates IfcSite and writes the file to disk.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| crs_mode | Yes | ||
| epsg | No | ||
| crs_name | No | ||
| geodetic_datum | No | ||
| map_projection | No | ||
| map_zone | No | ||
| eastings | No | ||
| northings | No | ||
| orthogonal_height | No | ||
| scale | No | ||
| x_axis_abscissa | No | ||
| x_axis_ordinate | No | ||
| true_north_azimuth_deg | No | ||
| context_filter | No | Model | |
| context_index | No | ||
| site_ref_latitude | No | ||
| site_ref_longitude | No | ||
| site_ref_elevation | No | ||
| site_ref_latitude_dd | No | ||
| site_ref_longitude_dd | No | ||
| overwrite | No | ||
| dry_run | No | ||
| write_path | No |
Implementation Reference
- tools.py:903-974 (handler)The handler function for the 'georeference_ifc_model' tool. It collects georeferencing parameters, filters out None values, and forwards them as a command to the Blender addon via the socket connection for actual IFC model georeferencing.def georeference_ifc_model( crs_mode: str, epsg: int = None, crs_name: str = None, geodetic_datum: str = None, map_projection: str = None, map_zone: str = None, eastings: float = None, northings: float = None, orthogonal_height: float = 0.0, scale: float = 1.0, x_axis_abscissa: float = None, x_axis_ordinate: float = None, true_north_azimuth_deg: float = None, context_filter: str = "Model", context_index: int = None, site_ref_latitude: list = None, # [deg, min, sec, millionth] site_ref_longitude: list = None, # [deg, min, sec, millionth] site_ref_elevation: float = None, site_ref_latitude_dd: float = None, # Decimal degrees (optional) site_ref_longitude_dd: float = None, # Decimal degrees (optional) overwrite: bool = False, dry_run: bool = False, write_path: str = None, ) -> str: """ Georeferences the IFC currently opened in Bonsai/BlenderBIM by creating or updating IfcProjectedCRS and IfcMapConversion. Optionally updates IfcSite and writes the file to disk. """ import json blender = get_blender_connection() # Build params excluding None values to keep the payload clean params = { "crs_mode": crs_mode, "epsg": epsg, "crs_name": crs_name, "geodetic_datum": geodetic_datum, "map_projection": map_projection, "map_zone": map_zone, "eastings": eastings, "northings": northings, "orthogonal_height": orthogonal_height, "scale": scale, "x_axis_abscissa": x_axis_abscissa, "x_axis_ordinate": x_axis_ordinate, "true_north_azimuth_deg": true_north_azimuth_deg, "context_filter": context_filter, "context_index": context_index, "site_ref_latitude": site_ref_latitude, "site_ref_longitude": site_ref_longitude, "site_ref_elevation": site_ref_elevation, "site_ref_latitude_dd": site_ref_latitude_dd, "site_ref_longitude_dd": site_ref_longitude_dd, "overwrite": overwrite, "dry_run": dry_run, "write_path": write_path, } params = {k: v for k, v in params.items() if v is not None} try: result = blender.send_command("georeference_ifc_model", params) return json.dumps(result, ensure_ascii=False, indent=2) except Exception as e: logger.exception("georeference_ifc_model error") return json.dumps( {"success": False, "error": "Could not georeference the model.", "details": str(e)}, ensure_ascii=False, indent=2, )