mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-31 21:05:01 +01:00
fix set location command
This commit is contained in:
parent
b27869327c
commit
78c89d16d0
5 changed files with 48 additions and 27 deletions
|
|
@ -1,13 +1,9 @@
|
|||
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";
|
||||
import { Interrogate, SetLocation } from "cad/craft/e0/interact";
|
||||
import { MDatum } from "cad/model/mdatum";
|
||||
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 {SetLocation} from "cad/craft/e0/interact";
|
||||
import {MDatum} from "cad/model/mdatum";
|
||||
|
||||
interface HoleParams {
|
||||
datum: MDatum;
|
||||
|
|
@ -73,13 +69,9 @@ export const HoleOperation: OperationDescriptor<HoleParams> = {
|
|||
oci.bopfuse("result");
|
||||
}
|
||||
|
||||
//let ptr = Interrogate("result", true).ptr;
|
||||
//console.log(params.datum.csys.outTransformation);
|
||||
//const location = params.datum.csys.outTransformation.toFlatArray();
|
||||
//SetLocation(ptr, location);
|
||||
let location = params.datum.csys.outTransformation._normalize();
|
||||
SetLocation("result", location.toFlatArray());
|
||||
returnObject.created.push(occ.io.getShell("result"));
|
||||
console.log(returnObject);
|
||||
console.log("Set location worked");
|
||||
|
||||
return returnObject;
|
||||
|
||||
|
|
|
|||
14
package-lock.json
generated
14
package-lock.json
generated
|
|
@ -14,7 +14,7 @@
|
|||
"earcut": "2.1.1",
|
||||
"font-awesome": "4.7.0",
|
||||
"immer": "^9.0.12",
|
||||
"jsketcher-occ-engine": "1.0.1-0cd4fdc77e9c85bbbe6951d90646bd3361ab6797",
|
||||
"jsketcher-occ-engine": "1.0.1-56d3ea00d3847efc527b0197be5c5b28b89e421e",
|
||||
"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-0cd4fdc77e9c85bbbe6951d90646bd3361ab6797",
|
||||
"resolved": "https://registry.npmjs.org/jsketcher-occ-engine/-/jsketcher-occ-engine-1.0.1-0cd4fdc77e9c85bbbe6951d90646bd3361ab6797.tgz",
|
||||
"integrity": "sha512-7f+cDN2efc5JVaTx+zuhOuTLOVpdlIXB8WhuKCusHc3s9toO+cI1GcPDNWxRxys5SWITD+8eb8cPwOsUyF+ObA=="
|
||||
"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=="
|
||||
},
|
||||
"node_modules/json-parse-better-errors": {
|
||||
"version": "1.0.2",
|
||||
|
|
@ -23437,9 +23437,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"jsketcher-occ-engine": {
|
||||
"version": "1.0.1-0cd4fdc77e9c85bbbe6951d90646bd3361ab6797",
|
||||
"resolved": "https://registry.npmjs.org/jsketcher-occ-engine/-/jsketcher-occ-engine-1.0.1-0cd4fdc77e9c85bbbe6951d90646bd3361ab6797.tgz",
|
||||
"integrity": "sha512-7f+cDN2efc5JVaTx+zuhOuTLOVpdlIXB8WhuKCusHc3s9toO+cI1GcPDNWxRxys5SWITD+8eb8cPwOsUyF+ObA=="
|
||||
"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=="
|
||||
},
|
||||
"json-parse-better-errors": {
|
||||
"version": "1.0.2",
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@
|
|||
"earcut": "2.1.1",
|
||||
"font-awesome": "4.7.0",
|
||||
"immer": "^9.0.12",
|
||||
"jsketcher-occ-engine": "1.0.1-0cd4fdc77e9c85bbbe6951d90646bd3361ab6797",
|
||||
"jsketcher-occ-engine": "1.0.1-56d3ea00d3847efc527b0197be5c5b28b89e421e",
|
||||
"jszip": "^3.10.0",
|
||||
"less": "^3.11.1",
|
||||
"libtess": "1.2.2",
|
||||
|
|
|
|||
2
web/app/cad/craft/e0/interact.d.ts
vendored
2
web/app/cad/craft/e0/interact.d.ts
vendored
|
|
@ -16,4 +16,4 @@ export function IsEdgesOverlap(e1Ptr: number, e2Ptr: number, tol: number): boole
|
|||
|
||||
export function UpdateTessellation(shapePtr: number, deflection: number): number;
|
||||
|
||||
export function SetLocation(shapePtr: number, matrixArray: number[]);
|
||||
export function SetLocation(shapeName: string, matrixArray: number[]);
|
||||
|
|
|
|||
|
|
@ -63,6 +63,35 @@ export function UpdateTessellation(shapePtr, deflection) {
|
|||
return Module._UpdateTessellation(shapePtr, deflection);
|
||||
}
|
||||
|
||||
export function SetLocation(shapePtr, matrixArray) {
|
||||
return Module._SetLocation(shapePtr, ...matrixArray);
|
||||
export function SetLocation(shapeName, matrixArray) {
|
||||
const shapeNamePtr = toCString(shapeName);
|
||||
const [
|
||||
mx0,
|
||||
mx1,
|
||||
mx2,
|
||||
mx3,
|
||||
mx4,
|
||||
mx5,
|
||||
mx6,
|
||||
mx7,
|
||||
mx8,
|
||||
mx9,
|
||||
mx10,
|
||||
mx11
|
||||
] = matrixArray;
|
||||
Module._SetLocation(shapeNamePtr,
|
||||
mx0,
|
||||
mx1,
|
||||
mx2,
|
||||
mx3,
|
||||
mx4,
|
||||
mx5,
|
||||
mx6,
|
||||
mx7,
|
||||
mx8,
|
||||
mx9,
|
||||
mx10,
|
||||
mx11
|
||||
);
|
||||
_free(shapeNamePtr);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue