2026-3-30Bug修复

This commit is contained in:
2026-03-30 15:33:05 +08:00
parent c08bba2b2a
commit 8fb2ffa50d
19 changed files with 11 additions and 13 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -10,11 +10,6 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
// ReSharper disable SuggestVarOrType_SimpleTypes
// ReSharper disable SuggestVarOrType_BuiltInTypes
// ReSharper disable SuggestVarOrType_Elsewhere
// ReSharper disable InvertIf
namespace CPSO.Forms._92_Knowledge namespace CPSO.Forms._92_Knowledge
{ {
public partial class FrmStepsManager : UserControls.FrmProperties public partial class FrmStepsManager : UserControls.FrmProperties
@@ -74,40 +69,42 @@ namespace CPSO.Forms._92_Knowledge
Self.Form.SetStateWorking(@"构建切削力分析模型..."); Self.Form.SetStateWorking(@"构建切削力分析模型...");
// 先把所有计算步反激活 // 1. 先把所有计算步反激活
var stepList = Self.GetAllSteps().ToList(); var stepList = Self.GetAllSteps().ToList();
stepList.ForEach(x => stepList.ForEach(x =>
{ {
Self.ActivateDeactivateStep(x.Name, false); Self.ActivateDeactivateStep(x.Name, false);
}); });
// 2. 加载网格
var mesh = LoadMesh(surface);
List<ProcessingJob> jobs = new List<ProcessingJob>(); List<ProcessingJob> jobs = new List<ProcessingJob>();
await Task.Run(() => await Task.Run(() =>
{ {
// 加载网格
var mesh = LoadMesh(surface);
foreach (var tp in Self.ToolPositions) foreach (var tp in Self.ToolPositions)
{ {
// 1. 计算最接近的顶点 // 1. 计算最接近的顶点
int vertId = GetClosedVertex(mesh, tp.Base); // PlanktonMesh中存储的Id int vertId = GetClosedVertex(mesh, tp.Base); // PlanktonMesh中存储的Id
if (vertId < 0) if (vertId < 0) // 找不到最近节点,继续执行
{ {
continue; continue;
} }
// 2. 最接近节点 // 2. 最接近节点
int nodeId = _vertexToNodeMapping[vertId]; // 全局网格中的Id // int nodeId = _vertexToNodeMapping[vertId]; // 全局网格中的Id
FeNode node = Self.Model.Mesh.Nodes[nodeId]; FeNode node = Self.Model.Mesh.Nodes[_vertexToNodeMapping[vertId]];
// 3. 最近节点周围的面单元 // 3. 最近节点周围的面单元
List<FeFace> faces = new List<FeFace>(); List<FeFace> faces = new List<FeFace>();
foreach (var f in mesh.Vertices.GetVertexFaces(vertId)) foreach (var f in mesh.Vertices.GetVertexFaces(vertId))
{ {
if (_cellToFaceMapping.TryGetValue(f, out var face)) if (_cellToFaceMapping.TryGetValue(f, out var face))
{
faces.Add(face); faces.Add(face);
}
} }
// 4. 复制一份基础计算步并激活 // 4. 复制一份基础计算步并激活
@@ -154,7 +151,7 @@ namespace CPSO.Forms._92_Knowledge
// 5.3 添加载荷 // 5.3 添加载荷
Self.AddLoad(newStep.Name, stLoad); Self.AddLoad(newStep.Name, stLoad);
// 5.4 添加到 List<ProcessingJob> jobs // 6. 添加到 List<ProcessingJob> jobs
jobs.Add(new ProcessingJob(tp.Base) jobs.Add(new ProcessingJob(tp.Base)
{ {
StepName = newStep.Name, StepName = newStep.Name,
@@ -175,6 +172,7 @@ namespace CPSO.Forms._92_Knowledge
catch (Exception ex) catch (Exception ex)
{ {
ExceptionTools.Show(ex); ExceptionTools.Show(ex);
Self.Form.SetStateReady(@"构建切削力分析模型...");
} }
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.