Uniform mm-spacing spiral toolpath (Issue #22)#23
Merged
Conversation
Replace FramesPerLayer (count) with FrameSpacingMm (arc-length distance) across the model, dialog, builders, and call sites. The old normalized- parameter sampling produced uneven physical spacing whenever contour perimeters varied; the new model gives uniform bead density regardless of part shape. SpiralInterpolator rewritten around a two-step plan: build one continuous on-surface spiral curve, then walk it from bottom to top at FrameSpacingMm. Helical pitch = the user's LayerHeight (one full turn per LayerHeight of Z rise). Surface fidelity comes from two changes: re-slicing the source brep/mesh internally at 0.5 mm pitch (independent of print layer height), and sampling each contour by ray-cast from its centroid at the target spiral angle — which handles non-convex / wavy contours correctly where arc-length parameter sampling cut across the part interior. Skirt and base contours also migrated: SampleSkirtFrames and BaseBuilder now derive sample count from perimeter / spacing so every closed loop prints at consistent bead density. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
AddCurvePoints used polyline vertices for polylines and a hardcoded 2 mm step for smooth curves. Replaced with uniform DivideByLength resampling at FrameSpacingMm so layer-mode toolpaths (outer contour + bracing zigzag) print at the same bead density as the spiral. Closed curves get the duplicate seam tick trimmed so frame tangents don't degenerate at the seam. Base infill remains on vertex sampling — its U-turn corners are direction changes the robot must hit exactly, so resampling would round them off. If uniform spacing is wanted there too, that's a follow-up. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ion, dedup helpers Spiral toolpath (Issue #22): - Replace per-contour-centroid ray-cast sampler with arc-length parameter sampling. Ray-cast was correct on convex contours but short-circuited across the interior on multi-lobe / wavy non-convex shapes. Arc-length parameterization walks the actual perimeter. - Restore AlignContourDirections + AlignSeamPoints, but anchor seam alignment to a SHARED centroid (mean of all per-layer centroids) so parameter t=0 maps to the same angular column on every contour. - Add constrained lateral projection: each chord-blend sample is projected onto the brep/mesh surface, but only when the closest surface point is within LayerHeight/2 in Z. Steep walls get hugged; near-horizontal regions fall back to chord (the price of staying on a printable monotonic-Z spiral). Sinusoidal bracing: - Take an optional shared centroid for seam alignment so the cosine peaks stack vertically across layers instead of wandering. Phase stays arc-length-based so peaks remain evenly distributed along each layer's perimeter. - Panel computes the shared centroid once and passes it to both the toolpath generation loop and the preview-arrow bake. Cleanup from review pass: - Promote SpiralInterpolator.ComputeSharedCentroid to public, delete the duplicate in CCL_Clay3DPPanel. - Replace magic 10000.0 (seam ray distance) and 1e-3 (dedup tolerance) with named constants. - RefineContoursIfPossible always returns a fresh list now — callers mutate the result via Align* and must not corrupt input contour data. - Strip narration comments that just restated the code. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #22.
Summary
FramesPerLayer(count per revolution) withFrameSpacingMm(arc-length distance between consecutive frames) across the model, dialog, builders, and call sites. Sampling by mm gives uniform bead density regardless of part shape.SpiralInterpolatoraround a two-step plan: build one continuous on-surface spiral curve, then walk it bottom-to-top atFrameSpacingMm. Helical pitch = the user'sLayerHeight(one full turn perLayerHeightof Z rise).SampleSkirtFramesandBaseBuilderderive sample counts fromperimeter / spacing, so every closed loop prints at the same bead density as the spiral.FramesPerLayerkeys in existingsettings.jsonfiles are silently dropped on load (no math-correct conversion exists without per-part perimeter); the new field defaults to 10.0 mm.What got cleaned up along the way
AlignSeamPointsandAlignContourDirectionshelpers — ray-cast sampling ignores contour parameterization and winding, so both were no-ops (and used to mutate the caller's contour list as a hidden side effect).degreeparameter fromCreateSpiralCurve(always polyline now).StartAnglecomment inParameters.cs.Test plan
dotnet build -c Debug, 0 warnings / 0 errorsFollow-up (separate PR)
Dead
PrintabilityAnalyzer+PrintabilityResult+MinLayerBondRatiofield are unreferenced and would need rework for the new mm-spacing model. Flagged as a follow-up task; not in this PR.🤖 Generated with Claude Code