131 lines
5.7 KiB
C#
131 lines
5.7 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;
|
|
using System.Drawing.Design;
|
|
|
|
namespace CPSO
|
|
{
|
|
[Serializable]
|
|
public class ViewCompressionOnly : ViewConstraint
|
|
{
|
|
// Variables
|
|
protected CaeModel.CompressionOnly _constraint;
|
|
|
|
|
|
// Properties
|
|
public override string Name { get { return _constraint.Name; } set { _constraint.Name = value; } }
|
|
//
|
|
[Category("Region")]
|
|
[OrderedDisplayName(0, 10, "Region type")]
|
|
[Description("Select the region type for the creation of the constraint definition.")]
|
|
[Id(1, 2)]
|
|
public override string MasterRegionType { get { return base.MasterRegionType; } set { base.MasterRegionType = value; } }
|
|
//
|
|
[Category("Region")]
|
|
[OrderedDisplayName(1, 10, "Surface")]
|
|
[Description("Select the surface for the creation of the constraint definition.")]
|
|
[Id(2, 2)]
|
|
public string SurfaceName { get { return _constraint.RegionName; } set { _constraint.RegionName = value; } }
|
|
//
|
|
[Category("Data")]
|
|
[OrderedDisplayName(0, 10, "Gap clearance")]
|
|
[Description("Value of the gap clearance.")]
|
|
[TypeConverter(typeof(EquationLengthConverter))]
|
|
[Id(1, 3)]
|
|
public virtual EquationString Clearance
|
|
{
|
|
get { return _constraint.Clearance.Equation; }
|
|
set { _constraint.Clearance.Equation = value; }
|
|
}
|
|
//
|
|
[Category("Data")]
|
|
[OrderedDisplayName(1, 10, "Spring stiffness")]
|
|
[Description("Value of the spring stiffness for the gap property definition.")]
|
|
[TypeConverter(typeof(EquationForcePerLengthDefaultConverter))]
|
|
[Id(2, 3)]
|
|
public virtual EquationString SpringStiffness
|
|
{
|
|
get { return _constraint.SpringStiffness.Equation; }
|
|
set { _constraint.SpringStiffness.Equation = value; }
|
|
}
|
|
//
|
|
[Category("Data")]
|
|
[OrderedDisplayName(2, 10, "Tensile force")]
|
|
[Description("Value of the tensile force for the gap property definition.")]
|
|
[TypeConverter(typeof(EquationForceDefaultConverter))]
|
|
[Id(3, 3)]
|
|
public virtual EquationString TensileForceAtNegativeInfinity
|
|
{
|
|
get { return _constraint.TensileForceAtNegativeInfinity.Equation; }
|
|
set { _constraint.TensileForceAtNegativeInfinity.Equation = value; }
|
|
}
|
|
//
|
|
[Category("Data")]
|
|
[OrderedDisplayName(3, 10, "Offset")]
|
|
[Description("The value for which one gap element node will be offset from the selected region.")]
|
|
[TypeConverter(typeof(EquationLengthConverter))]
|
|
[Id(4, 3)]
|
|
public virtual EquationString Offset
|
|
{
|
|
get { return _constraint.Offset.Equation; }
|
|
set { _constraint.Offset.Equation = value; }
|
|
}
|
|
//
|
|
[Category("Solution")]
|
|
[OrderedDisplayName(2, 9, "Nonlinear")]
|
|
[Description("Compression only support is linearized if a linear solution procedure is used.")]
|
|
[Id(1, 3)]
|
|
public bool NonLinear { get { return _constraint.NonLinear; } set { _constraint.NonLinear = value; } }
|
|
//
|
|
[Category("Appearance")]
|
|
[DisplayName("Color")]
|
|
[Description("Select the constraint color.")]
|
|
[Editor(typeof(UserControls.ColorEditorEx), typeof(UITypeEditor))]
|
|
[Id(1, 10)]
|
|
public Color Color { get { return _constraint.MasterColor; } set { _constraint.MasterColor = value; } }
|
|
|
|
|
|
// Constructors
|
|
public ViewCompressionOnly(CaeModel.CompressionOnly compressionOnlyConstraint)
|
|
{
|
|
_constraint = compressionOnlyConstraint;
|
|
// The order is important
|
|
Dictionary<RegionTypeEnum, string> regionTypePropertyNamePairs = new Dictionary<RegionTypeEnum, string>();
|
|
regionTypePropertyNamePairs.Add(RegionTypeEnum.Selection, nameof(MasterSelectionHidden));
|
|
regionTypePropertyNamePairs.Add(RegionTypeEnum.SurfaceName, nameof(SurfaceName));
|
|
SetBase(_constraint, regionTypePropertyNamePairs, null);
|
|
//
|
|
DynamicCustomTypeDescriptor = ProviderInstaller.Install(this);
|
|
//
|
|
StringForcePerLengthDefaultConverter.SetInitialValue =
|
|
CaeModel.GapSectionData.InitialSpringStiffness.ToString();
|
|
StringForceDefaultConverter.SetInitialValue =
|
|
CaeModel.GapSectionData.InitialTensileForceAtNegativeInfinity.ToString();
|
|
//
|
|
DynamicCustomTypeDescriptor.RenameBooleanPropertyToYesNo(nameof(NonLinear));
|
|
}
|
|
|
|
|
|
// Methods
|
|
public override CaeModel.Constraint GetBase()
|
|
{
|
|
return _constraint;
|
|
}
|
|
public void PopulateDropDownLists(string[] surfaceNames)
|
|
{
|
|
Dictionary<RegionTypeEnum, string[]> regionTypeListItemsPairs = new Dictionary<RegionTypeEnum, string[]>();
|
|
regionTypeListItemsPairs.Add(RegionTypeEnum.Selection, new string[] { "Hidden" });
|
|
regionTypeListItemsPairs.Add(RegionTypeEnum.SurfaceName, surfaceNames);
|
|
//
|
|
PopulateDropDownLists(regionTypeListItemsPairs, null);
|
|
}
|
|
}
|
|
|
|
}
|