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
This commit is contained in:
Frank Noirot
2025-05-27 12:51:19 -04:00
committed by GitHub
parent 083bfe6ec2
commit f502e445cc

View File

@ -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' }