/
counterbugtech
/
KontrBugCAD
Обзор
Документация
Войти
/
counterbugtech
/
KontrBugCAD
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
js/core/parametric/executors/ThreadCutExecutor.js
1 строка
1 KB
counterbugtech
версия 0.9.37
17 май 2026, 13:43
Верифицирован
17 май 2026, 13:43
31de57b
Код
Авторство
О чём код?
import{ParametricExecutor}from"./ParametricExecutor.js";import{ThreadGenerator}from"generators/thread-generator.js";import*as THREE from"three";export class ThreadCutExecutor extends ParametricExecutor{constructor(r){super(),this.editor=r,this.threadGenerator=new ThreadGenerator(this.editor.manifoldWrapper)}execute(r,e){const t=r.parameters,{targetObjectUuid:o,threadParams:a,position:s,rotation:i}=t,n=e.objectMap.get(o);if(!n)throw new Error(`ThreadCutExecutor: целевой объект ${o} не найден`);const c={...a,forCutting:!0},p=this.threadGenerator.createThread(c);p.position.set(s[0],s[1],s[2]),p.rotation.set(i[0],i[1],i[2]),p.updateMatrixWorld();const m=this.editor.booleanOps;if(!m)throw new Error("BooleanOperations не инициализированы в редакторе");const d=m.subtract(n,p,null,!1);if(!d)throw new Error("Вычитание не удалось");const u=d.geometry.clone(),h=(new THREE.Matrix4).copy(n.matrixWorld).invert();return u.applyMatrix4(h),n.geometry&&n.geometry.dispose(),n.geometry=u,n.geometry.computeVertexNormals(),d.geometry.dispose(),p.geometry.dispose(),p.material.dispose(),0===r.outputs.length&&(r.outputs=[o]),n}}