Beispiel #1
0
        private void OutTargetListAix_Click(object sender, EventArgs e)
        {
            GloalForDelmia GFD = new GloalForDelmia();

            DStype = GFD.InitCatEnv(this);
            if (DStype.Revalue == -1)
            {
                return;
            }
            Selection Uselect     = GFD.GetIRobotMotion(this, DStype, 9, "请选择正确的产品数模作为坐标基准");
            Product   BaseProduct = null;

            if (Uselect == null && Uselect.Count < 1)
            {
                return;
            }
            BaseProduct = (Product)Uselect.Item2(1).Value;
            SPAWorkbench TheSPAWorkbench = (SPAWorkbench)DStype.CDSActiveDocument.GetWorkbench("SPAWorkbench"); // Default Get Coordxyz From Word

            try
            {
                Reference  basereference = Uselect.Item2(1).Reference;
                Measurable measurable    = TheSPAWorkbench.GetMeasurable(basereference);
                object[]   PointCoord    = new object[3];//{-99, -99, -99, -99, -99, -99, -99, -99, -99 };
                Uselect.Item2(1).GetCoordinates(PointCoord);
                measurable.GetCenter(PointCoord);
            }
            catch (Exception e1)
            {
                MessageBox.Show("发生未知错误:" + e1.Message);
            }
        }
        private void BollToPoint_Click(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Minimized;
            ReadType         = 2;
            Selection SelectArc = null;

            CATIA_Class.GetSelect(CatDocument, ref SelectArc, this);
            if (SelectArc == null || SelectArc.Count2 == 0)
            {
                return;
            }
            int ERR = 0;

            object[] PointCoord = new object[] { -99, -99, -99 };
            for (int i = 1; i <= SelectArc.Count2; i++)
            {
                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);     //读取选择的曲面坐标
                var TName = referenceObject.get_Name(); //读取选择的曲面名称
                HybridShapePointCoord NewPoint = PartHyb.AddNewPointCoord(Convert.ToDouble(PointCoord[0]), Convert.ToDouble(PointCoord[1]), Convert.ToDouble(PointCoord[2]));
                if (KeepName.Checked)
                {
                    NewPoint.set_Name(TName);
                }
                else
                {
                    NewPoint.set_Name("Rx_" + i);
                }
                HybridBodies Hybs = PartID.HybridBodies;
                HybridBody   Hyb  = null;
                try
                {
                    Hyb = Hybs.Item("几何图形集.1");
                }
                catch (Exception)
                {
                    Hyb = Hybs.Item("Geometrical Set.1");
                }
                Hyb.AppendHybridShape(NewPoint);
                PartID.InWorkObject = NewPoint;
                try
                {
                    PartID.Update();
                }
                catch (Exception)
                {
                    ERR += 1;
                }
            }
            if (ERR > 0)
            {
                MessageBox.Show("共计:" + ERR + "个点创建新参考点失败!");
            }
        }
Beispiel #3
0
        public static Transformation GetCoordinates(this Document doc, Point point)
        {
            if (doc.IsPart())
            {
                var TheSPAWorkbench = (SPAWorkbench)doc.GetWorkbench("SPAWorkbench");

                Measurable mesPoint = TheSPAWorkbench.GetMeasurable((Reference)point);

                var arrPoint = new object[3];
                mesPoint.GetPoint(arrPoint);

                return(new Transformation(new ATN.Utils.MathExt.Numerical.Coordinate(arrPoint.Cast <double>().ToArray()), new RotationMatrix()));
            }
            return(null);
        }
        private void PointToCoord_Click(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Minimized;
            RepeatNum        = 0;
            Array.Clear(GetRepeatRef, 0, GetRepeatRef.Length);
            ReadType = 1;
            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;

            object[] PointCoord = new object[] { -99, -99, -99, -99, -99, -99 };
            for (int i = 1; i <= SelectArc.Count2; i++)
            {
                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);     //读取选择的曲面坐标
                var TName = referenceObject.get_Name(); //读取选择的曲面名称
                if (!KeepName.Checked)
                {
                    TName = "Rx_" + (datatable.Rows.Count + 1);
                }
                WriteObjectToDataGrid(TName, PointCoord, referenceObject, IgRepeat.Checked);
            }
            SetDataGrid();
            if (ERR > 0)
            {
                MessageBox.Show("共计:" + ERR + "个点创建新参考点失败!");
            }
            if (RepeatCheck.Checked)
            {
                CheckRepeat(SelectArc);
            }
        }
        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 #6
