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