mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-23 08:53:07 +01:00
Added option to keep tools to the boolean feature command.
This commit is contained in:
parent
ce75c904b4
commit
9f0e2d419b
1 changed files with 28 additions and 10 deletions
|
|
@ -3,10 +3,13 @@ import {ApplicationContext} from "context";
|
|||
import {EntityKind} from "cad/model/entities";
|
||||
import {BooleanDefinition} from "cad/craft/schema/common/BooleanDefinition";
|
||||
import {OperationDescriptor} from "cad/craft/operationPlugin";
|
||||
import { param } from 'cypress/types/jquery';
|
||||
import { MObject } from 'cad/model/mobject';
|
||||
|
||||
interface BooleanParams {
|
||||
tools: [];
|
||||
boolean: BooleanDefinition
|
||||
keepTools:boolean;
|
||||
boolean: BooleanDefinition;
|
||||
}
|
||||
|
||||
export const BooleanOperation: OperationDescriptor<BooleanParams> = {
|
||||
|
|
@ -20,29 +23,44 @@ export const BooleanOperation: OperationDescriptor<BooleanParams> = {
|
|||
let occ = ctx.occService;
|
||||
const oci = occ.commandInterface;
|
||||
|
||||
console.log(params.tools, params.boolean);
|
||||
let returnObject = occ.utils.applyBooleanModifier(params.tools, params.boolean);
|
||||
|
||||
return occ.utils.applyBooleanModifier(params.tools, params.boolean);
|
||||
if (params.keepTools == true) {
|
||||
// filter consumed array to remove the tools but leaving the targets regardless if
|
||||
// the targets are explicitly set or implied by leaving targets blank.
|
||||
returnObject.consumed = returnObject.created.filter((el) => !params.tools.includes(el as never));
|
||||
}else{
|
||||
returnObject.consumed = returnObject.consumed.concat(params.tools);
|
||||
}
|
||||
|
||||
return returnObject;
|
||||
|
||||
},
|
||||
form: [
|
||||
{
|
||||
type: 'boolean',
|
||||
name: 'boolean',
|
||||
label: 'Targets',
|
||||
optional: true,
|
||||
defaultValue: 'UNION'
|
||||
},
|
||||
{
|
||||
type: 'selection',
|
||||
name: 'tools',
|
||||
capture: [EntityKind.SHELL],
|
||||
label: 'Tools',
|
||||
optional: false,
|
||||
multi: true,
|
||||
defaultValue: {
|
||||
usePreselection: true,
|
||||
preselectionIndex: 0
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'checkbox',
|
||||
name: 'keepTools',
|
||||
label: 'Keep Tools',
|
||||
defaultValue: false,
|
||||
},
|
||||
{
|
||||
type: 'boolean',
|
||||
name: 'boolean',
|
||||
label: 'Targets',
|
||||
optional: true,
|
||||
defaultValue: "UNION",
|
||||
},
|
||||
],
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue