Beispiel #1
0
        private void buttonRename_Click(object sender, EventArgs e)
        {
            Document doc = CATIA.ActiveDocument;
            //PartDocument partDoc = (PartDocument)doc;
            //Part part = partDoc.Part;
            //HybridShapeFactory factory = (HybridShapeFactory)part.HybridShapeFactory;
            ////Reference objRef = part.CreateReferenceFromObject(_objRef);
            //for (int i = 1; i <= 100000;i++ )
            //{
            //    string sSuffix = i.ToString();
            //    string sName = textBoxSelect.Text + sSuffix;
            //    factory.ChangeFeatureName(_objRef, sName);
            //}
            //Selection select = doc.Selection;
            VisPropertySet visSet = _selection.VisProperties;

            visSet.SetRealColor(255, 255, 0, 0);
            visSet.SetRealColor(0, 255, 0, 0);
            visSet.SetRealColor(0, 0, 255, 0);

            for (int i = 1; i <= 100000; i++)
            {
                double f = 3.14 * 3.14;

                textBoxSelect.Text = i.ToString();

                //Console.Write(i.ToString());
            }
        }
        private void CheckRepeat(Selection SelectArc)
        {
            bool BoorkRepeart = false;

            if (RepeatNum > 0)
            {
                VisPropertySet VPS = SelectArc.VisProperties;
                SelectArc.Clear();
                foreach (var item in GetRepeatRef)
                {
                    if (item == null)
                    {
                        continue;
                    }
                    try
                    {
                        SelectArc.Add(item);// 标记重复点
                        BoorkRepeart = true;
                    }
                    catch (Exception e)
                    {
                        // MessageBox.Show("准备为您标记重复焊点,但是基于以下原因操作失败!"+e.Message);
                        BoorkRepeart = false;
                    }
                }
                VPS.SetRealColor(255, 0, 128, 0);
                MessageBox.Show(BoorkRepeart ? "当前选择的对象集中存在: " + RepeatNum + "个重复数据!并已为你进行颜色标记!" : "当前选择的对象集中存在: " + RepeatNum + "个重复数据!标记失败!");
                RepeatNum = 0;
                Array.Clear(GetRepeatRef, 0, GetRepeatRef.Length);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 创建一个工作用的Part 文件
        /// </summary>
        /// <param name="CatApplication">CATIA程序框架</param>
        /// <param name="CatDocument">CATIA 活动文档</param>
        /// <param name="PartID">待创建的CATIA 零件目标</param>
        public void CreatWorkPart(INFITF.Application CatApplication, ProductDocument CatDocument, ref Part PartID)
        {
            // 添加一个新零件
            string Name = "RXFastDesignTool";

            try
            {
                PartID = ((PartDocument)CatApplication.Documents.Item(Name + ".CATPart")).Part;
            }
            catch (Exception)
            {
                try
                {
                    CatDocument.Product.Products.AddNewComponent("Part", Name);
                    PartID = ((PartDocument)CatApplication.Documents.Item(Name + ".CATPart")).Part;
                }
                catch (Exception)
                {
                    return;
                    // throw;
                }
            }
            HybridBodies HBS = PartID.HybridBodies;

            if (HBS.Count < 1)
            {
                HybridBody HB = HBS.Add();
                HB.set_Name("Geometrical Set.1");
            }
            OriginElements Tpart   = PartID.OriginElements;
            AnyObject      dxy     = Tpart.PlaneXY;
            AnyObject      dyz     = Tpart.PlaneYZ;
            AnyObject      dzx     = Tpart.PlaneZX;
            Selection      SelectT = CatDocument.Selection;
            VisPropertySet VP      = SelectT.VisProperties;

            SelectT.Add(dxy);
            SelectT.Add(dyz);
            SelectT.Add(dzx);
            VP = (VisPropertySet)VP.Parent;
            VP.SetShow(CatVisPropertyShow.catVisPropertyNoShowAttr);
            SelectT.Clear();
        }
Beispiel #4
0
 private void CheckRepeat(Selection SelectArc)
 {
     if (RepeatNum > 0)
     {
         VisPropertySet VPS = SelectArc.VisProperties;
         SelectArc.Clear();
         foreach (var item in GetRepeatRef)
         {
             if (item == null)
             {
                 continue;
             }
             SelectArc.Add(item);
         }
         VPS.SetRealColor(255, 0, 128, 0);
         MessageBox.Show("当前选择的对象集中存在: " + RepeatNum + "个重复数据!并已为你进行颜色标记!");
         RepeatNum = 0;
         Array.Clear(GetRepeatRef, 0, GetRepeatRef.Length);
     }
 }
Beispiel #5
0
        /// <summary>
        /// 隐藏孔创建的草图并修改孔颜色
        /// </summary>
        /// <param name="Thole">目标孔</param>
        private void ChangeHoleColor(Hole Thole, RxHoleType HoleType)
        {
            //隐藏孔创建的草图并修改孔颜色
            Selection HoleSelection = CatActiveDoc.Selection;

            HoleSelection.Clear();
            VisPropertySet HoleSet    = HoleSelection.VisProperties;
            Sketch         HoleSketch = Thole.Sketch;

            HoleSelection.Add(HoleSketch);
            HoleSet.SetShow(CatVisPropertyShow.catVisPropertyNoShowAttr);
            HoleSelection.Clear();
            HoleSelection.Add(Thole);
            switch (HoleType)
            {
            case RxHoleType.PinHole:     //销孔
                HoleSet.SetVisibleColor(251, 146, 248, 0);
                break;

            case RxHoleType.NSmoothHole:     //光孔
                HoleSet.SetVisibleColor(167, 230, 182, 0);
                break;

            case RxHoleType.ISmoothHole:     //沉头孔
                HoleSet.SetVisibleColor(167, 230, 182, 0);
                break;

            case RxHoleType.ThreadHole:     //螺纹孔
                HoleSet.SetVisibleColor(128, 0, 255, 0);
                break;

            default:
                break;
            }
            HoleSelection.Clear();
        }
        //子线程中
        private void Creat3dBall_Click(object sender, EventArgs e)//Creat3dPoint_Click
        {
            progressBar.Value           = 0;
            DataGrid.AllowUserToAddRows = false;
            if (PartID == null)
            {
                MessageBox.Show("仿真环境未初始化!请先用工具栏初始化命令初始化运行环境!");
                return;
            }
            Creat3dBall.BackColor = SystemColors.ActiveCaption;
            ReadType = 2;
            int ERR = 0;

            if (DataGrid.RowCount < 1)
            {
                MessageBox.Show("数据为空,无法建立3D模型!");
                return;
            }
            HybridBodies Hybs = PartID.HybridBodies;
            HybridBody   Hyb  = null;

            //try
            //{
            //    Hyb = Hybs.Item("几何图形集.1");
            //}
            //catch (Exception)
            //{
            //    Hyb = Hybs.Item("Geometrical Set.1");
            //}
            progressBar.Maximum = DataGrid.RowCount;
            progressBar.Step    = 1;
            Hyb = Hybs.Add();
            for (int i = 0; i < DataGrid.RowCount; i++)
            {
                progressBar.PerformStep();
                HybridShapeFactory PartHyb = (HybridShapeFactory)PartID.HybridShapeFactory;
                //SPAWorkbench TheSPAWorkbench = (SPAWorkbench)CatDocument.GetWorkbench("SPAWorkbench");
                //Reference referenceObject = SelectArc.Item(i).Reference;
                //Measurable TheMeasurable = TheSPAWorkbench.GetMeasurable(referenceObject);
                //TheMeasurable.GetPoint(PointCoord); //读取选择的曲面坐标
                string TName;
                try
                {
                    TName = DataGrid.Rows[i].Cells[1].Value.ToString(); //读取选择的曲面名称
                }
                catch (Exception)
                {
                    continue;
                }
                HybridShapePointCoord NewPoint = PartHyb.AddNewPointCoord(Convert.ToDouble(DataGrid.Rows[i].Cells[2].Value.ToString()), Convert.ToDouble(DataGrid.Rows[i].Cells[3].Value.ToString()), Convert.ToDouble(DataGrid.Rows[i].Cells[4].Value.ToString()));
                Reference             ShapeRef = PartID.CreateReferenceFromObject(NewPoint);
                HybridShapeSphere     NewShape = PartHyb.AddNewSphere(ShapeRef, null, Convert.ToDouble(BallRadio.Text), -45.000000, 45.000000, 0.000000, 180.000000);
                NewShape.Limitation = 1;
                if (KeepName.Checked)
                {
                    NewPoint.set_Name(TName);
                    NewShape.set_Name(TName);
                }
                else
                {
                    NewPoint.set_Name("Rx_" + (i + 1));
                    NewShape.set_Name("Rx_" + (i + 1));
                }
                // Hyb.AppendHybridShape(NewPoint);
                Hyb.AppendHybridShape(NewShape);
                //  PartID.InWorkObject = NewPoint;
                PartID.InWorkObject = NewShape;
                try
                {
                    PartID.Update();
                }
                catch (Exception)
                {
                    ERR += 1;
                }
                Selection      SetColor = CatDocument.Selection;
                VisPropertySet VSet     = SetColor.VisProperties;
                SetColor.Add(NewShape);
                VSet.SetRealColor(128, 255, 0, 0);
                SetColor.Clear();
            }
            if (ERR > 0)
            {
                MessageBox.Show("共计:" + ERR + "个点创建新参考点失败!");
            }
            Creat3dBall.BackColor = Color.Green;
            ShowCenter();
            progressBar.Value = DataGrid.RowCount;
        }
        private void ReadCoord_Click(object sender, EventArgs e)
        {
            progressBar.Value = 0;
            if (datatable.Columns.Count < 1)
            {
                InitDataTable();
            }
            this.WindowState = FormWindowState.Minimized;
            RepeatNum        = 0;
            Array.Clear(GetRepeatRef, 0, GetRepeatRef.Length);
            ReadType = 2;
            Selection SelectArc = null;

            CATIA_Class.GetSelect(CatDocument, ref SelectArc, this);
            if (SelectArc == null || SelectArc.Count2 == 0)
            {
                this.WindowState   = FormWindowState.Normal;
                this.StartPosition = FormStartPosition.CenterScreen;
                this.TopMost       = true;
                return;
            }
            int ERR = 0;

            progressBar.Maximum = SelectArc.Count2;
            progressBar.Step    = 1;
            for (int i = 1; i < SelectArc.Count2 + 1; i++)
            {
                object[]           PointCoord      = new object[] { -99, -99, -99, -99, -99, -99 };
                HybridShapeFactory PartHyb         = (HybridShapeFactory)PartID.HybridShapeFactory;
                SPAWorkbench       TheSPAWorkbench = null;
                TheSPAWorkbench = (SPAWorkbench)CatDocument.GetWorkbench("SPAWorkbench"); // Default Get Coordxyz From Word
                Reference referenceObject;
                String    ObjType = SelectArc.Item(i).Type;
                Boolean   LeafProductProcessed;
                string    TName = string.Empty;
                switch (ObjType)
                {
                case "HybridShape":
                {
                    referenceObject = SelectArc.Item(i).Reference; //!=null? SelectArc.Item(i).Reference: Temp;
                    TName           = referenceObject.get_Name();  //读取选择的曲面名称
                    break;
                }

                case "Shape":
                {
                    string  Name    = string.Empty;
                    Shape   shape   = (Shape)SelectArc.Item(i).Value;
                    Product product = (Product)SelectArc.Item(i).LeafProduct;
                    TName = product.get_PartNumber();                                     //读取选择的曲面名称
                    String   RefStr     = product.GetMasterShapeRepresentationPathName(); //获取零件路径地址
                    string[] RefStrArry = RefStr.Split('\\');
                    if (RefStrArry.Length > 1)
                    {
                        RefStr = RefStrArry.Last();
                    }
                    Part RefPart = ((PartDocument)CatApplication.Documents.Item(RefStr)).Part;        //通过总文档将当前零件转换成PartDocumet
                    TName = RefPart.get_Name();
                    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    if (getJTCoord.Checked)
                    {
                        try
                        {
                            //Product PCompoments = (Product)product.Parent;
                            //TName = PCompoments.get_Name();
                            //referenceObject = PCompoments.CreateReferenceFromName(TName);
                            //Measurable TheMeasurable1 = TheSPAWorkbench.GetMeasurable(referenceObject);
                        }
                        catch (Exception)
                        {
                            throw;
                        }
                    }
                    //String RefStr1 = productPre.GetMasterShapeRepresentationPathName(); //获取零件路径地址
                    //string[] RefStrArry1 = RefStr1.Split('\\');
                    //if (RefStrArry.Length > 1)
                    //{
                    //    RefStr1 = RefStrArry1.Last();
                    //}
                    //string tname= productPre.get_PartNumber();
                    //referenceObject= productPre.CreateReferenceFromName(TName);
                    //Product RefProduct = ((ProductDocument)CatApplication.Documents.Item("70918")).Product;//通过总文档将当前零件转换成PartDocumet
                    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    try
                    {
                        //RefPart = (Part)RefPart.Parent;
                        referenceObject = RefPart.CreateReferenceFromObject(shape);
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("请确认当前是否打开了多个窗口,软件识别的零件和您选择的零件不在一个集合!");
                        return;
                    }
                    break;
                }

                default:
                {
                    AnyObject Feature = (AnyObject)SelectArc.Item(i).Value;
                    try
                    {
                        String Name = string.Empty;
                        Shape  GE   = (Shape)SelectArc.Item(i).Value;
                        //Name = GE.get_Name();
                        //Pad Spad = (Pad)GE.GetItem("Face1");
                        //Name = Spad.get_Name();
                        referenceObject = PartID.CreateReferenceFromObject(Feature);
                        PartHyb.AddNewPointCenter(referenceObject);
                    }
                    catch (Exception)
                    {
                        ERR += 1;
                        var LeafProduct = SelectArc.Item(i).LeafProduct;
                        LeafProductProcessed = true;
                        if (LeafProduct.get_Name() == "InvalidLeafProduct")
                        {
                            LeafProductProcessed = false;
                        }
                        if (LeafProductProcessed)
                        {
                            String         ShapeName = Feature.get_Name();
                            VisPropertySet VPS       = SelectArc.VisProperties;
                            VPS.SetVisibleColor(255, 0, 0, 0);
                            continue;
                        }
                        else
                        {
                            String         ShapeName = Feature.get_Name();
                            VisPropertySet VPS       = SelectArc.VisProperties;
                            VPS.SetVisibleColor(255, 0, 0, 0);
                            continue;
                        }
                    }
                }
                break;
                }
                Measurable TheMeasurable = TheSPAWorkbench.GetMeasurable(referenceObject);
                try
                {
                    TheMeasurable.GetPoint(PointCoord); //读取选择的曲面坐标
                }
                catch (Exception)
                {
                    try
                    {
                        TheMeasurable.GetCOG(PointCoord);
                    }
                    catch (Exception)
                    {
                        ERR += 1;
                    }
                }
                if (!KeepName.Checked)
                {
                    TName = "Rx_" + (datatable.Rows.Count + 1);
                }
                WriteObjectToDataGrid(TName, PointCoord, referenceObject, IgRepeat.Checked); //记录数据到DataGridView
                try
                {
                    this.Update(); //Updata Draw
                }
                catch (Exception)
                {
                }
                progressBar.PerformStep();
            }
            SetDataGrid();
            if (ERR > 0)
            {
                MessageBox.Show("共计:" + ERR + "个点创建新参考点失败!");
            }
            if (RepeatCheck.Checked)
            {
                CheckRepeat(SelectArc);
            }
            DataGrid.AllowUserToAddRows = false;
        }
Beispiel #8
0
        private bool GetSelect(bool InitFrame)
        {
            this.WindowState = FormWindowState.Minimized;
            try
            {
                CatApplication = (INFITF.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Catia.Application");
            }
            catch (Exception)
            {
                this.WindowState   = FormWindowState.Normal;
                this.StartPosition = FormStartPosition.CenterScreen;
                MessageBox.Show("未检测到打开的CATIA!,请重新运行CATIA!");
                return(false);
                //throw;
            }
            CatApplication.set_Caption("正在运行瑞祥快速建模工具!");
            // 获取当前活动ProductDocument
            try
            {
                CatDocument = (ProductDocument)CatApplication.ActiveDocument;
            }
            catch (Exception)
            {
                CatDocument = (ProductDocument)CatApplication.Documents.Add("Product");
                try
                {
                    CatDocument.Product.set_PartNumber("RxProduct");
                }
                catch (Exception)
                {
                    MessageBox.Show("未检测到活动Product,正在为您创建,请手动辅助完成!");
                    return(false);
                }
                //MessageBox.Show("未检测到活动Product,已自动为您创建对象!");
            }
            // 添加一个新零件
            string Name = "RXFastDesignTool";

            try
            {
                PartID = ((PartDocument)CatApplication.Documents.Item(Name + ".CATPart")).Part;
            }
            catch (Exception)
            {
                try
                {
                    CatDocument.Product.Products.AddNewComponent("Part", Name);
                }
                catch (Exception)
                {
                    return(false);
                    // throw;
                }
                PartID = ((PartDocument)CatApplication.Documents.Item(Name + ".CATPart")).Part;
                OriginElements Tpart   = PartID.OriginElements;
                AnyObject      dxy     = Tpart.PlaneXY;
                AnyObject      dyz     = Tpart.PlaneYZ;
                AnyObject      dzx     = Tpart.PlaneZX;
                Selection      SelectT = CatDocument.Selection;
                VisPropertySet VP      = SelectT.VisProperties;
                SelectT.Add(dxy);
                SelectT.Add(dyz);
                SelectT.Add(dzx);
                VP = (VisPropertySet)VP.Parent;
                VP.SetShow(CatVisPropertyShow.catVisPropertyNoShowAttr);
                SelectT.Clear();
            }
            try
            {
                CatDocument.Product.ApplyWorkMode(CatWorkModeType.DESIGN_MODE);
            }
            catch (Exception)
            {
                Console.WriteLine("Change Design Model Faild!");
            }
            this.WindowState   = FormWindowState.Normal;
            this.StartPosition = FormStartPosition.CenterScreen;
            return(true);
        }
Beispiel #9
0
        /// <summary>
        /// 连接CATIA COM 并获得选择集
        /// </summary>
        /// <returns></returns>
        private Selection GetSelect()
        {
            this.WindowState = FormWindowState.Minimized;
            try
            {
                CatApplication = (INFITF.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Catia.Application");
            }
            catch (Exception)
            {
                this.WindowState   = FormWindowState.Normal;
                this.StartPosition = FormStartPosition.CenterScreen;
                MessageBox.Show("未检测到打开的CATIA!,请重新运行CATIA!");
                return(null);
            }
            CatApplication.set_Caption("正在运行瑞祥快速建模工具!");
            // 获取当前活动ProductDocument
            try
            {
                CatDocument = (ProductDocument)CatApplication.ActiveDocument;
            }
            catch (Exception)
            {
                CatDocument = (ProductDocument)CatApplication.Documents.Add("Product");
                try
                {
                    CatDocument.Product.set_PartNumber("RxProduct");
                }
                catch (Exception)
                {
                    MessageBox.Show("未检测到活动Product,正在为您创建,请手动辅助完成!");
                    return(null);
                }
                //MessageBox.Show("未检测到活动Product,已自动为您创建对象!");
            }
            // 添加一个新零件
            string Name = "RXFastDesignTool";

            try
            {
                //PartID = ((PartDocument)CatApplication.Documents.Item(Name + ".CATPart")).Part;
                //PartID = ((PartDocument)CatApplication.Documents.Item(Name)).Part;
                Selection FindPart = CatApplication.ActiveDocument.Selection;
                FindPart.Search("Name=RXFastDesignTool,all");
                if (FindPart.Count2 > 0)
                {
                    PartID = (Part)FindPart.Item2(1).Value; //仅拾取带个并对第一个进行操作
                }
                else
                {
                    try
                    {
                        CatDocument.Product.Products.AddNewComponent("Part", Name);
                    }
                    catch (Exception)
                    {
                        return(null);
                        // throw;
                    }
                    PartID = ((PartDocument)CatApplication.Documents.Item(Name + ".CATPart")).Part;
                    OriginElements Tpart   = PartID.OriginElements;
                    AnyObject      dxy     = Tpart.PlaneXY;
                    AnyObject      dyz     = Tpart.PlaneYZ;
                    AnyObject      dzx     = Tpart.PlaneZX;
                    Selection      SelectT = CatDocument.Selection;
                    VisPropertySet VP      = SelectT.VisProperties;
                    SelectT.Add(dxy);
                    SelectT.Add(dyz);
                    SelectT.Add(dzx);
                    VP = (VisPropertySet)VP.Parent;
                    VP.SetShow(CatVisPropertyShow.catVisPropertyNoShowAttr);
                    SelectT.Clear();
                }
            }
            catch (Exception)
            {
                return(null);
            }
            try
            {
                CatDocument.Product.ApplyWorkMode(CatWorkModeType.DESIGN_MODE);
            }
            catch (Exception)
            {
                Console.WriteLine("Change Design Model Faild!");
            }
            Selection SelectArc = CatDocument.Selection;

            SelectArc.Clear();
            var Result = SelectArc.SelectElement3(InputObjectType(), "请选择曲面", true, CATMultiSelectionMode.CATMultiSelTriggWhenSelPerf, false);

            if (Result == "Cancel")
            {
                return(null);
            }
            if (SelectArc.Count < 1)
            {
                MessageBox.Show("请先选择对象后再点此命令!");
                return(null);
            }
            this.WindowState   = FormWindowState.Normal;
            this.StartPosition = FormStartPosition.CenterScreen;
            return(SelectArc);
        }
Beispiel #10
0
        private void ReadCoord_Click(object sender, EventArgs e)
        {
            if (datatable.Columns.Count < 1)
            {
                InitDataTable();
            }
            this.WindowState = FormWindowState.Minimized;
            RepeatNum        = 0;
            Array.Clear(GetRepeatRef, 0, GetRepeatRef.Length);

            ReadType = 2;
            Selection SelectArc = GetSelect();

            if (SelectArc == null || SelectArc.Count2 == 0)
            {
                this.WindowState   = FormWindowState.Normal;
                this.StartPosition = FormStartPosition.CenterScreen;
                this.TopMost       = true;
                return;
            }
            int ERR = 0;

            for (int i = 1; i <= SelectArc.Count2; i++)
            {
                object[]           PointCoord      = new object[] { -99, -99, -99, -99, -99, -99 };
                HybridShapeFactory PartHyb         = (HybridShapeFactory)PartID.HybridShapeFactory;
                SPAWorkbench       TheSPAWorkbench = (SPAWorkbench)CatDocument.GetWorkbench("SPAWorkbench");
                Reference          referenceObject;
                try
                {
                    //Temp = PartID.CreateReferenceFromGeometry((AnyObject)SelectArc.Item(i).Value);
                    referenceObject = SelectArc.Item(i).Reference;//!=null? SelectArc.Item(i).Reference: Temp;
                }
                catch (Exception)
                {
                    Boolean   LeafProductProcessed;
                    AnyObject Feature = (AnyObject)SelectArc.Item(i).Value;
                    try
                    {
                        String Name = string.Empty;
                        Shape  GE   = (Shape)SelectArc.Item(i).Value;
                        //Name = GE.get_Name();
                        //Pad Spad = (Pad)GE.GetItem("Face1");
                        //Name = Spad.get_Name();
                        referenceObject = PartID.CreateReferenceFromObject(Feature);
                        PartHyb.AddNewPointCenter(referenceObject);
                    }
                    catch (Exception)
                    {
                        ERR += 1;
                        var LeafProduct = SelectArc.Item(i).LeafProduct;
                        LeafProductProcessed = true;
                        if (LeafProduct.get_Name() == "InvalidLeafProduct")
                        {
                            LeafProductProcessed = false;
                        }
                        if (LeafProductProcessed)
                        {
                            String         ShapeName = Feature.get_Name();
                            VisPropertySet VPS       = SelectArc.VisProperties;
                            VPS.SetVisibleColor(255, 0, 0, 0);
                            continue;
                        }
                        else
                        {
                            String         ShapeName = Feature.get_Name();
                            VisPropertySet VPS       = SelectArc.VisProperties;
                            VPS.SetVisibleColor(255, 0, 0, 0);
                            continue;
                        }
                    }
                }
                Measurable TheMeasurable = TheSPAWorkbench.GetMeasurable(referenceObject);
                var        TName         = referenceObject.get_Name(); //读取选择的曲面名称
                try
                {
                    TheMeasurable.GetPoint(PointCoord); //读取选择的曲面坐标
                }
                catch (Exception)
                {
                    try
                    {
                        TheMeasurable.GetCOG(PointCoord);
                    }
                    catch (Exception)
                    {
                        ERR += 1;
                    }
                }
                if (!KeepName.Checked)
                {
                    TName = "Rx_" + (datatable.Rows.Count + 1);
                }
                WriteObjectToDataGrid(TName, PointCoord, referenceObject, IgRepeat.Checked); //记录数据到DataGridView
            }
            SetDataGrid();
            if (ERR > 0)
            {
                MessageBox.Show("共计:" + ERR + "个点创建新参考点失败!");
            }
            if (RepeatCheck.Checked)
            {
                CheckRepeat(SelectArc);
            }
        }