更新版本
This commit is contained in:
456
api.esm.js
456
api.esm.js
@@ -265,6 +265,19 @@ var FractionDigitsType;
|
||||
FractionDigitsType[FractionDigitsType["five"] = 5] = "five";
|
||||
FractionDigitsType[FractionDigitsType["six"] = 6] = "six";
|
||||
})(FractionDigitsType || (FractionDigitsType = {}));
|
||||
/**
|
||||
* 标注中的箭头样式
|
||||
* @see https://help.autodesk.com/view/ACD/2019/CHS/?guid=GUID-6E09DCCA-313F-4FF4-BB1B-F41B512B9CC9
|
||||
*/
|
||||
var ArrowType;
|
||||
(function (ArrowType) {
|
||||
/** 三角箭头 */
|
||||
ArrowType["arrow"] = "";
|
||||
/** 圆形小点 */
|
||||
ArrowType["dotsmall"] = "_DOTSMALL";
|
||||
/** 倾斜线段 */
|
||||
ArrowType["oblique"] = "_OBLIQUE";
|
||||
})(ArrowType || (ArrowType = {}));
|
||||
|
||||
/**
|
||||
* 场景的渲染类型.
|
||||
@@ -357,6 +370,7 @@ class IHostApplicationServices {
|
||||
this.ConceptualTransparentOpacity = 0.5; //概念(透明)的透明度
|
||||
this.IsTransparentMetals = false; // 五金是否受概念(透明)影响
|
||||
this.IsTransparentComp = false; // 组件是否受概念(透明)影响
|
||||
this.printIsColor = false; // 布局与打印是否有颜色
|
||||
this.DrawWallBottomFace = false; //绘制底面
|
||||
this.sealReserve = 0; //封边统计留头量
|
||||
//#region _RenderType 渲染类型
|
||||
@@ -476,6 +490,9 @@ __decorate([
|
||||
__decorate([
|
||||
ProxyValue
|
||||
], IHostApplicationServices.prototype, "IsTransparentComp", void 0);
|
||||
__decorate([
|
||||
ProxyValue
|
||||
], IHostApplicationServices.prototype, "printIsColor", void 0);
|
||||
__decorate([
|
||||
ProxyValue
|
||||
], IHostApplicationServices.prototype, "_renderType", void 0);
|
||||
@@ -4066,6 +4083,7 @@ var BufferGeometryUtils;
|
||||
}
|
||||
BufferGeometryUtils.UpdatePts = UpdatePts;
|
||||
let arrowGeometry;
|
||||
/** 在标注箭头上使用(端点为一个箭头) */
|
||||
function ArrowGeometry() {
|
||||
if (arrowGeometry)
|
||||
return arrowGeometry;
|
||||
@@ -4079,6 +4097,44 @@ var BufferGeometryUtils;
|
||||
}
|
||||
}
|
||||
BufferGeometryUtils.ArrowGeometry = ArrowGeometry;
|
||||
let pointGeometry;
|
||||
/** 在标注箭头上使用(端点为一个圆点) */
|
||||
function PointGeometry() {
|
||||
if (pointGeometry)
|
||||
return pointGeometry;
|
||||
else {
|
||||
const pointShape = new Shape$1();
|
||||
const R = 1; // 圆弧半径
|
||||
const N = 20; // 分段数量
|
||||
const sp = 2 * Math.PI / N; // 两个相邻点间隔弧度
|
||||
for (let i = 0; i <= N; i++) {
|
||||
const angle = sp * i; // 当前点弧度
|
||||
const X = R * Math.cos(angle);
|
||||
const Y = R * Math.sin(angle);
|
||||
pointShape.lineTo(X, Y);
|
||||
}
|
||||
pointGeometry = new ShapeGeometry(pointShape);
|
||||
pointGeometry.computeBoundingSphere();
|
||||
return pointGeometry;
|
||||
}
|
||||
}
|
||||
BufferGeometryUtils.PointGeometry = PointGeometry;
|
||||
let lineGeometry;
|
||||
/** 在标注箭头上使用(端点为一条斜线) */
|
||||
function LineGeometry() {
|
||||
if (lineGeometry)
|
||||
return lineGeometry;
|
||||
else {
|
||||
const lineShape = new Shape$1();
|
||||
const len = 2; // 线段长度
|
||||
lineShape.lineTo(len, len);
|
||||
lineShape.lineTo(-len, -len);
|
||||
lineGeometry = new ShapeGeometry(lineShape);
|
||||
lineGeometry.computeBoundingSphere();
|
||||
return lineGeometry;
|
||||
}
|
||||
}
|
||||
BufferGeometryUtils.LineGeometry = LineGeometry;
|
||||
function MergeBufferGeometries(geometries, useGroups = false) {
|
||||
if (geometries.length === 0)
|
||||
return new BufferGeometry();
|
||||
@@ -4985,7 +5041,11 @@ let Curve = class Curve extends Entity {
|
||||
for (let p of pts)
|
||||
array.push(p.x, p.y, 0);
|
||||
let geometry = new LineGeometry().setPositions(array);
|
||||
return new Line2(geometry, ColorMaterial.PrintLineMatrial);
|
||||
const material = ColorMaterial.PrintLineMatrial.clone();
|
||||
// 引线的颜色
|
||||
if (HostApplicationServices.printIsColor)
|
||||
material.color = ColorMaterial.GetColor(this.ColorIndex);
|
||||
return new Line2(geometry, material);
|
||||
}
|
||||
let geo = new BufferGeometry().setFromPoints(pts);
|
||||
return new Line$1(geo, ColorMaterial.GetLineMaterial(this.DrawColorIndex));
|
||||
@@ -5165,7 +5225,14 @@ let Line = Line_1 = class Line extends Curve {
|
||||
for (let p of pts)
|
||||
array.push(p.x, p.y, p.z);
|
||||
let geometry = new LineGeometry().setPositions(array);
|
||||
return new Line2(geometry, ColorMaterial.PrintLineMatrial);
|
||||
// 线段的颜色
|
||||
if (HostApplicationServices.printIsColor) {
|
||||
if (!this._PrintLineMatrial) {
|
||||
this._PrintLineMatrial = ColorMaterial.PrintLineMatrial.clone();
|
||||
this._PrintLineMatrial.color = ColorMaterial.GetColor(this.ColorIndex);
|
||||
}
|
||||
return new Line2(geometry, this._PrintLineMatrial);
|
||||
}
|
||||
}
|
||||
let geo = new BufferGeometry().setFromPoints(pts);
|
||||
return new Line$1(geo, ColorMaterial.GetLineMaterial(this.DrawColorIndex));
|
||||
@@ -15894,7 +15961,7 @@ const DefaultSpotLightOption = {
|
||||
SourceLength: 0,
|
||||
Angle: 45,
|
||||
InnerConeAngle: 30,
|
||||
AttenuationRadius: 300,
|
||||
AttenuationRadius: 1000,
|
||||
CaseShadow: true,
|
||||
ShowHelper: true,
|
||||
};
|
||||
@@ -15906,7 +15973,7 @@ const DefaultRectAreaLightOption = {
|
||||
Intensity: 100,
|
||||
IndirectLightingIntensity: 3,
|
||||
SpecularScale: 1,
|
||||
AttenuationRadius: 300,
|
||||
AttenuationRadius: 1000,
|
||||
Width: 150,
|
||||
Height: 150,
|
||||
BarnDoorAngle: 90,
|
||||
@@ -16820,6 +16887,7 @@ const DefaultDimStyleOption = {
|
||||
dimTXT: 60,
|
||||
dimTAD: 2,
|
||||
dimADEC: 2,
|
||||
dimARROW: ArrowType.arrow,
|
||||
};
|
||||
Object.freeze(DefaultDimStyleOption);
|
||||
const DefaultChangeColorByBoardMaterialOption = {
|
||||
@@ -16953,7 +17021,7 @@ const DefaultSpaceParseOption = {
|
||||
};
|
||||
Object.freeze(DefaultSpaceParseOption);
|
||||
const DefaultEditViewOption = {
|
||||
version: 1,
|
||||
version: 2,
|
||||
hight: 60,
|
||||
renderType: false,
|
||||
renderTypeValue: "概念",
|
||||
@@ -16976,7 +17044,8 @@ const DefaultEditViewOption = {
|
||||
hideLayer: false,
|
||||
hideLayerValue: "",
|
||||
showLayer: false,
|
||||
showLayerValue: ""
|
||||
showLayerValue: "",
|
||||
showDrill: false,
|
||||
};
|
||||
Object.freeze(DefaultEditViewOption);
|
||||
const DefaultFontStyleOption = {
|
||||
@@ -22287,8 +22356,9 @@ let ExtrudeSolid = ExtrudeSolid_1 = class ExtrudeSolid extends Entity {
|
||||
//---切割掉 在相交轮廓两侧的部分 begin--
|
||||
let pos = sideModelCon.Position;
|
||||
sideModelCon.ApplyMatrix(new Matrix4().setPosition(0, 0, -pos.z));
|
||||
let starKnifePls1 = new Polyline([{ pt: AsVector2({ x: box.min.x, y: 1 }), bul: 0 }, { pt: AsVector2({ x: box.min.x, y: 0 }), bul: 0 }]);
|
||||
let starKnifePls2 = new Polyline([{ pt: AsVector2({ x: box.max.x, y: 1 }), bul: 0 }, { pt: AsVector2({ x: box.max.x, y: 0 }), bul: 0 }]);
|
||||
const FaceLength = cus[intersectFaceIndex].Length;
|
||||
let starKnifePls1 = new Polyline([{ pt: new Vector2$1(0, 1), bul: 0 }, { pt: new Vector2$1(), bul: 0 }]);
|
||||
let starKnifePls2 = new Polyline([{ pt: new Vector2$1(FaceLength, 1), bul: 0 }, { pt: new Vector2$1(FaceLength), bul: 0 }]);
|
||||
let faceRegions = SplitPolyline(sideModelCon, [starKnifePls1, starKnifePls2]);
|
||||
// TestDraw(faceRegions);
|
||||
let maxX = con.BoundingBox.getSize(new Vector3).x;
|
||||
@@ -26905,6 +26975,7 @@ var Production;
|
||||
data.factory = ParseExpr(data.factory, accuracy, { L: size.x, W: size.y, H: size.z });
|
||||
data.brand = ParseExpr(data.brand, accuracy, { L: size.x, W: size.y, H: size.z });
|
||||
data.count = (safeEval(data.count, { L: size.x, W: size.y, H: size.z }) || 0).toString();
|
||||
data.comments = ParseExpr(data.comments, accuracy, { L: size.x, W: size.y, H: size.z });
|
||||
let metalData = {
|
||||
metalsOption: data,
|
||||
dataList: en.DataList,
|
||||
@@ -29390,7 +29461,7 @@ let Text = class Text extends Entity {
|
||||
get HasBoundingBox() { return this._CacheDrawObject.has(RenderType.Wireframe); }
|
||||
get BoundingBox() {
|
||||
let obj = this._CacheDrawObject.get(RenderType.Wireframe);
|
||||
if (obj && obj.children.length === 1)
|
||||
if (obj && (obj.children.length === 1 || obj.children.length === 2))
|
||||
return GetBox(obj);
|
||||
return this.BoundingBoxInOCS.applyMatrix4(new Matrix4().makeRotationZ(this.TextRotation)).applyMatrix4((this.OCSNoClone));
|
||||
}
|
||||
@@ -29398,7 +29469,8 @@ let Text = class Text extends Entity {
|
||||
let width = this.Width;
|
||||
let height = this.MultiHeight;
|
||||
let obj = this._CacheDrawObject.get(RenderType.Wireframe);
|
||||
if (obj && obj.children.length === 1) {
|
||||
if (obj && (obj.children.length === 1 || obj.children.length === 2)) {
|
||||
//单面和双面都只要第一个children对象包围盒
|
||||
let geo = obj.children[0].geometry;
|
||||
if (geo) {
|
||||
if (!geo.boundingBox)
|
||||
@@ -29476,13 +29548,30 @@ let Text = class Text extends Entity {
|
||||
let g = new Object3D();
|
||||
if (renderType !== RenderType.Wireframe) {
|
||||
let obj = this.CacheDrawObject.get(RenderType.Wireframe);
|
||||
if (obj && obj.children.length === 1 && obj.children[0].geometry) {
|
||||
let color = (renderType > 100 || renderType === RenderType.Print) ? 0 : this.DrawColorIndex;
|
||||
let mesh = new Mesh(obj.children[0].geometry, ColorMaterial.GetBasicMaterial(color));
|
||||
g.add((mesh));
|
||||
g.updateMatrixWorld(true);
|
||||
this.UpdateObjectTranslate(g);
|
||||
return g;
|
||||
if (obj) {
|
||||
let color = (renderType > 100 || renderType === RenderType.Print) && !HostApplicationServices.printIsColor ? 0 : this.DrawColorIndex;
|
||||
if (obj.children.length === 1) {
|
||||
let geom = obj.children[0].geometry;
|
||||
if (geom) {
|
||||
let mesh = new Mesh(geom, ColorMaterial.GetBasicMaterial(color));
|
||||
g.add((mesh));
|
||||
g.updateMatrixWorld(true);
|
||||
this.UpdateObjectTranslate(g);
|
||||
return g;
|
||||
}
|
||||
}
|
||||
else if (obj.children.length === 2) {
|
||||
let geom1 = obj.children[0].geometry;
|
||||
let geom2 = obj.children[1].geometry;
|
||||
if (geom1 && geom2) {
|
||||
let mesh1 = new Mesh(geom1, ColorMaterial.GetBasicMaterial(color));
|
||||
let mesh2 = new Mesh(geom2, ColorMaterial.GetBasicMaterial(color));
|
||||
g.add(mesh1, mesh2);
|
||||
g.updateMatrixWorld(true);
|
||||
this.UpdateObjectTranslate(g);
|
||||
return g;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.AsyncUpdateDrawObject(g, renderType);
|
||||
@@ -29494,11 +29583,12 @@ let Text = class Text extends Entity {
|
||||
UpdateDrawObjectMaterial(renderType, en) {
|
||||
if (en) {
|
||||
//因为我们是OnlyRnderType 所以Print会变成WireframePrint,所以要用下面的写法
|
||||
let color = (renderType > 100 || renderType === RenderType.Print) ? 0 : this.DrawColorIndex;
|
||||
let color = (!HostApplicationServices.printIsColor && (renderType > 100 || renderType === RenderType.Print)) ? 0 : this.DrawColorIndex;
|
||||
if (en.children.length === 1) {
|
||||
let mesh = en.children[0];
|
||||
mesh.material = ColorMaterial.GetBasicMaterialDoubleSide(color);
|
||||
}
|
||||
// 两个单面的情况
|
||||
else if (en.children.length === 2) {
|
||||
let mesh1 = en.children[0];
|
||||
let mesh2 = en.children[1];
|
||||
@@ -29755,26 +29845,32 @@ let Board = Board_1 = class Board extends ExtrudeSolid {
|
||||
this.Update();
|
||||
}
|
||||
UpdateArcBoardOptions(isNewPath) {
|
||||
//更新ArcBuild曲线数据
|
||||
this._SweepArcBoardBuild = new ArcBoardBuild(this).ParseSweepCurves();
|
||||
let cus = this.GetSweepPathInWCS().Explode();
|
||||
/** 路径段(旧) */
|
||||
const curves = this._SweepPath.Explode();
|
||||
/** (Length=0的路径段)的过滤表 */
|
||||
const ignores = new Set();
|
||||
for (let i = 0; i < curves.length; i++) {
|
||||
const cu = curves[i];
|
||||
if (equaln$1(cu.Length, 0, 1e-3))
|
||||
ignores.add(i);
|
||||
}
|
||||
let newOpts = new Map();
|
||||
newOpts.set(-1, this._ArcBoardOptions.get(-1));
|
||||
//如果是新的多段线信息,就更新全部数据
|
||||
if (isNewPath) {
|
||||
cus.forEach((cu, i) => {
|
||||
if (cu instanceof Arc) {
|
||||
// 新多出的圆弧段使用默认配置
|
||||
let arcBoardOptions = this._ArcBoardOptions.get(i) ?? defultArcBoardOption;
|
||||
newOpts.set(i, { ...arcBoardOptions, arcLength: parseFloat(FixedNotZero(cu.Length, 5)) });
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (cus.filter(cu => cu instanceof Arc).length <= this._ArcBoardOptions.size - 1) {
|
||||
cus.forEach((cu, i) => {
|
||||
if (cu instanceof Arc && this._ArcBoardOptions.has(i))
|
||||
newOpts.set(i, { ...this._ArcBoardOptions.get(i), arcLength: parseFloat(FixedNotZero(cu.Length, 5)) });
|
||||
});
|
||||
/** 圆弧配置的key值偏移量 */
|
||||
let offest = 0;
|
||||
for (let i = 0; i < curves.length; i++) {
|
||||
const cu = curves[i];
|
||||
/** 圆弧配置的key值 */
|
||||
let key = i - offest;
|
||||
if (ignores.has(i))
|
||||
offest++;
|
||||
// 更新圆弧配置
|
||||
if (cu instanceof Arc) {
|
||||
/** 之前的圆弧配置 */
|
||||
const arcBoardOptions = this._ArcBoardOptions.get(i) ?? defultArcBoardOption;
|
||||
const arcLength = parseFloat(FixedNotZero(cu.Length, 5));
|
||||
newOpts.set(key, { ...arcBoardOptions, arcLength });
|
||||
}
|
||||
}
|
||||
this._ArcBoardOptions = newOpts;
|
||||
}
|
||||
@@ -40979,6 +41075,8 @@ var DimStyleKeyCode;
|
||||
DimStyleKeyCode[DimStyleKeyCode["DIMTXT"] = 140] = "DIMTXT";
|
||||
/*147 尺寸线距离文字的距离(从尺寸线偏移) */
|
||||
DimStyleKeyCode[DimStyleKeyCode["DIMGAP"] = 147] = "DIMGAP";
|
||||
/** 箭头类型 */
|
||||
DimStyleKeyCode[DimStyleKeyCode["DIMARROW"] = ArrowType.arrow] = "DIMARROW";
|
||||
})(DimStyleKeyCode || (DimStyleKeyCode = {}));
|
||||
//enum to string
|
||||
// let code = DimStyleKeyCode[DimStyleKeyCode.DIMALT];
|
||||
@@ -41021,6 +41119,8 @@ let DimStyleRecord = class DimStyleRecord extends SymbolTableRecord {
|
||||
this.DIMTXT = 60;
|
||||
/**77 控制文本相对于尺寸线的垂直位置。 */
|
||||
this.DIMTAD = DimTextPosDir.Out;
|
||||
/** 箭头类型 */
|
||||
this.DIMARROW = ArrowType.arrow;
|
||||
//#endregion
|
||||
}
|
||||
// DIMTMOVE 279 设置标注文字移动规则。0 = 使用尺寸文本移动尺寸线 1 = 在移动尺寸文本时添加引线 2 = 允许文本在没有引线的情况下自由移动
|
||||
@@ -41044,10 +41144,13 @@ let DimStyleRecord = class DimStyleRecord extends SymbolTableRecord {
|
||||
if (ver > 1) {
|
||||
this.DIMADEC = file.Read();
|
||||
}
|
||||
if (ver > 2) {
|
||||
this.DIMARROW = file.Read();
|
||||
}
|
||||
}
|
||||
//对象将自身数据写入到文件.
|
||||
WriteFile(file) {
|
||||
file.Write(2);
|
||||
file.Write(3);
|
||||
super.WriteFile(file);
|
||||
let bitV = 0; //压缩布尔值到里面
|
||||
if (this.DIMFXLON)
|
||||
@@ -41065,6 +41168,7 @@ let DimStyleRecord = class DimStyleRecord extends SymbolTableRecord {
|
||||
file.Write(this.DIMTXT);
|
||||
file.Write(this.DIMTAD);
|
||||
file.Write(this.DIMADEC);
|
||||
file.Write(this.DIMARROW);
|
||||
}
|
||||
};
|
||||
__decorate([
|
||||
@@ -41103,10 +41207,22 @@ __decorate([
|
||||
__decorate([
|
||||
AutoRecord
|
||||
], DimStyleRecord.prototype, "DIMTAD", void 0);
|
||||
__decorate([
|
||||
AutoRecord
|
||||
], DimStyleRecord.prototype, "DIMARROW", void 0);
|
||||
DimStyleRecord = __decorate([
|
||||
Factory
|
||||
], DimStyleRecord);
|
||||
|
||||
function GetDimLineMaterial(dim, renderType) {
|
||||
if (renderType === RenderType.Wireframe || HostApplicationServices.printIsColor)
|
||||
return ColorMaterial.GetLineMaterial(dim.DrawColorIndex);
|
||||
else if (renderType > 100)
|
||||
return ColorMaterial.GetLineMaterial(0);
|
||||
else
|
||||
return ColorMaterial.GetLineMaterial(6);
|
||||
}
|
||||
|
||||
let Dimension = class Dimension extends Entity {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
@@ -41238,6 +41354,29 @@ let Dimension = class Dimension extends Entity {
|
||||
file.Write(this._RoomName);
|
||||
file.Write(this._CabinetName);
|
||||
}
|
||||
/** 获取箭头模型 */
|
||||
GetArrowObject(renderType) {
|
||||
let arrow1;
|
||||
let arrow2;
|
||||
let colorMaterial = GetDimLineMaterial(this, renderType);
|
||||
let arrowType = this.GetDimStyleValue(DimStyleKeyCode.DIMARROW) ?? 0;
|
||||
if (arrowType === ArrowType.dotsmall) {
|
||||
const geometry = BufferGeometryUtils.PointGeometry();
|
||||
arrow1 = new Mesh(geometry, colorMaterial);
|
||||
arrow2 = new Mesh(geometry, colorMaterial);
|
||||
}
|
||||
else if (arrowType === ArrowType.oblique) {
|
||||
const geometry = BufferGeometryUtils.LineGeometry();
|
||||
arrow1 = new Line$1(geometry, colorMaterial);
|
||||
arrow2 = new Line$1(geometry, colorMaterial);
|
||||
}
|
||||
else {
|
||||
const geometry = BufferGeometryUtils.ArrowGeometry();
|
||||
arrow1 = new Mesh(geometry, colorMaterial);
|
||||
arrow2 = new Mesh(geometry, colorMaterial);
|
||||
}
|
||||
return [arrow1, arrow2];
|
||||
}
|
||||
};
|
||||
Dimension = __decorate([
|
||||
Factory
|
||||
@@ -47669,6 +47808,7 @@ let ViewportEntity = ViewportEntity_1 = class ViewportEntity extends Entity {
|
||||
this._ShowObjectIds = new Set();
|
||||
this._FreezeLayers = new Set();
|
||||
this._RenderTarget = new WebGLRenderTarget(0, 0);
|
||||
this._IsShowDrill = false;
|
||||
this.ViewData = {
|
||||
left: 0,
|
||||
bottom: 0,
|
||||
@@ -47717,6 +47857,15 @@ let ViewportEntity = ViewportEntity_1 = class ViewportEntity extends Entity {
|
||||
}
|
||||
return this._EntitysBoundingBox;
|
||||
}
|
||||
get IsShowDrill() {
|
||||
return this._IsShowDrill;
|
||||
}
|
||||
set IsShowDrill(value) {
|
||||
if (value === this._IsShowDrill)
|
||||
return;
|
||||
this.WriteAllObjectRecord();
|
||||
this._IsShowDrill = value;
|
||||
}
|
||||
UpdateEntitysBoundingBox() {
|
||||
this._EntitysBoundingBox = new Box3Ext();
|
||||
for (let en of this.Entitys) {
|
||||
@@ -47774,6 +47923,8 @@ let ViewportEntity = ViewportEntity_1 = class ViewportEntity extends Entity {
|
||||
this.WriteAllObjectRecord();
|
||||
if (!Array.isArray(ids))
|
||||
ids = [ids];
|
||||
if (!this.IsShowDrill)
|
||||
ids = ids.filter(en => !(en?.Object instanceof Hole));
|
||||
for (let id of ids) {
|
||||
let ent = id?.Object;
|
||||
if (ent) {
|
||||
@@ -47919,7 +48070,7 @@ let ViewportEntity = ViewportEntity_1 = class ViewportEntity extends Entity {
|
||||
}
|
||||
CanRennder(en) {
|
||||
if (en?.Id
|
||||
&& !en.IsErase && (en instanceof Entity) && !(en instanceof Hole)
|
||||
&& !en.IsErase && (en instanceof Entity)
|
||||
&& !(en instanceof ViewportEntity_1)
|
||||
&& !(en instanceof VisualSpaceBox)) {
|
||||
//首个版本布局由隐藏列表控制
|
||||
@@ -48042,12 +48193,14 @@ let ViewportEntity = ViewportEntity_1 = class ViewportEntity extends Entity {
|
||||
}
|
||||
if (ver > 5)
|
||||
this._DimBlock = file.ReadObjectId();
|
||||
if (ver > 6)
|
||||
this._IsShowDrill = file.Read();
|
||||
if (!this._isErase)
|
||||
this.UpdateScene();
|
||||
}
|
||||
WriteFile(file) {
|
||||
super.WriteFile(file);
|
||||
file.Write(6);
|
||||
file.Write(7);
|
||||
this.camera.WriteFile(file);
|
||||
file.Write(this._width);
|
||||
file.Write(this._height);
|
||||
@@ -48063,6 +48216,7 @@ let ViewportEntity = ViewportEntity_1 = class ViewportEntity extends Entity {
|
||||
file.Write(this._FreezeLayers.size);
|
||||
this._FreezeLayers.forEach(id => file.WriteSoftObjectId(id));
|
||||
file.WriteObjectId(this._DimBlock);
|
||||
file.Write(this._IsShowDrill);
|
||||
}
|
||||
};
|
||||
ViewportEntity = ViewportEntity_1 = __decorate([
|
||||
@@ -48590,15 +48744,6 @@ AlignLineGroupRecord = __decorate([
|
||||
Factory
|
||||
], AlignLineGroupRecord);
|
||||
|
||||
function GetDimLineMaterial(dim, renderType) {
|
||||
if (renderType === RenderType.Wireframe)
|
||||
return ColorMaterial.GetLineMaterial(dim.DrawColorIndex);
|
||||
else if (renderType > 100)
|
||||
return ColorMaterial.GetLineMaterial(0);
|
||||
else
|
||||
return ColorMaterial.GetLineMaterial(6);
|
||||
}
|
||||
|
||||
/**
|
||||
* 两条直线的角度标注
|
||||
*/
|
||||
@@ -48732,8 +48877,12 @@ let LineAngularDimension = class LineAngularDimension extends Dimension {
|
||||
let arrowSize = 10;
|
||||
let l, l2;
|
||||
if (renderType === RenderType.WireframePrint) {
|
||||
l = new Line2(undefined, ColorMaterial.PrintLineMatrial);
|
||||
l2 = new Line2(undefined, ColorMaterial.PrintLineMatrial);
|
||||
const material = ColorMaterial.PrintLineMatrial.clone();
|
||||
// 线段的颜色
|
||||
if (HostApplicationServices.printIsColor)
|
||||
material.color = ColorMaterial.GetColor(this.DrawColorIndex);
|
||||
l = new Line2(undefined, material);
|
||||
l2 = new Line2(undefined, material);
|
||||
arrowSize *= HostApplicationServices.lineWidth * 0.5;
|
||||
}
|
||||
else {
|
||||
@@ -48793,6 +48942,17 @@ let LineAngularDimension = class LineAngularDimension extends Dimension {
|
||||
UpdateDrawObject(renderType, obj) {
|
||||
let [arrow1, arrow2, li1, li2] = obj.children;
|
||||
obj.remove(...obj.children.slice(4));
|
||||
// 修改箭头类型
|
||||
{
|
||||
obj.remove(arrow1, arrow2, li1, li2);
|
||||
const [newArrow1, newArrow2] = this.GetArrowObject(renderType);
|
||||
arrow1 = newArrow1;
|
||||
arrow2 = newArrow2;
|
||||
let arrowSize = 10;
|
||||
arrow1.scale.set(arrowSize, arrowSize, arrowSize);
|
||||
arrow2.scale.set(arrowSize, arrowSize, arrowSize);
|
||||
obj.add(arrow1, arrow2, li1, li2);
|
||||
}
|
||||
let l1 = new Line(this._L1StartPoint, this._L1EndPoint);
|
||||
let l2 = new Line(this._L2StartPoint, this._L2EndPoint);
|
||||
let insP = l1.IntersectWith(l2, IntersectOption.ExtendBoth)[0];
|
||||
@@ -48843,6 +49003,30 @@ let LineAngularDimension = class LineAngularDimension extends Dimension {
|
||||
}
|
||||
}
|
||||
UpdateDrawObjectMaterial(type, obj, material) {
|
||||
if (type === RenderType.WireframePrint) {
|
||||
// 为了支持彩印,更换材质
|
||||
let colorMaterial = ColorMaterial.PrintLineMatrial.clone();
|
||||
let arrowMaterial = GetDimLineMaterial(this, type);
|
||||
if (HostApplicationServices.printIsColor) {
|
||||
colorMaterial.color = ColorMaterial.GetColor(this.DrawColorIndex);
|
||||
arrowMaterial.color = ColorMaterial.GetColor(this.DrawColorIndex);
|
||||
}
|
||||
for (let i = 0; i < obj.children.length; i++) {
|
||||
let l = obj.children[i];
|
||||
if (i < 2) // 0和1是箭头
|
||||
{
|
||||
l.material = arrowMaterial;
|
||||
continue;
|
||||
}
|
||||
l.material = colorMaterial;
|
||||
}
|
||||
// 更换其文字的材质
|
||||
if (this.Text.CacheDrawObject.has(type)) {
|
||||
const obj = this.Text.CacheDrawObject.get(type);
|
||||
this.Text.UpdateDrawObjectMaterial(type, obj);
|
||||
}
|
||||
return;
|
||||
}
|
||||
let colorMaterial = GetDimLineMaterial(this, type);
|
||||
let count = Math.min(4, obj.children.length);
|
||||
for (let i = 0; i < count; i++) {
|
||||
@@ -49099,12 +49283,15 @@ let AlignedDimension = class AlignedDimension extends Dimension {
|
||||
let line;
|
||||
if (renderType === RenderType.WireframePrint) {
|
||||
const geo = new LineGeometry();
|
||||
line = new Line2(geo, ColorMaterial.PrintLineMatrial);
|
||||
const material = ColorMaterial.PrintLineMatrial.clone();
|
||||
// 线段的颜色
|
||||
if (HostApplicationServices.printIsColor)
|
||||
material.color = ColorMaterial.GetColor(this.DrawColorIndex);
|
||||
line = new Line2(geo, material);
|
||||
}
|
||||
else
|
||||
line = new Line$1(BufferGeometryUtils.CreateFromPts([this._FootP1, this._FootP2, this._ArmP1, this._ArmP2, this._ArmP2, this._ArmP2]), colorMaterial);
|
||||
let arrow1 = new Mesh(BufferGeometryUtils.ArrowGeometry(), colorMaterial);
|
||||
let arrow2 = new Mesh(BufferGeometryUtils.ArrowGeometry(), colorMaterial);
|
||||
const [arrow1, arrow2] = this.GetArrowObject(renderType);
|
||||
obj.add(line, arrow1, arrow2);
|
||||
this.UpdateDrawObject(renderType, obj);
|
||||
return obj;
|
||||
@@ -49174,6 +49361,11 @@ let AlignedDimension = class AlignedDimension extends Dimension {
|
||||
BufferGeometryUtils.UpdatePts(line.geometry, linePts, true);
|
||||
//#endregion
|
||||
//#region 箭头部分
|
||||
const [newArrow1, newArrow2] = this.GetArrowObject(renderType);
|
||||
obj.remove(arrow1, arrow2);
|
||||
arrow1 = newArrow1;
|
||||
arrow2 = newArrow2;
|
||||
obj.add(arrow1, arrow2);
|
||||
let arrowSize = this.GetDimStyleValue(DimStyleKeyCode.DIMASZ) ?? 10;
|
||||
if (renderType === RenderType.WireframePrint) //在打印模式下,改变箭头的大小?
|
||||
arrowSize *= HostApplicationServices.lineWidth * 0.5;
|
||||
@@ -49309,8 +49501,32 @@ let AlignedDimension = class AlignedDimension extends Dimension {
|
||||
// snapPolyline.LineData[5].pt.set(this._LeadOutPts.endPt.x, this._LeadOutPts.endPt.y);
|
||||
}
|
||||
UpdateDrawObjectMaterial(renderType, obj, material) {
|
||||
if (renderType === RenderType.WireframePrint)
|
||||
if (renderType === RenderType.WireframePrint) {
|
||||
// 为了支持彩印,更换材质
|
||||
let mtl = ColorMaterial.PrintLineMatrial.clone();
|
||||
let arrowMaterial = GetDimLineMaterial(this, renderType);
|
||||
if (HostApplicationServices.printIsColor) {
|
||||
mtl.color = ColorMaterial.GetColor(this.DrawColorIndex);
|
||||
arrowMaterial.color = ColorMaterial.GetColor(this.DrawColorIndex);
|
||||
}
|
||||
else
|
||||
mtl.color = ColorMaterial.GetColor(0);
|
||||
let [line, arrow1, arrow2] = obj.children;
|
||||
line.material = mtl;
|
||||
arrow1.material = arrowMaterial;
|
||||
arrow2.material = arrowMaterial;
|
||||
// 更换其文字的材质
|
||||
if (this.Text.CacheDrawObject.has(renderType)) {
|
||||
const obj = this.Text.CacheDrawObject.get(renderType);
|
||||
this.Text.UpdateDrawObjectMaterial(renderType, obj);
|
||||
}
|
||||
// 更换其引线的材质
|
||||
if (this._LeadLine.CacheDrawObject.has(renderType)) {
|
||||
const obj = this._LeadLine.CacheDrawObject.get(renderType);
|
||||
obj.material = mtl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
let mtl = GetDimLineMaterial(this, renderType);
|
||||
this._LeadLine.ColorIndex = this.DrawColorIndex;
|
||||
let [line, arrow1, arrow2] = obj.children;
|
||||
@@ -49570,6 +49786,17 @@ let ArcDimension = class ArcDimension extends Dimension {
|
||||
UpdateDrawObject(renderType, obj) {
|
||||
obj.remove(...obj.children.slice(3));
|
||||
let [line, arrow1, arrow2] = obj.children;
|
||||
// 修改箭头类型
|
||||
{
|
||||
obj.remove(arrow1, arrow2);
|
||||
const [newArrow1, newArrow2] = this.GetArrowObject(renderType);
|
||||
arrow1 = newArrow1;
|
||||
arrow2 = newArrow2;
|
||||
let arrowSize = 10;
|
||||
arrow1.scale.set(arrowSize, arrowSize, arrowSize);
|
||||
arrow2.scale.set(arrowSize, arrowSize, arrowSize);
|
||||
obj.add(arrow1, arrow2);
|
||||
}
|
||||
let colorMaterial = GetDimLineMaterial(this, renderType);
|
||||
line.material = colorMaterial;
|
||||
arrow1.material = colorMaterial;
|
||||
@@ -49612,6 +49839,13 @@ let ArcDimension = class ArcDimension extends Dimension {
|
||||
this._Text.IsDoubleMesh = true;
|
||||
}
|
||||
UpdateDrawObjectMaterial(type, obj, material) {
|
||||
if (type === RenderType.WireframePrint) {
|
||||
// 更换其文字的材质
|
||||
if (this.Text.CacheDrawObject.has(type)) {
|
||||
const obj = this.Text.CacheDrawObject.get(type);
|
||||
this.Text.UpdateDrawObjectMaterial(type, obj);
|
||||
}
|
||||
}
|
||||
let colorMaterial = GetDimLineMaterial(this, type);
|
||||
let count = Math.min(3, obj.children.length);
|
||||
for (let i = 0; i < count; i++) {
|
||||
@@ -49740,8 +49974,13 @@ let RadiusDimension = class RadiusDimension extends Dimension {
|
||||
let obj = new Object3D();
|
||||
let colorMaterial = GetDimLineMaterial(this, renderType);
|
||||
let line;
|
||||
if (renderType === RenderType.WireframePrint)
|
||||
line = new Line2(undefined, ColorMaterial.PrintLineMatrial);
|
||||
if (renderType === RenderType.WireframePrint) {
|
||||
const material = ColorMaterial.PrintLineMatrial.clone();
|
||||
// 线段的颜色
|
||||
if (HostApplicationServices.printIsColor)
|
||||
material.color = ColorMaterial.GetColor(this.DrawColorIndex);
|
||||
line = new Line2(undefined, material);
|
||||
}
|
||||
else
|
||||
line = new Line$1(BufferGeometryUtils.CreateFromPts([this._Center, this._DiameterOrRadiusPoint, this._TextPoint]), colorMaterial);
|
||||
let arrow = new Mesh(BufferGeometryUtils.ArrowGeometry(), colorMaterial);
|
||||
@@ -49751,6 +49990,13 @@ let RadiusDimension = class RadiusDimension extends Dimension {
|
||||
}
|
||||
UpdateDrawObject(renderType, obj) {
|
||||
let [line, arrow, textObj] = obj.children;
|
||||
// 修改箭头类型
|
||||
{
|
||||
obj.remove(arrow, textObj);
|
||||
const [newArrow1, newArrow2] = this.GetArrowObject(renderType);
|
||||
arrow = newArrow1;
|
||||
obj.add(arrow, textObj);
|
||||
}
|
||||
let arrowSize = this.GetDimStyleValue(DimStyleKeyCode.DIMASZ) ?? 10;
|
||||
if (renderType === RenderType.WireframePrint) {
|
||||
arrowSize *= HostApplicationServices.lineWidth * 0.5;
|
||||
@@ -49773,13 +50019,44 @@ let RadiusDimension = class RadiusDimension extends Dimension {
|
||||
AddEntityDrawObject(obj, this._Text, renderType);
|
||||
}
|
||||
UpdateDrawObjectMaterial(renderType, obj, material) {
|
||||
if (renderType === RenderType.WireframePrint)
|
||||
if (renderType === RenderType.WireframePrint) {
|
||||
// 为了支持彩印,更换材质
|
||||
let lineMaterial = ColorMaterial.PrintLineMatrial.clone();
|
||||
let arrowMaterial = GetDimLineMaterial(this, renderType);
|
||||
if (HostApplicationServices.printIsColor) {
|
||||
lineMaterial.color = ColorMaterial.GetColor(this.DrawColorIndex);
|
||||
arrowMaterial.color = ColorMaterial.GetColor(this.DrawColorIndex);
|
||||
}
|
||||
let [line, arrow, textObj] = obj.children;
|
||||
line.material = lineMaterial;
|
||||
arrow.material = arrowMaterial;
|
||||
//如果实体是拷贝的,那么可能修改材质失败
|
||||
if (textObj.children[0]) {
|
||||
let mesh = textObj.children[0];
|
||||
mesh.material = ColorMaterial.GetBasicMaterialDoubleSide(this.DrawColorIndex); //TODO:在布局时应该如何渲染?
|
||||
}
|
||||
// 更换其文字的材质
|
||||
if (this.Text.CacheDrawObject.has(renderType)) {
|
||||
const obj = this.Text.CacheDrawObject.get(renderType);
|
||||
this.Text.UpdateDrawObjectMaterial(renderType, obj);
|
||||
}
|
||||
return;
|
||||
}
|
||||
let [line, arrow, textObj] = obj.children;
|
||||
let lineMaterial = GetDimLineMaterial(this, renderType);
|
||||
line.material = lineMaterial;
|
||||
arrow.material = line.material;
|
||||
this._Text.ColorIndex = this.DrawColorIndex;
|
||||
//如果实体是 超级复制拷贝的,那么可能修改材质失败
|
||||
//insert.ts :73 获取e.BoundingBox 而半径、直径标注没有重构BoundingBox方法
|
||||
if (textObj.children[0]) {
|
||||
let mesh = textObj.children[0];
|
||||
mesh.material = ColorMaterial.GetBasicMaterial(this.DrawColorIndex);
|
||||
}
|
||||
if (textObj.children[1]) {
|
||||
let mesh = textObj.children[1];
|
||||
mesh.material = ColorMaterial.GetBasicMaterial(this.DrawColorIndex);
|
||||
}
|
||||
}
|
||||
UpdateText() {
|
||||
this._Text.AutoUpdate = false;
|
||||
@@ -49900,8 +50177,13 @@ let DiameterDimension = class DiameterDimension extends RadiusDimension {
|
||||
let colorMaterial = GetDimLineMaterial(this, renderType);
|
||||
let vec = this._DiameterOrRadiusPoint.clone().sub(this._Center).normalize().multiplyScalar(-LINE_EXTEND_VAL);
|
||||
let line;
|
||||
if (renderType === RenderType.WireframePrint)
|
||||
line = new Line2(undefined, ColorMaterial.PrintLineMatrial);
|
||||
if (renderType === RenderType.WireframePrint) {
|
||||
const material = ColorMaterial.PrintLineMatrial.clone();
|
||||
// 线段的颜色
|
||||
if (HostApplicationServices.printIsColor)
|
||||
material.color = ColorMaterial.GetColor(this.DrawColorIndex);
|
||||
line = new Line2(undefined, material);
|
||||
}
|
||||
else
|
||||
line = new Line$1(BufferGeometryUtils.CreateFromPts([this._Center.clone().add(vec), this._DiameterOrRadiusPoint, this._TextPoint]), colorMaterial);
|
||||
let arrow = new Mesh(BufferGeometryUtils.ArrowGeometry(), colorMaterial);
|
||||
@@ -49912,6 +50194,14 @@ let DiameterDimension = class DiameterDimension extends RadiusDimension {
|
||||
}
|
||||
UpdateDrawObject(renderType, obj) {
|
||||
let [line, arrow, arrow2, textObj] = obj.children;
|
||||
// 修改箭头类型
|
||||
{
|
||||
obj.remove(arrow, arrow2, textObj);
|
||||
const [newArrow1, newArrow2] = this.GetArrowObject(renderType);
|
||||
arrow = newArrow1;
|
||||
arrow2 = newArrow2;
|
||||
obj.add(arrow, arrow2, textObj);
|
||||
}
|
||||
let vec = this._DiameterOrRadiusPoint.clone().sub(this._Center).normalize().multiplyScalar(-LINE_EXTEND_VAL);
|
||||
let arrowSize = 10;
|
||||
let sp = this._Center.clone().add(vec);
|
||||
@@ -49940,18 +50230,45 @@ let DiameterDimension = class DiameterDimension extends RadiusDimension {
|
||||
AddEntityDrawObject(obj, this._Text, renderType);
|
||||
}
|
||||
UpdateDrawObjectMaterial(renderType, obj, material) {
|
||||
if (renderType === RenderType.WireframePrint)
|
||||
if (renderType === RenderType.WireframePrint) {
|
||||
// 为了支持彩印,更换材质
|
||||
let lineMaterial = ColorMaterial.PrintLineMatrial.clone();
|
||||
let arrowMaterial = GetDimLineMaterial(this, renderType);
|
||||
if (HostApplicationServices.printIsColor) {
|
||||
lineMaterial.color = ColorMaterial.GetColor(this.DrawColorIndex);
|
||||
arrowMaterial.color = ColorMaterial.GetColor(this.DrawColorIndex);
|
||||
}
|
||||
let [line, arrow, arrow2, textObj] = obj.children;
|
||||
line.material = lineMaterial;
|
||||
arrow.material = arrowMaterial;
|
||||
arrow2.material = arrowMaterial;
|
||||
//如果实体是拷贝的,那么可能修改材质失败
|
||||
if (textObj.children[0]) {
|
||||
let mesh = textObj.children[0];
|
||||
mesh.material = ColorMaterial.GetBasicMaterialDoubleSide(this.DrawColorIndex); //TODO:在布局时应该如何渲染?
|
||||
}
|
||||
// 更换其文字的材质
|
||||
if (this.Text.CacheDrawObject.has(renderType)) {
|
||||
const obj = this.Text.CacheDrawObject.get(renderType);
|
||||
this.Text.UpdateDrawObjectMaterial(renderType, obj);
|
||||
}
|
||||
return;
|
||||
}
|
||||
let [line, arrow, arrow2, textObj] = obj.children;
|
||||
let lineMaterial = GetDimLineMaterial(this, renderType);
|
||||
line.material = lineMaterial;
|
||||
arrow.material = line.material;
|
||||
arrow2.material = lineMaterial;
|
||||
this._Text.ColorIndex = this.DrawColorIndex;
|
||||
//如果实体是拷贝的,那么可能修改材质失败
|
||||
//如果实体是 超级复制拷贝的,那么可能修改材质失败
|
||||
//insert.ts :73 获取e.BoundingBox 而半径、直径标注没有重构BoundingBox方法
|
||||
if (textObj.children[0]) {
|
||||
let mesh = textObj.children[0];
|
||||
mesh.material = ColorMaterial.GetBasicMaterial(this.DrawColorIndex); //TODO:在布局时应该如何渲染?
|
||||
mesh.material = ColorMaterial.GetBasicMaterial(this.DrawColorIndex);
|
||||
}
|
||||
if (textObj.children[1]) {
|
||||
let mesh = textObj.children[1];
|
||||
mesh.material = ColorMaterial.GetBasicMaterial(this.DrawColorIndex);
|
||||
}
|
||||
}
|
||||
MoveGripPoints(indexList, vec) {
|
||||
@@ -50637,7 +50954,7 @@ let PointLight = class PointLight extends Light {
|
||||
this.SourceLength = 0; //源长度 默认0 范围0-1000
|
||||
//LocalLightComponent
|
||||
//Radius:number 没设置这个
|
||||
this.AttenuationRadius = 300; //衰减半径 10-1000
|
||||
this.AttenuationRadius = 1000; //衰减半径 30-1000
|
||||
}
|
||||
get Decay() {
|
||||
return this._Decay;
|
||||
@@ -50849,7 +51166,7 @@ let RectAreaLight = class RectAreaLight extends Light {
|
||||
this._Height = 1; //UE SourceHeight
|
||||
//LocalLightComponent
|
||||
//Radius:number 没设置这个
|
||||
this.AttenuationRadius = 300; //衰减半径 10-1000
|
||||
this.AttenuationRadius = 1000; //衰减半径 30-1000
|
||||
//RectLightComponent extends LocalLightComponent
|
||||
this._BarnDoorAngle = 0; //0-90 挡光板角度
|
||||
this._BarnDoorLength = 0; //0-100 挡光板长度
|
||||
@@ -51172,7 +51489,7 @@ let SpotLight = class SpotLight extends Light {
|
||||
this.SourceLength = 0; //源长度 默认0 范围0-1000
|
||||
//LocalLightComponent
|
||||
//Radius:number 没设置这个
|
||||
this.AttenuationRadius = 300; //衰减半径 10-1000
|
||||
this.AttenuationRadius = 1000; //衰减半径 30-1000
|
||||
}
|
||||
get Target() {
|
||||
return this.Position.add(this.Normal.multiplyScalar(-this._Distance * 0.5));
|
||||
@@ -52475,6 +52792,15 @@ let TemplateaRadiusAction = class TemplateaRadiusAction extends TemplateFilletAc
|
||||
cu = cu.Clone();
|
||||
cu.LineData[Math.floor(arcParam)].bul = bul;
|
||||
}
|
||||
else {
|
||||
// 半径动作bul计算中,弓(两点距离的一半)的长度 > 半径则提示错误
|
||||
ToasterShowEntityMsg({
|
||||
msg: `半径:${newValue} 设置半径动作失败!请检查!`,
|
||||
timeout: 5000,
|
||||
intent: Intent.DANGER,
|
||||
ent: br
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
if (br instanceof ExtrudeSolid) {
|
||||
|
Reference in New Issue
Block a user