get_selected_elements
Retrieve currently selected elements in Revit UI, providing detailed data like ID, name, and category in JSON-RPC 2.0 format, with built-in error handling.
Instructions
获取当前Revit UI中选择的元素,遵循JSON-RPC 2.0规范。
特性:
- 获取当前用户在Revit界面中选择的所有元素
- 返回元素的完整信息,包括ID、类别和名称
- 无需额外参数,直接反映当前UI状态
- 完善的错误处理机制
参数: ctx (Context): FastMCP上下文对象 method (str): JSON-RPC方法名,默认为"GetSelectedElements"
返回: 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 = get_selected_elements(ctx)
Input Schema
Name | Required | Description | Default |
---|---|---|---|
method | No | GetSelectedElements |