mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-06 08:25:19 +01:00
stable face IDs for primitive opperations using featureId param.
This commit is contained in:
parent
22cdafd336
commit
ee4a19e720
5 changed files with 26 additions and 24 deletions
|
|
@ -1,11 +1,11 @@
|
|||
import {ApplicationContext} from 'cad/context';
|
||||
import {roundValueForPresentation as r} from 'cad/craft/operationHelper';
|
||||
import {EntityKind} from "cad/model/entities";
|
||||
import {BooleanDefinition} from "cad/craft/schema/common/BooleanDefinition";
|
||||
import {OperationDescriptor} from "cad/craft/operationBundle";
|
||||
import { ApplicationContext } from 'cad/context';
|
||||
import { roundValueForPresentation as r } from 'cad/craft/operationHelper';
|
||||
import { EntityKind } from "cad/model/entities";
|
||||
import { BooleanDefinition } from "cad/craft/schema/common/BooleanDefinition";
|
||||
import { OperationDescriptor } from "cad/craft/operationBundle";
|
||||
import CSys from "math/csys";
|
||||
import {MDatum} from "cad/model/mdatum";
|
||||
import {ExpectedOrderProductionAnalyzer} from "cad/craft/production/productionAnalyzer";
|
||||
import { MDatum } from "cad/model/mdatum";
|
||||
import { ExpectedOrderProductionAnalyzer } from "cad/craft/production/productionAnalyzer";
|
||||
import icon from "./CUBE.svg";
|
||||
|
||||
interface PrimitiveBoxParams {
|
||||
|
|
@ -14,15 +14,16 @@ interface PrimitiveBoxParams {
|
|||
z: number,
|
||||
locations: MDatum,
|
||||
boolean: BooleanDefinition,
|
||||
featureId:string,
|
||||
}
|
||||
|
||||
export const PrimitiveBoxOperation: OperationDescriptor<PrimitiveBoxParams> = {
|
||||
export const PrimitiveBoxOperation: OperationDescriptor<any> = {
|
||||
id: 'BOX',
|
||||
label: 'Box',
|
||||
icon,
|
||||
info: 'Primitive Box',
|
||||
path:__dirname,
|
||||
paramsInfo: ({x, y, z}) => `(${r(x)} , ${r(y)} , ${r(z)})`,
|
||||
path: __dirname,
|
||||
paramsInfo: ({ x, y, z }) => `(${r(x)} , ${r(y)} , ${r(z)})`,
|
||||
form: [
|
||||
{
|
||||
type: 'number',
|
||||
|
|
@ -67,6 +68,7 @@ export const PrimitiveBoxOperation: OperationDescriptor<PrimitiveBoxParams> = {
|
|||
|
||||
|
||||
run: (params: PrimitiveBoxParams, ctx: ApplicationContext) => {
|
||||
console.log(params , this);
|
||||
const occ = ctx.occService;
|
||||
const oci = occ.commandInterface;
|
||||
|
||||
|
|
@ -82,37 +84,37 @@ export const PrimitiveBoxOperation: OperationDescriptor<PrimitiveBoxParams> = {
|
|||
const box = occ.io.getShell("box", new ExpectedOrderProductionAnalyzer(
|
||||
[
|
||||
{
|
||||
id: 'F:LEFT',
|
||||
id: params.featureId + 'F:LEFT',
|
||||
productionInfo: {
|
||||
role: 'sweep'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'F:RIGHT',
|
||||
id: params.featureId + 'F:RIGHT',
|
||||
productionInfo: {
|
||||
role: 'sweep'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'F:BASE',
|
||||
id: params.featureId + 'F:BASE',
|
||||
productionInfo: {
|
||||
role: 'base'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'F:LID',
|
||||
id: params.featureId + 'F:LID',
|
||||
productionInfo: {
|
||||
role: 'lid'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'F:BACK',
|
||||
id: params.featureId + 'F:BACK',
|
||||
productionInfo: {
|
||||
role: 'sweep'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'F:FRONT',
|
||||
id: params.featureId + 'F:FRONT',
|
||||
productionInfo: {
|
||||
role: 'sweep'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ export const PrimitiveConeOperation: OperationDescriptor<PrimitiveConeParams> =
|
|||
|
||||
const newFacesIds = [
|
||||
{
|
||||
id: 'F:SIDE',
|
||||
id: params.featureId + 'F:SIDE',
|
||||
productionInfo: {
|
||||
role: 'sweep'
|
||||
}
|
||||
|
|
@ -97,7 +97,7 @@ export const PrimitiveConeOperation: OperationDescriptor<PrimitiveConeParams> =
|
|||
|
||||
if (params.diameterB > 0) {
|
||||
newFacesIds.push({
|
||||
id: 'F:BASE',
|
||||
id: params.featureId + 'F:BASE',
|
||||
productionInfo: {
|
||||
role: 'base'
|
||||
}
|
||||
|
|
@ -106,7 +106,7 @@ export const PrimitiveConeOperation: OperationDescriptor<PrimitiveConeParams> =
|
|||
|
||||
if (params.diameterA > 0) {
|
||||
newFacesIds.push({
|
||||
id: 'F:LID',
|
||||
id: params.featureId + 'F:LID',
|
||||
productionInfo: {
|
||||
role: 'lid'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,19 +81,19 @@ export const PrimitiveCylinderOperation: OperationDescriptor<PrimitiveCylinderPa
|
|||
const cylinder = occ.io.getShell("cylinder", new ExpectedOrderProductionAnalyzer(
|
||||
[
|
||||
{
|
||||
id: 'F:SIDE',
|
||||
id: params.featureId + 'F:SIDE',
|
||||
productionInfo: {
|
||||
role: 'sweep'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'F:BASE',
|
||||
id: params.featureId + 'F:BASE',
|
||||
productionInfo: {
|
||||
role: 'base'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'F:LID',
|
||||
id: params.featureId + 'F:LID',
|
||||
productionInfo: {
|
||||
role: 'lid'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ export const PrimitiveSphereOperation: OperationDescriptor<PrimitiveSphereParams
|
|||
const sphere = occ.io.getShell("sphere", new ExpectedOrderProductionAnalyzer(
|
||||
[
|
||||
{
|
||||
id: 'F:SPHERE',
|
||||
id: params.featureId + 'F:SPHERE',
|
||||
productionInfo: {
|
||||
role: 'sweep'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ export const PrimitiveTorusOperation: OperationDescriptor<PrimitiveTorusParams>
|
|||
const torus = occ.io.getShell("torus", new ExpectedOrderProductionAnalyzer(
|
||||
[
|
||||
{
|
||||
id: 'F:TORUS',
|
||||
id: params.featureId + 'F:TORUS',
|
||||
productionInfo: {
|
||||
role: 'sweep'
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue