Made fillet and Champher work for all edges of a selected face.

This commit is contained in:
Mike Molinari 2022-08-26 22:26:22 +00:00 committed by Val Erastov
parent 6c89bec12d
commit 8553ac15ef

View file

@ -7,9 +7,10 @@ import {FromMObjectProductionAnalyzer} from "cad/craft/production/productionAnal
import {MEdge} from "cad/model/medge"; import {MEdge} from "cad/model/medge";
import {MObject} from "cad/model/mobject"; import {MObject} from "cad/model/mobject";
import {MShell} from "cad/model/mshell"; import {MShell} from "cad/model/mshell";
import { MBrepFace } from 'cad/model/mface';
interface FilletParams { interface FilletParams {
edges: MEdge[], edges: MEdge[] | MBrepFace[],
size: number size: number
opperationType: 'Champher'|'Fillet' opperationType: 'Champher'|'Fillet'
} }
@ -25,13 +26,23 @@ export const FilletOperation: OperationDescriptor<any> = {
const occ = ctx.occService; const occ = ctx.occService;
const oci = occ.commandInterface; const oci = occ.commandInterface;
let edgeList = [];
//check if input contains faces and if a face is an input add all adjacent edges to list for processing.
params.edges.forEach((edge) => {
if(edge.TYPE === EntityKind.FACE){
edgeList = edgeList.concat(edge.edges);
}
if(edge.TYPE === EntityKind.EDGE){
edgeList.push(edge);
}
});
//add all the edges and size to seperate arrays for each shell that edges are selected from //add all the edges and size to seperate arrays for each shell that edges are selected from
const groups = new Map<MShell, any[]>() const groups = new Map<MShell, any[]>()
params.edges.forEach((edge) => { edgeList.forEach((edge) => {
let shellArgs = groups.get(edge.shell); let shellArgs = groups.get(edge.shell);
if (!shellArgs) { if (!shellArgs) {
shellArgs = []; shellArgs = [];
@ -74,7 +85,7 @@ export const FilletOperation: OperationDescriptor<any> = {
{ {
type: 'selection', type: 'selection',
name: 'edges', name: 'edges',
capture: [EntityKind.EDGE], capture: [EntityKind.EDGE,EntityKind.FACE],
label: 'edges', label: 'edges',
multi: true, multi: true,
defaultValue: { defaultValue: {