create_door_windows
Create door and window family instances in Revit with batch processing, automatic unit conversion, and precise placement on walls using coordinates.
Instructions
在Revit中创建门窗族实例,支持批量创建,遵循JSON-RPC 2.0规范。 mcp_tool使用时params不要有任何注释信息
特性:
支持批量创建多个门窗族实例
自动处理单位转换(毫米转英尺)
支持指定族类型和类别
支持指定主体墙ElementId
完善的错误处理机制
参数: ctx (Context): FastMCP上下文对象 method (str): JSON-RPC方法名,默认为"CreateDoorWindows" params (List[Dict]): 门窗参数列表,每个字典包含: - categoryName (str): 类别名称(门或窗) - familyName (str): 族名称 - name (str): 类型名称 - startX (float): 放置点X坐标(毫米) - startY (float): 放置点Y坐标(毫米) - startZ (float): 放置点Z坐标(毫米) - hostId (str): 主体墙的ElementId - offset (str, optional): 底高度偏移值
返回: 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_door_windows(ctx, params=[ { "categoryName": "门", "familyName": "单扇门", "name": "915 x 2134mm", "startX": 5000, "startY": 2500, "startZ": 0, "hostId": "123456", "offset": "0" }, { "categoryName": "窗", "familyName": "固定窗", "name": "0915 x 1220mm", "startX": 8000, "startY": 2500, "startZ": 1000, "hostId": "123456", "offset": "900" } ])
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| method | No | CreateDoorWindows | |
| params | No |
Implementation Reference
- xml_revit_mcp/server.py:41-44 (registration)The tool 'create_door_windows' is included in the ARCHITECTURAL_TOOLS list used for registering MCP tools.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:137-139 (registration)Architectural tools, including create_door_windows, are registered to the FastMCP server using server.tool() decorator.for tool in ARCHITECTURAL_TOOLS: server.tool()(tool)
- xml_revit_mcp/prompts.py:31-32 (helper)Prompt documentation instructs to use create_door_windows() to create doors and windows on walls.- 使用create_door_windows()在墙体上创建门窗 注意:门窗族需要指定宿主墙,所以必须先有墙再创建门窗
- xml_revit_mcp/server.py:248-248 (registration)The register_tools function is called to register all tools including create_door_windows.register_tools(mcp)