Skip to main content
Glama

export_drawing_png

Export IFC building model drawings as PNG images with customizable view types, resolution, and camera height for architectural documentation.

Instructions

Export drawings as PNG images with custom resolution.

Creates a drawing, with the view type specified, of the IFC building at the specified 
height above the floor level. Supports custom resolution for high-quality architectural drawings.

Args:
    height_offset: Height in meters above the storey level for the camera position (default 0.5m)
    view_type: Type of view - "top" for plan view, "front", "right" and "left" for elevation views, and "isometric" for 3D view
    resolution_x: Horizontal resolution in pixels (default 1920, max recommended 4096)
    resolution_y: Vertical resolution in pixels (default 1080, max recommended 4096)
    storey_name: Specific storey name to add to the file name (if None, prints default in the file name)
    output_path: Optional file path to save the PNG (if None, returns as base64 image)

Returns:
    metadata and the path of the file image of the drawing at the specified resolution

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
height_offsetNo
view_typeNotop
resolution_xNo
resolution_yNo
storey_nameNo
output_pathNo

Implementation Reference

  • The handler function for the 'export_drawing_png' MCP tool. It validates input parameters, connects to Blender via the global connection, sends an 'export_drawing_png' command with parameters to the Blender addon, receives base64-encoded PNG image data, decodes it, generates a filename if not provided, saves the image to ./exports/drawings/, and returns a dictionary with status and absolute file path.
    @mcp.tool()
    def export_drawing_png(
        height_offset: float = 0.5,
        view_type: str = "top",
        resolution_x: int = 1920,
        resolution_y: int = 1080,
        storey_name: str | None = None,
        output_path: str | None = None
    ) -> dict:
        """Export drawings as PNG images with custom resolution.
        
        Creates a drawing, with the view type specified, of the IFC building at the specified 
        height above the floor level. Supports custom resolution for high-quality architectural drawings.
        
        Args:
            height_offset: Height in meters above the storey level for the camera position (default 0.5m)
            view_type: Type of view - "top" for plan view, "front", "right" and "left" for elevation views, and "isometric" for 3D view
            resolution_x: Horizontal resolution in pixels (default 1920, max recommended 4096)
            resolution_y: Vertical resolution in pixels (default 1080, max recommended 4096)
            storey_name: Specific storey name to add to the file name (if None, prints default in the file name)
            output_path: Optional file path to save the PNG (if None, returns as base64 image)
        
        Returns:
            metadata and the path of the file image of the drawing at the specified resolution
        """
        try:
            # Validate resolution limits for performance
            if resolution_x > 4096 or resolution_y > 4096:
                raise Exception("Resolution too high. Maximum recommended: 4096x4096 pixels")
            
            if resolution_x < 100 or resolution_y < 100:
                raise Exception("Resolution too low. Minimum: 100x100 pixels")
            
            # Get the global connection
            blender = get_blender_connection()
            
            # Request drawing render
            result = blender.send_command("export_drawing_png", {
                "view_type": view_type,
                "height_offset": height_offset,
                "resolution_x": resolution_x,
                "resolution_y": resolution_y,
                "storey_name": storey_name,
                "output_path": output_path
            })
            
            if "error" in result:
                raise Exception(f"Error creating {view_type} drawing: {result.get('error', 'Unknown error')}")
            
            if "data" not in result:
                raise Exception("No image data returned from Blender")
            
            # Decode the base64 image data
            image_data = base64.b64decode(result["data"])
            
            # Ensure output path exists
            if not output_path:
                os.makedirs("./exports/drawings", exist_ok=True)
                # Generate filename based on view type
                view_name = {
                    "top": "plan_view",
                    "front": "front_elevation", 
                    "right": "right_elevation",
                    "left": "left_elevation",
                    "isometric": "isometric_view"
                }.get(view_type, view_type)
                filename = f"{view_name}_{storey_name or 'default'}.png"
                output_path = os.path.join("./exports/drawings", filename)
            
            # Save to file
            with open(output_path, "wb") as f:
                f.write(image_data)
            
            # Return only metadata
            return {
                "status": "success",
                "file_path": os.path.abspath(output_path),
                # Opcional: si tienes un servidor de archivos, podrías devolver también una URL
                # "url": f"http://localhost:8000/files/{filename}"
            }
            
        except Exception as e:
            logger.error(f"Error exporting drawing: {str(e)}")
            return { "status": "error", "message": str(e) }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden and does well by disclosing key behaviors: it creates a drawing (implies mutation/write operation), specifies default values and limits (e.g., 'max recommended 4096'), and describes output handling (file path vs base64). However, it lacks details on permissions, error conditions, or performance implications.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded with the core purpose. The parameter explanations are necessary given the 0% schema coverage, though the 'Returns' section could be integrated more smoothly. No redundant sentences.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 6-parameter tool with no annotations and no output schema, the description is quite complete: it covers purpose, parameters, and output behavior. It could improve by detailing error cases or performance constraints, but given the context, it provides sufficient guidance for effective tool use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate fully. It provides detailed semantics for all 6 parameters: explains what each parameter controls (e.g., 'Height in meters above the storey level'), lists valid values for 'view_type', specifies defaults and limits, and clarifies optional behavior for 'storey_name' and 'output_path'.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Export drawings as PNG images with custom resolution.' It specifies the verb ('Export'), resource ('drawings'), and format ('PNG images'), and distinguishes it from sibling tools by focusing on visual export rather than data extraction or manipulation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage by mentioning 'architectural drawings' and IFC building context, but does not explicitly state when to use this tool versus alternatives like 'get_user_view' or 'execute_blender_code'. No exclusions or prerequisites are provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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