From 544871e5795751d640487a1824ad238c4de5821f Mon Sep 17 00:00:00 2001 From: Frank Noirot Date: Mon, 4 Nov 2024 15:46:34 -0500 Subject: [PATCH] Make `expandPath` not assume there is an associated sweep artifact --- src/lang/std/artifactGraph.ts | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/lang/std/artifactGraph.ts b/src/lang/std/artifactGraph.ts index fc76255768..702e1a14ae 100644 --- a/src/lang/std/artifactGraph.ts +++ b/src/lang/std/artifactGraph.ts @@ -36,9 +36,12 @@ interface solid2D { } export interface PathArtifactRich { type: 'path' + /** A path must always lie on a plane */ plane: PlaneArtifact | WallArtifact + /** A path must always contain 0 or more segments */ segments: Array - sweep: SweepArtifact + /** A path may not result in a sweep artifact */ + sweep?: SweepArtifact codeRef: CommonCommandProperties } @@ -587,13 +590,15 @@ export function expandPath( { keys: path.segIds, types: ['segment'] }, artifactGraph ) - const sweep = getArtifactOfTypes( - { - key: path.sweepId, - types: ['sweep'], - }, - artifactGraph - ) + const sweep = path.sweepId + ? getArtifactOfTypes( + { + key: path.sweepId, + types: ['sweep'], + }, + artifactGraph + ) + : undefined const plane = getArtifactOfTypes( { key: path.planeId, types: ['plane', 'wall'] }, artifactGraph