- 까닭: 새로 만든 장은 서버 · CAD 걸름 모두 원지반이 잡힘 — 안 잡힌 것은 180-1 앞에 원지반 층 잠금째 저장된 확정 장 또는 반영 전 서버 · 페이지 메모리의 옛 도면
- 확정 장을 열 때 원지반 층 잠금 풂 · 측점 층 없는 확정 장은 stale_layers 안내([수정] 때 새 꼴)
- 장의 측점마다 층 하나(b08-station-{측점} · 「횡단 No.3」) = 원지반 · 계획선 · 구조물 · 암 그림(자식 선까지) · 종류는 색 · 선 꼴 · 표 · 글은 수량표 층 · 종류 층 지움
- 개체 id · groupId 그대로 · placement 에 layer_id · design_ids — 화면 덧그림도 측점 층 · 서버 설계선은 id 로 걷음
- DXF 층 이름 = 측점 층 id
- 새 시험 test_212 · 174 · 180 · 180_2 원지반 찾기를 색으로
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TNMXVCZXMpHpVvqmFkeChL
89 lines
3.2 KiB
Python
89 lines
3.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""180-1 B07 횡단 장 — 원지반선 고르기 · 측점 한 벌 groupId.
|
|
|
|
못박는 것
|
|
- 횡단 장 · 측점 한 장의 원지반 층은 안 잠김(종단은 그대로 잠김).
|
|
- 측점마다 groupId 하나(원지반 · 계획선 · 표 · 글 전부) · 측점끼리 다름.
|
|
- 칸 격자선 · 도각엔 groupId 없음.
|
|
- cross_placements 의 group_id = 그 측점 엔티티 값(화면 덧그림이 같은 묶음).
|
|
"""
|
|
|
|
from B07_DesignDetail.B07_DesignDetail_Engine_Cad import (
|
|
FRAME_LAYER_ID,
|
|
GROUND_COLOR,
|
|
GROUND_LAYER_ID,
|
|
build_cross_drawing,
|
|
)
|
|
from B07_DesignDetail.B07_DesignDetail_Engine_Cad_Sheet import (
|
|
build_cross_sheet,
|
|
plan_cross_sheets,
|
|
)
|
|
from B07_DesignDetail.B07_DesignDetail_Engine_Template import use_project_templates
|
|
|
|
|
|
def _source(chainage: float) -> dict:
|
|
return {
|
|
"chainage_m": chainage,
|
|
"samples": [
|
|
{"valid": True, "offset_m": float(x), "elevation_m": 100.0 + 0.1 * x}
|
|
for x in range(-5, 6)
|
|
],
|
|
}
|
|
|
|
|
|
def _design_line() -> list[dict]:
|
|
return [{"offset_m": x, "elevation_m": 100.0} for x in (-3.0, 0.0, 3.0)]
|
|
|
|
|
|
def _drawing() -> dict:
|
|
use_project_templates(None)
|
|
chainages = [0.0, 20.0, 40.0, 60.0]
|
|
sheet = plan_cross_sheets(chainages, {"default": [2, 2]})[0]
|
|
sections = [
|
|
{
|
|
"chainage": c,
|
|
"source": _source(c),
|
|
"design_line": _design_line(),
|
|
"design": {"structure_note": "L형 측구"},
|
|
"quantity_table": {"ground": 1.0, "planned": 0.5},
|
|
"title": f"No.{int(c // 20)}",
|
|
}
|
|
for c in chainages
|
|
]
|
|
return build_cross_sheet(sheet, sections)
|
|
|
|
|
|
def _ground_locked(drawing: dict) -> bool:
|
|
return next(layer for layer in drawing["layers"] if layer["id"] == GROUND_LAYER_ID)["isLocked"]
|
|
|
|
|
|
def test_원지반_층_안_잠김() -> None:
|
|
# 장 = 원지반이 측점 층에(212-2) · 도각 말고 잠긴 층 없음
|
|
layers = _drawing()["layers"]
|
|
assert not any(layer["isLocked"] for layer in layers if layer["id"] != FRAME_LAYER_ID)
|
|
single = build_cross_drawing(_source(0.0), "cross_00000m", _design_line(), None, None, "")
|
|
assert _ground_locked(single) is False
|
|
|
|
|
|
def test_측점마다_groupId_하나() -> None:
|
|
drawing = _drawing()
|
|
placements = drawing["cross_placements"]
|
|
assert len(placements) == 4
|
|
group_ids = [p["group_id"] for p in placements]
|
|
assert len(set(group_ids)) == 4 # 측점끼리 다름
|
|
grouped = [e for e in drawing["entities"] if "groupId" in e]
|
|
assert {e["groupId"] for e in grouped} == set(group_ids)
|
|
for group_id in group_ids:
|
|
members = [e for e in grouped if e["groupId"] == group_id]
|
|
types = {e["type"] for e in members}
|
|
ground = any(e["type"] == "PolyLine" and e["lineColor"] == GROUND_COLOR for e in members)
|
|
assert ground and "Table" in types and "Text" in types
|
|
# 격자선 · 도각은 묶지 않음
|
|
assert all("groupId" not in e for e in drawing["entities"] if e["layerId"] == FRAME_LAYER_ID)
|
|
assert all(e["layerId"] != FRAME_LAYER_ID for e in grouped)
|
|
|
|
|
|
def test_groupId_결정적() -> None:
|
|
first = [p["group_id"] for p in _drawing()["cross_placements"]]
|
|
assert first == [p["group_id"] for p in _drawing()["cross_placements"]]
|