同步代码,导出更多api
This commit is contained in:
389
api.esm.js
389
api.esm.js
@@ -1,4 +1,4 @@
|
||||
import { Vector3, Matrix4, Box3, Color, MeshPhysicalMaterial, Object3D, Vector2 as Vector2$1, Quaternion, MathUtils, Shape as Shape$1, EllipseCurve, FrontSide, LineDashedMaterial, DoubleSide, MeshBasicMaterial, LineBasicMaterial, ShaderMaterial, BufferGeometry, ShapeGeometry, BufferAttribute, Line as Line$1, Plane, Line3, CatmullRomCurve3, Path as Path$1, LineSegments, Mesh, CylinderBufferGeometry, Float32BufferAttribute, Geometry, ShapeUtils, Face3, BoxBufferGeometry, InstancedInterleavedBuffer, InterleavedBufferAttribute, ExtrudeGeometry, BoxGeometry, AmbientLight as AmbientLight$1, DirectionalLightHelper, SphereBufferGeometry, Matrix3, Group, DirectionalLight as DirectionalLight$1, HemisphereLight as HemisphereLight$1, MirroredRepeatWrapping, Texture, OrthographicCamera, PerspectiveCamera, Scene, WebGLRenderTarget, Frustum, MeshNormalMaterial, PointLight as PointLight$1, SphereGeometry, BackSide, RectAreaLight as RectAreaLight$1, SpotLight as SpotLight$1, ConeGeometry, PointsMaterial, Points, Box2 as Box2$1, Raycaster } from 'three';
|
||||
import { Vector3, Matrix4, Box3, Color, FrontSide, MeshPhysicalMaterial, Object3D, Vector2 as Vector2$1, Quaternion, MathUtils, Shape as Shape$1, EllipseCurve, LineDashedMaterial, DoubleSide, MeshBasicMaterial, LineBasicMaterial, ShaderMaterial, BufferGeometry, ShapeGeometry, BufferAttribute, Line as Line$1, Plane, Line3, CatmullRomCurve3, Path as Path$1, LineSegments, Mesh, CylinderBufferGeometry, Float32BufferAttribute, Geometry, ShapeUtils, Face3, BoxBufferGeometry, InstancedInterleavedBuffer, InterleavedBufferAttribute, ExtrudeGeometry, BoxGeometry, AmbientLight as AmbientLight$1, DirectionalLightHelper, SphereBufferGeometry, Matrix3, Group, DirectionalLight as DirectionalLight$1, HemisphereLight as HemisphereLight$1, MirroredRepeatWrapping, Texture, OrthographicCamera, PerspectiveCamera, Scene, WebGLRenderTarget, Frustum, MeshNormalMaterial, PointLight as PointLight$1, SphereGeometry, BackSide, RectAreaLight as RectAreaLight$1, SpotLight as SpotLight$1, ConeGeometry, PointsMaterial, Points, Box2 as Box2$1, Raycaster } from 'three';
|
||||
import { iaop, end } from 'xaop';
|
||||
import { Line2 } from 'three/examples/jsm/lines/Line2';
|
||||
import { LineGeometry } from 'three/examples/jsm/lines/LineGeometry';
|
||||
@@ -1002,6 +1002,8 @@ let PhysicalMaterialRecord = class PhysicalMaterialRecord extends MaterialTableR
|
||||
this.opacityMaximum = 1; //不透明度最大值 默认1
|
||||
this.opacityMinimum = 0.3; // 不透明度最小值 默认0.3
|
||||
//#endregion
|
||||
//折射
|
||||
this.refraction = 1; //玻璃折射 默认1
|
||||
this.matalness = 0; //金属性 0-1
|
||||
this.bumpScale = 0; //凹凸比例 UE:法线强度 默认0 范围0-20
|
||||
this.roughness = 0.2; //粗糙度 0-1
|
||||
@@ -1013,6 +1015,7 @@ let PhysicalMaterialRecord = class PhysicalMaterialRecord extends MaterialTableR
|
||||
this.useRoughnessMap = true;
|
||||
//#endregion
|
||||
this.IsFull = false; //完全平铺板(此时修改板的uv)
|
||||
this.side = FrontSide; //双面
|
||||
this.UVType = UVType.LocalUV;
|
||||
//#region 菲涅尔 默认折叠(绒毛?) 反射?(皮革 布料中可用)
|
||||
this.fresnelPO = 1; //菲涅尔对比度 默认1 范围-1至10
|
||||
@@ -1052,10 +1055,13 @@ let PhysicalMaterialRecord = class PhysicalMaterialRecord extends MaterialTableR
|
||||
else
|
||||
this.material.color.set(this.color);
|
||||
this.material.transparent = this.transparent;
|
||||
if (this.type === "玻璃")
|
||||
if (this.type === "玻璃") {
|
||||
this.material.metalness = 0.2;
|
||||
this.material.reflectivity = Math.abs(this.refraction);
|
||||
}
|
||||
else
|
||||
this.material.metalness = this.matalness;
|
||||
this.material.side = this.side;
|
||||
this.material.opacity = Math.max(0.1, this.opacity);
|
||||
this.material.depthTest = this.depthTest;
|
||||
this.material.bumpScale = this.bumpScale;
|
||||
@@ -1191,13 +1197,17 @@ let PhysicalMaterialRecord = class PhysicalMaterialRecord extends MaterialTableR
|
||||
this.UWorldMove = file.Read();
|
||||
this.VWorldMove = file.Read();
|
||||
}
|
||||
if (ver > 9) {
|
||||
this.refraction = file.Read();
|
||||
this.side = file.Read();
|
||||
}
|
||||
}
|
||||
this.Update();
|
||||
}
|
||||
//对象将自身数据写入到文件.
|
||||
WriteFile(file) {
|
||||
super.WriteFile(file);
|
||||
file.Write(9);
|
||||
file.Write(10);
|
||||
file.Write(this.color);
|
||||
file.Write(this.transparent);
|
||||
file.Write(this.matalness);
|
||||
@@ -1252,6 +1262,9 @@ let PhysicalMaterialRecord = class PhysicalMaterialRecord extends MaterialTableR
|
||||
file.Write(this.UWroldRo);
|
||||
file.Write(this.UWorldMove);
|
||||
file.Write(this.VWorldMove);
|
||||
//ver10
|
||||
file.Write(this.refraction);
|
||||
file.Write(this.side);
|
||||
}
|
||||
};
|
||||
__decorate([
|
||||
@@ -1293,6 +1306,9 @@ __decorate([
|
||||
__decorate([
|
||||
AutoRecord
|
||||
], PhysicalMaterialRecord.prototype, "opacityMinimum", void 0);
|
||||
__decorate([
|
||||
AutoRecord
|
||||
], PhysicalMaterialRecord.prototype, "refraction", void 0);
|
||||
__decorate([
|
||||
AutoRecord
|
||||
], PhysicalMaterialRecord.prototype, "matalness", void 0);
|
||||
@@ -1329,6 +1345,9 @@ __decorate([
|
||||
__decorate([
|
||||
AutoRecord
|
||||
], PhysicalMaterialRecord.prototype, "IsFull", void 0);
|
||||
__decorate([
|
||||
AutoRecord
|
||||
], PhysicalMaterialRecord.prototype, "side", void 0);
|
||||
__decorate([
|
||||
AutoRecord
|
||||
], PhysicalMaterialRecord.prototype, "UVType", void 0);
|
||||
@@ -6022,12 +6041,12 @@ function fastEqualCurve(c1, c2, tolerance = 1e-3) {
|
||||
//对于双多段线互相切割后的结果,快速判断曲线是否在另一条曲线内部
|
||||
//也许有一天这个中点算法需要改一下, 使用.MidPoint比较稳妥
|
||||
function fastCurveInCurve(sourceCu, targetCu) {
|
||||
return sourceCu.PtInCurve(targetCu.GetPointAtParam(targetCu.EndParam * 0.5));
|
||||
return sourceCu.PtInCurve(targetCu.Midpoint);
|
||||
}
|
||||
//当交点小于等于1时
|
||||
function fastCurveInCurve2(sourceCu, targetCu) {
|
||||
return sourceCu.PtInCurve(targetCu.StartPoint) ||
|
||||
sourceCu.PtInCurve(targetCu.GetPointAtParam(targetCu.EndParam * 0.5));
|
||||
sourceCu.PtInCurve(targetCu.Midpoint);
|
||||
}
|
||||
|
||||
class CurveTreeNode {
|
||||
@@ -6956,6 +6975,14 @@ let Polyline = Polyline_1 = class Polyline extends Curve {
|
||||
this.CloseMark = true;
|
||||
return this;
|
||||
}
|
||||
FromPoints2d(pts) {
|
||||
this.WriteAllObjectRecord();
|
||||
this._LineData.length = 0;
|
||||
for (let p of pts)
|
||||
this._LineData.push({ pt: AsVector2(p), bul: 0 });
|
||||
this.Update();
|
||||
return this;
|
||||
}
|
||||
//多段线起点
|
||||
get StartPoint() {
|
||||
if (this._LineData.length > 0)
|
||||
@@ -11261,7 +11288,8 @@ function InitRectBoardHoleOption(br, option) {
|
||||
let c = cus[i];
|
||||
let derv = c.GetFistDeriv(0).multiplyScalar(dir);
|
||||
let an = angle(derv);
|
||||
if (equaln$1(an, 0) || (an < Math.PI / 4 + 1e-8 && an > Math.PI * 7 / 4))
|
||||
an = clampRad(an);
|
||||
if (an < Math.PI / 4 + 1e-8 || an > Math.PI * 7 / 4)
|
||||
option.down = hightDrill[i];
|
||||
else if (an > Math.PI / 4 && an < Math.PI * 3 / 4 + 1e-8)
|
||||
option.right = hightDrill[i];
|
||||
@@ -11295,7 +11323,8 @@ function SetRectHighHole(br, option) {
|
||||
let c = cus[i];
|
||||
let derv = c.GetFistDeriv(0).multiplyScalar(dir);
|
||||
let an = angle(derv);
|
||||
if (equaln$1(an, 0) || (an < Math.PI / 4 + 1e-8 && an > Math.PI * 7 / 4))
|
||||
an = clampRad(an);
|
||||
if (an < Math.PI / 4 + 1e-8 || an > Math.PI * 7 / 4)
|
||||
highDrill.push(option.down);
|
||||
else if (an > Math.PI / 4 && an < Math.PI * 3 / 4 + 1e-8)
|
||||
highDrill.push(option.right);
|
||||
@@ -19478,20 +19507,32 @@ function CalcEdgeSealing(cus, highSeals) {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//与GetBoardSealingCurves相关
|
||||
function GetBoardHighSeal(br, sealcus) {
|
||||
let highSeals = br.BoardProcessOption.highSealed.slice().filter(d => d.size !== null && d.size !== undefined);
|
||||
let sealDown = parseFloat(br.BoardProcessOption[EBoardKeyList.DownSealed]);
|
||||
let sealUp = parseFloat(br.BoardProcessOption[EBoardKeyList.UpSealed]);
|
||||
let sealLeft = parseFloat(br.BoardProcessOption[EBoardKeyList.LeftSealed]);
|
||||
let sealRight = parseFloat(br.BoardProcessOption[EBoardKeyList.RightSealed]);
|
||||
if (br.BoardProcessOption[EBoardKeyList.SpliteHeight]
|
||||
&& br.BoardProcessOption[EBoardKeyList.SpliteWidth]
|
||||
&& br.BoardProcessOption[EBoardKeyList.SpliteThickness]) {
|
||||
return [
|
||||
{ size: parseFloat(br.BoardProcessOption.sealedDown) },
|
||||
{ size: parseFloat(br.BoardProcessOption.sealedRight) },
|
||||
{ size: parseFloat(br.BoardProcessOption.sealedUp) },
|
||||
{ size: parseFloat(br.BoardProcessOption.sealedLeft) },
|
||||
];
|
||||
}
|
||||
let highSeals = br.BoardProcessOption.highSealed.filter(d => d.size !== null && d.size !== undefined);
|
||||
//若未设置高级封边,把上下左右封边存入高级封边
|
||||
if (sealcus.length !== highSeals.length || !br.IsSpecialShape) {
|
||||
let sealDown = parseFloat(br.BoardProcessOption[EBoardKeyList.DownSealed]);
|
||||
let sealUp = parseFloat(br.BoardProcessOption[EBoardKeyList.UpSealed]);
|
||||
let sealLeft = parseFloat(br.BoardProcessOption[EBoardKeyList.LeftSealed]);
|
||||
let sealRight = parseFloat(br.BoardProcessOption[EBoardKeyList.RightSealed]);
|
||||
highSeals.length = 0;
|
||||
let dir = Math.sign(br.ContourCurve.Area2);
|
||||
for (let c of sealcus) {
|
||||
let derv = c.GetFistDeriv(0).multiplyScalar(dir);
|
||||
let an = angle(derv);
|
||||
if (equaln$1(an, 0) || (an < Math.PI / 4 + 1e-8 && an > Math.PI * 7 / 4))
|
||||
an = clampRad(an);
|
||||
if ((an < Math.PI / 4 + 1e-8) || (an > Math.PI * 7 / 4))
|
||||
highSeals.push({ size: sealDown });
|
||||
else if (an > Math.PI / 4 && an < Math.PI * 3 / 4 + 1e-8)
|
||||
highSeals.push({ size: sealRight });
|
||||
@@ -20381,10 +20422,37 @@ let Board = Board_1 = class Board extends ExtrudeSolid {
|
||||
// super.ApplyMirrorMatrix(m); //这个变更导致镜像错误 因为实体没有正常的被更新. 所以需要注意的是,如果需要镜像变更,需要给实体一个id!!!
|
||||
return this;
|
||||
}
|
||||
this.ContourCurve; //因为下面翻转孔面的代码,所以必须初始化这个
|
||||
let hasSplitSize = (this.BoardProcessOption[EBoardKeyList.SpliteHeight]
|
||||
&& this.BoardProcessOption[EBoardKeyList.SpliteWidth]
|
||||
&& this.BoardProcessOption[EBoardKeyList.SpliteThickness]);
|
||||
let highSeals = GetBoardHighSeal(this, GetBoardSealingCurves(this));
|
||||
super.ApplyMirrorMatrix(m);
|
||||
if (this.contourCurve.Area2 < 0) {
|
||||
this.contourCurve.Reverse();
|
||||
highSeals.reverse();
|
||||
this.BoardProcessOption.highSealed?.reverse();
|
||||
this.BoardProcessOption.highDrill?.reverse();
|
||||
if (hasSplitSize) {
|
||||
[
|
||||
this.BoardProcessOption.sealedUp,
|
||||
this.BoardProcessOption.sealedLeft,
|
||||
this.BoardProcessOption.sealedDown,
|
||||
this.BoardProcessOption.sealedRight,
|
||||
]
|
||||
=
|
||||
[
|
||||
this.BoardProcessOption.sealedUp,
|
||||
this.BoardProcessOption.sealedRight,
|
||||
this.BoardProcessOption.sealedDown,
|
||||
this.BoardProcessOption.sealedLeft,
|
||||
];
|
||||
}
|
||||
}
|
||||
else
|
||||
this.BoardProcessOption[EBoardKeyList.BigHole] = 1 - this.BoardProcessOption[EBoardKeyList.BigHole]; //反转大孔面
|
||||
this.BoardProcessOption.highSealed = highSeals;
|
||||
if (this.isRect)
|
||||
if (!hasSplitSize && this.isRect)
|
||||
HandleRectBoardSealingData(this, highSeals);
|
||||
//重新构建SpaceOCS
|
||||
this._SpaceOCS.multiplyMatrices(this._Matrix, new Matrix4().getInverse(this.RotateMat));
|
||||
@@ -22717,6 +22785,81 @@ function GetHoleLengthOfIndex(hole, index) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
function Purge(db) {
|
||||
db.hm.Clear();
|
||||
let bakEnable = db.hm.Enable;
|
||||
db.hm.Enable = false;
|
||||
//应该避免占位空间被PU(占位空间内没有实体,也没有子层)
|
||||
arrayRemoveIf(db.TemplateTable.Objects, t => {
|
||||
if (!t || t.IsErase)
|
||||
return true;
|
||||
let allEnts = [];
|
||||
t.Traverse(ct => {
|
||||
for (let id of ct.Objects) {
|
||||
if (id.Object)
|
||||
allEnts.push(id.Object);
|
||||
}
|
||||
});
|
||||
if (allEnts.length && allEnts.every(e => e.IsErase)) {
|
||||
t.Erase();
|
||||
t.Traverse(ct => ct.Erase()); //PU所有子层
|
||||
return true;
|
||||
}
|
||||
//否则PU本层
|
||||
t.Purge();
|
||||
});
|
||||
//再次清理,避免子模块没了之后,父模块还引用它
|
||||
for (let t of db.TemplateTable.Objects)
|
||||
t.Children = t.Children.filter(c => !c.IsErase);
|
||||
arrayRemoveIf(db.GroupTable.Objects, g => {
|
||||
if (!g || g.IsErase)
|
||||
return true;
|
||||
g.Purge();
|
||||
return g.Entitys.length === 0;
|
||||
});
|
||||
//由于我们现在Goodbye会将Object清空,所以为了模块能正确的pu,我们把这个延后了
|
||||
arrayRemoveIf(db.ModelSpace.Entitys, e => {
|
||||
let isErase = e.IsErase;
|
||||
if (isErase)
|
||||
e.GoodBye();
|
||||
return isErase;
|
||||
});
|
||||
arrayRemoveIf(db.Lights.Entitys, e => {
|
||||
let isErase = e.IsErase;
|
||||
if (isErase)
|
||||
e.GoodBye();
|
||||
return isErase;
|
||||
});
|
||||
arrayRemoveIf(db.LayoutSpace.Entitys, e => {
|
||||
let isErase = e.IsErase;
|
||||
if (isErase)
|
||||
e.GoodBye();
|
||||
return isErase;
|
||||
});
|
||||
arrayRemoveIf(db.ProcessingGroupTable.Objects, e => {
|
||||
if (!e || e.IsErase)
|
||||
return true;
|
||||
e.Purge();
|
||||
return e.Objects.length === 0;
|
||||
});
|
||||
db.hm.Enable = bakEnable;
|
||||
}
|
||||
//裁剪树 有时候会有不好的行为,仅在copy.ts中使用
|
||||
function PurgeTemplateTreeRoot(db) {
|
||||
for (let t of db.TemplateTable.Objects) {
|
||||
if (t.IsRoot && t.Objects.length === 0) {
|
||||
t.Erase();
|
||||
let children = t.Children.concat(); //必须备份,否则子实体设置Parent=undefined时错误
|
||||
t.Children = [];
|
||||
for (let ctId of children) {
|
||||
let ct = ctId.Object;
|
||||
ct.Parent = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
arrayRemoveIf(db.TemplateTable.Objects, t => t.IsErase);
|
||||
}
|
||||
|
||||
let CreateObjectData = class CreateObjectData extends CADObject {
|
||||
/**
|
||||
* 如果是实体新建,那么不需要调用`Save`,历史记录会在命令结束的时候调用.
|
||||
@@ -30076,6 +30219,97 @@ TemplateFilletAction = __decorate([
|
||||
Factory
|
||||
], TemplateFilletAction);
|
||||
|
||||
function ApplyGoodInfo(en, material) {
|
||||
en.BoardProcessOption[EBoardKeyList.BrMat] = material.GoodsInfo.name;
|
||||
en.BoardProcessOption[EBoardKeyList.Color] = material.GoodsInfo.color;
|
||||
en.BoardProcessOption[EBoardKeyList.Mat] = material.GoodsInfo.material;
|
||||
}
|
||||
|
||||
let TemplateMaterialAction = class TemplateMaterialAction extends TemplateAction {
|
||||
constructor(Entitys = [], CompositeEntitys = [], ApplyGoodInfo = true) {
|
||||
super();
|
||||
this.Entitys = Entitys;
|
||||
this.CompositeEntitys = CompositeEntitys;
|
||||
this.ApplyGoodInfo = ApplyGoodInfo;
|
||||
}
|
||||
_Update(paramDiff) {
|
||||
if (!this.parent.MaterialValue)
|
||||
return;
|
||||
for (let id of this.Entitys) {
|
||||
if (!(id?.Object) || id.IsErase)
|
||||
continue;
|
||||
let en = id.Object;
|
||||
if (this.ApplyGoodInfo && en instanceof Board)
|
||||
ApplyGoodInfo(en, this.parent.MaterialValue);
|
||||
en.Material = this.parent.MaterialValue.Id;
|
||||
}
|
||||
for (let [id, indexs] of this.CompositeEntitys) {
|
||||
if (!(id?.Object) || id.IsErase)
|
||||
continue;
|
||||
let en = id.Object;
|
||||
let allEntitys = [];
|
||||
const GetAllEntitys = (hard) => {
|
||||
for (let e of hard.Entitys) {
|
||||
if (e instanceof HardwareCompositeEntity)
|
||||
GetAllEntitys(e);
|
||||
else
|
||||
allEntitys.push(e);
|
||||
}
|
||||
};
|
||||
GetAllEntitys(en);
|
||||
for (let index of indexs) {
|
||||
let subE = allEntitys[index];
|
||||
if (!subE)
|
||||
continue;
|
||||
if (this.ApplyGoodInfo && subE instanceof Board)
|
||||
ApplyGoodInfo(subE, this.parent.MaterialValue);
|
||||
subE.Material = this.parent.MaterialValue.Id;
|
||||
}
|
||||
}
|
||||
}
|
||||
//#region -------------------------File-------------------------
|
||||
//对象应该实现dataIn和DataOut的方法,为了对象的序列化和反序列化
|
||||
//对象从文件中读取数据,初始化自身
|
||||
ReadFile(file) {
|
||||
let ver = file.Read();
|
||||
super.ReadFile(file);
|
||||
this.ApplyGoodInfo = file.Read() === 1;
|
||||
this.Entitys.length = 0;
|
||||
let count = file.Read();
|
||||
for (let i = 0; i < count; i++) {
|
||||
let id = file.ReadObjectId();
|
||||
if (id)
|
||||
this.Entitys.push(id);
|
||||
}
|
||||
if (ver > 1) {
|
||||
count = file.Read();
|
||||
this.CompositeEntitys.length = 0;
|
||||
for (let i = 0; i < count; i++) {
|
||||
let id = file.ReadObjectId();
|
||||
let indexs = file.Read();
|
||||
this.CompositeEntitys.push([id, indexs]);
|
||||
}
|
||||
}
|
||||
}
|
||||
//对象将自身数据写入到文件.
|
||||
WriteFile(file) {
|
||||
file.Write(2);
|
||||
super.WriteFile(file);
|
||||
file.Write(this.ApplyGoodInfo ? 1 : 0);
|
||||
file.Write(this.Entitys.length);
|
||||
for (let ent of this.Entitys)
|
||||
file.WriteObjectId(ent);
|
||||
file.Write(this.CompositeEntitys.length);
|
||||
for (let [id, indexs] of this.CompositeEntitys) {
|
||||
file.WriteObjectId(id);
|
||||
file.Write(indexs.concat());
|
||||
}
|
||||
}
|
||||
};
|
||||
TemplateMaterialAction = __decorate([
|
||||
Factory
|
||||
], TemplateMaterialAction);
|
||||
|
||||
/**
|
||||
* 模版参数类型
|
||||
*/
|
||||
@@ -30150,14 +30384,11 @@ let TemplateParam = class TemplateParam {
|
||||
break;
|
||||
case TemplateParamType.Material:
|
||||
{
|
||||
let oldV = this.value;
|
||||
let newV = value;
|
||||
if (newV !== oldV) {
|
||||
this.WriteAllObjectRecord();
|
||||
this.value = newV;
|
||||
if (this.MaterialValue) {
|
||||
for (let a of this.actions)
|
||||
a.Update(0, newV);
|
||||
a.Update(0, 0);
|
||||
}
|
||||
this.MaterialValue = undefined;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -30168,6 +30399,16 @@ let TemplateParam = class TemplateParam {
|
||||
* @param paramMap 所有的参数列表.(可能我们需要依赖更新它)
|
||||
*/
|
||||
EvalUpdate(vardefines, paramMap, evaled, update = true) {
|
||||
if (this.type === TemplateParamType.Material) {
|
||||
if (update && this.MaterialValue) {
|
||||
for (let a of this.actions) {
|
||||
if (a instanceof TemplateMaterialAction)
|
||||
a.Update(0, this.value);
|
||||
}
|
||||
this.MaterialValue = undefined;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (this.expr === "") {
|
||||
if (update) {
|
||||
for (let a of this.actions) {
|
||||
@@ -31284,59 +31525,6 @@ TempateThicknessAction = __decorate([
|
||||
Factory
|
||||
], TempateThicknessAction);
|
||||
|
||||
function ApplyGoodInfo(en, material) {
|
||||
en.BoardProcessOption[EBoardKeyList.BrMat] = material.GoodsInfo.name;
|
||||
en.BoardProcessOption[EBoardKeyList.Color] = material.GoodsInfo.color;
|
||||
en.BoardProcessOption[EBoardKeyList.Mat] = material.GoodsInfo.material;
|
||||
}
|
||||
|
||||
let TemplateMaterialAction = class TemplateMaterialAction extends TemplateAction {
|
||||
constructor(Entitys = [], ApplyGoodInfo = true) {
|
||||
super();
|
||||
this.Entitys = Entitys;
|
||||
this.ApplyGoodInfo = ApplyGoodInfo;
|
||||
}
|
||||
_Update(paramDiff) {
|
||||
if (!this.parent.MaterialValue)
|
||||
return;
|
||||
for (let id of this.Entitys) {
|
||||
if (!(id?.Object) || id.IsErase)
|
||||
continue;
|
||||
let en = id.Object;
|
||||
if (this.ApplyGoodInfo && en instanceof Board)
|
||||
ApplyGoodInfo(en, this.parent.MaterialValue);
|
||||
en.Material = this.parent.MaterialValue.Id;
|
||||
}
|
||||
}
|
||||
//#region -------------------------File-------------------------
|
||||
//对象应该实现dataIn和DataOut的方法,为了对象的序列化和反序列化
|
||||
//对象从文件中读取数据,初始化自身
|
||||
ReadFile(file) {
|
||||
file.Read();
|
||||
super.ReadFile(file);
|
||||
this.ApplyGoodInfo = file.Read() === 1;
|
||||
this.Entitys.length = 0;
|
||||
let count = file.Read();
|
||||
for (let i = 0; i < count; i++) {
|
||||
let id = file.ReadObjectId();
|
||||
if (id)
|
||||
this.Entitys.push(id);
|
||||
}
|
||||
}
|
||||
//对象将自身数据写入到文件.
|
||||
WriteFile(file) {
|
||||
file.Write(1);
|
||||
super.WriteFile(file);
|
||||
file.Write(this.ApplyGoodInfo ? 1 : 0);
|
||||
file.Write(this.Entitys.length);
|
||||
for (let ent of this.Entitys)
|
||||
file.WriteObjectId(ent);
|
||||
}
|
||||
};
|
||||
TemplateMaterialAction = __decorate([
|
||||
Factory
|
||||
], TemplateMaterialAction);
|
||||
|
||||
let TemplateMoveAction = class TemplateMoveAction extends TemplateAction {
|
||||
constructor(StretchDirection = new Vector3, MoveEntitys = []) {
|
||||
super();
|
||||
@@ -31384,6 +31572,59 @@ TemplateMoveAction = __decorate([
|
||||
Factory
|
||||
], TemplateMoveAction);
|
||||
|
||||
/**
|
||||
* 设置封边动作
|
||||
*/
|
||||
let TemplateSetSealAction = class TemplateSetSealAction extends TemplateAction {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.EntitySealIndexsMap = [];
|
||||
}
|
||||
_Update(diff, newV) {
|
||||
for (let { entity, indexs } of this.EntitySealIndexsMap) {
|
||||
if (entity?.Object && !entity.IsErase) {
|
||||
let br = entity.Object;
|
||||
let highSealData = GetBoardSealingCurves(br, true);
|
||||
let highseals = GetBoardHighSeal(br, highSealData);
|
||||
for (let i of indexs) {
|
||||
if (highseals[i])
|
||||
highseals[i].size = newV;
|
||||
}
|
||||
HandleRectBoardSealingData(br, highseals, highSealData);
|
||||
br.BoardProcessOption.highSealed = highseals;
|
||||
}
|
||||
}
|
||||
}
|
||||
//#region -------------------------File-------------------------
|
||||
//对象应该实现dataIn和DataOut的方法,为了对象的序列化和反序列化
|
||||
//对象从文件中读取数据,初始化自身
|
||||
ReadFile(file) {
|
||||
file.Read();
|
||||
super.ReadFile(file);
|
||||
this.EntitySealIndexsMap.length = 0;
|
||||
let count = file.Read();
|
||||
for (let i = 0; i < count; i++) {
|
||||
let entity = file.ReadObjectId();
|
||||
let indexs = file.Read();
|
||||
if (entity)
|
||||
this.EntitySealIndexsMap.push({ entity, indexs });
|
||||
}
|
||||
}
|
||||
//对象将自身数据写入到文件.
|
||||
WriteFile(file) {
|
||||
file.Write(1);
|
||||
super.WriteFile(file);
|
||||
file.Write(this.EntitySealIndexsMap.length);
|
||||
for (let d of this.EntitySealIndexsMap) {
|
||||
file.WriteObjectId(d.entity);
|
||||
file.Write(arrayClone(d.indexs));
|
||||
}
|
||||
}
|
||||
};
|
||||
TemplateSetSealAction = __decorate([
|
||||
Factory
|
||||
], TemplateSetSealAction);
|
||||
|
||||
/**
|
||||
* Stretch夹点动作
|
||||
*/
|
||||
@@ -36753,5 +36994,5 @@ function UpdateStartEndPoint(curve) {
|
||||
curve.EndPoint = ep;
|
||||
}
|
||||
|
||||
export { AlignedDimension, AllObjectData, AmbientLight, Arc, ArcDimension, AxisCS, BlockTable, BlockTableRecord, Board, BoxSolid, CADFactory, CADFiler, CURVE_FACE_TYPE_KEY, CURVE_MESH_NAMES, CameraSnapshootRecord, CameraType, CameraUpdate, Circle, CommandHistoryRecord, CompositeEntity, ContourTreeNode, ConverBoardTypeToSpaceType, CreateObjectData, Curve, CurveTapeShape, CylinderHole, Cylineder, Database, DepthType, DiameterDimension, Dimension, DirectionalLight, DisposeTextShapeCache, Ellipse, Entity, EntityColorHistoryRecord, EntityRef, EraseEntityData, ExtendType$1 as ExtendType, ExtrudeBuildConfig, ExtrudeGeometryBuilder, ExtrudeHole, ExtrudeSolid, FaceEntity, Factory, FastDrillingEdgeGeometry, FastDrillingMeshGeometry, FastMeshGeometry, GangDrillType, GetBoxGeoBufferGeometry, GetHoleLengthOfIndex, Groove, GroupRecord, GroupTable, HardwareCompositeEntity, HardwareTopline, HemisphereLight, HistoricManage, HistorycRecord, Hole, InitClipperCpp, IsPhysical, Light, Line, LineAngularDimension, LinearDimension, MaterialTableRecord, MaxDrawGrooveCount, ObjectAllDataHistoryRecord, ObjectCollection, PhysicalMaterialRecord, Point, PointLight, Polyline, Positioning, PositioningBoardSpace, PositioningClampSpace, PositioningTemporary, ProcessingGroupRecord, ProcessingGroupTable, RadiusDimension, RectAreaLight, Region, RemoveObjectData, RenderType, RevolveSolid, RoomBase, RoomFlatBase, RoomFlatFloor, RoomFlatTop, RoomHoleBase, RoomHoleLine, RoomHolePolyline, RoomRegion, RoomWallArc, RoomWallBase, RoomWallLine, RoomWallParse, Shape2, Spline, SpotLight, SubtractRange, SubtractRange2, SweepSolid, SymbolTable, Tape, TempPolyline$1 as TempPolyline, TempateDefaultParamCount, TempateThicknessAction, TemplateAction, TemplateBehindBoard, TemplateBoardRecord, TemplateFilletAction, TemplateLatticeRecord, TemplateLayerBoard, TemplateLeftRightBoardRecord, TemplateMaterialAction, TemplateMoveAction, TemplateParam, TemplateRecord, TemplateSizeBoard, TemplateStretchGripAction, TemplateStretchScaleBoxAction, TemplateTable, TemplateTopBottomBoard, TemplateVerticalBoard, TemplateVisualSpace, TemplateWineRackRecord, Text, TextAligen, TextureTable, TextureTableRecord, ThicknessDirection, UVType, UpdateHoleFakerWallsAndUpdateDraw, UpdateRelevanceWallHole, UpdateTempPolyline, UpdateWallHolesDataAndUpdateDraw, ViewportEntity, ViewportEntity2, VisualSpaceBox, WallFaceType, applyMixins, boardUVGenerator, boardUVGenerator2, clipperCpp };
|
||||
export { AlignedDimension, AllObjectData, AmbientLight, Arc, ArcDimension, AxisCS, BlockTable, BlockTableRecord, Board, BoxSolid, CADFactory, CADFiler, CURVE_FACE_TYPE_KEY, CURVE_MESH_NAMES, CameraSnapshootRecord, CameraType, CameraUpdate, Circle, CommandHistoryRecord, CompositeEntity, ContourTreeNode, ConverBoardTypeToSpaceType, CreateObjectData, Curve, CurveTapeShape, CylinderHole, Cylineder, Database, DepthType, DiameterDimension, Dimension, DirectionalLight, DisposeTextShapeCache, DuplicateRecordCloning, Ellipse, Entity, EntityColorHistoryRecord, EntityRef, EraseEntityData, ExtendType$1 as ExtendType, ExtrudeBuildConfig, ExtrudeGeometryBuilder, ExtrudeHole, ExtrudeSolid, FaceEntity, Factory, FastDrillingEdgeGeometry, FastDrillingMeshGeometry, FastMeshGeometry, GangDrillType, GetBoxGeoBufferGeometry, GetHoleLengthOfIndex, Groove, GroupRecord, GroupTable, HardwareCompositeEntity, HardwareTopline, HemisphereLight, HistoricManage, HistorycRecord, Hole, InitClipperCpp, IsPhysical, Light, Line, LineAngularDimension, LinearDimension, MaterialTableRecord, MaxDrawGrooveCount, ObjectAllDataHistoryRecord, ObjectCollection, PhysicalMaterialRecord, Point, PointLight, Polyline, Positioning, PositioningBoardSpace, PositioningClampSpace, PositioningTemporary, ProcessingGroupRecord, ProcessingGroupTable, Purge, PurgeTemplateTreeRoot, RadiusDimension, RectAreaLight, Region, RemoveObjectData, RenderType, RevolveSolid, RoomBase, RoomFlatBase, RoomFlatFloor, RoomFlatTop, RoomHoleBase, RoomHoleLine, RoomHolePolyline, RoomRegion, RoomWallArc, RoomWallBase, RoomWallLine, RoomWallParse, Shape2, Spline, SpotLight, Status, SubtractRange, SubtractRange2, SweepSolid, SymbolTable, Tape, TempPolyline$1 as TempPolyline, TempateDefaultParamCount, TempateThicknessAction, TemplateAction, TemplateBehindBoard, TemplateBoardRecord, TemplateFilletAction, TemplateLatticeRecord, TemplateLayerBoard, TemplateLeftRightBoardRecord, TemplateMaterialAction, TemplateMoveAction, TemplateParam, TemplateRecord, TemplateSetSealAction, TemplateSizeBoard, TemplateStretchGripAction, TemplateStretchScaleBoxAction, TemplateTable, TemplateTopBottomBoard, TemplateVerticalBoard, TemplateVisualSpace, TemplateWineRackRecord, Text, TextAligen, TextureTable, TextureTableRecord, ThicknessDirection, UVType, UpdateDraw, UpdateHoleFakerWallsAndUpdateDraw, UpdateRelevanceWallHole, UpdateTempPolyline, UpdateWallHolesDataAndUpdateDraw, ViewportEntity, ViewportEntity2, VisualSpaceBox, WallFaceType, applyMixins, boardUVGenerator, boardUVGenerator2, clipperCpp };
|
||||
//# sourceMappingURL=api.esm.js.map
|
||||
|
Reference in New Issue
Block a user