Windows support: install-path probing + platform notes
- Blender discovery adds the Windows versioned install dir (Program Files/ Blender Foundation/Blender */blender.exe); ODA adds Program Files/ODA (both still env > PATH first; shutil.which resolves .exe via PATHEXT) - README cross-platform section: pathlib + explicit UTF-8 I/O + bytes-decoded subprocesses throughout; Windows advice (PYTHONUTF8=1, LongPathsEnabled, ODA as the primary DWG path since libredwg is rare there) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -39,6 +39,8 @@ tools/cad-building-showcase/SKILL.md 并遵守其中 One-Shot Definition of Done
|
||||
|
||||
**运行依赖**:Python ≥3.10 + `ezdxf`(惯例装到 `pip install --target work/vendor ezdxf`)、`shapely`、`trimesh`、`matplotlib`;Node ≥18(`tools/compress.mjs`、无原生转换器时的 WASM DWG 兜底)。可选:libredwg(`dwg2dxf` 批量转换)、ODA File Converter(坏件/天正大图兜底,脚本自动调用)、Blender(高保真渲染分支)。
|
||||
|
||||
**跨平台**:脚本全用 pathlib + 显式 UTF-8 I/O + 子进程 bytes 解码,macOS/Linux/Windows 均可跑。工具发现顺序:Blender = env `BLENDER` → PATH → 平台安装默认(macOS 应用包 / Windows `Program Files\Blender Foundation`);ODA = env `ODA_CONVERTER` → PATH → 平台默认(Windows 含 `Program Files\ODA`)。Windows 建议:设 `PYTHONUTF8=1`(防重定向输出按 GBK 解码)、开启 LongPathsEnabled(中文长文件名的深层 work/ 目录可能触及 260 字符 MAX_PATH);Windows 上 libredwg 少见,DWG 转换以 ODA 为主路径。
|
||||
|
||||
## 用法
|
||||
|
||||
入口是 `SKILL.md`(操作手册):决策循环、One-Shot Definition of Done 七条门禁、天正图层方言预设、多栋厂区流程。核心链路:
|
||||
|
||||
@@ -8,6 +8,8 @@ Blender to produce GLBs. Its manifest is consumed by write_web_showcase.py.
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
import glob
|
||||
import shutil
|
||||
import os
|
||||
import copy
|
||||
@@ -40,13 +42,17 @@ VARIANTS = [
|
||||
|
||||
|
||||
def default_blender() -> str:
|
||||
"""Blender executable: env BLENDER > PATH > macOS app-bundle default."""
|
||||
"""Blender executable: env BLENDER > PATH > platform install defaults."""
|
||||
override = os.environ.get("BLENDER")
|
||||
if override:
|
||||
return override
|
||||
found = shutil.which("blender")
|
||||
if found:
|
||||
return found
|
||||
if sys.platform == "win32":
|
||||
hits = sorted(glob.glob(r"C:/Program Files/Blender Foundation/Blender */blender.exe"))
|
||||
if hits:
|
||||
return hits[-1]
|
||||
return "/Applications/Blender.app/Contents/MacOS/Blender"
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import glob
|
||||
import fnmatch
|
||||
import json
|
||||
import os
|
||||
@@ -93,6 +94,13 @@ def oda_converter() -> str | None:
|
||||
found = shutil.which("ODAFileConverter")
|
||||
if found:
|
||||
return found
|
||||
if sys.platform == "win32":
|
||||
hits = sorted(
|
||||
glob.glob(r"C:/Program Files/ODA/*/ODAFileConverter.exe")
|
||||
+ glob.glob(r"C:/Program Files (x86)/ODA/*/ODAFileConverter.exe")
|
||||
)
|
||||
if hits:
|
||||
return hits[-1]
|
||||
default = Path("/Applications/ODAFileConverter.app/Contents/MacOS/ODAFileConverter")
|
||||
return str(default) if default.exists() else None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user