Skip to content

feat(featurescript): fit splines and mate connectors locally, so wire runs preview - #136

Open
AadiJo wants to merge 1 commit into
featurescript-community-scriptsfrom
featurescript-splines
Open

AadiJo wants to merge 1 commit into
featurescript-community-scriptsfrom
featurescript-splines

Conversation

@AadiJo

@AadiJo AadiJo commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

An agent asked to merge two FRC wiring FeatureScripts (a spline path plus a wire sweep) into one wrote a sensible wire-run.fs, but couldn't show a wire: the local runtime didn't support opFitSpline, and couldn't create mate connectors, the natural way to mark a motor or controller port. Every preview stopped at the spline.

  • opFitSpline: a cubic spline through points, open or closed (a repeated first point), with start, end and inner derivatives, on OpenCascade's GeomAPI_Interpolate. Without parameters, points are spaced by chord length over [0, 1], so derivatives mean what std documents. Second derivatives and a target length stop the run as unsupported rather than being ignored.
  • Mate connectors: opMateConnector makes a point body of type MATE_CONNECTOR that carries its coordinate system, evMateConnector returns it, and evVertexPoint reads its origin, as Onshape allows. Connectors don't yet follow their owner through transforms.
  • qBodyType(qEverything(...), ...) returned every body. std folds body types into the EVERYTHING query instead of wrapping it, and the evaluator ignored them, so "all solids" also returned sketch sheets, sketch wires and connectors. Found while testing connectors.

Testing

  • Splines: collinear points give the straight line (100.000 mm); a 3D spline contains its points and leaves and arrives along its derivatives; a closed spline meets itself with a continuous tangent; second derivatives and a target length are refused; one point is the feature's error.
  • A connector evaluates to its frame and origin and isn't counted as a solid.
  • qBodyType(qEverything(BODY), SOLID) next to a sketch counts one solid and one sheet.
  • All 367 package tests, including the corpus volumes, and the server's preview tests.

Stacked on #135.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant