Files
wg_cpso/CPSO/Forms/92_Knowledge/ViewSteps.cs
2026-03-25 18:20:24 +08:00

71 lines
2.1 KiB
C#

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 ViewSteps
{
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 NewStep { get; set; } = "new_step";
public ViewSteps(Controller self)
{
_controller = self;
_dctd = ProviderInstaller.Install(this);
PopulateDropDownList();
}
public void PopulateDropDownList()
{
// ReSharper disable once JoinDeclarationAndInitializer
CustomPropertyDescriptor cpd;
// Steps
cpd = _dctd.GetProperty(nameof(Step));
cpd.StatandardValues.Clear();
_controller.Model.StepCollection.StepsList.ForEach(x =>
{
cpd.StatandardValues.Add(new StandardValueAttribute(x.Name));
});
// 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));
}
}
}
}