!2373 新增:大孔面视图

Merge pull request !2373 from 林三/big_hole_face
pull/2372/MERGE
林三 1 year ago committed by ChenX
parent 646ca54aed
commit 662d77391a

@ -22,7 +22,7 @@ import { AppToaster } from "../../UI/Components/Toaster";
import { IsDoor, IsDrawer, IsHandle, IsHinge, IsLattice } from "../HideSelect/HideSelectUtils"; import { IsDoor, IsDrawer, IsHandle, IsHinge, IsLattice } from "../HideSelect/HideSelectUtils";
const MOVECOUNT = 150; const MOVECOUNT = 150;
const UNOPENRENDERTYPE = [RenderType.Edge, RenderType.PlaceFace]; //不支持开门动作的视图类型 const UNOPENRENDERTYPE = [RenderType.Edge, RenderType.PlaceFace, RenderType.BigHoleFace]; //不支持开门动作的视图类型
export class Command_OpenCabinet implements Command export class Command_OpenCabinet implements Command
{ {

@ -38,6 +38,15 @@ export class ChangeRenderType implements Command
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}, "rendertype"); }, "rendertype");
} }
else if (this._type === RenderType.BigHoleFace)
{
AppToaster.show({
message: "大孔面显示模式:灰色+大孔面",
timeout: 15000,
intent: Intent.SUCCESS,
}, "rendertype");
}
if (app.Viewer.isLayout) if (app.Viewer.isLayout)
{ {

@ -167,6 +167,7 @@ export enum CommandNames
Wireframe = "WIREFRAME", Wireframe = "WIREFRAME",
Conceptual = "CONCEPTUAL", Conceptual = "CONCEPTUAL",
ConceptualTransparent = "CONCEPTUALTRANSPARENT", ConceptualTransparent = "CONCEPTUALTRANSPARENT",
BigHoleFace = "BIGHOLEFACE",
Physical = "PHYSICAL", Physical = "PHYSICAL",
Physical2 = "PHYSICAL2", Physical2 = "PHYSICAL2",
PrintType = "PRINTTYPE", PrintType = "PRINTTYPE",

@ -103,6 +103,7 @@ export class Board extends ExtrudeSolid
{ {
protected HasEdgeRenderType = true; protected HasEdgeRenderType = true;
protected HasPlaceFaceRenderType = true; protected HasPlaceFaceRenderType = true;
protected HasBigHoleFaceRenderType = true;
private _Rotation = { private _Rotation = {
x: 0, x: 0,
@ -220,6 +221,15 @@ export class Board extends ExtrudeSolid
obj.updateMatrixWorld(true); obj.updateMatrixWorld(true);
} }
} }
else if (key === EBoardKeyList.BigHole)
{
let obj = this.CacheDrawObject.get(RenderType.BigHoleFace);
if (obj)
{
this.UpdateDrawObject(RenderType.BigHoleFace, obj);
obj.updateMatrixWorld(true);
}
}
} }
return result; return result;
@ -1535,6 +1545,7 @@ export class Board extends ExtrudeSolid
let obj: Object3D; let obj: Object3D;
if (renderType === RenderType.Edge //封边检查 if (renderType === RenderType.Edge //封边检查
|| renderType === RenderType.PlaceFace //排版面检查 || renderType === RenderType.PlaceFace //排版面检查
|| renderType === RenderType.BigHoleFace //大孔面检查
|| renderType === RenderType.CustomNumber //自定义编号 || renderType === RenderType.CustomNumber //自定义编号
|| renderType === RenderType.CustomNumberPrint//自定义编号打印 || renderType === RenderType.CustomNumberPrint//自定义编号打印
) )
@ -1569,6 +1580,15 @@ export class Board extends ExtrudeSolid
if (!isArbitrary)//如果不是任意面 if (!isArbitrary)//如果不是任意面
obj.add(this.GetPlaceFace()); obj.add(this.GetPlaceFace());
} }
else if (renderType === RenderType.BigHoleFace)
{
obj.add(new Mesh(this.MeshGeometry, ColorMaterial.GetConceptualMaterial(8)),
new LineSegments(this.EdgeGeometry, ColorMaterial.GetLineMaterial(7))
);
obj.add(this.GetBigHoleFace());
}
else if (renderType === RenderType.CustomNumber || renderType === RenderType.CustomNumberPrint) else if (renderType === RenderType.CustomNumber || renderType === RenderType.CustomNumberPrint)
{ {
if (renderType === RenderType.CustomNumberPrint) if (renderType === RenderType.CustomNumberPrint)
@ -1620,6 +1640,17 @@ export class Board extends ExtrudeSolid
return mesh; return mesh;
} }
//大孔面网格
private GetBigHoleFace(): Mesh
{
let shapeGeom = new ShapeGeometry(this.contourCurve.Shape);
let isBack = this._BoardProcessOption[EBoardKeyList.BigHole] === FaceDirection.Back;
shapeGeom.applyMatrix4(this.contourCurve.OCSNoClone);
shapeGeom.translate(0, 0, isBack ? -1e-3 : this.thickness + 1e-3);
let mesh = new Mesh(shapeGeom, ColorMaterial.GetBasicMaterialDoubleSide(this.PlaceColor));
return mesh;
}
//偏移缓存 //偏移缓存
private _OffsetPathCache = new Map<Polyline, { [key: string]: Polyline; }>(); private _OffsetPathCache = new Map<Polyline, { [key: string]: Polyline; }>();
private GetOffsetPath(path: Polyline, item: I2DModeingItem): Polyline private GetOffsetPath(path: Polyline, item: I2DModeingItem): Polyline
@ -1704,7 +1735,7 @@ export class Board extends ExtrudeSolid
{ {
super.UpdateDrawObjectMaterial(renderType, obj); super.UpdateDrawObjectMaterial(renderType, obj);
if (renderType === RenderType.PlaceFace) if (renderType === RenderType.PlaceFace || renderType === RenderType.BigHoleFace)
{ {
let face = obj.children[2] as Mesh; let face = obj.children[2] as Mesh;
if (!face) return; if (!face) return;

@ -34,6 +34,7 @@ export class Entity extends CADObject
protected OnlyRenderType = false; protected OnlyRenderType = false;
protected HasEdgeRenderType = false;//拥有封边检查绘制模式 protected HasEdgeRenderType = false;//拥有封边检查绘制模式
protected HasPlaceFaceRenderType = false;//拥有排版面绘制模式 protected HasPlaceFaceRenderType = false;//拥有排版面绘制模式
protected HasBigHoleFaceRenderType = false;//拥有大孔面绘制模式
protected _CacheDrawObject = new Map<RenderType, Object3D>(); protected _CacheDrawObject = new Map<RenderType, Object3D>();
//材质id //材质id
@ -411,6 +412,8 @@ export class Entity extends CADObject
renderType = RenderType.Conceptual; renderType = RenderType.Conceptual;
if (renderType === RenderType.PlaceFace && !this.HasPlaceFaceRenderType) if (renderType === RenderType.PlaceFace && !this.HasPlaceFaceRenderType)
renderType = RenderType.Wireframe; renderType = RenderType.Wireframe;
if (renderType === RenderType.BigHoleFace && !this.HasBigHoleFaceRenderType)
renderType = RenderType.Wireframe;
if (this._CacheDrawObject.has(renderType)) if (this._CacheDrawObject.has(renderType))
{ {

@ -631,6 +631,7 @@ export function registerCommand()
commandMachine.RegisterCommand(CommandNames.PrintType, new ChangeRenderType(RenderType.Print)); commandMachine.RegisterCommand(CommandNames.PrintType, new ChangeRenderType(RenderType.Print));
commandMachine.RegisterCommand(CommandNames.CheckEdge, new ChangeRenderType(RenderType.Edge)); commandMachine.RegisterCommand(CommandNames.CheckEdge, new ChangeRenderType(RenderType.Edge));
commandMachine.RegisterCommand(CommandNames.CheckPlaceFace, new ChangeRenderType(RenderType.PlaceFace)); commandMachine.RegisterCommand(CommandNames.CheckPlaceFace, new ChangeRenderType(RenderType.PlaceFace));
commandMachine.RegisterCommand(CommandNames.BigHoleFace, new ChangeRenderType(RenderType.BigHoleFace));
commandMachine.RegisterCommand(CommandNames.VisualStyle_CustomNumber, new ChangeRenderType(RenderType.CustomNumber, 0.2)); commandMachine.RegisterCommand(CommandNames.VisualStyle_CustomNumber, new ChangeRenderType(RenderType.CustomNumber, 0.2));
commandMachine.RegisterCommand(CommandNames.BackgroundSwitching, new BackgroundSwitching()); commandMachine.RegisterCommand(CommandNames.BackgroundSwitching, new BackgroundSwitching());
commandMachine.RegisterCommand(CommandNames.Renderer, new CMD_Renderer()); commandMachine.RegisterCommand(CommandNames.Renderer, new CMD_Renderer());

@ -24,8 +24,9 @@ export enum RenderType
Print = 5, Print = 5,
/**物理带线框 */ /**物理带线框 */
Physical2 = 6, Physical2 = 6,
Edge = 7,//封边检查 Edge = 7,//封边检查 OpenCabinet.UNOPENRENDERTYPE 该视图下不支持开门动作
PlaceFace = 8,//排版面 PlaceFace = 8,//排版面 OpenCabinet.UNOPENRENDERTYPE 该视图下不支持开门动作
BigHoleFace = 81, //大孔面 OpenCabinet.UNOPENRENDERTYPE 该视图下不支持开门动作
CustomNumber = 9,//自定义编号 CustomNumber = 9,//自定义编号
/******************************************** 在视口时的渲染模式 */ /******************************************** 在视口时的渲染模式 */

@ -34,6 +34,10 @@ export const VisualStyleData2: IVisualStyle[] = [
title: "排版面", title: "排版面",
cmd: CommandNames.CheckPlaceFace cmd: CommandNames.CheckPlaceFace
}, },
{
title: "大孔面",
cmd: CommandNames.BigHoleFace
},
{ {
title: "概念(透明)", title: "概念(透明)",
cmd: CommandNames.ConceptualTransparent cmd: CommandNames.ConceptualTransparent

Loading…
Cancel
Save