create_floors
Create floors in Revit by defining boundary points, specifying floor types, and setting structural properties for batch processing in building models.
Instructions
在Revit中创建楼板,支持批量创建,遵循JSON-RPC 2.0规范。 mcp_tool使用时params不要有任何注释信息
特性:
支持批量创建多个楼板
自动处理单位转换(毫米转英尺)
自动匹配楼板类型或使用默认类型
支持结构楼板和非结构楼板
自动根据z值标高确定楼层
完善的错误处理机制
参数: ctx (Context): FastMCP上下文对象 method (str): JSON-RPC方法名,默认为"CreateFloors" params (List[Dict]): 楼板参数列表,每个字典包含: - boundaryPoints (List[Dict]): 楼板边界点列表,每个点包含: - x (float): X坐标(毫米) - y (float): Y坐标(毫米) - z (float): Z坐标(毫米) - floorTypeName (str, optional): 楼板类型名称(可选) - structural (bool, optional): 是否为结构楼板(默认为False)
返回: dict: JSON-RPC 2.0格式的响应,结构为: 成功时: { "jsonrpc": "2.0", "result": [ { "elementId": "楼板元素ID", "name": "楼板名称", "familyName": "楼板族名称" }, ... ], "id": request_id } 失败时: { "jsonrpc": "2.0", "error": { "code": int, "message": str, "data": any }, "id": request_id }
示例: # 创建多个楼板 response = create_floors(ctx, params=[ { "boundaryPoints": [ {"x": 0, "y": 0, "z": 0}, {"x": 5000, "y": 0, "z": 0}, {"x": 5000, "y": 5000, "z": 0}, {"x": 0, "y": 5000, "z": 0}, {"x": 0, "y": 0, "z": 0} ], "floorTypeName": "常规 - 150mm", "structural": True }, { "boundaryPoints": [ {"x": 0, "y": 0, "z": 3000}, {"x": 5000, "y": 0, "z": 3000}, {"x": 5000, "y": 5000, "z": 3000}, {"x": 0, "y": 5000, "z": 3000}, {"x": 0, "y": 0, "z": 3000} ], "floorTypeName": "常规 - 200mm" } ])
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| method | No | CreateFloors | |
| params | No |
Implementation Reference
- xml_revit_mcp/server.py:41-44 (registration)The tool 'create_floors' is included in the ARCHITECTURAL_TOOLS list, which is used to register tools with the MCP server via server.tool() in register_tools function.ARCHITECTURAL_TOOLS = [ create_levels, create_floor_plan_views, create_grids, create_walls, create_floors, create_door_windows, create_rooms, create_room_tags, create_family_instances, create_sheets ]
- xml_revit_mcp/server.py:136-139 (registration)Registration loop that applies server.tool() decorator to create_floors among other architectural tools.# 注册建筑工具 for tool in ARCHITECTURAL_TOOLS: server.tool()(tool)
- tests/CreateFloors.py:30-38 (helper)Test script demonstrating the expected input format for CreateFloors RPC method on Revit side: list of dicts with boundaryPoints, floorTypeName, structural.# 构造 JSON-RPC 请求 json_rpc_request = { "jsonrpc": "2.0", "method": "CreateFloors", "params": data, } # 发送更新元素数据 send_tcp_data(json_rpc_request)
- xml_revit_mcp/prompts.py:28-29 (helper)Prompt mentioning usage of create_floors() for creating floors with closed boundary loops.- 使用create_floors()创建楼板,确保边界点形成封闭环路