call_func
Execute Revit functions by specifying names and parameters in JSON-RPC 2.0 format. Supports batch calls, parameter validation, and robust error handling to automate building model interactions.
Instructions
调用 Revit 函数服务,支持直接传递功能名称及其参数,遵循 JSON-RPC 2.0 规范。
特性:
支持批量调用多个功能
支持传递参数给每个功能
自动验证参数有效性
完善的错误处理机制
参数: ctx (Context): FastMCP上下文对象 method (str): JSON-RPC方法名,默认为"CallFunc" params (List[Dict]): 功能参数列表,每个字典包含:
返回: 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 = call_func(ctx, params=[ {"name": "ClearDuplicates"}, {"name": "DeleteZeroRooms"}, {"name": "DimensionViewPlanGrids"}, {"name": "新增标高", "params": {"offset": 3000}} ])
Input Schema
Name | Required | Description | Default |
---|---|---|---|
method | No | CallFunc | |
params | No |