feat: P0-7 玻璃装饰格条设计器(8风格/2D+3D渲染/算料计价)

This commit is contained in:
HHY
2026-09-25 03:38:18 -07:00
parent 40c16d56a1
commit 5fe6608ae1
10 changed files with 888 additions and 8 deletions
+15 -1
View File
@@ -92,6 +92,20 @@ def takeoff(dd) -> TakeoffResult:
# 玻璃面积(重放后各窗格之和)
result.glass_area_m2 += sum(_shoelace_area(r) for r in region_pts) / 1_000_000
# 装饰格条(自研 decs 扩展): 横条=区域宽×rows, 竖条=区域高×cols
for dec in (shape.get("decs") or []):
if not isinstance(dec, dict):
continue
ri = int(dec.get("ri", -1))
if not (0 <= ri < len(regions)):
continue
bb = region_bbs[ri]
rows, cols = int(dec.get("rows", 0) or 0), int(dec.get("cols", 0) or 0)
if rows:
result.bars.append(BarItem("dec_bar", round(bb[2] - bb[0]), rows, "格条-横"))
if cols:
result.bars.append(BarItem("dec_bar", round(bb[3] - bb[1]), cols, "格条-竖"))
# 扇框
for sub in (shape.get("sm") or []):
bd = sub.get("bd") if isinstance(sub, dict) else None
@@ -153,7 +167,7 @@ def quote(drawing: str | dict, prices: dict | None = None, scripts: dict | None
"""
from huamenchuang.services.formula import FormulaError, eval_formula
p = {"frame": 45, "mullion": 40, "sash": 50, "glass": 120, "hardware": 180}
p = {"frame": 45, "mullion": 40, "sash": 50, "glass": 120, "hardware": 180, "dec_bar": 12}
if prices:
p.update(prices)