Merge remote-tracking branch 'origin/dev' into main_laptop_1
This commit is contained in:
@@ -19,15 +19,17 @@ ROOT = Path(__file__).resolve().parents[2]
|
||||
if str(ROOT) not in sys.path:
|
||||
sys.path.insert(0, str(ROOT))
|
||||
|
||||
from B07_DesignDetail.B07_DesignDetail_Engine_Cad_StandardFigure import ( # noqa: E402
|
||||
FIGURE_TYPE_IDS,
|
||||
SLOPE_TYPE_IDS,
|
||||
figure_reason,
|
||||
)
|
||||
from B07_DesignDetail.B07_DesignDetail_Engine_Cad_StandardSheet import ( # noqa: E402
|
||||
build_standard_drawing,
|
||||
)
|
||||
from B08_Quantity.B08_Quantity_Engine_StructureSheet import sheet_title # noqa: E402
|
||||
from B08_Quantity.B08_Quantity_Engine_StructureFigure import ( # noqa: E402
|
||||
FIGURE_TYPE_IDS,
|
||||
figure_reason,
|
||||
)
|
||||
from B08_Quantity.B08_Quantity_Engine_StructureSheet import ( # noqa: E402
|
||||
SLOPE_TYPE_IDS,
|
||||
sheet_title,
|
||||
)
|
||||
|
||||
|
||||
def _sheet(type_id: str, **options) -> dict:
|
||||
|
||||
@@ -21,7 +21,7 @@ ROOT = Path(__file__).resolve().parents[2]
|
||||
if str(ROOT) not in sys.path:
|
||||
sys.path.insert(0, str(ROOT))
|
||||
|
||||
from B07_DesignDetail.B07_DesignDetail_Engine_Cad_StandardFigure import ( # noqa: E402
|
||||
from B08_Quantity.B08_Quantity_Engine_StructureFigure import ( # noqa: E402
|
||||
build_figure,
|
||||
)
|
||||
from B08_Quantity.B08_Quantity_Engine_StructureSheet_Edit import ( # noqa: E402
|
||||
@@ -83,10 +83,7 @@ def _figure_labels(**options) -> list[str]:
|
||||
"height_m": 2.0,
|
||||
"options": {"height_m": 2.0, "back_len_cm": 45, **options},
|
||||
}
|
||||
entities, _height = build_figure(
|
||||
"d1", sheet, "layer", (0.0, 0.0), "#000000", "#111111", "#222222"
|
||||
)
|
||||
return [str((item.get("shapeData") or {}).get("label") or "") for item in entities]
|
||||
return [shape["text"] for shape in build_figure(sheet) or [] if shape["kind"] == "text"]
|
||||
|
||||
|
||||
def test_물빼기_주석이_구조물_값을_쓴다() -> None:
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
"""구조물도 상단 그림 — 그림 치수가 **수량표와 같은 한 벌**인가 (PLAN 12장).
|
||||
|
||||
⚠ 옛 B07 그림은 두께 식을 따로 적어, 상부·하부 두께를 넣어도 **그림만 옛 두께**였음.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
if str(ROOT) not in sys.path:
|
||||
sys.path.insert(0, str(ROOT))
|
||||
|
||||
from B08_Quantity.B08_Quantity_Engine_StructureFigure import ( # noqa: E402
|
||||
attach_figures,
|
||||
build_figure,
|
||||
)
|
||||
|
||||
|
||||
def _sheet(**options) -> dict:
|
||||
return {
|
||||
"title": "돌쌓기(메)",
|
||||
"type_id": "masonry_dry",
|
||||
"height_m": 2.0,
|
||||
"options": {"height_m": 2.0, **options},
|
||||
}
|
||||
|
||||
|
||||
def _paths(shapes: list[dict]) -> list[dict]:
|
||||
return [shape for shape in shapes if shape["kind"] == "path"]
|
||||
|
||||
|
||||
def _area(points: list[list[float]]) -> float:
|
||||
return abs(sum(x0 * y1 - x1 * y0 for (x0, y0), (x1, y1) in zip(points, points[1:]))) / 2
|
||||
|
||||
|
||||
def test_벽_두께는_사용자가_넣은_값을_따른다() -> None:
|
||||
wall = _paths(build_figure(_sheet(back_len_cm=35, face_slope_ratio=0.3)))[0]["points"]
|
||||
# 식: 상부 0.35+0.30=0.65 · 하부 0.65+0.30×(2−1)=0.95 · 기울기 0.3 → 앞면 위 끝 0.6
|
||||
assert wall[:4] == [[0.0, 0.0], [0.6, 2.0], [1.25, 2.0], [0.95, 0.0]]
|
||||
given = _paths(
|
||||
build_figure(
|
||||
_sheet(
|
||||
back_len_cm=35, face_slope_ratio=0.3, thickness_top_m=0.5, thickness_bottom_m=1.2
|
||||
)
|
||||
)
|
||||
)[0]["points"]
|
||||
assert given[2] == [1.1, 2.0] and given[3] == [1.2, 0.0]
|
||||
|
||||
|
||||
def test_터파기_넓이는_수량식과_같다() -> None:
|
||||
dig = _paths(build_figure(_sheet(back_len_cm=35, face_slope_ratio=0.3)))[1]
|
||||
assert dig["dash"]
|
||||
assert abs(_area(dig["points"]) - 2.0 * ((0.65 + 0.95) / 2 + 0.2)) < 1e-9
|
||||
|
||||
|
||||
def test_못_그리는_장은_그림_대신_까닭이_실린다() -> None:
|
||||
payload = {
|
||||
"sheets": [
|
||||
_sheet(),
|
||||
{**_sheet(stone_cm="60~80"), "type_id": "boulder_masonry"},
|
||||
_sheet(back_len_cm=45),
|
||||
]
|
||||
}
|
||||
attach_figures(payload)
|
||||
no_back, boulder, drawn = payload["sheets"]
|
||||
assert no_back["figure"] is None and "뒷길이" in no_back["figure_reason"]
|
||||
assert boulder["figure"] is None and "직경" in boulder["figure_reason"]
|
||||
assert drawn["figure_reason"] is None and drawn["figure"]
|
||||
Reference in New Issue
Block a user