同步代码
This commit is contained in:
216
api.esm.js
216
api.esm.js
@@ -153,6 +153,7 @@ var RenderType;
|
||||
/**真实带线框 */
|
||||
RenderType[RenderType["Physical2Print"] = 106] = "Physical2Print";
|
||||
RenderType[RenderType["CustomNumberPrint"] = 109] = "CustomNumberPrint";
|
||||
RenderType[RenderType["ConceptualTransparent"] = 182] = "ConceptualTransparent"; //概念透明
|
||||
})(RenderType || (RenderType = {}));
|
||||
function IsPhysical(renderType) {
|
||||
return renderType === RenderType.Physical || renderType === RenderType.Physical2 || renderType === RenderType.PhysicalPrint || renderType === RenderType.Physical2Print;
|
||||
@@ -169,6 +170,7 @@ class IHostApplicationServices {
|
||||
}
|
||||
}
|
||||
constructor() {
|
||||
this.IsRoomEntityVisible = true; //室内实体可见
|
||||
this.isShowLightShadow = true; //灯光阴影 (除太阳光外)
|
||||
this.ShowHistoryLog = true;
|
||||
this.Physical2EdgeColor = 7; //真实视图带线框的线框颜色 默认白色
|
||||
@@ -202,7 +204,8 @@ class IHostApplicationServices {
|
||||
isCheckInterfere: false,
|
||||
noModeingData: "",
|
||||
statTk: false,
|
||||
statSt: false, //统计双头排钻
|
||||
statSt: false,
|
||||
drillRemark: false //拆单获取排钻备注
|
||||
};
|
||||
this.viewSize = {
|
||||
minViewHeight: 1e-3,
|
||||
@@ -2201,7 +2204,6 @@ function FixedNotZero(v, fractionDigits = 0) {
|
||||
* To fixed
|
||||
* @param v
|
||||
* @param [fractionDigits]
|
||||
* @returns
|
||||
*/
|
||||
function ToFixed(v, fractionDigits = 5) {
|
||||
if (equaln$1(v, 0, Math.pow(0.1, fractionDigits)))
|
||||
@@ -3141,7 +3143,7 @@ class ColorMaterial {
|
||||
}
|
||||
static GetConceptualEdgeMaterial() {
|
||||
if (!this._ConceptualEdgeMaterial)
|
||||
this._ConceptualEdgeMaterial = new LineBasicMaterial({ color: this.GetColor(HostApplicationServices.ConceptualEdgeColor).clone(), side: DoubleSide });
|
||||
this._ConceptualEdgeMaterial = new LineBasicMaterial({ color: this.GetColor(HostApplicationServices.ConceptualEdgeColor), side: DoubleSide });
|
||||
return this._ConceptualEdgeMaterial;
|
||||
}
|
||||
static UpdateConceptualEdgeMaterial() {
|
||||
@@ -3150,7 +3152,7 @@ class ColorMaterial {
|
||||
}
|
||||
static GetPhysical2EdgeMaterial() {
|
||||
if (!this._Physical2EdgeMaterial)
|
||||
this._Physical2EdgeMaterial = new LineBasicMaterial({ color: this.GetColor(HostApplicationServices.Physical2EdgeColor).clone(), side: DoubleSide });
|
||||
this._Physical2EdgeMaterial = new LineBasicMaterial({ color: this.GetColor(HostApplicationServices.Physical2EdgeColor), side: DoubleSide });
|
||||
return this._Physical2EdgeMaterial;
|
||||
}
|
||||
static UpdatePhysical2EdgeMaterial() {
|
||||
@@ -8729,12 +8731,25 @@ function IntersectPolylineAndCurve(pl, cu, extType, tolerance = 1e-6) {
|
||||
//如果曲线是起始又是结束,那么不校验.
|
||||
if (isStart && isEnd) ;
|
||||
else if (isStart) {
|
||||
//暂时没有必要
|
||||
// let cu1EndPoint = cu1.EndPoint;
|
||||
// for (let i = 0; i < ptPars.length; i++)
|
||||
// if (equalv3(ptPars[i].pt, cu1EndPoint, tolerance))
|
||||
// ptPars[i].thisParam = 1;//如果通过容差测试,我们认为它在终点上
|
||||
ptPars = ptPars.filter(res => res.thisParam <= 1);
|
||||
}
|
||||
else if (isEnd) {
|
||||
//暂时没有必要
|
||||
// let cu1StartPoint = cu1.StartPoint;
|
||||
// for (let i = 0; i < ptPars.length; i++)
|
||||
// if (equalv3(ptPars[i].pt, cu1StartPoint, tolerance))
|
||||
// ptPars[i].thisParam = 0;//如果通过容差测试,我们认为它在起点上
|
||||
ptPars = ptPars.filter(res => res.thisParam >= 0);
|
||||
}
|
||||
}
|
||||
else //当曲线不延伸时,它通过了容差测验,这时我们认为曲线在线上
|
||||
for (let i = 0; i < ptPars.length; i++)
|
||||
ptPars[i].thisParam = clamp(ptPars[i].thisParam, 0, 1);
|
||||
if (IntersectOption.ExtendArg & ext) {
|
||||
//如果曲线是起始又是结束,那么不校验.
|
||||
if (isStart2 && isEnd2) ;
|
||||
@@ -8745,6 +8760,9 @@ function IntersectPolylineAndCurve(pl, cu, extType, tolerance = 1e-6) {
|
||||
ptPars = ptPars.filter(res => res.argParam + j >= 0);
|
||||
}
|
||||
}
|
||||
else //当曲线不延伸时,它通过了容差测验,这时我们认为曲线在线上
|
||||
for (let i = 0; i < ptPars.length; i++)
|
||||
ptPars[i].argParam = clamp(ptPars[i].argParam, 0, 1);
|
||||
intRes.push(...ptPars.map(r => {
|
||||
return {
|
||||
pt: r.pt,
|
||||
@@ -10977,6 +10995,8 @@ var EBoardKeyList;
|
||||
EBoardKeyList["SpliteWidth"] = "spliteWidth";
|
||||
EBoardKeyList["SpliteThickness"] = "spliteThickness";
|
||||
EBoardKeyList["DrawNumber"] = "drawNumber";
|
||||
EBoardKeyList["Remarks"] = "remarks";
|
||||
EBoardKeyList["ExtraRemarks"] = "extraRemarks"; //追加备注
|
||||
})(EBoardKeyList || (EBoardKeyList = {}));
|
||||
|
||||
/**序列化板件数据 */
|
||||
@@ -12877,6 +12897,15 @@ const DefaultChangeColorByBoardMaterialOption = {
|
||||
accordMaterialName: true
|
||||
};
|
||||
Object.freeze(DefaultChangeColorByBoardMaterialOption);
|
||||
const DefaultShareBoardInfConfigurationOption = {
|
||||
Physical2EdgeColor: 7,
|
||||
VisualStyle: RenderType.Conceptual,
|
||||
Viewport: ViewDirection.Southwest,
|
||||
IsExportBoard: true,
|
||||
IsExportHardware: true,
|
||||
showBom: true,
|
||||
};
|
||||
Object.freeze(DefaultShareBoardInfConfigurationOption);
|
||||
|
||||
function equaln(v1, v2, fuzz = 1e-5) {
|
||||
return Math.abs(v1 - v2) <= fuzz;
|
||||
@@ -16375,12 +16404,13 @@ let ExtrudeSolid = ExtrudeSolid_1 = class ExtrudeSolid extends Entity {
|
||||
return grooves;
|
||||
}
|
||||
}
|
||||
//del_exp2_end
|
||||
/**
|
||||
* (步骤2)
|
||||
* 更新凹槽位置和厚度(校验凹槽的Z轴位置是否存在交集)
|
||||
*/
|
||||
GrooveCheckPosition(target) {
|
||||
if (target.Width < 1e-2 || target.Height < 1e-2 || target.Thickness < 1e-2)
|
||||
if (target.Width < 1e-1 || target.Height < 1e-1 || target.Thickness < 1e-1)
|
||||
return Status.False;
|
||||
let tp = target.Position.applyMatrix4(this.OCSInv);
|
||||
let minZ = tp.z;
|
||||
@@ -16391,13 +16421,13 @@ let ExtrudeSolid = ExtrudeSolid_1 = class ExtrudeSolid extends Entity {
|
||||
if (!(equaln$1(minZ, 0)))
|
||||
target.ApplyMatrix(MoveMatrix(this.Normal.multiplyScalar(-minZ)));
|
||||
}
|
||||
else if (maxZ >= (this.thickness - 1e-3) && minZ > 0) //正面
|
||||
else if (maxZ >= (this.thickness - 1e-2) && minZ > 0) //正面
|
||||
target.Thickness = this.thickness - minZ;
|
||||
else
|
||||
return Status.False;
|
||||
if (equaln$1(target.thickness, this.thickness, 1e-3))
|
||||
if (equaln$1(target.thickness, this.thickness, 1e-2))
|
||||
target.thickness = this.thickness;
|
||||
return target.thickness > 1e-3 ? Status.True : Status.False;
|
||||
return target.thickness > 1e-2 ? Status.True : Status.False;
|
||||
}
|
||||
/**
|
||||
* (步骤3)
|
||||
@@ -17479,6 +17509,70 @@ ExtrudeHole = __decorate([
|
||||
Factory
|
||||
], ExtrudeHole);
|
||||
|
||||
let GroupRecord = class GroupRecord extends SymbolTableRecord {
|
||||
constructor() {
|
||||
super();
|
||||
this.Entitys = new Proxy([], {
|
||||
set: (target, key, value, receiver) => {
|
||||
if (Reflect.get(target, key, receiver) !== value) {
|
||||
if (this.WriteAllObjectRecord()) {
|
||||
if (value instanceof ObjectId && value.Object instanceof Entity) {
|
||||
if (!this.Id)
|
||||
console.warn("请先添加到Database后在进行操作!");
|
||||
else
|
||||
value.Object.GroupId = this.Id;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Reflect.set(target, key, value, receiver);
|
||||
},
|
||||
get: (target, key, receiver) => {
|
||||
if (key === ISPROXYKEY)
|
||||
return true;
|
||||
return Reflect.get(target, key, receiver);
|
||||
}
|
||||
});
|
||||
}
|
||||
get Name() {
|
||||
return this.name;
|
||||
}
|
||||
set Name(name) {
|
||||
if (name !== this.name) {
|
||||
this.WriteAllObjectRecord();
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
Purge() {
|
||||
arrayRemoveIf(this.Entitys, id => !id || id.IsErase);
|
||||
}
|
||||
//对象从文件中读取数据,初始化自身
|
||||
ReadFile(file) {
|
||||
file.Read();
|
||||
super.ReadFile(file);
|
||||
let count = file.Read();
|
||||
this.Entitys.length = 0;
|
||||
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.Entitys.length);
|
||||
for (let id of this.Entitys)
|
||||
file.WriteObjectId(id);
|
||||
}
|
||||
};
|
||||
__decorate([
|
||||
AutoRecord
|
||||
], GroupRecord.prototype, "Entitys", void 0);
|
||||
GroupRecord = __decorate([
|
||||
Factory
|
||||
], GroupRecord);
|
||||
|
||||
var CompositeEntity_1;
|
||||
let CompositeEntity = CompositeEntity_1 = class CompositeEntity extends Entity {
|
||||
constructor() {
|
||||
@@ -17749,6 +17843,9 @@ let HardwareCompositeEntity = HardwareCompositeEntity_1 = class HardwareComposit
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.HardwareOption = { ...DefaultCompositeMetalsOption };
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
this.DataList = [];
|
||||
this.RelevanceBoards = [];
|
||||
this.RelevanceHardware = []; //当这个实体为复合板时,关联五金的信息
|
||||
@@ -18242,13 +18339,9 @@ function OptimizeToolPath(offsetCus, originShape, rad) {
|
||||
}
|
||||
if (cu instanceof Polyline) {
|
||||
//轮廓朝下的逆时针轮廓需要翻转
|
||||
//如果走刀不止一条,第一刀为顺时针,其余为逆时针
|
||||
//第一刀为顺时针,其余为逆时针
|
||||
if (cu.IsClose) {
|
||||
if (offsetCus.length === 1) {
|
||||
if (cu.Normal.z * cu.Area2 < 0)
|
||||
cu.Reverse();
|
||||
}
|
||||
else if ((cu.Normal.z * cu.Area2 < 0) === (cu !== offsetCus[0]))
|
||||
if ((cu.Normal.z * cu.Area2 < 0) === (cu !== offsetCus[0]))
|
||||
cu.Reverse();
|
||||
}
|
||||
plList.push(cu);
|
||||
@@ -19227,6 +19320,7 @@ var Production;
|
||||
radius: nail.Radius,
|
||||
depth,
|
||||
face,
|
||||
name: '层板钉'
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -19239,7 +19333,8 @@ var Production;
|
||||
position: center,
|
||||
radius: cu.Radius,
|
||||
depth: m.thickness,
|
||||
face: m.dir
|
||||
face: m.dir,
|
||||
name: GetGroupName(cu)
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -19380,7 +19475,8 @@ var Production;
|
||||
radius: cyHole.Radius,
|
||||
depth,
|
||||
face,
|
||||
angle
|
||||
angle,
|
||||
name: GetGroupName(cyHole)
|
||||
});
|
||||
}
|
||||
/**分析自定义圆柱排钻 */
|
||||
@@ -19432,6 +19528,7 @@ var Production;
|
||||
depth,
|
||||
face: z0 < CanDrawHoleFuzz ? FaceDirection.Back : FaceDirection.Front,
|
||||
angle: angle,
|
||||
name: GetGroupName(d)
|
||||
});
|
||||
}
|
||||
else {
|
||||
@@ -19473,6 +19570,7 @@ var Production;
|
||||
radius: cir.Radius,
|
||||
depth,
|
||||
face,
|
||||
name: GetGroupName(d)
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -19671,6 +19769,13 @@ var Production;
|
||||
return paths.map((c) => ConverToPtsBul(c, false));
|
||||
}
|
||||
Production.GetChaiDanFeedingPath = GetChaiDanFeedingPath;
|
||||
function GetGroupName(ent) {
|
||||
let group = ent.GroupId?.Object;
|
||||
if (!group || !(group instanceof GroupRecord))
|
||||
return "未知(无拆单名称)";
|
||||
return group.Name;
|
||||
}
|
||||
Production.GetGroupName = GetGroupName;
|
||||
})(Production || (Production = {}));
|
||||
|
||||
/**
|
||||
@@ -22079,6 +22184,9 @@ function EntitysUpdateWrap(ens, exec) {
|
||||
* 墙 平面(地板 天花)
|
||||
*/
|
||||
let RoomBase = class RoomBase extends Entity {
|
||||
get IsVisible() {
|
||||
return HostApplicationServices.IsRoomEntityVisible && super.IsVisible;
|
||||
}
|
||||
};
|
||||
RoomBase = __decorate([
|
||||
Factory
|
||||
@@ -28450,6 +28558,15 @@ class MaterialTable extends SymbolTable {
|
||||
file.WriteObjectId(this._CurDrawMtl);
|
||||
}
|
||||
}
|
||||
__decorate([
|
||||
observable
|
||||
], MaterialTable.prototype, "_CurFloorMtl", void 0);
|
||||
__decorate([
|
||||
observable
|
||||
], MaterialTable.prototype, "_CurWallMtl", void 0);
|
||||
__decorate([
|
||||
observable
|
||||
], MaterialTable.prototype, "_CurDrawMtl", void 0);
|
||||
|
||||
let ProcessingGroupTable = class ProcessingGroupTable extends ObjectCollection {
|
||||
Append(object, isCheckObjectCleanly = true) {
|
||||
@@ -29068,70 +29185,6 @@ FaceEntity = __decorate([
|
||||
Factory
|
||||
], FaceEntity);
|
||||
|
||||
let GroupRecord = class GroupRecord extends SymbolTableRecord {
|
||||
constructor() {
|
||||
super();
|
||||
this.Entitys = new Proxy([], {
|
||||
set: (target, key, value, receiver) => {
|
||||
if (Reflect.get(target, key, receiver) !== value) {
|
||||
if (this.WriteAllObjectRecord()) {
|
||||
if (value instanceof ObjectId && value.Object instanceof Entity) {
|
||||
if (!this.Id)
|
||||
console.warn("请先添加到Database后在进行操作!");
|
||||
else
|
||||
value.Object.GroupId = this.Id;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Reflect.set(target, key, value, receiver);
|
||||
},
|
||||
get: (target, key, receiver) => {
|
||||
if (key === ISPROXYKEY)
|
||||
return true;
|
||||
return Reflect.get(target, key, receiver);
|
||||
}
|
||||
});
|
||||
}
|
||||
get Name() {
|
||||
return this.name;
|
||||
}
|
||||
set Name(name) {
|
||||
if (name !== this.name) {
|
||||
this.WriteAllObjectRecord();
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
Purge() {
|
||||
arrayRemoveIf(this.Entitys, id => !id || id.IsErase);
|
||||
}
|
||||
//对象从文件中读取数据,初始化自身
|
||||
ReadFile(file) {
|
||||
file.Read();
|
||||
super.ReadFile(file);
|
||||
let count = file.Read();
|
||||
this.Entitys.length = 0;
|
||||
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.Entitys.length);
|
||||
for (let id of this.Entitys)
|
||||
file.WriteObjectId(id);
|
||||
}
|
||||
};
|
||||
__decorate([
|
||||
AutoRecord
|
||||
], GroupRecord.prototype, "Entitys", void 0);
|
||||
GroupRecord = __decorate([
|
||||
Factory
|
||||
], GroupRecord);
|
||||
|
||||
function BuildLayerBoards(opt, space, grooveOption) {
|
||||
let spaceBox = space.SpaceBox;
|
||||
let spaceOCS = space.SpaceOCS;
|
||||
@@ -36166,6 +36219,9 @@ let EntityRef = class EntityRef extends Entity {
|
||||
this._Center = new Vector3; //盒子中心
|
||||
this._OverWriteMaterial = new Map(); //section index -> materialId
|
||||
}
|
||||
get IsVisible() {
|
||||
return HostApplicationServices.IsRoomEntityVisible && super.IsVisible;
|
||||
}
|
||||
get Url() { return this._url; }
|
||||
get CurSize() { return this.ScaleSize.x ? this.ScaleSize.clone() : this._Size.clone(); }
|
||||
get ScaleSize() { return this._ScaleSize; }
|
||||
|
Reference in New Issue
Block a user