Skip to content

Commit 3555faa

Browse files
committed
update docs workflow
1 parent 8fbc179 commit 3555faa

2 files changed

Lines changed: 34 additions & 20 deletions

File tree

.github/workflows/build-docs.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,14 @@ jobs:
2424
steps:
2525
- name: Checkout
2626
uses: actions/checkout@v4
27-
- name: Setup bun
28-
uses: oven-sh/setup-bun@v2
27+
- name: Setup Node
28+
uses: actions/setup-node@v4
2929
with:
30-
bun-version: latest
30+
node-version: '22'
3131
- name: Install dependencies
32-
run: bun install
33-
- name: Build docs
34-
run:
35-
bun docs-build
32+
run: npm ci
33+
- name: Build docs
34+
run: npm run docs-build
3635
- name: Setup Pages
3736
uses: actions/configure-pages@v5
3837
- name: Upload artifact
@@ -43,4 +42,3 @@ jobs:
4342
- name: Deploy to GitHub Pages
4443
id: deployment
4544
uses: actions/deploy-pages@v4
46-

docs/refs/DXF_IMPORT_REVIEW.md

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# DXF Import Implementation Review
22

33
## Overview
4+
45
Added DXF import functionality to complement the existing DXF export feature, following the same architecture as SVG import.
56

67
## Implementation Summary
@@ -28,6 +29,7 @@ Added DXF import functionality to complement the existing DXF export feature, fo
2829
### Export Format (from `src/kiri/mode/laser/init-work.js`)
2930

3031
The existing `exportDXF()` function generates:
32+
3133
```dxf
3234
0
3335
SECTION
@@ -58,12 +60,14 @@ ENDSEC
5860
### Import Implementation Compatibility
5961

6062
**Fully Compatible** with exported format:
63+
6164
- Parses POLYLINE entities with VERTEX sub-entities
6265
- Reads group code 70 (closed flag)
6366
- Reads group codes 10, 20, 30 (X, Y, Z coordinates)
6467
- Handles SEQEND terminator
6568

6669
**Additional Entity Support**:
70+
6771
- LWPOLYLINE (modern compact format)
6872
- LINE (simple two-point segments)
6973
- CIRCLE (converted to polygon)
@@ -74,30 +78,35 @@ ENDSEC
7478
### Entity Parsing
7579

7680
#### POLYLINE (Traditional Format)
81+
7782
- Uses VERTEX sub-entities for each point
7883
- Flag 70 bit 0: closed (1) or open (0)
7984
- Group codes: 10=X, 20=Y, 30=Z
8085
- Terminated by SEQEND
8186

8287
#### LWPOLYLINE (Lightweight Format)
88+
8389
- Direct vertex coordinates (no VERTEX entities)
8490
- More compact than POLYLINE
8591
- Flag 70 bit 0: closed/open
8692
- **Limitation**: Bulge values (arcs) not yet supported
8793

8894
#### LINE
95+
8996
- Simple two-point entity
9097
- Group codes: 10,20,30 = start, 11,21,31 = end
9198
- Always treated as open polyline
9299

93100
#### CIRCLE
101+
94102
- Center point (10,20,30) + radius (40)
95103
- Converted to polygon based on segment size
96104
- **Default**: 1mm segments (e.g., 10mm radius circle = ~63 segments)
97105
- **Minimum**: 4 segments to avoid degenerate geometry
98106
- Calculation: `segments = max(minSegments, ceil(2πr / segmentSize))`
99107

100108
#### ARC
109+
101110
- Center (10,20,30) + radius (40)
102111
- Start angle (50) and end angle (51) in degrees
103112
- Converted to polyline based on segment size
@@ -138,7 +147,7 @@ Load into scene
138147
**Line Ending Handling**: Normalizes \r\n, \r, \n
139148
**Whitespace**: Trims all lines (handles varying spacing in group codes)
140149
**Bounds Checking**: Prevents index out of bounds errors
141-
**Empty Entity Skip**: Ignores entities with < 2 points
150+
**Empty Entity Skip**: Ignores entities with fewer than 2 points
142151
**Default Values**: Safe defaults for missing Z coordinates
143152
**Error Handling**: Try/catch in parseAsync wrapper
144153

@@ -231,32 +240,35 @@ The DXF import dialog provides the following options:
231240
## Comparison with SVG Import
232241

233242
### Similarities
243+
234244
- Both use polygon-based pipeline
235245
- Both support nesting for holes
236246
- Both extrude 2D to 3D
237247
- Both have import dialogs with depth setting
238248

239249
### Differences
240250

241-
| Feature | SVG Import | DXF Import |
242-
|---------|-----------|------------|
243-
| Parser | THREE.SVGLoader | Custom implementation |
244-
| Dependency | three.js library | None (pure JS) |
245-
| Arc Resolution | User-configurable | Fixed algorithm |
246-
| DPI Setting | Yes | No (DXF is unitless) |
247-
| Curve Types | Bezier, arcs, ellipses | Lines, arcs, circles |
248-
| Y-Axis | Inverted (SVG quirk) | Standard (CAD) |
251+
| Feature | SVG Import | DXF Import |
252+
| -------------- | ---------------------- | --------------------- |
253+
| Parser | THREE.SVGLoader | Custom implementation |
254+
| Dependency | three.js library | None (pure JS) |
255+
| Arc Resolution | User-configurable | Fixed algorithm |
256+
| DPI Setting | Yes | No (DXF is unitless) |
257+
| Curve Types | Bezier, arcs, ellipses | Lines, arcs, circles |
258+
| Y-Axis | Inverted (SVG quirk) | Standard (CAD) |
249259

250260
## Code Quality
251261

252262
### Strengths
263+
253264
✅ Follows existing architecture patterns
254265
✅ No external dependencies
255266
✅ Clear, readable code with comments
256267
✅ Proper error handling
257268
✅ Consistent with SVG import style
258269

259270
### Areas for Improvement
271+
260272
⚠️ No comprehensive unit tests yet
261273
⚠️ Could add SPLINE support for advanced CAD
262274
⚠️ Could expose layer information to UI
@@ -265,24 +277,28 @@ The DXF import dialog provides the following options:
265277
## Security Considerations
266278

267279
**Safe Parsing**:
280+
268281
- No `eval()` or code execution
269282
- No file system access
270283
- Bounds checking prevents array overflow
271284
- String operations only (no binary exploits)
272285

273286
**Input Validation**:
287+
274288
- parseFloat() for numeric values (NaN-safe)
275289
- Trim whitespace (prevents injection)
276290
- Length checks before array access
277291

278292
## Performance
279293

280294
**Expected Performance**:
281-
- Small files (<100 entities): <10ms
282-
- Medium files (100-1000 entities): <100ms
283-
- Large files (1000-10000 entities): <1s
295+
296+
- Small files (fewer than 100 entities): under 10ms
297+
- Medium files (100-1000 entities): under 100ms
298+
- Large files (1000-10000 entities): under 1s
284299

285300
**Optimization Opportunities**:
301+
286302
- Could use worker thread for large files
287303
- Could stream parse (currently loads entire file)
288304
- Could skip unknown entities faster (regex match)

0 commit comments

Comments
 (0)