Skip to main content

@magistr/jscad-stl-slicer

v2026.04.04.2

STL slicer — Z-plane slicing, orthographic projection, symmetry analysis, feature detection, mesh comparison

Labels

cadjscadstlanalysis

Contents

Install

$ swamp extension pull @magistr/jscad-stl-slicer

@magistr/jscad-stl-slicerv2026.04.04.2jscad_stl_slicer.ts
sliceFileSlice an STL file at an absolute path and produce cross-section SVG
ArgumentTypeDescription
filePathstring
sliceZ?number
referenceWidthMm?number
referenceDepthMm?number
sixViewsFile6-view orthographic drawing from an STL file, optionally overlaying a reference STL
ArgumentTypeDescription
filePathstring
refHnumberReference height in mm for title
refWnumberReference width in mm for title
refPath?stringAbsolute path to reference STL for overlay
sixViews6-view orthographic drawing from a @magistr/jscad-cad model, optionally overlaying a reference STL
ArgumentTypeDescription
cadModelNamestring
refHnumber
refWnumber
refPath?stringAbsolute path to reference STL for overlay
analyzePCA-based rotation-invariant analysis: principal axes, profile extraction, symmetry detection
ArgumentTypeDescription
filePathstring
sliceCountnumber
analyzeSymmetryPer-axis mirror symmetry analysis — identifies symmetric and asymmetric axes
ArgumentTypeDescription
filePathstring
thresholdnumberSymmetry score threshold (0-1)
extractDirectionalProfileExtract a profile along a specified axis, measuring extent along another axis
ArgumentTypeDescription
filePathstring
sliceCountnumber
detectFeaturesDetect asymmetric feature regions (protrusions beyond the body envelope)
ArgumentTypeDescription
filePathstring
sliceCountnumber
multiSliceCross-section analysis at multiple heights with separate width and depth
ArgumentTypeDescription
filePathstring
sliceCountnumber
decomposeDecompose a reference STL into features (body, tube, loop, platform) and generate a JSCAD script
ArgumentTypeDescription
filePathstring
sliceCountnumber
surfaceDistanceCompute RMS surface distance between two STL meshes (Hausdorff, mean, percentiles)
ArgumentTypeDescription
refPathstring
modelPathstring
sampleCountnumber
extractSkeletonExtract centerline skeleton of tubular features (spouts, handles) from an STL
ArgumentTypeDescription
filePathstring
sliceCountnumber
generateScriptGenerate a JSCAD script that reproduces a reference STL using polynomial profiles and directional extents
ArgumentTypeDescription
filePathstring
sliceCountnumber
fitProfilesFit polynomials to body profile curves — returns coefficients for xRadius, dP, dN vs normalized height
ArgumentTypeDescription
filePathstring
sliceCountnumber
maxDegreenumber
targetErrornumberMax acceptable error in mm
extractContoursExtract actual cross-section contour points at multiple heights along an axis
ArgumentTypeDescription
filePathstring
sliceCountnumber
pointsPerSlicenumber
compareFilesPCA-based rotation-invariant comparison of two STL files
ArgumentTypeDescription
refPathstring
modelPathstring
compareModelsPCA-based comparison: reference STL file vs @magistr/jscad-cad model output
ArgumentTypeDescription
refPathstring
cadModelNamestring
enhancedCompareFilesCombined PCA + aligned AABB + symmetry comparison of two STL files
ArgumentTypeDescription
refPathstring
modelPathstring
enhancedCompareModelsCombined PCA + aligned AABB + symmetry comparison: reference STL vs @magistr/jscad-cad model
ArgumentTypeDescription
refPathstring
cadModelNamestring

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