0
        enum RxHoleType { PinHole, NSmoothHole, ISmoothHole, ThreadHole }//PinHole销孔  NormarlSmoothHole 光孔 Inner SmoothHole 沉头孔  ThreadHole 螺纹孔

        /// <summary>
        /// 新增孔
        /// </summary>
        /// <param name="UserSelected">用户选择的3个参考</param>
        /// <param name="tform">父级窗体</param>
        /// <param name="AbortHole">是否对装配零件直接打孔</param>
        public void CreateNwThroughtHole(Reference[] UserSelected, Form tform, bool AbortHole, object[] UserSelectedValue)
        {
            object[] HolePoint = new object[3];
            Edge     ed1       = (Edge)UserSelected[0];
            Edge     ed2       = (Edge)UserSelected[1];

            if (CatActiveDoc == null)
            {
                InitCatEnv(tform);
            }
            SPAWorkbench TheSPAWorkbench = (SPAWorkbench)CatActiveDoc.GetWorkbench("SPAWorkbench");
            Measurable   LengthA         = TheSPAWorkbench.GetMeasurable(ed1);
            Measurable   LengthB         = TheSPAWorkbench.GetMeasurable(ed2);
            Edge         LengthEdge      = LengthA.Length >= LengthB.Length ? ed1 : ed2; //获取长边
            Edge         WeightEdge      = LengthA.Length <= LengthB.Length ? ed1 : ed2; //获取短边
            double       Weight          = LengthA.Length <= LengthB.Length ? LengthA.Length : LengthB.Length;
            double       Length          = LengthA.Length >= LengthB.Length ? LengthA.Length : LengthB.Length;
            double       JianDis         = 0;

            if (Length <= 45)
            {
                JianDis = 12.5;
            }
            else if (Length <= 60 && Length > 45)
            {
                JianDis = 15;
            }
            else if (Length > 60)
            {
                JianDis = 15;
            }
            GetProductByFace GPB          = new GetProductByFace();
            Part             Spart        = GPB.GetPart((Face)UserSelected[2]);
            ShapeFactory     shapeFactory = (ShapeFactory)Spart.ShapeFactory;
            Hole             Nwhole       = shapeFactory.AddNewHoleWith2Constraints(Convert.ToDouble(HolePoint[0]), Convert.ToDouble(HolePoint[1]), Convert.ToDouble(HolePoint[2]), UserSelected[0], UserSelected[1], UserSelected[2], 50);//创建过孔

            RxSetHoleType(Nwhole, 10, Weight / 2, 9, RxHoleType.NSmoothHole);
            Spart.Update();
            Hole NwPinHole = shapeFactory.AddNewHoleWith2Constraints(Convert.ToDouble(HolePoint[0]) + 5, Convert.ToDouble(HolePoint[1]) + 5, Convert.ToDouble(HolePoint[2]), UserSelected[0], UserSelected[1], UserSelected[2], 50);//创建销孔

            RxSetHoleType(NwPinHole, 10, Weight / 2 + JianDis, 8, RxHoleType.PinHole);
            Spart.Update();
            if (Length <= 60)
            {
                RectPattern RPhole = shapeFactory.AddNewRectPattern(Nwhole, 2, 1, JianDis * 2, 20, 1, 1, LengthEdge, WeightEdge, true, true, 0); //阵列过孔
                RPhole.FirstRectangularPatternParameters  = CatRectangularPatternParameters.catInstancesandSpacing;
                RPhole.SecondRectangularPatternParameters = CatRectangularPatternParameters.catInstancesandSpacing;
                Spart.Update();
            }
            else
            {
                RectPattern RPhole = shapeFactory.AddNewRectPattern(Nwhole, 2, 1, JianDis * 2, 20, 1, 1, LengthEdge, WeightEdge, true, true, 0); //阵列过孔
                RPhole.FirstRectangularPatternParameters  = CatRectangularPatternParameters.catInstancesandSpacing;
                RPhole.SecondRectangularPatternParameters = CatRectangularPatternParameters.catInstancesandSpacing;

                RectPattern RPinhole = shapeFactory.AddNewRectPattern(NwPinHole, 2, 1, JianDis * 2, 20, 1, 1, LengthEdge, WeightEdge, true, true, 0); //阵列过孔
                RPinhole.FirstRectangularPatternParameters  = CatRectangularPatternParameters.catInstancesandSpacing;
                RPinhole.SecondRectangularPatternParameters = CatRectangularPatternParameters.catInstancesandSpacing;
                Spart.Update();
            }
            if (AbortHole)
            {
                CreateThreadHole(Spart, UserSelected, UserSelectedValue, WeightEdge, LengthEdge, Weight, Length, JianDis);
            }
        }
