Jscad Stl Slicer
@magistr/jscad-stl-slicerv2026.05.25.1
01README
STL slicer — Z-plane slicing, orthographic projection, symmetry analysis, feature detection, mesh comparison
02Release Notes
Merge pull request #5 from umag/extensions/jscad-stl-pair
extensions: add 15 more @magistr extensions + auto-discover CI
03Models
@magistr/jscad-stl-slicerv2026.05.25.1jscad_stl_slicer.ts
fn sliceFile(filePath: string, sliceZ?: number, referenceWidthMm?: number, referenceDepthMm?: number)
Slice an STL file at an absolute path and produce cross-section SVG
| Argument | Type | Description |
|---|---|---|
| filePath | string | |
| sliceZ? | number | |
| referenceWidthMm? | number | |
| referenceDepthMm? | number |
fn sixViewsFile(filePath: string, refH: number, refW: number, refPath?: string)
6-view orthographic drawing from an STL file, optionally overlaying a reference STL
| Argument | Type | Description |
|---|---|---|
| filePath | string | |
| refH | number | Reference height in mm for title |
| refW | number | Reference width in mm for title |
| refPath? | string | Absolute path to reference STL for overlay |
fn sixViews(cadModelName: string, refH: number, refW: number, refPath?: string)
6-view orthographic drawing from a @magistr/jscad-cad model, optionally overlaying a reference STL
| Argument | Type | Description |
|---|---|---|
| cadModelName | string | |
| refH | number | |
| refW | number | |
| refPath? | string | Absolute path to reference STL for overlay |
fn analyze(filePath: string, sliceCount: number)
PCA-based rotation-invariant analysis: principal axes, profile extraction, symmetry detection
| Argument | Type | Description |
|---|---|---|
| filePath | string | |
| sliceCount | number |
fn analyzeSymmetry(filePath: string, threshold: number)
Per-axis mirror symmetry analysis — identifies symmetric and asymmetric axes
| Argument | Type | Description |
|---|---|---|
| filePath | string | |
| threshold | number | Symmetry score threshold (0-1) |
fn extractDirectionalProfile(filePath: string, sliceCount: number)
Extract a profile along a specified axis, measuring extent along another axis
| Argument | Type | Description |
|---|---|---|
| filePath | string | |
| sliceCount | number |
fn detectFeatures(filePath: string, sliceCount: number)
Detect asymmetric feature regions (protrusions beyond the body envelope)
| Argument | Type | Description |
|---|---|---|
| filePath | string | |
| sliceCount | number |
fn multiSlice(filePath: string, sliceCount: number)
Cross-section analysis at multiple heights with separate width and depth
| Argument | Type | Description |
|---|---|---|
| filePath | string | |
| sliceCount | number |
fn decompose(filePath: string, sliceCount: number)
Decompose a reference STL into features (body, tube, loop, platform) and generate a JSCAD script
| Argument | Type | Description |
|---|---|---|
| filePath | string | |
| sliceCount | number |
fn surfaceDistance(refPath: string, modelPath: string, sampleCount: number)
Compute RMS surface distance between two STL meshes (Hausdorff, mean, percentiles)
| Argument | Type | Description |
|---|---|---|
| refPath | string | |
| modelPath | string | |
| sampleCount | number |
fn extractSkeleton(filePath: string, sliceCount: number)
Extract centerline skeleton of tubular features (spouts, handles) from an STL
| Argument | Type | Description |
|---|---|---|
| filePath | string | |
| sliceCount | number |
fn generateScript(filePath: string, sliceCount: number)
Generate a JSCAD script that reproduces a reference STL using polynomial profiles and directional extents
| Argument | Type | Description |
|---|---|---|
| filePath | string | |
| sliceCount | number |
fn fitProfiles(filePath: string, sliceCount: number, maxDegree: number, targetError: number)
Fit polynomials to body profile curves — returns coefficients for xRadius, dP, dN vs normalized height
| Argument | Type | Description |
|---|---|---|
| filePath | string | |
| sliceCount | number | |
| maxDegree | number | |
| targetError | number | Max acceptable error in mm |
fn extractContours(filePath: string, sliceCount: number, pointsPerSlice: number)
Extract actual cross-section contour points at multiple heights along an axis
| Argument | Type | Description |
|---|---|---|
| filePath | string | |
| sliceCount | number | |
| pointsPerSlice | number |
fn compareFiles(refPath: string, modelPath: string)
PCA-based rotation-invariant comparison of two STL files
| Argument | Type | Description |
|---|---|---|
| refPath | string | |
| modelPath | string |
fn compareModels(refPath: string, cadModelName: string)
PCA-based comparison: reference STL file vs @magistr/jscad-cad model output
| Argument | Type | Description |
|---|---|---|
| refPath | string | |
| cadModelName | string |
fn enhancedCompareFiles(refPath: string, modelPath: string)
Combined PCA + aligned AABB + symmetry comparison of two STL files
| Argument | Type | Description |
|---|---|---|
| refPath | string | |
| modelPath | string |
fn enhancedCompareModels(refPath: string, cadModelName: string)
Combined PCA + aligned AABB + symmetry comparison: reference STL vs @magistr/jscad-cad model
| Argument | Type | Description |
|---|---|---|
| refPath | string | |
| cadModelName | string |
Resources
slice(infinite)— Z-plane slice result with cross-section measurements
sixViewReport(infinite)— 6-view projection measurements (front/back/left/right/top/bottom)
analysisReport(infinite)— PCA-based rotation-invariant mesh analysis
comparisonReport(infinite)— Rotation-invariant PCA comparison between two STL meshes
symmetryReport(infinite)— Per-axis mirror symmetry analysis
featureDetectionReport(infinite)— Detected asymmetric feature regions (protrusions, appendages)
surfaceDistanceReport(infinite)— RMS surface distance between two meshes (mean, RMS, Hausdorff, percentiles)
enhancedComparisonReport(infinite)— Combined PCA + aligned AABB + symmetry comparison
Files
crossSection(image/svg+xml)— SVG cross-section at the sliced Z plane
sideProfile(image/svg+xml)— SVG side profile projected onto XZ plane
sixViewSheet(image/svg+xml)— SVG 6-view engineering drawing sheet with optional reference overlay
profileData(application/json)— JSON profile curve extracted along primary axis
directionalProfile(application/json)— JSON profile curve along a specified axis with directional extents
multiSliceData(application/json)— JSON multi-height cross-section measurements with separate width and depth
04Previous Versions
2026.04.04.2Apr 4, 2026
2026.04.04.1Apr 4, 2026
05Stats
A
100 / 100
Downloads
4
Archive size
54.7 KB
- Has README or module doc2/2earned
- README has a code example1/1earned
- README is substantive1/1earned
- Most symbols documented1/1earned
- No slow types1/1earned
- Dependencies pass trust audit2/2earned
- Has description1/1earned
- Platform support declared (or universal)2/2earned
- License declared1/1earned
- Verified public repository2/2earned
Repository
https://github.com/umag/swamp-workspace06Platforms
07Labels