Files
minsungandClaude Opus 5 ce3859c487 docs: ship the acadrust MPL-2.0 notice, license text and local patch
The deployed site serves a .wasm with acadrust compiled into it, and our
vendored copy carries one modified MPL file
(src/io/dwg/dwg_stream_readers/object_reader/entities.rs, the read_mesh
array-count bounds fix). That is Executable Form distribution of modified
Covered Software, so MPL-2.0 3.2 requires the Source Code Form to be
available and recipients to be told how to get it. Nothing shipped said
so: no license text, no notice, no obtainable source - the upstream
mirror repos are private.

Add THIRD-PARTY-NOTICES.md plus public/licenses/ (MPL-2.0 text, the
read_mesh patch against the pristine 0.4.1 crate, and a served copy of
the notice), and link them from the page so recipients can actually find
them. Original crate download plus the patch reproduces the exact source
compiled into the wasm.

MPL does not require upstreaming, and the lineweight work did not touch
any MPL file - dwg-wasm/src/lib.rs is our MIT wrapper. docs/license-mpl2-
acadrust.md records the analysis and the checklist for future changes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-04 17:59:10 +09:00

136 lines
4.5 KiB
Markdown

# dwg-dxf-viewer-sample
**hmwebviewer 형제 폴더**에 분리된 DWG/DXF 2D 뷰어 샘플입니다.
`docs/modules-dwg-dxf.html` 모듈 지도의 카드
(`acadrust-dwg`, `dxf-parser`, `Viewer2D` …)를 **직접 조합**해 동작하는 독립 프로젝트입니다.
`hmwebviewer` 저장소 안에 의존하지 않습니다.
```
D:\MYCLAUDE_PROJECT\
hmwebviewer\ ← 본 제품
dwg-dxf-viewer-sample\ ← 이 샘플 (형제)
```
---
## 실행
```bash
cd D:\MYCLAUDE_PROJECT\dwg-dxf-viewer-sample
npm install
npm run dev
# → http://localhost:5173
```
| UI | 모듈 경로 |
|----|-----------|
| **Sample DWG** | `ext2d`**acadrust-dwg WASM**`Viewer2D` |
| **Sample DXF** | `ext2d`**dxf-parser + hatch + adapter**`Viewer2D` |
| 파일 드롭 / Open | 확장자로 위 둘 중 하나 |
모듈 지도: 브라우저에서 [`docs/modules-dwg-dxf.html`](./docs/modules-dwg-dxf.html)
조합 코드: [`src/main.ts`](./src/main.ts)
---
## 레이아웃
```
dwg-dxf-viewer-sample/
docs/modules-dwg-dxf.html # 모듈 조합 레시피 HTML
public/
fonts/NanumGothic-Regular.ttf
samples/BasicSample.dwg
samples/simple.dxf
src/
main.ts # 모듈을 import 해서 조립
viewer2d/ # 재사용 모듈 본체
acadrust-dwg/ # WASM
Viewer2D.js
dwgParser.ts
parseDxf.ts
dxfAdapter.js
dxfHatchHandler.js
ext2d.ts
slugText.ts
package.json
vite.config.ts
```
---
## 조합 파이프라인
```
File/URL
→ ext2d (isDwg / isDxf)
→ parseDwgBuffer | parseDxfBuffer
│ │
└ acadrust-dwg ├ decodeDxf
├ dxf-parser + dxfHatchHandler
└ dxfAdapter
→ CadParseResult
→ Viewer2D.load() (+ three, slugText/font)
```
---
## 의존성
| 패키지 | 역할 |
|--------|------|
| `three` | WebGL 렌더 / OrbitControls |
| `dxf-parser` | DXF 텍스트 파싱 |
| `opentype.js` | TTF 글리프 (slugText) |
WASM(`acadrust_dwg_bg.wasm`)은 `src/viewer2d/acadrust-dwg/` 에 포함되어 있으며
Vite `?url` import 로 로드됩니다.
---
## 다른 앱에 이식
1. `src/viewer2d/` 폴더 복사
2. `npm i three dxf-parser opentype.js`
3. 폰트 `public/fonts/NanumGothic-Regular.ttf`
4. Vite: `assetsInclude: ['**/*.wasm']`
5. `src/main.ts` 의 ①~④ 블록을 호스트에 붙이고 ⑤ UI만 교체
소스 동기화(선택): 본가 `hmwebviewer/src/viewer2d` 가 업데이트되면 해당 파일을
이 프로젝트 `src/viewer2d` 로 다시 복사하면 됩니다.
---
## 알려진 이슈 / 원본 반영 메모
| 이슈 | 문서 |
|------|------|
| 구형 한글 DWG TEXT 깨짐 (CP949→Latin-1 mojibake) | [`docs/korean-dwg-text-encoding.md`](./docs/korean-dwg-text-encoding.md) |
| Model + Paper 동시 렌더로 글자 겹침 / Layout 탭 | [`docs/model-paper-space.md`](./docs/model-paper-space.md) |
| `dist2` 정적 빌드 배포 절차 (공식 배포 스크립트 없음) | [`docs/deploy-dist2-static-build.md`](./docs/deploy-dist2-static-build.md) |
| SubDMesh(MESH) 미표시 — parseResult 누락 + 큰 메쉬 잘림 | [`docs/subdmesh-rendering.md`](./docs/subdmesh-rendering.md) |
| 선가중치(Lineweight) 미적용 — parseResult 누락 + WebGL 1px 한계 | [`docs/lineweight-rendering.md`](./docs/lineweight-rendering.md) |
| acadrust MPL-2.0 고지 누락 (수정본 wasm 공개 배포) | [`docs/license-mpl2-acadrust.md`](./docs/license-mpl2-acadrust.md) |
| ↳ 위 둘의 측정 결과 + 상호작용(메쉬 선분이 굵기 버킷 상한을 넘길 위험) | [`docs/improvement-results-2026-08-04.md`](./docs/improvement-results-2026-08-04.md) |
샘플 패치: `fixDwgKoreanText`, `cadSpaces` + Viewer2D 공간 필터, Model/Layout 탭.
원본 `hmwebviewer` 반영 절차는 각 문서를 따른다.
---
## 라이선스 메모
| 조각 | 라이선스 |
|------|----------|
| Viewer2D 포트 · 샘플 글루 | MIT (hmwebviewer 계열) |
| acadrust (WASM 내부, `read_mesh` 로컬 패치 포함) | **MPL-2.0 — 수정본** |
| dxf-parser · three · opentype.js | MIT |
| NanumGothic | OFL |
acadrust 는 파일 단위 카피레프트라 **패치한 파일의 소스를 배포 대상자에게 제공할 의무**가
있다. 고지·MPL 원문·패치는 [`THIRD-PARTY-NOTICES.md`](./THIRD-PARTY-NOTICES.md) 와
`public/licenses/`(배포 시 `/licenses/`)에 동봉한다.
의무 범위와 조치 근거: [`docs/license-mpl2-acadrust.md`](./docs/license-mpl2-acadrust.md)