feat: 新增 19 個視圖診斷/篩選器/Section Box/文件操作 MCP 工具(192→211) - #136
Open
7alexhuang-ux wants to merge 10 commits into
Open
7alexhuang-ux wants to merge 10 commits into
7alexhuang-ux wants to merge 10 commits into
Conversation
接手他人模型時,看到不合預期的表現法(某面牆莫名被填色、某個元素該在卻不見、 線變粗變淡),要查出原因只能到 VG、篩選器、視圖樣板、材料、元素覆寫逐層點開比對。 最麻煩的是「同時有兩個來源」——查到第一個就停手,往往修錯地方。 本工具沿 Revit 的覆寫優先序一次掃完五個來源,唯讀回報: 視覺型式 > 元素個別覆寫 > 視圖篩選器 > 類別覆寫 > 材料本身 並列出**所有**命中的成因(不是只回第一個),每筆帶影響範圍與修正方式。 實作: - MCP/Core/Commands/CommandExecutor.ViewGraphicsDiagnostics.cs(新檔,partial class) - CommandExecutor.cs 新增 dispatcher case - visualization-tools.ts 註冊工具;工具名 get_ 開頭,annotations.ts 自動判定 readOnlyHint=true,無須新增覆寫條目 回傳 Verdict 結構: - Causes[]:每筆含 Priority / Source / Scope(整個視圖/這個元素/整個品類/ 全專案)/ Detail / Fix,依優先序排列 - PrimaryCause、CauseCount、人類可讀的 Summary 偵測涵蓋:表面與剖面的前景/背景填滿(顏色與樣式)、投影線色、剖面線色、線寬、 半色調、透明度;以及兩種「元素根本看不到」的情形——篩選器把可見性關掉、 品類在本視圖被關閉。視圖樣板鎖住哪些圖形參數也會一併回報(那是使用者在視圖上 改不動的原因)。 唯讀保證:不開 Transaction,只呼叫 getter。 文件連動:工具數 192 → 193,同步 CLAUDE.md / README / README.zh-TW / DOCUMENT_AUDIENCE_INVENTORY / BIM_MCP 各索引頁與 tools-index 卡片。 驗收: - dotnet build R22 / R24 / R25 / R26 皆 0 errors(跨 REVIT2025_OR_GREATER 的 Int32/Int64 ElementId 分歧已驗) - verify-qaqc.ps1 -SkipDeploy:PASS 72 / FAIL 0 / WARN 2(兩個 WARN 皆為既有項目) 未驗:尚未在真實 Revit session 實跑;多成因同時命中時的排序是否符合 Revit 實際 勝出規則,目前僅以 API 語意為據。連結模型覆寫、設計選項、階段化圖形覆寫未涵蓋, 只在「都沒找到」時以文字提示使用者自行檢查。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
set_3d_section_box / align_view_cropbox_to_element 新增 upperStructureMode: - current_level_only(預設,維持原行為):頂面=目標頂 + padding_top_mm - include_upper_structure_without_slab:頂面延伸到最近上層樓板底(扣 upperSlabClearance_mm,預設 10mm),上層樑可見但不含樓板本體 找不到上層樓板時直接報錯且不修改 Section Box,避免留下半套狀態。 排煙檢討的 domain 與 skill 同步說明兩路由的適用時機。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
get_filterable_parameters:用 ParameterFilterUtilities.GetFilterableParametersInCommon 列出某類別實際可作為篩選條件的參數,附 StorageType 與支援運算子,不必憑印象猜。 create_view_filter:建立 ParameterFilterElement 並套用到視圖含圖形覆寫,回傳 MatchedElementCount 讓規則是否命中當場可見;同名預設報錯,overwriteExisting 才更新。 remove_view_filter:從視圖移除,可選一併刪除篩選器本身。 動機:逐元素 override_element_graphics 不是規則、不涵蓋新元素、接手者看不出意圖; 檢討用視圖應該用「規則 → 表現法」表達,改資料就改顏色。 工具數 194 → 197,同步 CLAUDE.md / README / README.zh-TW / 稽核清單與 BIM_MCP 索引頁。 QA/QC:scripts/verify-qaqc.ps1 -SkipBuild -SkipDeploy → 67 PASS / 0 FAIL / 2 WARN(既有)。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
- capture_view_image:視圖擷圖,server 端改以 image content block 回傳 - list_fill_patterns:查詢填充樣式名稱 - get/set_view_range、get/set_link_display_settings - get/set_material_graphics、get_camera_info - list_open_documents / open_document / save_document / close_document / reload_links - create_view_filter 支援 patternName / backgroundPatternName / backgroundColor(未給時行為不變) - 修正 get_all_materials 遇未初始化材質顏色整份 crash Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
projectedOpeningRatio 預設由 0.5 改為 1.0,兩個排煙工具的 schema 與 C# 預設同步; domain 窗型表改標「1.0(工具預設)」。 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
程式預設原本即為 1.0;domain 窗型表、smoke-exhaust skill 範例與係數表、 TS 參數說明原寫「本案 0.5」,統一改為 1.0。 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
摘要
相對 upstream
main(2faacc5)新增 19 個 MCP 工具(192 → 211),並改善排煙檢討流程。upstream 既有工具無刪除、無改名;既有工具的新參數全部有預設值,不給時行為與原本一致。主軸是補上 AI 端原本缺席的兩種能力:
capture_view_image),不必再請使用者截圖。一、視圖表現法診斷(
66b0e1c,+1 工具)get_view_graphics_diagnostics(唯讀)接手他人模型時,常遇到表現法跟預期不符:某面牆被填色、某元素不見、線變粗或變淡。最麻煩的是同時有兩個成因的情況,查到第一個就停手,往往會修錯地方。
本工具依 Revit 覆寫優先序一次掃完五個來源:
Priority/Source/Scope(整個視圖/這個元素/整個品類/全專案)/Detail/Fix已知限制:連結模型覆寫、設計選項、階段化圖形覆寫尚未涵蓋。都沒找到成因時,會以文字提示使用者自行檢查。
二、排煙檢討:3D Section Box 與窗型係數(
cb3d31f、4925544,+1 工具)問題 1:3D 視圖用 CropBox 裁切是錯的
原本
align_view_cropbox_to_element對 3D 視圖也操作 CropBox。CropBox 在 3D 只是平面框,不做 Z 向裁切,房間上下的樓板、樑、上一層都會混進畫面,排煙檢討(天花板下 80 cm 有效帶)根本看不清楚。修正:
set_3d_section_box:用View3D.SetSectionBox()依元素完整 XYZ BoundingBox 做三向裁切,同時關閉 CropBox,避免雙重裁切align_view_cropbox_to_element回到 2D 專用(只調 XY,保留 Z 深度與 Transform)。為了相容已快取舊 schema 的 client,目標是 View3D 時會轉交set_3d_section_box,不會直接拒絕clearCropOnly=true:只關閉先前被舊流程誤啟用的 3D CropBox,不動 Section Box問題 2:統一 padding 顧此失彼
實測時遇到的情況:房間底標高約 -2.8 m,但下方支承樑底到 -5.3 m。統一 600 mm padding 的結果是:
修正:
padding_xy_mm/padding_bottom_mm/padding_top_mm,保留padding_mm當相容入口includeSupportingBeams=true:自動找出「樑頂貼近目標底面(容許值supportingBeamTolerance_mm,預設 300)且 XY 相交」的結構構架,把完整樑身納入 Section Box,不必猜水平 padding 要給多少問題 3:上層結構要不要看,依檢討目的而定(
4925544)新增
upperStructureMode兩條路由:current_level_only(預設,維持原行為)padding_top_mminclude_upper_structure_without_slabupperSlabClearance_mm(預設 10 mm)找不到上層樓板時會直接報錯,不修改 Section Box,不會留下半套狀態。
問題 4:窗型有效面積係數寫死在程式裡
check_smoke_exhaust_windows/export_smoke_review_excel新增參數,係數改成可稽核的專案政策:projectedOpeningRatiocasementOpeningRatioslidingOpeningRatiounknownWindowAssumptionmanualWindowOperationPolicy欄位,記錄這次檢討用了哪組係數。Excel 匯出沿用同一組projectedOpeningRatio預設改為 1.0(f817e03);domain/skill 的推開/平開窗係數統一為 1.0,與工具預設一致。兩者皆視為可完整開啟,開啟角度受限的專案可調低其他:天花板高度來源路由(domain + skill)
domain/smoke-exhaust-review.md與smoke-exhaustskill 新增ceilingHeightSource選擇規則:room_parameterceiling_elementceiling_element找不到匹配天花時會靜默回退到 Room 參數。文件明定部分建模階段不得依賴這個隱性回退三、視圖篩選器(
92e7d57,+3 工具)動機:逐元素的
override_element_graphics不是規則,新增元素不會套用,接手的人也看不出意圖。檢討用視圖應該寫成「規則 → 表現法」,資料一改,顏色跟著變。get_filterable_parametersParameterFilterUtilities.GetFilterableParametersInCommon列出某些類別實際可以當篩選條件的參數,附 StorageType 與支援的運算子,不必憑印象猜create_view_filterParameterFilterElement並套用到視圖(含圖形覆寫)。回傳MatchedElementCount,規則有沒有命中當場就看得到。同名預設報錯,要overwriteExisting=true才會更新remove_view_filter484ff4c再擴充create_view_filter:新增patternName/backgroundPatternName/backgroundColor,篩選器可以畫 hatch,不只是色塊(例如前景土壤紋加背景淺綠實心,組成草地)。填充樣式名稱填錯會直接報錯,不會靜默退回實心。不給這些參數時,行為與原本完全相同。四、診斷層與文件操作(
484ff4c,+14 工具)看得見畫面
capture_view_imageServer 端配套(
MCP-Server/src/index.ts):結果裡有ImageBase64時,改用 MCPimagecontent block 回傳,其餘欄位(視圖名稱、尺寸、Warnings)另附在 text block。原本的一般路徑會把 base64 塞進 JSON 字串,AI client 只拿到一長串文字、看不到圖,工具等於白做。這個分支只在結果含ImageBase64時觸發,不影響其他工具。「看不到」的三個常見盲區
get_view_range/set_view_rangelevel支援樓層名稱或Unlimited/Level Above/Level Below/Currentget_link_display_settings/set_link_display_settingsHostFiltersApply:連結設成 ByLinkView 或 Custom 時,主檔覆寫完全不作用,畫面上又看不出來。set可以改成byHostView,逐個連結獨立處理,一個失敗不影響其他list_fill_patterns材質層級與相機
get_material_graphics/set_material_graphicsshadingColor會自動關閉「使用彩現外觀」get_camera_info文件操作
list_open_documentsopen_documentsave_documentclose_documentsave=true或discardChanges=true才會關reload_linksBug 修正
get_all_materials整份查詢 crash:部分材質的 Color 未初始化,讀 Red/Green/Blue 會丟The color represents an invalid or uninitialized color,導致searchKeyword="*"整份失敗。改為單一材質取色失敗時回null,不拖垮整份清單文件同步(
a8d2c16等)工具數 211 同步到
CLAUDE.md、README.md、README.zh-TW.md、docs/DOCUMENT_AUDIENCE_INVENTORY.md、docs/BIM_MCP/**。tools-index.html每支新工具各有一張卡片。每次改動都依 Logging Protocol 記錄在log/2026-09.md。驗證
verify-qaqc.ps1 -SkipBuild -SkipDeploycheck_sanitary_fixture_requirements隔離)casetitle/readOnlyHint;destructiveHint=true仍只限既有白名單get_view_graphics_diagnostics與 Section Box 系列:R22–R26 皆 0 errors;484ff4c批次:R24 / R26 0 errors實機驗證狀態(誠實揭露)
set_3d_section_box(含includeSupportingBeams)SectionBoxActive=true、CropBoxActive=false,自動納入 7 支當層支承樑,底面涵蓋完整樑身、頂面不外擴到上一層;部署 DLL 與 build output SHA256 一致upperStructureMode、窗型係數參數get_view_graphics_diagnostics484ff4c的 14 支新工具建議 merge 前或 merge 後補上實機測試。有問題的工具我可以再追修。
🤖 Generated with Claude Code