diff --git a/packages/chili/src/commands/boolean.ts b/packages/chili/src/commands/boolean.ts index c915fde2..eb7b506f 100644 --- a/packages/chili/src/commands/boolean.ts +++ b/packages/chili/src/commands/boolean.ts @@ -33,7 +33,11 @@ export abstract class BooleanOperate extends CreateCommand { protected override getSteps(): IStep[] { return [ new SelectModelStep("prompt.select.shape", false), - new SelectModelStep("prompt.select.shape", false), + new SelectModelStep("prompt.select.shape", false, { + allow: (shape) => { + return !this.stepDatas[0].models?.map((x) => x.shape()).includes(shape); + }, + }), ]; } } diff --git a/packages/chili/src/commands/create/converter.ts b/packages/chili/src/commands/create/converter.ts index d1b8b2b6..59a17708 100644 --- a/packages/chili/src/commands/create/converter.ts +++ b/packages/chili/src/commands/create/converter.ts @@ -22,6 +22,10 @@ export class ConvertToWire extends CreateCommand { return new GeometryModel(this.document, `Wire ${count++}`, wireBody); } + protected override shouldClearSelectedBeforeExcute() { + return false; + } + protected override getSteps(): IStep[] { return [ new SelectModelStep("prompt.select.edges", true, { @@ -47,6 +51,10 @@ export class ConvertToFace extends CreateCommand { return new GeometryModel(this.document, `Face ${count++}`, wireBody); } + protected override shouldClearSelectedBeforeExcute() { + return false; + } + protected override getSteps(): IStep[] { return [ new SelectModelStep("prompt.select.edges", true, { diff --git a/packages/chili/src/commands/create/createCommand.ts b/packages/chili/src/commands/create/createCommand.ts index 84a60134..4e110d8b 100644 --- a/packages/chili/src/commands/create/createCommand.ts +++ b/packages/chili/src/commands/create/createCommand.ts @@ -14,8 +14,14 @@ export abstract class CreateCommand extends MultistepCommand { protected abstract create(): GeometryModel; + protected shouldClearSelectedBeforeExcute() { + return true; + } + protected override beforeExecute(): Promise { - this.document.selection.clearSelected(); + if (this.shouldClearSelectedBeforeExcute()) { + this.document.selection.clearSelected(); + } return super.beforeExecute(); } }