Files
Aislo/B09_Estimation/draft/B09_Draft_Print_Drawings_Node.ts
T
eomsangdonandClaude Opus 5.5 f4889352f9 feat(b09-print): 인쇄 미리보기 도면 PDF — B07 도면 + 구조물 조합 도면 · 도각 크기 쪽 · 숨긴 층 뺌 · 벡터 · 한글 (302-2)
- 길 = GET /api/projects/{id}/print/drawings · POST /api/projects/{id}/print/drawings-pdf {ids?} (draft 라우터 · 로그인 · 회사 · 프로젝트 권한 스스로)
- 차례 = B07 도면번호 → 구조물 조합 도면(도번 차례 · 도번마다 한 번 · 더한장)
- B07 = B07 단건 조회 그대로(확정본 · 미확정 조립) · 미확정 횡단 장 구조물 = 화면 TS 를 서버 Node 로(번들 tmp · package.json 안 건드림)
- 쪽 = 도각 양식 실치수(A1 840×594) · 색 = openwebcad 밝은 바탕 규칙 · 글 = 맑은 고딕 심음(subset) · 그림 = data URL 넣음 · 못 넣은 수 = 응답 머리
- 화면 쪽 = fetchDrawingList · fetchDrawingsPdf(약속 꼴) · skippedImagesOf
- requirements = PyMuPDF · ezdxf

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013QyNXY2TUKXCFMwAca2APG
2026-10-13 08:01:47 +09:00

35 lines
1.8 KiB
TypeScript

/* =============================================================================
* B09_Draft_Print_Drawings_Node.ts
* 인쇄 미리보기 도면(PLAN 302-2) — 미확정 횡단 장에 구조물을 얹는 Node 진입점(CLAUDE.md 5장 ②).
*
* B07 화면이 미확정 장을 열 때 얹는 것과 **같은 코드**(`placeStructureEntities`)를 서버에서 돌린다.
* 입력 상세 = 정본(`get_section_detail`) — 화면 캐시의 저장 안 한 편집은 안 실림(인쇄 = 저장본).
*
* 실행: node <번들> <입력.json> <출력.json>
* 입력 { detail: 종횡단 상세, drawings: { [도면 id]: CAD 도면 } }
* 출력 { drawings: { [도면 id]: 구조물을 얹은 CAD 도면 } }
* 끝 코드: 0 성공 / 2 인자 오류
* ========================================================================== */
import { readFileSync, writeFileSync } from "node:fs";
import type { SectionDetailResponse } from "../../B06_Section/B06_Section_Api_Fetch";
import "../../B07_DesignDetail/B07_DesignDetail_Node_Dom"; // 최소 DOM — 그리기 코드보다 먼저
import { placeStructureEntities } from "../../B07_DesignDetail/B07_DesignDetail_Cross_Overlay";
type Drawing = Parameters<typeof placeStructureEntities>[1];
const [inputPath, outputPath] = process.argv.slice(2);
if (!inputPath || !outputPath) {
console.error("사용법: node <번들> <입력.json> <출력.json>");
process.exit(2);
}
const input = JSON.parse(readFileSync(inputPath, "utf8")) as {
detail?: SectionDetailResponse;
drawings?: Record<string, Drawing>;
};
const sections = input.detail?.cross_sections ?? [];
const drawings = input.drawings ?? {};
for (const drawing of Object.values(drawings)) placeStructureEntities(sections, drawing);
writeFileSync(outputPath, JSON.stringify({ drawings }), "utf8");