CyPhy2CAD_CSharp.DataRep.StructuralInterfaceConstraint.GetDegreesOfFreedom C# (CSharp) Méthode

GetDegreesOfFreedom() public méthode

public GetDegreesOfFreedom ( ) : int
Résultat int
        public int GetDegreesOfFreedom()
        {
            int AxisCnt = 0, PointCnt = 0, SurfaceCnt = 0, CsysCnt = 0;
            int count = DatumList.Count(), dof = 0;

            foreach (KeyValuePair<string, Datum> item in DatumList)
            {
                string dtype = item.Value.Type.ToString();
                if (dtype == "Axis")
                    AxisCnt++;
                else if (dtype == "Point")
                    PointCnt++;
                else if (dtype == "Surface")
                    SurfaceCnt++;
                else if (dtype == "CoordinateSystem")
                    CsysCnt++;
            }

            if (CsysCnt > 0)
            {
                switch (count)
                {
                    case 0:
                        dof = 0;
                        break;
                    case 1:
                        {
                            if (AxisCnt > 0)
                                dof = 4;
                            else
                                dof = 3;
                        }
                        break;
                    case 2:
                        dof = 5;
                        break;
                    case 3:
                        dof = 6;
                        break;
                    default:
                        dof = 6;
                        break;
                }
            }
            else
                dof = 6;

            return dof;
        }