分析模块重新调整
This commit is contained in:
@@ -1,55 +1,38 @@
|
||||
using CaeMesh;
|
||||
// ReSharper disable SuggestVarOrType_BuiltInTypes
|
||||
// ReSharper disable ConvertToAutoProperty
|
||||
using LiteDB;
|
||||
|
||||
namespace CaeKnowledge.Data
|
||||
{
|
||||
public class ProcessingJob
|
||||
{
|
||||
private readonly ToolPosition _toolPosition;
|
||||
private readonly FeNode _feNode;
|
||||
public ObjectId Id { get; set; }
|
||||
|
||||
// 要继承的计算步
|
||||
public string StepName { get; }
|
||||
// 计算步名称
|
||||
public string StepName { get; set; }
|
||||
|
||||
public string NewStepName { get; set; }
|
||||
// StepId
|
||||
public int StepId {get; set; }
|
||||
|
||||
// 曲面集名称
|
||||
public string SurfaceName {get; set; }
|
||||
|
||||
// 刀位点位置坐标
|
||||
public double X => _toolPosition.X;
|
||||
public double Y => _toolPosition.Y;
|
||||
public double Z => _toolPosition.Z;
|
||||
public double X {get; set;}
|
||||
public double Y {get; set;}
|
||||
public double Z {get; set;}
|
||||
|
||||
// 切削力
|
||||
public double Fx => _toolPosition.MaxFx;
|
||||
public double Fy => _toolPosition.MaxFy;
|
||||
public double Fz => _toolPosition.MaxFz;
|
||||
public double Fx {get; set;}
|
||||
public double Fy {get; set;}
|
||||
public double Fz {get; set;}
|
||||
|
||||
// 最接近的节点
|
||||
public FeNode Node => _feNode;
|
||||
public ProcessingJob()
|
||||
{ }
|
||||
|
||||
public FeFace[] Faces { get; }
|
||||
|
||||
// 刀位点到网格最近节点的距离
|
||||
public double MinimumDistance { get; } = 0;
|
||||
|
||||
public ProcessingJob(string stepName, ToolPosition tp, FeNode node, FeFace[] faces)
|
||||
public ProcessingJob(ToolPosition tp)
|
||||
{
|
||||
_toolPosition = tp;
|
||||
_feNode = node;
|
||||
X = tp.X; Y = tp.Y; Z = tp.Z;
|
||||
|
||||
StepName = stepName;
|
||||
|
||||
double x1 = _toolPosition.X;
|
||||
double y1 = _toolPosition.Y;
|
||||
double z1 = _toolPosition.Z;
|
||||
|
||||
double x2 = node.X;
|
||||
double y2 = node.Y;
|
||||
double z2 = node.Z;
|
||||
|
||||
Faces = faces;
|
||||
|
||||
MinimumDistance = MeshTools.Distance(x1, y1, z1, x2, y2, z2);
|
||||
Fx = tp.MaxFx; Fy = tp.MaxFy; Fz = tp.MaxFz;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -317,5 +317,43 @@ namespace CaeKnowledge
|
||||
}
|
||||
|
||||
public static Type ObjectIdType => typeof(ObjectId);
|
||||
|
||||
// Luke 2026-3-25
|
||||
public static void SaveDatabase(string fullPath, List<ProcessingJob> jobs)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var db = new LiteDatabase(fullPath))
|
||||
{
|
||||
var col = db.GetCollection<ProcessingJob>("jobs");
|
||||
col.DeleteAll();
|
||||
col.InsertBulk(jobs);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ExceptionTools.Show(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static List<ProcessingJob> LoadDatabase(string fullPath)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var db = new LiteDatabase(fullPath))
|
||||
{
|
||||
var col = db.GetCollection<ProcessingJob>("jobs");
|
||||
// Fetch all documents in the collection and return as a list
|
||||
return col.FindAll().ToList();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Handle exceptions (e.g., log or display an error)
|
||||
// Console.Error.WriteLine($"Error loading data from LiteDB: {ex.Message}");
|
||||
// Return an empty list on error
|
||||
return new List<ProcessingJob>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,11 +7,13 @@ namespace CaeKnowledge.View
|
||||
public class ViewFeLog : INotifyPropertyChanged
|
||||
{
|
||||
public ViewFeLog(
|
||||
string jobName,
|
||||
int stepId,
|
||||
string stepName,
|
||||
int id, double x, double y, double z,
|
||||
double all= 0.0, double u = 0.0, double v = 0.0, double w = 0.0)
|
||||
{
|
||||
_jobName = jobName;
|
||||
_stepId = stepId;
|
||||
_stepName = stepName;
|
||||
_id = id;
|
||||
_x = x;
|
||||
_y = y;
|
||||
@@ -22,14 +24,26 @@ namespace CaeKnowledge.View
|
||||
_w = w;
|
||||
}
|
||||
|
||||
private string _jobName;
|
||||
[DisplayName("Job名称")]
|
||||
public string JobName
|
||||
private int _stepId;
|
||||
[DisplayName("Step ID")]
|
||||
public int StepId
|
||||
{
|
||||
get => _jobName;
|
||||
get => _stepId;
|
||||
set
|
||||
{
|
||||
_jobName = value;
|
||||
_stepId =value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private string _stepName;
|
||||
[DisplayName("Step名称")]
|
||||
public string StepName
|
||||
{
|
||||
get => _stepName;
|
||||
set
|
||||
{
|
||||
_stepName = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,11 +16,11 @@ namespace CaeKnowledge.View
|
||||
_base = @base;
|
||||
}
|
||||
|
||||
[DisplayName("基准Step名称")]
|
||||
[DisplayName("Step名称")]
|
||||
public string StepName => _base.StepName;
|
||||
|
||||
[DisplayName("新Step名称")]
|
||||
public string NewStepName => _base.NewStepName;
|
||||
[DisplayName("Surface名称")]
|
||||
public string SurfaceName => _base.SurfaceName;
|
||||
|
||||
public double X => _base.X;
|
||||
|
||||
@@ -34,12 +34,6 @@ namespace CaeKnowledge.View
|
||||
|
||||
public double Fz => _base.Fz;
|
||||
|
||||
[DisplayName("最近节点Id")]
|
||||
public int NodeId=> _base.Node.Id;
|
||||
|
||||
[DisplayName("最近距离")]
|
||||
public double MinimumDistance => _base.MinimumDistance;
|
||||
|
||||
[Browsable(false)]
|
||||
public ProcessingJob Base => _base;
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user