Beispiel #7
0
        /// <summary>
        /// 创建螺纹孔安装面
        /// </summary>
        /// <param name="Spart">对象零件</param>
        /// <param name="UserSelected">用户选择参考对象2边1面</param>
        /// <param name="WeightEdge">宽边</param>
        /// <param name="LengthEdge">长边</param>
        /// <param name="Weight">宽边宽度</param>
        /// <param name="Length">长边长度</param>
        /// <param name="JianDis">孔间距</param>
        public void CreateThreadHole(Part Spart, Reference[] UserSelected, object[] UserSelectedValue, Edge WeightEdge, Edge LengthEdge, double Weight, double Length, double JianDis)
        {
            //对与孔装配的零件执行打孔
            object[]  SHolePoint = new object[3];
            Selection SelectArc  = CatActiveDoc.Selection;

            SelectArc.Clear();
            var Result = SelectArc.SelectElement2(InputObjectType(2), "请选择子零件孔支持面!", true);

            if (Result == "Cancel" || SelectArc == null || SelectArc.Count2 == 0)
            {
                return;
            }
            Reference        SonReface = SelectArc.Item(1).Reference;
            GetProductByFace SGPB      = new GetProductByFace();
            Part             SonPart   = SGPB.GetPart((Face)SelectArc.Item(1).Value);

            SelectArc.Item(1).GetCoordinates(SHolePoint);
            SelectArc.Clear();
            ShapeFactory       NextshapeFactory   = (ShapeFactory)SonPart.ShapeFactory;
            HybridShapeFactory NextHyShapeFactory = (HybridShapeFactory)SonPart.HybridShapeFactory;
            InstanceFactory    NextInf            = (InstanceFactory)SonPart.GetCustomerFactory("InstanceFactory");

            NextInf.AddInstance(WeightEdge);
            try
            {
                Reference Wref = null;
                Reference Lref = null;
                try
                {
                    object[]     LinePoint       = new object[12];
                    object[]     LineDirection   = new object[12];
                    SPAWorkbench TheSPAWorkbench = (SPAWorkbench)CatActiveDoc.GetWorkbench("SPAWorkbench");
                    Measurable   LengthA         = TheSPAWorkbench.GetMeasurable(WeightEdge);
                    Measurable   LengthB         = TheSPAWorkbench.GetMeasurable(LengthEdge);
                    //LengthA.GetMinimumDistancePoints(, LinePoint);
                    //LengthA.GetDirection(LineDirection);
                    //NextHyShapeFactory.AddNewLineNormal(SonReface, 10, 10, true);
                    Edge   WeightEdgeT     = (Edge)UserSelectedValue[0];
                    Edge   LengthEdgeT     = (Edge)UserSelectedValue[1];
                    string WeightEdgeName  = WeightEdgeT.get_Name();
                    string LengthEdgeTName = LengthEdgeT.get_Name();
                    Wref            = SonPart.CreateReferenceFromName(null);
                    Lref            = SonPart.CreateReferenceFromName(null);
                    WeightEdgeName  = Wref.get_Name();
                    LengthEdgeTName = Lref.get_Name();
                    SelectArc.Add(WeightEdgeT);
                    SelectArc.Add(LengthEdgeT);
                    SelectArc.Copy();
                }
                catch (Exception e)
                {
                    throw e;
                }
                Hole SonNwhole = NextshapeFactory.AddNewHoleWith2Constraints(Convert.ToDouble(SHolePoint[0]), Convert.ToDouble(SHolePoint[1]), Convert.ToDouble(SHolePoint[2]), Wref, Lref, SonReface, 50);//创建过孔
                try
                {
                    RxSetHoleType(SonNwhole, 10, Weight / 2, 9, RxHoleType.NSmoothHole);
                }
                catch (Exception)
                {
                    RxSetHoleType(SonPart, SonNwhole, 10, Weight / 2, 9, RxHoleType.NSmoothHole, WeightEdge, LengthEdge);
                }
                SonPart.Update();
                Hole SonNwPinHole = NextshapeFactory.AddNewHoleWith2Constraints(Convert.ToDouble(SHolePoint[0]) + 5, Convert.ToDouble(SHolePoint[1]) + 5, Convert.ToDouble(SHolePoint[2]), UserSelected[0], UserSelected[1], SonReface, 50);//创建销孔
                RxSetHoleType(SonNwPinHole, 10, Weight / 2 + JianDis, 8, RxHoleType.PinHole);
                SonPart.Update();
                if (Length <= 60)
                {
                    RectPattern RPhole = NextshapeFactory.AddNewRectPattern(SonNwhole, 2, 1, JianDis * 2, 20, 1, 1, LengthEdge, WeightEdge, true, true, 0); //阵列过孔
                    RPhole.FirstRectangularPatternParameters  = CatRectangularPatternParameters.catInstancesandSpacing;
                    RPhole.SecondRectangularPatternParameters = CatRectangularPatternParameters.catInstancesandSpacing;
                    Spart.Update();
                }
                else
                {
                    RectPattern RPhole = NextshapeFactory.AddNewRectPattern(SonNwhole, 2, 1, JianDis * 2, 20, 1, 1, LengthEdge, WeightEdge, true, true, 0); //阵列过孔
                    RPhole.FirstRectangularPatternParameters  = CatRectangularPatternParameters.catInstancesandSpacing;
                    RPhole.SecondRectangularPatternParameters = CatRectangularPatternParameters.catInstancesandSpacing;

                    RectPattern RPinhole = NextshapeFactory.AddNewRectPattern(SonNwPinHole, 2, 1, JianDis * 2, 20, 1, 1, LengthEdge, WeightEdge, true, true, 0); //阵列过孔
                    RPinhole.FirstRectangularPatternParameters  = CatRectangularPatternParameters.catInstancesandSpacing;
                    RPinhole.SecondRectangularPatternParameters = CatRectangularPatternParameters.catInstancesandSpacing;
                    Spart.Update();
                }
            }
            catch (Exception)
            {
                throw;
                MessageBox.Show("打孔失败!请确定选择是否有误!");
            }
        }
Beispiel #8
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);
            }
        }
Beispiel #9
0
 public override int GetHashCode()
 {
     return(Id.GetHashCode() ^ Name.GetHashCode() ^ Measurable.GetHashCode() ^ Alch.GetHashCode());
 }