198 lines
8.9 KiB
C#
198 lines
8.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.ComponentModel;
|
|
using CaeGlobals;
|
|
using DynamicTypeDescriptor;
|
|
using System.Drawing.Design;
|
|
using CaeModel;
|
|
|
|
namespace CPSO
|
|
{
|
|
[Serializable]
|
|
public class ViewCentrifLoad : ViewLoad
|
|
{
|
|
// Variables
|
|
private CentrifLoad _cenLoad;
|
|
private ItemSetData _centerPointItemSetData;
|
|
|
|
|
|
// Properties
|
|
public override string Name { get { return _cenLoad.Name; } set { _cenLoad.Name = value; } }
|
|
//
|
|
[Category("Region")]
|
|
[OrderedDisplayName(2, 10, "Part")]
|
|
[Description("Select the part for the creation of the load.")]
|
|
[Id(3, 2)]
|
|
public string PartName { get { return _cenLoad.RegionName; } set { _cenLoad.RegionName = value; } }
|
|
//
|
|
[Category("Region")]
|
|
[OrderedDisplayName(3, 10, "Element set")]
|
|
[Description("Select the element set for the creation of the load.")]
|
|
[Id(4, 2)]
|
|
public string ElementSetName { get { return _cenLoad.RegionName; } set { _cenLoad.RegionName = value; } }
|
|
//
|
|
[Category("Region")]
|
|
[OrderedDisplayName(4, 10, "Mass section")]
|
|
[Description("Select the mass section for the creation of the load.")]
|
|
[Id(5, 2)]
|
|
public string MassSectionName { get { return _cenLoad.RegionName; } set { _cenLoad.RegionName = value; } }
|
|
//
|
|
[Category("Rotation center coordinates")]
|
|
[OrderedDisplayName(0, 10, "By selection")]
|
|
[Description("Use selection for the definition of the rotation center.")]
|
|
[Editor(typeof(SinglePointDataEditor), typeof(UITypeEditor))]
|
|
[Id(1, 3)]
|
|
public ItemSetData CenterPointItemSet
|
|
{
|
|
get { return _centerPointItemSetData; }
|
|
set
|
|
{
|
|
if (value != _centerPointItemSetData)
|
|
_centerPointItemSetData = value;
|
|
}
|
|
}
|
|
//
|
|
[Category("Rotation center coordinates")]
|
|
[OrderedDisplayName(1, 10, "X")]
|
|
[Description("X coordinate of the axis point.")]
|
|
[TypeConverter(typeof(EquationLengthConverter))]
|
|
[Id(2, 3)]
|
|
public EquationString X { get { return _cenLoad.X.Equation; } set { _cenLoad.X.Equation = value; } }
|
|
//
|
|
[Category("Rotation center coordinates")]
|
|
[OrderedDisplayName(2, 10, "Y")]
|
|
[Description("Y coordinate of the axis point.")]
|
|
[TypeConverter(typeof(EquationLengthConverter))]
|
|
[Id(3, 3)]
|
|
public EquationString Y { get { return _cenLoad.Y.Equation; } set { _cenLoad.Y.Equation = value; } }
|
|
//
|
|
[Category("Rotation center coordinates")]
|
|
[OrderedDisplayName(3, 10, "Z")]
|
|
[Description("Z coordinate of the axis point.")]
|
|
[TypeConverter(typeof(EquationLengthConverter))]
|
|
[Id(4, 3)]
|
|
public EquationString Z { get { return _cenLoad.Z.Equation; } set { _cenLoad.Z.Equation = value; } }
|
|
//
|
|
[Category("Rotation axis components")]
|
|
[OrderedDisplayName(0, 10, "N1")]
|
|
[Description("Axis component in the direction of the first axis.")]
|
|
[TypeConverter(typeof(EquationLengthConverter))]
|
|
[Id(1, 4)]
|
|
public EquationString N1 { get { return _cenLoad.N1.Equation; } set { _cenLoad.N1.Equation = value; } }
|
|
//
|
|
[Category("Rotation axis components")]
|
|
[OrderedDisplayName(1, 10, "N2")]
|
|
[Description("Axis component in the direction of the second axis.")]
|
|
[TypeConverter(typeof(EquationLengthConverter))]
|
|
[Id(2, 4)]
|
|
public EquationString N2 { get { return _cenLoad.N2.Equation; } set { _cenLoad.N2.Equation = value; } }
|
|
//
|
|
[Category("Rotation axis components")]
|
|
[OrderedDisplayName(2, 10, "N3")]
|
|
[Description("Axis component in the direction of the third axis.")]
|
|
[TypeConverter(typeof(EquationLengthConverter))]
|
|
[Id(3, 4)]
|
|
public EquationString N3 { get { return _cenLoad.N3.Equation; } set { _cenLoad.N3.Equation = value; } }
|
|
//
|
|
[Category("Rotational speed magnitude")]
|
|
[OrderedDisplayName(0, 10, "Magnitude")]
|
|
[Description("Value of the rotational speed magnitude around the axis defined by the point and direction.")]
|
|
[TypeConverter(typeof(EquationRotationalSpeedConverter))]
|
|
[Id(1, 5)]
|
|
public EquationString RotationalSpeed
|
|
{
|
|
get { return _cenLoad.RotationalSpeed.Equation; }
|
|
set { _cenLoad.RotationalSpeed.Equation = value; }
|
|
}
|
|
//
|
|
[Category("Rotational speed phase")]
|
|
[OrderedDisplayName(0, 10, "Phase")]
|
|
[Description("Value of the rotational speed phase.")]
|
|
[TypeConverter(typeof(EquationAngleDegConverter))]
|
|
[Id(1, 6)]
|
|
public EquationString Phase { get { return _cenLoad.PhaseDeg.Equation; } set { _cenLoad.PhaseDeg.Equation = value; } }
|
|
//
|
|
public override string AmplitudeName { get { return _cenLoad.AmplitudeName; } set { _cenLoad.AmplitudeName = value; } }
|
|
[Browsable(false)]
|
|
public override string CoordinateSystemName
|
|
{
|
|
get { return _cenLoad.CoordinateSystemName; }
|
|
set { _cenLoad.CoordinateSystemName = value; }
|
|
}
|
|
public override System.Drawing.Color Color { get { return _cenLoad.Color; } set { _cenLoad.Color = value; } }
|
|
//
|
|
[Browsable(false)]
|
|
public bool Axisymmetric
|
|
{
|
|
get { return _cenLoad.Axisymmetric; }
|
|
set
|
|
{
|
|
_cenLoad.Axisymmetric = value;
|
|
UpdateVisibility();
|
|
}
|
|
}
|
|
|
|
|
|
// Constructors
|
|
public ViewCentrifLoad(CentrifLoad cenLoad)
|
|
{
|
|
// The order is important
|
|
_cenLoad = cenLoad;
|
|
//
|
|
Dictionary<RegionTypeEnum, string> regionTypePropertyNamePairs = new Dictionary<RegionTypeEnum, string>();
|
|
regionTypePropertyNamePairs.Add(RegionTypeEnum.Selection, nameof(SelectionHidden));
|
|
regionTypePropertyNamePairs.Add(RegionTypeEnum.PartName, nameof(PartName));
|
|
regionTypePropertyNamePairs.Add(RegionTypeEnum.ElementSetName, nameof(ElementSetName));
|
|
regionTypePropertyNamePairs.Add(RegionTypeEnum.MassSection, nameof(MassSectionName));
|
|
//
|
|
SetBase(_cenLoad, regionTypePropertyNamePairs);
|
|
DynamicCustomTypeDescriptor = ProviderInstaller.Install(this);
|
|
//
|
|
_centerPointItemSetData = new ItemSetData(); // needed to display ItemSetData.ToString()
|
|
_centerPointItemSetData.ToStringType = ItemSetDataToStringType.SelectSinglePoint;
|
|
//
|
|
UpdateVisibility();
|
|
}
|
|
|
|
|
|
// Methods
|
|
public override Load GetBase()
|
|
{
|
|
return _cenLoad;
|
|
}
|
|
public void PopulateDropDownLists(string[] partNames, string[] elementSetNames, string[] massSectionNames,
|
|
string[] amplitudeNames)
|
|
{
|
|
Dictionary<RegionTypeEnum, string[]> regionTypeListItemsPairs = new Dictionary<RegionTypeEnum, string[]>();
|
|
regionTypeListItemsPairs.Add(RegionTypeEnum.Selection, new string[] { "Hidden" });
|
|
regionTypeListItemsPairs.Add(RegionTypeEnum.PartName, partNames);
|
|
regionTypeListItemsPairs.Add(RegionTypeEnum.ElementSetName, elementSetNames);
|
|
regionTypeListItemsPairs.Add(RegionTypeEnum.MassSection, massSectionNames);
|
|
PopulateDropDownLists(regionTypeListItemsPairs);
|
|
//
|
|
PopulateAmplitudeNames(amplitudeNames);
|
|
}
|
|
private void UpdateVisibility()
|
|
{
|
|
bool visible = !_cenLoad.Axisymmetric;
|
|
bool readOnly = _cenLoad.Axisymmetric;
|
|
//
|
|
DynamicCustomTypeDescriptor.GetProperty(nameof(CenterPointItemSet)).SetIsBrowsable(visible);
|
|
//
|
|
DynamicCustomTypeDescriptor.GetProperty(nameof(X)).SetIsReadOnly(readOnly);
|
|
DynamicCustomTypeDescriptor.GetProperty(nameof(Y)).SetIsReadOnly(readOnly);
|
|
DynamicCustomTypeDescriptor.GetProperty(nameof(Z)).SetIsBrowsable(visible);
|
|
//
|
|
DynamicCustomTypeDescriptor.GetProperty(nameof(N1)).SetIsReadOnly(readOnly);
|
|
DynamicCustomTypeDescriptor.GetProperty(nameof(N2)).SetIsReadOnly(readOnly);
|
|
DynamicCustomTypeDescriptor.GetProperty(nameof(N3)).SetIsBrowsable(visible);
|
|
// Phase
|
|
DynamicCustomTypeDescriptor.GetProperty(nameof(Phase)).SetIsBrowsable(_cenLoad.Complex);
|
|
}
|
|
}
|
|
|
|
}
|