Example #1
0
        /// <summary>
        /// 通过属性获取
        /// </summary>
        /// <param name="bodys">一种齿(阵列)</param>
        /// <returns></returns>
        public ElectrodeToolhInfo[,] GetToolhInfosForAttribute(List <Body> bodys, Matrix4 matr, CartesianCoordinateSystem csys)
        {
            ElectrodeToolhInfo[,] info = new ElectrodeToolhInfo[this.PitchXNum, this.PitchYNum];
            var toolhNumList             = bodys.GroupBy(a => AttributeUtils.GetAttrForInt(a, "ToolhNumber"));
            List <BodyPitchClassify> bps = new List <BodyPitchClassify>();

            foreach (var toolhNum in toolhNumList)
            {
                BodyPitchClassify bp = new BodyPitchClassify(toolhNum.ToList(), matr, csys, this.PitchXNum, this.PitchYNum);
                bp.SetAttribute();
                bps.Add(bp);
            }
            for (int i = 0; i < this.PitchXNum; i++)
            {
                for (int k = 0; k < this.PitchYNum; k++)
                {
                    List <Body> temp = new List <Body>();
                    foreach (BodyPitchClassify by in bps)
                    {
                        temp.Add(by.ClassifyBodys[i, k]);
                    }
                    info[i, k] = ElectrodeToolhInfo.GetToolhInfoForAttribute(temp.ToArray());
                }
            }
            return(info);
        }