update docs workflow
This commit is contained in:
parent
ed1009fd15
commit
5f1f77add9
2 changed files with 34 additions and 20 deletions
12
.github/workflows/build-docs.yml
vendored
12
.github/workflows/build-docs.yml
vendored
|
|
@ -24,15 +24,14 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Setup bun
|
- name: Setup Node
|
||||||
uses: oven-sh/setup-bun@v2
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
bun-version: latest
|
node-version: '22'
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: bun install
|
run: npm ci
|
||||||
- name: Build docs
|
- name: Build docs
|
||||||
run:
|
run: npm run docs-build
|
||||||
bun docs-build
|
|
||||||
- name: Setup Pages
|
- name: Setup Pages
|
||||||
uses: actions/configure-pages@v5
|
uses: actions/configure-pages@v5
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
|
|
@ -43,4 +42,3 @@ jobs:
|
||||||
- name: Deploy to GitHub Pages
|
- name: Deploy to GitHub Pages
|
||||||
id: deployment
|
id: deployment
|
||||||
uses: actions/deploy-pages@v4
|
uses: actions/deploy-pages@v4
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
# DXF Import Implementation Review
|
# DXF Import Implementation Review
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
Added DXF import functionality to complement the existing DXF export feature, following the same architecture as SVG import.
|
Added DXF import functionality to complement the existing DXF export feature, following the same architecture as SVG import.
|
||||||
|
|
||||||
## Implementation Summary
|
## Implementation Summary
|
||||||
|
|
@ -28,6 +29,7 @@ Added DXF import functionality to complement the existing DXF export feature, fo
|
||||||
### Export Format (from `src/kiri/mode/laser/init-work.js`)
|
### Export Format (from `src/kiri/mode/laser/init-work.js`)
|
||||||
|
|
||||||
The existing `exportDXF()` function generates:
|
The existing `exportDXF()` function generates:
|
||||||
|
|
||||||
```dxf
|
```dxf
|
||||||
0
|
0
|
||||||
SECTION
|
SECTION
|
||||||
|
|
@ -58,12 +60,14 @@ ENDSEC
|
||||||
### Import Implementation Compatibility
|
### Import Implementation Compatibility
|
||||||
|
|
||||||
✅ **Fully Compatible** with exported format:
|
✅ **Fully Compatible** with exported format:
|
||||||
|
|
||||||
- Parses POLYLINE entities with VERTEX sub-entities
|
- Parses POLYLINE entities with VERTEX sub-entities
|
||||||
- Reads group code 70 (closed flag)
|
- Reads group code 70 (closed flag)
|
||||||
- Reads group codes 10, 20, 30 (X, Y, Z coordinates)
|
- Reads group codes 10, 20, 30 (X, Y, Z coordinates)
|
||||||
- Handles SEQEND terminator
|
- Handles SEQEND terminator
|
||||||
|
|
||||||
✅ **Additional Entity Support**:
|
✅ **Additional Entity Support**:
|
||||||
|
|
||||||
- LWPOLYLINE (modern compact format)
|
- LWPOLYLINE (modern compact format)
|
||||||
- LINE (simple two-point segments)
|
- LINE (simple two-point segments)
|
||||||
- CIRCLE (converted to polygon)
|
- CIRCLE (converted to polygon)
|
||||||
|
|
@ -74,23 +78,27 @@ ENDSEC
|
||||||
### Entity Parsing
|
### Entity Parsing
|
||||||
|
|
||||||
#### POLYLINE (Traditional Format)
|
#### POLYLINE (Traditional Format)
|
||||||
|
|
||||||
- Uses VERTEX sub-entities for each point
|
- Uses VERTEX sub-entities for each point
|
||||||
- Flag 70 bit 0: closed (1) or open (0)
|
- Flag 70 bit 0: closed (1) or open (0)
|
||||||
- Group codes: 10=X, 20=Y, 30=Z
|
- Group codes: 10=X, 20=Y, 30=Z
|
||||||
- Terminated by SEQEND
|
- Terminated by SEQEND
|
||||||
|
|
||||||
#### LWPOLYLINE (Lightweight Format)
|
#### LWPOLYLINE (Lightweight Format)
|
||||||
|
|
||||||
- Direct vertex coordinates (no VERTEX entities)
|
- Direct vertex coordinates (no VERTEX entities)
|
||||||
- More compact than POLYLINE
|
- More compact than POLYLINE
|
||||||
- Flag 70 bit 0: closed/open
|
- Flag 70 bit 0: closed/open
|
||||||
- **Limitation**: Bulge values (arcs) not yet supported
|
- **Limitation**: Bulge values (arcs) not yet supported
|
||||||
|
|
||||||
#### LINE
|
#### LINE
|
||||||
|
|
||||||
- Simple two-point entity
|
- Simple two-point entity
|
||||||
- Group codes: 10,20,30 = start, 11,21,31 = end
|
- Group codes: 10,20,30 = start, 11,21,31 = end
|
||||||
- Always treated as open polyline
|
- Always treated as open polyline
|
||||||
|
|
||||||
#### CIRCLE
|
#### CIRCLE
|
||||||
|
|
||||||
- Center point (10,20,30) + radius (40)
|
- Center point (10,20,30) + radius (40)
|
||||||
- Converted to polygon based on segment size
|
- Converted to polygon based on segment size
|
||||||
- **Default**: 1mm segments (e.g., 10mm radius circle = ~63 segments)
|
- **Default**: 1mm segments (e.g., 10mm radius circle = ~63 segments)
|
||||||
|
|
@ -98,6 +106,7 @@ ENDSEC
|
||||||
- Calculation: `segments = max(minSegments, ceil(2πr / segmentSize))`
|
- Calculation: `segments = max(minSegments, ceil(2πr / segmentSize))`
|
||||||
|
|
||||||
#### ARC
|
#### ARC
|
||||||
|
|
||||||
- Center (10,20,30) + radius (40)
|
- Center (10,20,30) + radius (40)
|
||||||
- Start angle (50) and end angle (51) in degrees
|
- Start angle (50) and end angle (51) in degrees
|
||||||
- Converted to polyline based on segment size
|
- Converted to polyline based on segment size
|
||||||
|
|
@ -138,7 +147,7 @@ Load into scene
|
||||||
✅ **Line Ending Handling**: Normalizes \r\n, \r, \n
|
✅ **Line Ending Handling**: Normalizes \r\n, \r, \n
|
||||||
✅ **Whitespace**: Trims all lines (handles varying spacing in group codes)
|
✅ **Whitespace**: Trims all lines (handles varying spacing in group codes)
|
||||||
✅ **Bounds Checking**: Prevents index out of bounds errors
|
✅ **Bounds Checking**: Prevents index out of bounds errors
|
||||||
✅ **Empty Entity Skip**: Ignores entities with < 2 points
|
✅ **Empty Entity Skip**: Ignores entities with fewer than 2 points
|
||||||
✅ **Default Values**: Safe defaults for missing Z coordinates
|
✅ **Default Values**: Safe defaults for missing Z coordinates
|
||||||
✅ **Error Handling**: Try/catch in parseAsync wrapper
|
✅ **Error Handling**: Try/catch in parseAsync wrapper
|
||||||
|
|
||||||
|
|
@ -231,6 +240,7 @@ The DXF import dialog provides the following options:
|
||||||
## Comparison with SVG Import
|
## Comparison with SVG Import
|
||||||
|
|
||||||
### Similarities
|
### Similarities
|
||||||
|
|
||||||
- Both use polygon-based pipeline
|
- Both use polygon-based pipeline
|
||||||
- Both support nesting for holes
|
- Both support nesting for holes
|
||||||
- Both extrude 2D to 3D
|
- Both extrude 2D to 3D
|
||||||
|
|
@ -239,7 +249,7 @@ The DXF import dialog provides the following options:
|
||||||
### Differences
|
### Differences
|
||||||
|
|
||||||
| Feature | SVG Import | DXF Import |
|
| Feature | SVG Import | DXF Import |
|
||||||
|---------|-----------|------------|
|
| -------------- | ---------------------- | --------------------- |
|
||||||
| Parser | THREE.SVGLoader | Custom implementation |
|
| Parser | THREE.SVGLoader | Custom implementation |
|
||||||
| Dependency | three.js library | None (pure JS) |
|
| Dependency | three.js library | None (pure JS) |
|
||||||
| Arc Resolution | User-configurable | Fixed algorithm |
|
| Arc Resolution | User-configurable | Fixed algorithm |
|
||||||
|
|
@ -250,6 +260,7 @@ The DXF import dialog provides the following options:
|
||||||
## Code Quality
|
## Code Quality
|
||||||
|
|
||||||
### Strengths
|
### Strengths
|
||||||
|
|
||||||
✅ Follows existing architecture patterns
|
✅ Follows existing architecture patterns
|
||||||
✅ No external dependencies
|
✅ No external dependencies
|
||||||
✅ Clear, readable code with comments
|
✅ Clear, readable code with comments
|
||||||
|
|
@ -257,6 +268,7 @@ The DXF import dialog provides the following options:
|
||||||
✅ Consistent with SVG import style
|
✅ Consistent with SVG import style
|
||||||
|
|
||||||
### Areas for Improvement
|
### Areas for Improvement
|
||||||
|
|
||||||
⚠️ No comprehensive unit tests yet
|
⚠️ No comprehensive unit tests yet
|
||||||
⚠️ Could add SPLINE support for advanced CAD
|
⚠️ Could add SPLINE support for advanced CAD
|
||||||
⚠️ Could expose layer information to UI
|
⚠️ Could expose layer information to UI
|
||||||
|
|
@ -265,12 +277,14 @@ The DXF import dialog provides the following options:
|
||||||
## Security Considerations
|
## Security Considerations
|
||||||
|
|
||||||
✅ **Safe Parsing**:
|
✅ **Safe Parsing**:
|
||||||
|
|
||||||
- No `eval()` or code execution
|
- No `eval()` or code execution
|
||||||
- No file system access
|
- No file system access
|
||||||
- Bounds checking prevents array overflow
|
- Bounds checking prevents array overflow
|
||||||
- String operations only (no binary exploits)
|
- String operations only (no binary exploits)
|
||||||
|
|
||||||
✅ **Input Validation**:
|
✅ **Input Validation**:
|
||||||
|
|
||||||
- parseFloat() for numeric values (NaN-safe)
|
- parseFloat() for numeric values (NaN-safe)
|
||||||
- Trim whitespace (prevents injection)
|
- Trim whitespace (prevents injection)
|
||||||
- Length checks before array access
|
- Length checks before array access
|
||||||
|
|
@ -278,11 +292,13 @@ The DXF import dialog provides the following options:
|
||||||
## Performance
|
## Performance
|
||||||
|
|
||||||
**Expected Performance**:
|
**Expected Performance**:
|
||||||
- Small files (<100 entities): <10ms
|
|
||||||
- Medium files (100-1000 entities): <100ms
|
- Small files (fewer than 100 entities): under 10ms
|
||||||
- Large files (1000-10000 entities): <1s
|
- Medium files (100-1000 entities): under 100ms
|
||||||
|
- Large files (1000-10000 entities): under 1s
|
||||||
|
|
||||||
**Optimization Opportunities**:
|
**Optimization Opportunities**:
|
||||||
|
|
||||||
- Could use worker thread for large files
|
- Could use worker thread for large files
|
||||||
- Could stream parse (currently loads entire file)
|
- Could stream parse (currently loads entire file)
|
||||||
- Could skip unknown entities faster (regex match)
|
- Could skip unknown entities faster (regex match)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue