From f502e445ccd749bc10fac624feb0e5f69813a980 Mon Sep 17 00:00:00 2001 From: Frank Noirot Date: Tue, 27 May 2025 12:51:19 -0400 Subject: [PATCH] Don't error when editing via feature tree if no `angle` arg is present in revolve, use `360deg` (#7230) * Don't error if no `angle` arg is present in revolve, use `360` KCL uses a default value if the keyword argument isn't present, so the feature tree edit flow should do the same. In the future these should flow from the same source of truth so that the feature tree doesn't have to duplicate default arg values like this. * Use `360deg` for more definite UoM --- src/lib/operations.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/lib/operations.ts b/src/lib/operations.ts index 3ef5518f4..cefbf055f 100644 --- a/src/lib/operations.ts +++ b/src/lib/operations.ts @@ -861,14 +861,14 @@ const prepareToEditRevolve: PrepareToEditCallback = async ({ } // angle kcl arg - if (!('angle' in operation.labeledArgs) || !operation.labeledArgs.angle) { - return { reason: "Couldn't find angle argument" } - } + // Default to '360' if not present const angle = await stringToKclExpression( - codeManager.code.slice( - operation.labeledArgs.angle.sourceRange[0], - operation.labeledArgs.angle.sourceRange[1] - ) + 'angle' in operation.labeledArgs && operation.labeledArgs.angle + ? codeManager.code.slice( + operation.labeledArgs.angle.sourceRange[0], + operation.labeledArgs.angle.sourceRange[1] + ) + : '360deg' ) if (err(angle) || 'errors' in angle) { return { reason: 'Error in angle argument retrieval' }