Files
wg_cpso/CPSO/Forms/43_Constraint/ViewSpring.cs
2026-03-25 18:20:24 +08:00

75 lines
3.0 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 abstract class ViewSpring : ViewConstraint
{
// Variables
protected CaeModel.SpringConstraint _spring;
// Properties
public override string Name { get { return _spring.Name; } set { _spring.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("Stiffness")]
[OrderedDisplayName(0, 10, "K1")]
[Description("Value of the stiffness per node in the direction of the first axis.")]
[TypeConverter(typeof(EquationForcePerLengthConverter))]
[Id(1, 3)]
public virtual EquationString K1 { get { return _spring.K1.Equation; } set { _spring.K1.Equation = value; } }
//
[Category("Stiffness")]
[OrderedDisplayName(1, 10, "K2")]
[Description("Value of the stiffness per node in the direction of the second axis.")]
[TypeConverter(typeof(EquationForcePerLengthConverter))]
[Id(2, 3)]
public virtual EquationString K2 { get { return _spring.K2.Equation; } set { _spring.K2.Equation = value; } }
//
[Category("Stiffness")]
[OrderedDisplayName(2, 10, "K3")]
[Description("Value of the stiffness per node in the direction of the third axis.")]
[TypeConverter(typeof(EquationForcePerLengthConverter))]
[Id(3, 3)]
public virtual EquationString K3 { get { return _spring.K3.Equation; } set { _spring.K3.Equation = value; } }
//
[Category("Appearance")]
[DisplayName("Color")]
[Description("Select the constraint color.")]
[Editor(typeof(UserControls.ColorEditorEx), typeof(UITypeEditor))]
[Id(1, 10)]
public Color Color { get { return _spring.MasterColor; } set { _spring.MasterColor = value; } }
// Constructors
public ViewSpring(CaeModel.SpringConstraint springConstraint)
{
_spring = springConstraint;
}
// Methods
public override CaeModel.Constraint GetBase()
{
return _spring;
}
}
}