Give startSketchAt a 3D artifact (#65)

* Give startSketchAt a 3D artifact

* fix tests

* refactor start geo to be in the start property

* small tweak
This commit is contained in:
Kurt Hutten
2023-03-17 08:27:40 +11:00
committed by GitHub
parent d73003e3fd
commit c11e7e7fd3
9 changed files with 113 additions and 29 deletions

View File

@ -35,7 +35,10 @@ export const segLen: InternalFn = (
function segEndFactory(which: 'x' | 'y'): InternalFn {
return (_, segName: string, sketchGroup: SketchGroup): number => {
const line = sketchGroup?.value.find((seg) => seg.name === segName)
const line =
sketchGroup.start?.name === segName
? sketchGroup.start
: sketchGroup?.value.find((seg) => seg.name === segName)
// maybe this should throw, but the language doesn't have a way to handle errors yet
if (!line) return 0
return which === 'x' ? line.to[0] : line.to[1]