export_ifc_data
Extract and export IFC data to JSON or CSV format, allowing filtering by entity type or building level for structured file creation.
Instructions
Export IFC data to a file in JSON or CSV format.
This tool extracts IFC data and creates a structured export file. You can filter
by entity type and/or building level, and choose the output format.
Args:
entity_type: Type of IFC entity to export (e.g., "IfcWall") - leave empty for all entities
level_name: Name of the building level to filter by (e.g., "Level 1") - leave empty for all levels
output_format: "json" or "csv" format for the output file
Returns:
Confirmation message with the export file path or an error message
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| entity_type | No | ||
| level_name | No | ||
| output_format | No | csv |
Implementation Reference
- tools.py:426-473 (handler)MCP tool handler function for 'export_ifc_data'. Proxies parameters to Blender addon via socket command 'export_ifc_data' and returns JSON-formatted result or error.@mcp.tool() def export_ifc_data( entity_type: str | None = None, level_name: str | None = None, output_format: str = "csv", ctx: Context | None = None ) -> str: """ Export IFC data to a file in JSON or CSV format. This tool extracts IFC data and creates a structured export file. You can filter by entity type and/or building level, and choose the output format. Args: entity_type: Type of IFC entity to export (e.g., "IfcWall") - leave empty for all entities level_name: Name of the building level to filter by (e.g., "Level 1") - leave empty for all levels output_format: "json" or "csv" format for the output file Returns: Confirmation message with the export file path or an error message """ try: # Get Blender connection blender = get_blender_connection() # Validate output format if output_format not in ["json", "csv"]: return "Error: output_format must be 'json' or 'csv'" # Execute the export code in Blender result = blender.send_command("export_ifc_data", { "entity_type": entity_type, "level_name": level_name, "output_format": output_format }) # Check for errors from Blender if isinstance(result, dict) and "error" in result: return f"Error: {result['error']}" # Return the result with export summary # return result return json.dumps(result, indent=2) except Exception as e: logger.error(f"Error exporting IFC data: {str(e)}") return f"Error exporting IFC data: {str(e)}"