Skip to main content
Glama

get_ifc_georeferencing_info

Check if an IFC model in Bonsai/BlenderBIM has georeferencing data and retrieve coordinate reference system, map conversion, and site location information.

Instructions

Checks whether the IFC currently opened in Bonsai/BlenderBIM is georeferenced
and returns the key georeferencing information.

Parameters
----------
include_contexts : bool
    If True, adds a breakdown of the RepresentationContexts and operations.
    

Returns
--------
str (JSON pretty-printed)
    {
      "georeferenced": true|false,
      "crs": {
        "name": str|null,
        "geodetic_datum": str|null,
        "vertical_datum": str|null,
        "map_unit": str|null
      },
      "map_conversion": {
        "eastings": float|null,
        "northings": float|null,
        "orthogonal_height": float|null,
        "scale": float|null,
        "x_axis_abscissa": float|null,
        "x_axis_ordinate": float|null
      },
      "world_coordinate_system": {
        "origin": [x, y, z]|null
      },
      "true_north": {
        "direction_ratios": [x, y]|null
      },
      "site": {
        "local_placement_origin": [x, y, z]|null,
        "ref_latitude": [deg, min, sec, millionth]|null,
        "ref_longitude": [deg, min, sec, millionth]|null,
        "ref_elevation": float|null
      },
      "contexts": [...],              # only if include_contexts = true
      "warnings": [ ... ]             # Informational message
    }

Notes
-----
- This tool acts as a wrapper: it sends the "get_ifc_georeferencing_info"
  command to the Blender add-on. The add-on must implement that logic
  (reading IfcProject/IfcGeometricRepresentationContext, IfcMapConversion,
  TargetCRS, IfcSite.RefLatitude/RefLongitude/RefElevation, etc.).
- It always returns a JSON string with indentation for easier reading.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
include_contextsNo

Implementation Reference

  • The handler function implementing the MCP tool 'get_ifc_georeferencing_info'. It establishes a connection to the Blender addon, sends the corresponding command with the 'include_contexts' parameter, and returns a formatted JSON string with georeferencing information or an error message. The detailed schema for input/output is provided in the docstring.
    def get_ifc_georeferencing_info(include_contexts: bool = False) -> str:
        """
        Checks whether the IFC currently opened in Bonsai/BlenderBIM is georeferenced
        and returns the key georeferencing information.
    
        Parameters
        ----------
        include_contexts : bool
            If True, adds a breakdown of the RepresentationContexts and operations.
            
    
        Returns
        --------
        str (JSON pretty-printed)
            {
              "georeferenced": true|false,
              "crs": {
                "name": str|null,
                "geodetic_datum": str|null,
                "vertical_datum": str|null,
                "map_unit": str|null
              },
              "map_conversion": {
                "eastings": float|null,
                "northings": float|null,
                "orthogonal_height": float|null,
                "scale": float|null,
                "x_axis_abscissa": float|null,
                "x_axis_ordinate": float|null
              },
              "world_coordinate_system": {
                "origin": [x, y, z]|null
              },
              "true_north": {
                "direction_ratios": [x, y]|null
              },
              "site": {
                "local_placement_origin": [x, y, z]|null,
                "ref_latitude": [deg, min, sec, millionth]|null,
                "ref_longitude": [deg, min, sec, millionth]|null,
                "ref_elevation": float|null
              },
              "contexts": [...],              # only if include_contexts = true
              "warnings": [ ... ]             # Informational message
            }
    
        Notes
        -----
        - This tool acts as a wrapper: it sends the "get_ifc_georeferencing_info"
          command to the Blender add-on. The add-on must implement that logic
          (reading IfcProject/IfcGeometricRepresentationContext, IfcMapConversion,
          TargetCRS, IfcSite.RefLatitude/RefLongitude/RefElevation, etc.).
        - It always returns a JSON string with indentation for easier reading.
        """
        blender = get_blender_connection()
        params = {
            "include_contexts": bool(include_contexts)
        }
    
        try:
            result = blender.send_command("get_ifc_georeferencing_info", params)
            # Ensures that the result is serializable and easy to read
            return json.dumps(result, ensure_ascii=False, indent=2)
        except Exception as e:
            logger.exception("get_ifc_georeferencing_info error")
            return json.dumps(
                {
                    "georeferenced": False,
                    "error": "Unable to retrieve georeferencing information from the IFC model.",
                    "details": str(e)
                },
                ensure_ascii=False,
                indent=2
            )

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/JotaDeRodriguez/Bonsai_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server