create_cable_trays
Create cable trays in Revit by specifying type, dimensions, and coordinates. Automatically converts units and handles batch creation for efficient electrical system modeling.
Instructions
在Revit中创建电缆桥架,支持批量创建,遵循JSON-RPC 2.0规范。 mcp_tool使用时params不要有任何注释信息
特性:
支持批量创建多个电缆桥架
自动处理单位转换(毫米转英尺)
自动匹配桥架类型
支持指定桥架宽度和高度
完善的错误处理机制
参数: ctx (Context): FastMCP上下文对象 method (str): JSON-RPC方法名,默认为"CreateCableTrays" params (List[Dict]): 桥架参数列表,每个字典包含: - cableTrayTypeName (str): 桥架类型名称 - startX (float): 起点X坐标(毫米) - startY (float): 起点Y坐标(毫米) - startZ (float): 起点Z坐标(毫米) - endX (float): 终点X坐标(毫米) - endY (float): 终点Y坐标(毫米) - endZ (float): 终点Z坐标(毫米) - width (float): 桥架宽度(毫米) - height (float): 桥架高度(毫米)
返回: 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_cable_trays(ctx, params=[ { "cableTrayTypeName": "梯级式电缆桥架", "startX": 0, "startY": 0, "startZ": 3000, "endX": 5000, "endY": 0, "endZ": 3000, "width": 200, "height": 100 }, { "cableTrayTypeName": "标准", "startX": 5000, "startY": 0, "startZ": 3000, "endX": 5000, "endY": 5000, "endZ": 3000, "width": 200, "height": 100 } ])
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| method | No | CreateCableTrays | |
| params | No |
Implementation Reference
- xml_revit_mcp/server.py:41-56 (registration)Tool categorization lists where create_cable_trays is included in MEP_TOOLS for registration.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 ] MEP_TOOLS = [ create_ducts, create_pipes, create_cable_trays ] GENERAL_TOOLS = [ get_commands, execute_commands, call_func, find_elements, update_elements, delete_elements, parameter_elements, get_locations, move_elements, show_elements, active_view, get_selected_elements, link_dwg_and_activate_view, get_view_data ]
- xml_revit_mcp/server.py:134-147 (registration)The register_tools function that applies server.tool() decorator to all tools including create_cable_trays from MEP_TOOLS, registering it as an MCP tool.def register_tools(server: FastMCP) -> None: """注册所有工具到MCP服务器""" # 注册建筑工具 for tool in ARCHITECTURAL_TOOLS: server.tool()(tool) # 注册MEP工具 for tool in MEP_TOOLS: server.tool()(tool) # 注册通用工具 for tool in GENERAL_TOOLS: server.tool()(tool)
- xml_revit_mcp/prompts.py:38-38 (helper)Documentation in prompts mentioning the usage of create_cable_trays tool.- 使用create_cable_trays()创建电缆桥架