Skip to main content
Glama
快速使用指南.md3.21 kB
# Grasshopper Tools 快速使用指南 ## 🚀 三種使用方式 ### 方式 1: 從項目根目錄(最簡單,推薦) ```powershell # 在項目根目錄下(H:\MCP\grasshopper-mcp-master\grasshopper-mcp-master) python -m grasshopper_tools.cli --help python -m grasshopper_tools.cli parse-mmd GH_WIP\component_info.mmd --action sliders python -m grasshopper_tools.cli execute-placement GH_WIP\placement_info.json ``` ### 方式 2: 使用快捷腳本 ```powershell # 切換到 grasshopper_tools 目錄 cd grasshopper_tools # 運行命令 python gh_cli.py --help python gh_cli.py parse-mmd ..\GH_WIP\component_info.mmd --action sliders python gh_cli.py execute-placement ..\GH_WIP\placement_info.json ``` ### 方式 3: 直接運行 CLI 腳本 ```powershell # 切換到 grasshopper_tools 目錄 cd grasshopper_tools # 直接運行 CLI python cli.py --help python cli.py parse-mmd ..\GH_WIP\component_info.mmd --action sliders python cli.py execute-placement ..\GH_WIP\placement_info.json ``` --- ## 📝 常用命令快速參考 ### 查看幫助 ```powershell python -m grasshopper_tools.cli --help python -m grasshopper_tools.cli <命令> --help ``` ### 解析 MMD 文件(不需要服務器) ```powershell # 解析組件和連接 python -m grasshopper_tools.cli parse-mmd GH_WIP\component_info.mmd --action components # 解析 subgraph python -m grasshopper_tools.cli parse-mmd GH_WIP\component_info.mmd --action subgraphs # 解析 slider 值 python -m grasshopper_tools.cli parse-mmd GH_WIP\component_info.mmd --action sliders ``` ### 生成和執行(需要服務器) ```powershell # 生成 placement_info.json python -m grasshopper_tools.cli generate-json GH_WIP\component_info.mmd -o GH_WIP\placement_info.json # 執行 placement_info.json python -m grasshopper_tools.cli execute-placement GH_WIP\placement_info.json ``` ### 設置參數(需要服務器) ```powershell # 設置 Slider python -m grasshopper_tools.cli set-slider --component-id SLIDER_WIDTH --value "120.0" --min 0 --max 200 # 設置 Vector XYZ python -m grasshopper_tools.cli set-vector --component-id VECTOR_LEG1 --x -50.0 --y -30.0 --z 0.0 ``` ### 查詢和連接(需要服務器) ```powershell # 查詢組件 GUID python -m grasshopper_tools.cli query-guid "Number Slider" # 連接組件 python -m grasshopper_tools.cli connect --source-id SLIDER_WIDTH --target-id DIVISION_X --source-param Number --target-param A ``` --- ## ⚠️ 路徑注意事項 ### PowerShell 路徑分隔符 - 使用反斜線 `\` 或正斜線 `/` 都可以 - 建議使用反斜線 `\`(Windows 標準) ### 相對路徑 vs 絕對路徑 - **從項目根目錄**: 使用 `python -m grasshopper_tools.cli`(推薦) - **從 grasshopper_tools 目錄**: 使用 `python gh_cli.py` 或 `python cli.py` --- ## 💡 提示 1. **如果遇到 "ModuleNotFoundError"**: - 確保在正確的目錄下運行 - 或使用絕對路徑 2. **如果文件路徑有問題**: - 使用相對路徑時,確保相對於當前工作目錄 - 或使用絕對路徑 3. **測試命令(不需要服務器)**: ```powershell python -m grasshopper_tools.cli parse-mmd GH_WIP\component_info.mmd --action sliders ```

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/AmemiyaLai/grasshopper-mcp-workflow'

If you have feedback or need assistance with the MCP directory API, please join our Discord server