Example #1
0
        public Ordinate SelectVertexDatumUp(ModelDoc2 swModel, double[] boundBox, BlockPosition left, bool clear = false)
        {
            var sizeX = boundBox[2] - boundBox[0];
            if (sizeX < 0)
                sizeX = -sizeX;
            var sizeY = boundBox[3] - boundBox[1];
            if (sizeY < 0)
                sizeY = -sizeY;
            var etalon = sizeX > sizeY ? sizeY : sizeX;
            double step = etalon / 40;

            var ordinate = new Ordinate(0, 0);
            if (left.AsBoolean())
            {
                for (int iX = 0; iX <= 30; iX++)
                {
                    for (int iY = 0; iY <= 30; iY++)
                    {
                        var boolstatus = swModel.Extension.SelectByID2("", "VERTEX", boundBox[0] + step * iX,
                                                                       boundBox[3] - step * iY, 0.0, true,
                                                                       (int)
                                                                       swAutodimMark_e.swAutodimMarkOriginDatum,
                                                                       null, 0);
                        if (boolstatus)
                        {
                            ordinate.X = boundBox[0] + step * iX;
                            ordinate.Y = boundBox[3] - step * iY;
                            if (clear)
                                swModel.ClearSelection();
                            return ordinate;
                        }
                    }
                }
            }
            else
            {
                for (int iX = 0; iX <= 30; iX++)
                {
                    for (int iY = 0; iY <= 30; iY++)
                    {
                        var boolstatus = swModel.Extension.SelectByID2("", "VERTEX", boundBox[2] - step * iX,
                                                                       boundBox[3] - step * iY, 0.0, true,
                                                                       (int)
                                                                       swAutodimMark_e.swAutodimMarkOriginDatum,
                                                                       null, 0);
                        if (boolstatus)
                        {
                            ordinate.X = boundBox[2] - step * iX;
                            ordinate.Y = boundBox[3] - step * iY;
                            if (clear)
                                swModel.ClearSelection();
                            return ordinate;
                        }
                    }
                }
            }
            if (clear)
                swModel.ClearSelection();
            return ordinate;
        }
Example #2
0
        public void SelectVertexDatumDown(ModelDoc2 swModel, double[] boundBox, BlockPosition left)
        {
            var sizeX = boundBox[2] - boundBox[0];
            if (sizeX < 0)
                sizeX = -sizeX;
            var sizeY = boundBox[3] - boundBox[1];
            if (sizeY < 0)
                sizeY = -sizeY;
            var etalon = sizeX > sizeY ? sizeY : sizeX;
            double step = etalon / 40;

            if (left.AsBoolean())
            {
                for (int iX = 0; iX <= 30; iX++)
                {
                    for (int iY = 0; iY <= 30; iY++)
                    {
                        var boolstatus = swModel.Extension.SelectByID2("", "VERTEX", boundBox[0] + step * iX,
                                                                       boundBox[1] + step * iY, 0.0, true,
                                                                       (int)
                                                                       swAutodimMark_e.swAutodimMarkOriginDatum,
                                                                       null, 0);
                        if (boolstatus)
                        {
                            return;
                        }
                    }
                }
            }
            else
            {
                for (int iX = 0; iX <= 30; iX++)
                {
                    for (int iY = 0; iY <= 30; iY++)
                    {
                        var boolstatus = swModel.Extension.SelectByID2("", "VERTEX", boundBox[2] - step * iX,
                                                                       boundBox[1] + step * iY, 0.0, true,
                                                                       (int)
                                                                       swAutodimMark_e.swAutodimMarkOriginDatum,
                                                                       null, 0);
                        if (boolstatus)
                        {
                            return;
                        }
                    }
                }
            }
        }