63 lines
1.7 KiB
C#
63 lines
1.7 KiB
C#
|
|
using CaeMesh;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.ComponentModel;
|
|||
|
|
using System.Linq;
|
|||
|
|
|
|||
|
|
namespace RBFMorphing
|
|||
|
|
{
|
|||
|
|
public class ViewElementSet
|
|||
|
|
{
|
|||
|
|
private readonly FeMesh _mesh;
|
|||
|
|
|
|||
|
|
public ViewElementSet(FeMesh mesh)
|
|||
|
|
{
|
|||
|
|
_mesh = mesh;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[Category("单元集合")]
|
|||
|
|
[DisplayName("名称")]
|
|||
|
|
[Description("指定单元集合名称")]
|
|||
|
|
[TypeConverter(typeof(NameListConverter))]
|
|||
|
|
public string Name { get; set; }
|
|||
|
|
|
|||
|
|
[Browsable(false)]
|
|||
|
|
public List<string> NameList
|
|||
|
|
{
|
|||
|
|
get
|
|||
|
|
{
|
|||
|
|
if (_mesh != null && _mesh.ElementSets.Count > 0)
|
|||
|
|
{
|
|||
|
|
return _mesh.ElementSets
|
|||
|
|
.Select(kvp => kvp.Value)
|
|||
|
|
.Where(e => !e.Internal) // 不显示内部单元集合
|
|||
|
|
.Select(e => e.Name)
|
|||
|
|
.OrderBy(x => x)
|
|||
|
|
.ToList();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return null;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
class NameListConverter : TypeConverter
|
|||
|
|
{
|
|||
|
|
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
|
|||
|
|
{
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
|
|||
|
|
{
|
|||
|
|
List<string> list;
|
|||
|
|
|
|||
|
|
// ReSharper disable once SuspiciousTypeConversion.Global
|
|||
|
|
if (context.Instance is ViewElementSet elementSet)
|
|||
|
|
list = elementSet.NameList;
|
|||
|
|
else
|
|||
|
|
list = null;
|
|||
|
|
|
|||
|
|
return new StandardValuesCollection(list);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|