mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-07 00:45:08 +01:00
optimize double sided extrude
This commit is contained in:
parent
99802d66f4
commit
2d16fdba4e
1 changed files with 10 additions and 19 deletions
|
|
@ -38,34 +38,25 @@ export const ExtrudeOperation: OperationDescriptor<ExtrudeParams> = {
|
||||||
params.profiles
|
params.profiles
|
||||||
|
|
||||||
}
|
}
|
||||||
|
const dir: UnitVector = (params.direction || face.normal()).normalize();
|
||||||
|
let extrusionVector = dir._multiply(params.length);
|
||||||
|
|
||||||
let sketch = ctx.sketchStorageService.readSketch(face.id);
|
let sketch = ctx.sketchStorageService.readSketch(face.id);
|
||||||
if (!sketch) {
|
if (!sketch) {
|
||||||
occFaces.push(params.face);
|
occFaces.push(params.face);
|
||||||
} else {
|
} else {
|
||||||
occFaces = occ.utils.sketchToFaces(sketch, face.csys);
|
let csys = face.csys;
|
||||||
|
if (params.doubleSided) {
|
||||||
|
csys = csys.clone();
|
||||||
|
csys.origin._minus(extrusionVector);
|
||||||
|
extrusionVector._scale(2);
|
||||||
|
}
|
||||||
|
occFaces = occ.utils.sketchToFaces(sketch, csys);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const dir: UnitVector = params.direction || face.normal();
|
|
||||||
|
|
||||||
const extrusionVector = dir.normalize()._multiply(params.length).data();
|
|
||||||
const extrusionVectorFliped = dir.normalize()._multiply(params.length).negate().data();
|
|
||||||
|
|
||||||
|
|
||||||
const tools = occFaces.map((faceName, i) => {
|
const tools = occFaces.map((faceName, i) => {
|
||||||
const shapeName = "Tool/" + i;
|
const shapeName = "Tool/" + i;
|
||||||
oci.prism(shapeName, faceName, ...extrusionVector);
|
oci.prism(shapeName, faceName, ...extrusionVector.data());
|
||||||
|
|
||||||
if(params.doubleSided){
|
|
||||||
oci.prism(shapeName + "B", faceName, ...extrusionVectorFliped);
|
|
||||||
oci.bop(shapeName, shapeName + "B");
|
|
||||||
oci.bopfuse(shapeName);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// occIterateFaces(oc, shape, face => {
|
// occIterateFaces(oc, shape, face => {
|
||||||
// let role;
|
// let role;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue