use add location instead of set location

This commit is contained in:
Val Erastov 2022-07-28 20:32:40 -07:00
parent 28b2daa2cd
commit 6b8213519e
6 changed files with 47 additions and 12 deletions

View file

@ -8,7 +8,7 @@ import { OperationDescriptor } from "cad/craft/operationPlugin";
import { MShell } from 'cad/model/mshell';
import { MDatum } from "cad/model/mdatum";
import {Matrix3x4} from "math/matrix";
import {SetLocation} from "cad/craft/e0/interact";
import {AddLocation, SetLocation} from "cad/craft/e0/interact";
interface patternLinearParams {
inputBodies: MShell[];
@ -45,7 +45,7 @@ export const PatternLinearOperation: OperationDescriptor<patternLinearParams> =
const newShellName = shellToPatern.id + ":patern/" + index + "/" +i;
oci.copy(shellToPatern, newShellName);
SetLocation(newShellName, tr.toFlatArray());
AddLocation(newShellName, tr.toFlatArray());
created.push(occ.io.getShell(newShellName));
}

View file

@ -6,7 +6,7 @@ import Axis from "math/axis";
import {OperationDescriptor} from "cad/craft/operationPlugin";
import {MShell} from 'cad/model/mshell';
import {Matrix3x4} from "math/matrix";
import {SetLocation} from "cad/craft/e0/interact";
import {AddLocation, SetLocation} from "cad/craft/e0/interact";
import {DEG_RAD} from "math/commons";
interface patternRadialParams {
@ -49,7 +49,7 @@ export const PatternRadialOperation: OperationDescriptor<patternRadialParams> =
const newShellName = shellToPatern.id + ":pattern/" + index + "/" +i;
oci.copy(shellToPatern, newShellName);
SetLocation(newShellName, tr.toFlatArray());
AddLocation(newShellName, tr.toFlatArray());
created.push(occ.io.getShell(newShellName));
}

14
package-lock.json generated
View file

@ -14,7 +14,7 @@
"earcut": "2.1.1",
"font-awesome": "4.7.0",
"immer": "^9.0.12",
"jsketcher-occ-engine": "1.0.1-56d3ea00d3847efc527b0197be5c5b28b89e421e",
"jsketcher-occ-engine": "1.0.1-055e9551d187d751bf4850255121de8971c1c7bc",
"jszip": "^3.10.0",
"less": "^3.11.1",
"libtess": "1.2.2",
@ -9164,9 +9164,9 @@
}
},
"node_modules/jsketcher-occ-engine": {
"version": "1.0.1-56d3ea00d3847efc527b0197be5c5b28b89e421e",
"resolved": "https://registry.npmjs.org/jsketcher-occ-engine/-/jsketcher-occ-engine-1.0.1-56d3ea00d3847efc527b0197be5c5b28b89e421e.tgz",
"integrity": "sha512-nGkfHX6KvyV+2JZkzzynZsbDZ78MK2Y+MWPmeepLGEeVfuHWG97qW66c3g9MzWVM5vEoMwHXpiRncIqr0gOz6w=="
"version": "1.0.1-055e9551d187d751bf4850255121de8971c1c7bc",
"resolved": "https://registry.npmjs.org/jsketcher-occ-engine/-/jsketcher-occ-engine-1.0.1-055e9551d187d751bf4850255121de8971c1c7bc.tgz",
"integrity": "sha512-Uqf5cJovjdBXfoKuL+hquiWQAr7OP4AeVWeIdHYVMXkMpuZW01BjTkhKucyrwV7odWpDrzZsJrDtoYCjS6X2yw=="
},
"node_modules/json-parse-better-errors": {
"version": "1.0.2",
@ -23437,9 +23437,9 @@
"dev": true
},
"jsketcher-occ-engine": {
"version": "1.0.1-56d3ea00d3847efc527b0197be5c5b28b89e421e",
"resolved": "https://registry.npmjs.org/jsketcher-occ-engine/-/jsketcher-occ-engine-1.0.1-56d3ea00d3847efc527b0197be5c5b28b89e421e.tgz",
"integrity": "sha512-nGkfHX6KvyV+2JZkzzynZsbDZ78MK2Y+MWPmeepLGEeVfuHWG97qW66c3g9MzWVM5vEoMwHXpiRncIqr0gOz6w=="
"version": "1.0.1-055e9551d187d751bf4850255121de8971c1c7bc",
"resolved": "https://registry.npmjs.org/jsketcher-occ-engine/-/jsketcher-occ-engine-1.0.1-055e9551d187d751bf4850255121de8971c1c7bc.tgz",
"integrity": "sha512-Uqf5cJovjdBXfoKuL+hquiWQAr7OP4AeVWeIdHYVMXkMpuZW01BjTkhKucyrwV7odWpDrzZsJrDtoYCjS6X2yw=="
},
"json-parse-better-errors": {
"version": "1.0.2",

View file

@ -71,7 +71,7 @@
"earcut": "2.1.1",
"font-awesome": "4.7.0",
"immer": "^9.0.12",
"jsketcher-occ-engine": "1.0.1-56d3ea00d3847efc527b0197be5c5b28b89e421e",
"jsketcher-occ-engine": "1.0.1-055e9551d187d751bf4850255121de8971c1c7bc",
"jszip": "^3.10.0",
"less": "^3.11.1",
"libtess": "1.2.2",

View file

@ -17,3 +17,5 @@ export function IsEdgesOverlap(e1Ptr: number, e2Ptr: number, tol: number): boole
export function UpdateTessellation(shapePtr: number, deflection: number): number;
export function SetLocation(shapeName: string, matrixArray: number[]);
export function AddLocation(shapeName: string, matrixArray: number[]);

View file

@ -95,3 +95,36 @@ export function SetLocation(shapeName, matrixArray) {
);
_free(shapeNamePtr);
}
export function AddLocation(shapeName, matrixArray) {
const shapeNamePtr = toCString(shapeName);
const [
mx0,
mx1,
mx2,
mx3,
mx4,
mx5,
mx6,
mx7,
mx8,
mx9,
mx10,
mx11
] = matrixArray;
Module._AddLocation(shapeNamePtr,
mx0,
mx1,
mx2,
mx3,
mx4,
mx5,
mx6,
mx7,
mx8,
mx9,
mx10,
mx11
);
_free(shapeNamePtr);
}