Beispiel #1
0
        /// <summary>
        /// 获取取点信息
        /// </summary>
        public static GetPointInfo GetCMMPointInfo(List <PointData> points, ElecManage.Electrode elec, EactConfig.ConfigData configData)
        {
            var info     = new GetPointInfo();
            var elecInfo = elec.GetElectrodeInfo();

            info.basestationh = Math.Round(elecInfo.BasestationH, 4);
            info.sizex        = elecInfo.X;
            info.sizey        = elecInfo.Y;
            info.sizez        = elecInfo.Z;
            var box = elec.ElecBody.Box;

            info.boxMaxX  = Math.Round(box.MaxXYZ.X, 4);
            info.boxMaxY  = Math.Round(box.MaxXYZ.Y, 4);
            info.boxMaxZ  = Math.Round(box.MaxXYZ.Z, 4);
            info.boxMinX  = Math.Round(box.MinXYZ.X, 4);
            info.boxMinY  = Math.Round(box.MinXYZ.Y, 4);
            info.boxMinZ  = Math.Round(box.MinXYZ.Z, 4);
            info.headh    = Math.Round(elecInfo.HEADPULLUPH, 4);
            info.partname = elecInfo.Elec_Name;
            info.cornor   = ((int)elec.GetCMMQuadrantType(configData.QuadrantType)) + 1;
            var MODEL_NUMBER = elecInfo.EACT_MODELNO;

            info.mouldname = MODEL_NUMBER;

            var trans = Snap.Geom.Transform.CreateTranslation();

            if (elec.BaseFace != null)
            {
                var midPoint = elec.BaseFace.GetCenterPoint();
                trans = Snap.Geom.Transform.CreateTranslation(new Snap.Position() - midPoint);
            }

            //TODO 电极取点的象限角

            points.ForEach(u =>
            {
                var pointInfo       = new CMM.GetPointInfo.PointInfo();
                u.Position          = u.Position.Copy(trans);
                pointInfo.pointname = u.PointName;
                pointInfo.arrow     = u.Arrow;
                pointInfo.TIP       = string.Format("A{0}B{1}", u.A, u.B);
                pointInfo.a         = u.A;
                pointInfo.b         = u.B;
                pointInfo.type      = (int)u.PointType;
                pointInfo.x         = System.Math.Round(u.Position.X, 4);
                pointInfo.y         = System.Math.Round(u.Position.Y, 4);
                pointInfo.z         = System.Math.Round(u.Position.Z, 4);
                pointInfo.i         = System.Math.Round(u.Vector.X, 4);
                pointInfo.j         = System.Math.Round(u.Vector.Y, 4);
                pointInfo.k         = System.Math.Round(u.Vector.Z, 4);
                info.pointlist.Add(pointInfo);
            });

            return(info);
        }
Beispiel #2
0
        /// <summary>
        /// 自动取点
        /// </summary>
        public static List <PointData> AutoSelPoint(ElecManage.Electrode electrode, CMMConfig config, bool isUploadFile = true)
        {
            var positions     = new List <PointData>();
            var tempPositions = new List <PointData>();
            var elecInfo      = electrode.GetElectrodeInfo();

            config.ElecMaxZ = electrode.ElecBody.Box.MaxZ;
            var elecName = elecInfo.Elec_Name;

            Helper.ShowMsg(string.Format("{0}基准面取点", elecName));
            tempPositions = GetHorizontalDatumFacePositions(electrode, config);
            if (tempPositions.Count < 3)
            {
                throw new Exception("基准面取点异常!");
            }
            //根据象限排序
            positions.AddRange(OrderPointDatas(tempPositions));



            Helper.ShowMsg(string.Format("{0}侧面取点", elecName));
            tempPositions = GetVerticalDatumFacesPositions(electrode, config);
            if (tempPositions.Count < 8)
            {
                throw new Exception("侧面取点异常!");
            }
            positions.AddRange(tempPositions);



            Helper.ShowMsg(string.Format("{0}电极头部面取点", elecName));
            tempPositions = GetElectrodeHeadFacePositions(electrode, config);
            if (tempPositions.Count <= 0)
            {
                throw new Exception("电极头部面取点异常!");
            }
            //排序
            tempPositions = tempPositions.OrderBy(u => u.A).ThenBy(u => u.B).ThenByDescending(u => u.Position.Z).ToList();
            positions.AddRange(tempPositions);

            //名称
            foreach (var item in positions)
            {
                item.PointName = string.Format("P{0}", positions.IndexOf(item) + 1);
            }

            if (isUploadFile)
            {
                WriteCMMFile(electrode, GetPointInfo.GetCMMPointInfo(positions, electrode, _EactConfigData), config);
            }
            return(positions);
        }
Beispiel #3
0
 /// <summary>
 /// 上传CMM文件
 /// </summary>
 public static void WriteCMMFileByPointData(ElecManage.Electrode elec, List <PointData> pointData, CMMConfig cmmconfig)
 {
     WriteCMMFile(elec, GetPointInfo.GetCMMPointInfo(pointData, elec, _EactConfigData), cmmconfig);
 }