Added start of paterning commands
|
|
@ -2,9 +2,13 @@ import {roundValueForPresentation as r} from 'cad/craft/operationHelper';
|
|||
import {ApplicationContext} from "context";
|
||||
import {EntityKind} from "cad/model/entities";
|
||||
import {OperationDescriptor} from "cad/craft/operationPlugin";
|
||||
|
||||
import { MFace } from "cad/model/mface";
|
||||
import { BooleanDefinition } from "cad/craft/schema/common/BooleanDefinition";
|
||||
import { UnitVector } from "math/vector";
|
||||
import { MObject } from "cad/model/mobject";
|
||||
|
||||
interface HoleParams {
|
||||
sketch: MFace;
|
||||
diameter: number;
|
||||
depth: number;
|
||||
counterBoreDiameter: number;
|
||||
|
|
@ -20,6 +24,7 @@ export const HoleOperation: OperationDescriptor<HoleParams> = {
|
|||
icon: 'img/cad/Shell',
|
||||
info: 'creates hole features',
|
||||
paramsInfo: ({
|
||||
|
||||
diameter,
|
||||
depth,
|
||||
counterBoreDiameter,
|
||||
|
|
@ -39,6 +44,10 @@ export const HoleOperation: OperationDescriptor<HoleParams> = {
|
|||
created: []
|
||||
};
|
||||
|
||||
let sketch = ctx.sketchStorageService.readSketch(params.sketch.id);
|
||||
console.log(sketch, "sketch info here");
|
||||
|
||||
|
||||
oci.pcylinder("basehole", params.diameter / 2, params.depth);
|
||||
|
||||
if (params.holeType == "normal") {
|
||||
|
|
@ -76,8 +85,8 @@ export const HoleOperation: OperationDescriptor<HoleParams> = {
|
|||
type: 'selection',
|
||||
name: 'sketch',
|
||||
capture: [EntityKind.FACE],
|
||||
label: 'faces',
|
||||
multi: true,
|
||||
label: 'Sketch',
|
||||
multi: false,
|
||||
defaultValue: {
|
||||
usePreselection: true,
|
||||
preselectionIndex: 0
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
# MIRROR BODY
|
||||
The MIRROR BODY feature allows for selection of one or more shells in the 3d environment. A mirror plane is specified by selecting a plane or existing planar face. New bodies are created in the mirror image of the selected bodies.
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
import { roundValueForPresentation as r } from 'cad/craft/operationHelper';
|
||||
import { MFace } from "cad/model/mface";
|
||||
import { ApplicationContext } from "context";
|
||||
import { EntityKind } from "cad/model/entities";
|
||||
import Axis from "math/axis";
|
||||
import { UnitVector } from "math/vector";
|
||||
import { OperationDescriptor } from "cad/craft/operationPlugin";
|
||||
import { MShell } from 'cad/model/mshell';
|
||||
|
||||
interface patternLinearParams {
|
||||
inputBodies: MShell[];
|
||||
patternMethod: string;
|
||||
face: MFace;
|
||||
distance: number;
|
||||
qty: number;
|
||||
direction?: UnitVector,
|
||||
}
|
||||
|
||||
|
||||
export const PatternLinearOperation: OperationDescriptor<patternLinearParams> = {
|
||||
id: 'PATTERN_LINEAR',
|
||||
label: 'Linear pattern',
|
||||
icon: 'img/cad/patternLinear',
|
||||
info: 'Creates a linear pattern.',
|
||||
paramsInfo: ({ }) => `(${r()})`,
|
||||
run: (params: patternLinearParams, ctx: ApplicationContext) => {
|
||||
console.log(params);
|
||||
let occ = ctx.occService;
|
||||
const oci = occ.commandInterface;
|
||||
|
||||
let created = [];
|
||||
|
||||
params.inputBodies.forEach((shellToMirror) => {
|
||||
const newShellName = shellToMirror.id + ":mirror";
|
||||
oci.copy(shellToMirror, newShellName);
|
||||
oci.tmirror(newShellName, ...params.face.csys.origin.data(), ...params.face.csys.z.normalize().data());
|
||||
created.push(occ.io.getShell(newShellName));
|
||||
});
|
||||
|
||||
return {
|
||||
created,
|
||||
consumed: []
|
||||
};
|
||||
|
||||
|
||||
},
|
||||
form: [
|
||||
{
|
||||
type: 'selection',
|
||||
name: 'inputBodies',
|
||||
capture: [EntityKind.SHELL],
|
||||
label: 'body',
|
||||
multi: true,
|
||||
defaultValue: {
|
||||
usePreselection: false,
|
||||
preselectionIndex: 0
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'choice',
|
||||
label: 'Pattern Method',
|
||||
name: "patternMethod",
|
||||
style: "dropdown",
|
||||
defaultValue: "Step Angle",
|
||||
values: ['Step Angle', 'Span Angle',],
|
||||
},
|
||||
{
|
||||
type: 'number',
|
||||
label: 'Distance',
|
||||
name: 'distance',
|
||||
defaultValue: 50,
|
||||
},
|
||||
{
|
||||
type: 'number',
|
||||
label: 'Qty',
|
||||
name: 'qty',
|
||||
defaultValue: 3,
|
||||
},
|
||||
{
|
||||
type: 'direction',
|
||||
name: 'direction',
|
||||
label: 'direction',
|
||||
optional: true
|
||||
},
|
||||
],
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
# MIRROR BODY
|
||||
The MIRROR BODY feature allows for selection of one or more shells in the 3d environment. A mirror plane is specified by selecting a plane or existing planar face. New bodies are created in the mirror image of the selected bodies.
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
import { roundValueForPresentation as r } from 'cad/craft/operationHelper';
|
||||
import { MFace } from "cad/model/mface";
|
||||
import { ApplicationContext } from "context";
|
||||
import { EntityKind } from "cad/model/entities";
|
||||
import Axis from "math/axis";
|
||||
import { UnitVector } from "math/vector";
|
||||
import { OperationDescriptor } from "cad/craft/operationPlugin";
|
||||
import { MShell } from 'cad/model/mshell';
|
||||
|
||||
interface patternRadialParams {
|
||||
inputBodies: MShell[];
|
||||
patternMethod: string;
|
||||
face: MFace;
|
||||
angle: number;
|
||||
qty: number;
|
||||
direction?: UnitVector,
|
||||
}
|
||||
|
||||
|
||||
export const PatternRadialOperation: OperationDescriptor<patternRadialParams> = {
|
||||
id: 'PATTERN_RADIAL',
|
||||
label: 'Radial pattern',
|
||||
icon: 'img/cad/patternRadial',
|
||||
info: 'Creates a Radial pattern.',
|
||||
paramsInfo: ({ }) => `(${r()})`,
|
||||
run: (params: patternRadialParams, ctx: ApplicationContext) => {
|
||||
console.log(params);
|
||||
let occ = ctx.occService;
|
||||
const oci = occ.commandInterface;
|
||||
|
||||
let created = [];
|
||||
|
||||
params.inputBodies.forEach((shellToMirror) => {
|
||||
const newShellName = shellToMirror.id + ":mirror";
|
||||
oci.copy(shellToMirror, newShellName);
|
||||
oci.tmirror(newShellName, ...params.face.csys.origin.data(), ...params.face.csys.z.normalize().data());
|
||||
created.push(occ.io.getShell(newShellName));
|
||||
});
|
||||
|
||||
return {
|
||||
created,
|
||||
consumed: []
|
||||
};
|
||||
|
||||
|
||||
},
|
||||
form: [
|
||||
{
|
||||
type: 'selection',
|
||||
name: 'inputBodies',
|
||||
capture: [EntityKind.SHELL],
|
||||
label: 'body',
|
||||
multi: true,
|
||||
defaultValue: {
|
||||
usePreselection: false,
|
||||
preselectionIndex: 0
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'choice',
|
||||
label: 'Pattern Method',
|
||||
name: "patternMethod",
|
||||
style: "dropdown",
|
||||
defaultValue: "Step Distance",
|
||||
values: ['Step Distance', 'Span Distance',],
|
||||
},
|
||||
{
|
||||
type: 'number',
|
||||
label: 'Angle',
|
||||
name: 'angle',
|
||||
defaultValue: 50,
|
||||
},
|
||||
{
|
||||
type: 'number',
|
||||
label: 'Qty',
|
||||
name: 'qty',
|
||||
defaultValue: 3,
|
||||
},
|
||||
{
|
||||
type: 'direction',
|
||||
name: 'direction',
|
||||
label: 'direction',
|
||||
optional: true
|
||||
},
|
||||
],
|
||||
}
|
||||
|
|
@ -16,7 +16,8 @@ import { ShellOperation } from "./features/shell/shell.operation";
|
|||
import { SweepOperation } from "./features/sweep/sweep.operation";
|
||||
import { ScaleOperation } from "./features/scaleBody/scaleBody.operation";
|
||||
import { MirrorBodyOperation} from "./features/mirrorBody/mirrorBody.operation";
|
||||
|
||||
import { PatternLinearOperation } from "./features/patternLinear/patternLinear.operation"
|
||||
import { PatternRadialOperation } from "./features/patternRadial/patternRadial.operation"
|
||||
//imports of action type commands
|
||||
import { GetVolume } from './actions/getVolume/getVolume.action';
|
||||
|
||||
|
|
@ -39,7 +40,9 @@ export const ModelerWorkspace: WorkbenchConfig = {
|
|||
LoftOperation,
|
||||
SweepOperation,
|
||||
ScaleOperation,
|
||||
MirrorBodyOperation
|
||||
MirrorBodyOperation,
|
||||
PatternLinearOperation,
|
||||
PatternRadialOperation,
|
||||
],
|
||||
actions: [GetVolume],
|
||||
ui: {
|
||||
|
|
@ -47,7 +50,8 @@ export const ModelerWorkspace: WorkbenchConfig = {
|
|||
'DATUM_CREATE', 'PLANE', 'EditFace', '-',
|
||||
"EXTRUDE", "REVOLVE", "LOFT", "SWEEP", "-",
|
||||
"BOOLEAN", "-",
|
||||
"SHELL_TOOL", "FILLET_TOOL", "SCALE_BODY", "MIRROR_BODY", "-",
|
||||
"SHELL_TOOL", "FILLET_TOOL", "SCALE_BODY","-",
|
||||
"MIRROR_BODY", "PATTERN_LINEAR", "PATTERN_RADIAL", "-",
|
||||
"CYLINDER", "BOX", "CONE", "SPHERE", "TORUS", "-",
|
||||
"HOLE_TOOL", "-", 'GET_VOLUME',
|
||||
]
|
||||
|
|
|
|||
BIN
web/img/cad/patternLinear32.png
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
BIN
web/img/cad/patternLinear96.png
Normal file
|
After Width: | Height: | Size: 3 KiB |
BIN
web/img/cad/patternRadial32.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
BIN
web/img/cad/patternRadial96.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 5.4 KiB |