mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-06 00:16:32 +01:00
Added move body feature
This commit is contained in:
parent
c8f8c1dc71
commit
b97d4d9701
3 changed files with 72 additions and 1 deletions
|
|
@ -0,0 +1 @@
|
|||
place holder
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
import {ApplicationContext} from "cad/context";
|
||||
import {EntityKind} from "cad/model/entities";
|
||||
import {OperationDescriptor} from "cad/craft/operationBundle";
|
||||
import {SetLocation} from "cad/craft/e0/interact";
|
||||
import {MDatum} from "cad/model/mdatum";
|
||||
import { MShell } from 'cad/model/mshell';
|
||||
|
||||
interface MoveBodyParams {
|
||||
datum: MDatum;
|
||||
body: MShell;
|
||||
}
|
||||
|
||||
export const MoveBodyOperation: OperationDescriptor<MoveBodyParams> = {
|
||||
id: 'MOVE_BODY',
|
||||
label: 'Move Body',
|
||||
icon: 'img/cad/moveBody',
|
||||
info: 'Move Body',
|
||||
path:__dirname,
|
||||
paramsInfo: () => '',
|
||||
|
||||
run: (params: MoveBodyParams, ctx: ApplicationContext) => {
|
||||
const occ = ctx.occService;
|
||||
const oci = occ.commandInterface;
|
||||
|
||||
console.log(params);
|
||||
const returnObject = {
|
||||
consumed: [params.body],
|
||||
created: []
|
||||
};
|
||||
const location = params.datum.csys.outTransformation._normalize();
|
||||
|
||||
const newShellName = params.body.id+":T";
|
||||
|
||||
oci.copy(params.body, newShellName);
|
||||
|
||||
SetLocation(newShellName, location.toFlatArray());
|
||||
returnObject.created.push(occ.io.getShell(newShellName));
|
||||
|
||||
return returnObject;
|
||||
|
||||
},
|
||||
form: [
|
||||
{
|
||||
type: 'selection',
|
||||
name: 'datum',
|
||||
capture: [EntityKind.DATUM],
|
||||
label: 'Sketch',
|
||||
multi: false,
|
||||
defaultValue: {
|
||||
usePreselection: true,
|
||||
preselectionIndex: 0
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
type: 'selection',
|
||||
name: 'body',
|
||||
capture: [EntityKind.SHELL],
|
||||
label: 'body',
|
||||
multi: false,
|
||||
defaultValue: {
|
||||
usePreselection: true,
|
||||
preselectionIndex: 1
|
||||
},
|
||||
},
|
||||
|
||||
],
|
||||
}
|
||||
|
|
@ -22,6 +22,7 @@ import {ImportModelOperation} from "./features/importModel/importModel.operation
|
|||
import {DeleteBodyOperation} from "./features/deleteBody/deleteBody.operation";
|
||||
import {DefeatureRemoveFaceOperation} from "./features/defeatureRemoveFace/defeatureRemoveFace.operation";
|
||||
import { WireLineOperation } from "./features/wireLine/wireLine";
|
||||
import { MoveBodyOperation } from "./features/moveBody/moveBody.operation"
|
||||
//imports of action type commands
|
||||
import {GetInfo} from "./actions/getInfo/getInfo.action";
|
||||
import {ExportBREP} from "./actions/exportBREP/exportBREP.action";
|
||||
|
|
@ -54,6 +55,7 @@ export const ModelerWorkspace: WorkbenchConfig = {
|
|||
DeleteBodyOperation,
|
||||
DefeatureRemoveFaceOperation,
|
||||
WireLineOperation,
|
||||
MoveBodyOperation,
|
||||
|
||||
GetInfo,
|
||||
ExportBREP,
|
||||
|
|
@ -71,7 +73,7 @@ export const ModelerWorkspace: WorkbenchConfig = {
|
|||
|
||||
"SHELL_TOOL", "FILLET_TOOL", "SCALE_BODY", "DEFEATURE_REMOVE_FACE", "-",
|
||||
|
||||
"MIRROR_BODY", "PATTERN_LINEAR", "PATTERN_RADIAL", "-",
|
||||
"MIRROR_BODY", "PATTERN_LINEAR", "PATTERN_RADIAL", "MOVE_BODY" ,"-",
|
||||
|
||||
"CYLINDER", "BOX", "CONE", "SPHERE", "TORUS", "-",
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue