2026-3-26

This commit is contained in:
2026-03-26 06:53:55 +08:00
parent 8c105c5068
commit c08bba2b2a
14 changed files with 122 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
using CaeJob;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace CPSO.Forms._92_Knowledge
{
public class ViewAnalysisJob: INotifyPropertyChanged
{
private AnalysisJob Job { get; }
public void UpdateProgress()
{
OnPropertyChanged(nameof(Status));
}
public ViewAnalysisJob(AnalysisJob job)
{
Job = job;
}
[DisplayName("Job名称")]
public string JobName => Job.Name;
private string _stepName;
[DisplayName("Step名称")]
public string StepName { get => _stepName; set => SetField(ref _stepName, value); }
private string _surfaceName;
[DisplayName("Surface名称")]
public string SurfaceName { get => _surfaceName; set => SetField(ref _surfaceName, value); }
[DisplayName("状态")]
public JobStatus Status => Job.JobStatus;
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
protected bool SetField<T>(ref T field, T value, [CallerMemberName] string propertyName = null)
{
if (EqualityComparer<T>.Default.Equals(field, value)) return false;
field = value;
OnPropertyChanged(propertyName);
return true;
}
}
}

View File

@@ -0,0 +1,71 @@
using CaeGlobals;
using CaeKnowledge.View;
using DynamicTypeDescriptor;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing.Design;
using System.Linq;
namespace CPSO.Forms._92_Knowledge
{
public class ViewJobs
{
private readonly DynamicCustomTypeDescriptor _dctd;
private readonly Controller _controller;
[Category("1数据")]
[OrderedDisplayName(0, 3, "计算步Step")]
[Description("选择要继承的计算步")]
public string Step { get; set; }
[Category("1数据")]
[OrderedDisplayName(1, 3, "曲面集")]
[Description("选择要载荷所在的曲面集")]
public string Surface { get; set; }
[Category("1数据")]
[OrderedDisplayName(2, 3, "切削力")]
[Editor(typeof(MyCollectionEditor), typeof(UITypeEditor))]
public List<ViewToolPosition> ToolPositionList { get; set; } = new List<ViewToolPosition>();
[Category("2分析")]
[DisplayName("新分析步名称")]
public string NewStepName { get; set; } = "Step";
public ViewJobs(Controller self)
{
_controller = self;
_dctd = ProviderInstaller.Install(this);
PopulateDropDownList();
}
public void PopulateDropDownList()
{
// ReSharper disable once JoinDeclarationAndInitializer
CustomPropertyDescriptor cpd;
// 1.加入已有的Steps列表
cpd = _dctd.GetProperty(nameof(Step));
cpd.StatandardValues.Clear();
_controller.Model.StepCollection.StepsList.ForEach(x =>
{
cpd.StatandardValues.Add(new StandardValueAttribute(x.Name));
});
// 2.加入已有的Surface列表
cpd = _dctd.GetProperty(nameof(Surface));
cpd.StatandardValues.Clear();
foreach (var surfaceName in _controller.Model.Mesh.Surfaces.Values
.Where(x => !x.Internal)
.Select(x => x.Name))
{
cpd.StatandardValues.Add(new StandardValueAttribute(surfaceName));
}
}
}
}