diff --git a/src/DatabaseServices/Dimension/AlignedDimension.ts b/src/DatabaseServices/Dimension/AlignedDimension.ts index 16770a8ae..fe674633a 100644 --- a/src/DatabaseServices/Dimension/AlignedDimension.ts +++ b/src/DatabaseServices/Dimension/AlignedDimension.ts @@ -121,13 +121,8 @@ export class AlignedDimension extends Entity return ent; } - GetDrawObjectFromRenderType(renderType: RenderType = RenderType.Wireframe): Object3D - { - if (renderType === RenderType.Jig) - return; - return super.GetDrawObjectFromRenderType(RenderType.Wireframe); - } - + //重载 + protected OnlyRenderType = true; InitDrawObject(renderType: RenderType = RenderType.Wireframe): Object3D { let obj = new Object3D(); diff --git a/src/DatabaseServices/Entity/Curve.ts b/src/DatabaseServices/Entity/Curve.ts index 6b78e4bfd..bb39024f1 100644 --- a/src/DatabaseServices/Entity/Curve.ts +++ b/src/DatabaseServices/Entity/Curve.ts @@ -154,12 +154,8 @@ export abstract class Curve extends Entity IntersectWith(curve: Curve, intType: IntersectOption, tolerance = 1e-6): Vector3[] { return []; } //------------------绘制相关------------------ - GetDrawObjectFromRenderType(renderType: RenderType = RenderType.Wireframe): Object3D - { - if (renderType === RenderType.Jig) - return; - return super.GetDrawObjectFromRenderType(RenderType.Wireframe); - } + //重载 + protected OnlyRenderType = true; /** * 重载:更新实体材质 diff --git a/src/DatabaseServices/Entity/Entity.ts b/src/DatabaseServices/Entity/Entity.ts index 2bb7b1c8b..f57ed71ba 100644 --- a/src/DatabaseServices/Entity/Entity.ts +++ b/src/DatabaseServices/Entity/Entity.ts @@ -22,6 +22,11 @@ import { PhysicalMaterialRecord } from '../PhysicalMaterialRecord'; @Factory export class Entity extends CADObject { + + /** + * 该实体的只有一个渲染类型,任何渲染类型都一个样 + */ + protected OnlyRenderType = false; protected _CacheDrawObject = new Map(); //材质id protected materialId: ObjectId; @@ -158,6 +163,7 @@ export class Entity extends CADObject } UpdateRenderType(type: RenderType) { + if (this.OnlyRenderType) return; DisposeThreeObj(this.DrawObject); let obj = this.GetDrawObjectFromRenderType(type); if (obj) this.DrawObject.add(obj); @@ -165,6 +171,9 @@ export class Entity extends CADObject GetDrawObjectFromRenderType(renderType: RenderType = RenderType.Wireframe): Object3D { + if (this.OnlyRenderType) + renderType = RenderType.Wireframe; + if (this._CacheDrawObject.has(renderType)) { return this._CacheDrawObject.get(renderType);