修复自定义编号不显示,添加双面显示
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import { CylinderGeometry, LineSegments, Matrix4, Mesh, MeshBasicMaterial, Vector2, Vector3 } from "three";
|
||||
import { DbText, ExtrudeSolid, Polyline, RenderType, TextAligen, boardUVGenerator2 } from "webcad_ue4_api";
|
||||
import { ExtrudeSolid, Polyline, boardUVGenerator2 } from "webcad_ue4_api";
|
||||
import { ColorMaterial } from "./ColorPalette";
|
||||
import { edgeMaterial } from "./Material";
|
||||
import { DbText } from "./Text";
|
||||
|
||||
function getVec(data: object): Vector3
|
||||
{
|
||||
@@ -32,7 +33,6 @@ export class SimpleBoard
|
||||
DataID: number;
|
||||
_BoardType: BoardType;
|
||||
_CustomNumber: string;
|
||||
_CustomNumberTextEntity: any;
|
||||
|
||||
constructor(boardData: any)
|
||||
{
|
||||
@@ -157,32 +157,34 @@ export class SimpleBoard
|
||||
mesh.updateWorldMatrix(false, true);
|
||||
|
||||
// 自定义编号
|
||||
this.createCustomNo();
|
||||
let o = this._CustomNumberTextEntity.GetDrawObjectFromRenderType(RenderType.Conceptual);
|
||||
if (o)
|
||||
{
|
||||
mesh.add(o);
|
||||
}
|
||||
|
||||
// let o = this._CustomNumberTextEntity.GetDrawObjectFromRenderType(RenderType.Conceptual);
|
||||
// if (o)
|
||||
// {
|
||||
// mesh.add(o);
|
||||
// }
|
||||
if (this._CustomNumber)
|
||||
{
|
||||
mesh.add(this.createCustomNo());
|
||||
}
|
||||
|
||||
return { mesh, edges };
|
||||
}
|
||||
private createCustomNo()
|
||||
{
|
||||
if (!this._CustomNumberTextEntity)
|
||||
{
|
||||
this._CustomNumberTextEntity = new DbText();
|
||||
this._CustomNumberTextEntity.TextAligen = TextAligen.Mid;
|
||||
this._CustomNumberTextEntity.IsDoubleMesh = true;
|
||||
this._CustomNumberTextEntity.IsFsText = this._BoardType === BoardType.Layer;
|
||||
|
||||
this._CustomNumberTextEntity.IsEmbedEntity = true;
|
||||
}
|
||||
let text = new DbText(this._CustomNumber?.toString(), 100);
|
||||
let position = new Vector3(this.width * 0.5, this.height * 0.5, this.thickness * 0.5);
|
||||
if (this._BoardType === BoardType.Layer)
|
||||
this._CustomNumberTextEntity.OCSNoClone.makeRotationZ(-Math.PI / 2).setPosition(this.width * 0.5, this.height * 0.5, this.thickness * 0.5);
|
||||
{
|
||||
text.applyMatrix4(new Matrix4().makeRotationZ(-Math.PI / 2).setPosition(position));
|
||||
}
|
||||
else
|
||||
this._CustomNumberTextEntity.OCSNoClone.identity().setPosition(this.width * 0.5, this.height * 0.5, this.thickness * 0.5);
|
||||
{
|
||||
text.applyMatrix4(new Matrix4().setPosition(position));
|
||||
}
|
||||
|
||||
this._CustomNumberTextEntity.TextString = this._CustomNumber?.toString() ?? "未编号";
|
||||
text.CreateDoubleMesh(this._BoardType === BoardType.Layer);
|
||||
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user