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 // angle kcl arg
if (!('angle' in operation.labeledArgs) || !operation.labeledArgs.angle) { // Default to '360' if not present
return { reason: "Couldn't find angle argument" }
}
const angle = await stringToKclExpression( const angle = await stringToKclExpression(
codeManager.code.slice( 'angle' in operation.labeledArgs && operation.labeledArgs.angle
operation.labeledArgs.angle.sourceRange[0], ? codeManager.code.slice(
operation.labeledArgs.angle.sourceRange[1] operation.labeledArgs.angle.sourceRange[0],
) operation.labeledArgs.angle.sourceRange[1]
)
: '360deg'
) )
if (err(angle) || 'errors' in angle) { if (err(angle) || 'errors' in angle) {
return { reason: 'Error in angle argument retrieval' } return { reason: 'Error in angle argument retrieval' }