Esempio n. 1
0
        public static void ManualInsertMText(AcDb.MText oMText)
        {
            using (AcDb.Transaction tr = db.TransactionManager.StartTransaction())
            {
                AcDb.BlockTableRecord btr = (AcDb.BlockTableRecord)tr.GetObject(db.CurrentSpaceId, AcDb.OpenMode.ForWrite);

                oMText.Normal = ed.CurrentUserCoordinateSystem.CoordinateSystem3d.Zaxis;

                btr.AppendEntity(oMText);
                tr.AddNewlyCreatedDBObject(oMText, true);

                MTextPlacementJig pj = new MTextPlacementJig(oMText);

                AcEd.PromptStatus stat = AcEd.PromptStatus.Keyword;
                while (stat == AcEd.PromptStatus.Keyword)
                {
                    AcEd.PromptResult res = ed.Drag(pj);
                    stat = res.Status;
                    if (stat != AcEd.PromptStatus.OK && stat != AcEd.PromptStatus.Keyword)
                    {
                        return;
                    }
                }
                tr.Commit();
                //return (MText)pj.Entity;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Створює елементи вектору з данними виносу.
        /// </summary>
        private void CreateDrawingStakeOut()
        {
            if (this.PointStation == null)
            {
                return;
            }

            AcGe.Point3d pntStart = new AcGe.Point3d(this.PointStation.E, this.PointStation.N, this.PointStation.H);
            AcGe.Point3d pntEnd   = new AcGe.Point3d(this.Coordinates.X, this.Coordinates.Y, 0);

            AcDb.Line line = new AcDb.Line(pntStart, pntEnd);
            line.Visible = this.Visible;

            AcGe.Point3d pntMiddle = new AcGe.LineSegment3d(pntStart, pntEnd).MidPoint;

            double angleTXT = line.Angle;

            if (angleTXT > Math.PI / 2 && angleTXT < Math.PI * 3 / 2)
            {
                angleTXT += Math.PI;
            }

            AcDb.MText text = new AcDb.MText();
            text.Contents = this.DistanceToString(AcRx.DistanceUnitFormat.Decimal) + "\r\n"
                            + "л.к. " + ServiceTable.FormatAngleValue(this.LeftlAngleToString(AcRx.AngularUnitFormat.DegreesMinutesSeconds));
            text.Rotation   = angleTXT;
            text.Location   = pntMiddle;
            text.Attachment = AcDb.AttachmentPoint.MiddleCenter;
            text.Width      = 25;
            text.TextHeight = 1.8 * this.ScaleDrawing;


            this.lineID = ServiceCAD.InsertObject(line);
            this.txtID  = ServiceCAD.InsertObject(text);
        }
Esempio n. 3
0
        private void AddAreaAndPerimetr()
        {
            AcDb.Polyline2d borderParcel = ServiceSimpleElements.CreatePolyline2d(this.Parcel.Points, true);

            AcDb.MText oMText = new AcDb.MText();
            oMText.TextHeight = 2.5 * this.SettingsForm.ScaleDrawing;
            oMText.Attachment = AcDb.AttachmentPoint.MiddleCenter;

            if (SettingsForm.DisplayArea && SettingsForm.UnitArea)
            {
                oMText.Contents = borderParcel.Area.ToString("Площа ділянки: S=0.00") + " кв.м";
            }
            else if (SettingsForm.DisplayArea && !SettingsForm.UnitArea)
            {
                oMText.Contents = (borderParcel.Area / 10000).ToString("Всього: 0.0000") + " га";
            }

            if (SettingsForm.DisplayPerimeter)
            {
                oMText.Contents = oMText.Contents + "\n" +
                                  borderParcel.Length.ToString("Периметр: 0.00") + " м";
            }

            if (SettingsForm.DisplayArea || SettingsForm.UnitArea)
            {
                oMText.Contents = oMText.Contents.Replace(',', '.');
            }

            ServiceSimpleElements.ManualInsertMText(oMText);
        }
Esempio n. 4
0
        public void renameBlockInside(string find, string replace)
        {
            foreach (_Db.ObjectId btrId in _c.blockTable)
            {
                _Db.BlockTableRecord btr = _c.trans.GetObject(btrId, _Db.OpenMode.ForWrite) as _Db.BlockTableRecord;

                foreach (_Db.ObjectId bid in btr)
                {
                    _Db.Entity currentEntity = _c.trans.GetObject(bid, _Db.OpenMode.ForWrite) as _Db.Entity;

                    if (currentEntity == null)
                    {
                        continue;
                    }
                    if (currentEntity is _Db.MText)
                    {
                        _Db.MText txt = currentEntity as _Db.MText;
                        txt.Contents = txt.Contents.Replace(find, replace);
                        txt.DowngradeOpen();
                    }
                    if (currentEntity is _Db.DBText)
                    {
                        _Db.DBText txt = currentEntity as _Db.DBText;
                        txt.TextString = txt.TextString.Replace(find, replace);
                    }
                }
            }
        }
Esempio n. 5
0
        private void insertReinforcmentMark(string mark, G.Point IP)
        {
            string layerName = "K023TL";
            string styleName = "dmt_M" + (int)Math.Round(L._V_.Z_DRAWING_SCALE);

            textStyleHandler();
            blockHandler();
            leaderStyleHandler(styleName, (int)Math.Round(L._V_.Z_DRAWING_SCALE));

            _Db.DBDictionary mleaderStyleTable = _c.trans.GetObject(_c.db.MLeaderStyleDictionaryId, _Db.OpenMode.ForWrite) as _Db.DBDictionary;

            _Ge.Point3d insertPointLeader = new _Ge.Point3d(IP.X, IP.Y, 0);
            _Ge.Point3d insertPointText   = new _Ge.Point3d(IP.X + 7.5 * L._V_.Z_DRAWING_SCALE, IP.Y + 7.5 * L._V_.Z_DRAWING_SCALE, 0);

            _Db.MText mText = new _Db.MText();
            mText.SetDatabaseDefaults();
            mText.Contents = mark;

            _Db.MLeader leader = new _Db.MLeader();
            leader.SetDatabaseDefaults();
            leader.ContentType = _Db.ContentType.MTextContent;
            leader.MText       = mText;
            leader.AddLeaderLine(insertPointLeader);
            leader.TextLocation = insertPointText;
            leader.MLeaderStyle = mleaderStyleTable.GetAt(styleName);

            leader.Layer = layerName;

            _c.modelSpace.AppendEntity(leader);
            _c.trans.AddNewlyCreatedDBObject(leader, true);
        }
Esempio n. 6
0
        private void alfa(_Db.ObjectId id, ref List <_Db.Dimension> dims, ref List <_Db.BlockReference> blocks, ref List <_Db.MText> txts)
        {
            _Db.DBObject currentEntity = _c.trans.GetObject(id, _Db.OpenMode.ForWrite, false) as _Db.DBObject;

            if (currentEntity == null)
            {
                return;
            }

            else if (currentEntity is _Db.BlockReference)
            {
                _Db.BlockReference blockRef = currentEntity as _Db.BlockReference;

                _Db.BlockTableRecord block = null;
                if (blockRef.IsDynamicBlock)
                {
                    block = _c.trans.GetObject(blockRef.DynamicBlockTableRecord, _Db.OpenMode.ForRead) as _Db.BlockTableRecord;
                }
                else
                {
                    block = _c.trans.GetObject(blockRef.BlockTableRecord, _Db.OpenMode.ForRead) as _Db.BlockTableRecord;
                }

                if (block != null)
                {
                    blocks.Add(blockRef);
                }
            }
            else if (currentEntity is _Db.Dimension)
            {
                _Db.Dimension dim = currentEntity as _Db.Dimension;
                dims.Add(dim);
            }
            else if (currentEntity is _Db.MText)
            {
                _Db.MText br = currentEntity as _Db.MText;
                txts.Add(br);
            }
            else if (currentEntity is _Db.DBText)
            {
                _Db.DBText br = currentEntity as _Db.DBText;

                _Db.MText myMtext = new _Db.MText();
                myMtext.Contents   = br.TextString;
                myMtext.Location   = br.Position;
                myMtext.TextHeight = br.Height;
                txts.Add(myMtext);
            }
            else if (currentEntity is _Db.MLeader)
            {
                _Db.MLeader br = currentEntity as _Db.MLeader;

                if (br.ContentType == _Db.ContentType.MTextContent)
                {
                    _Db.MText leaderText = br.MText;
                    txts.Add(leaderText);
                }
            }
        }
Esempio n. 7
0
        protected override bool Update()
        {
            AcDb.MText mText = (AcDb.MText)Entity;

            mText.Location = _location;
            mText.Height   = _txtSize;
            mText.Rotation = _angle;

            return(true);
        }
Esempio n. 8
0
        public void InsertMTextPlacementJig()
        {
            AcDb.MText oMText = new AcDb.MText
            {
                TextHeight = 7.37,
                Attachment = AcDb.AttachmentPoint.MiddleLeft,
                Contents   = "Test Value #"
            };

            //ServiceSimpleElements.ManualInsertMText(oMText);
        }
Esempio n. 9
0
        private void insertText(_Ge.Point3d ip, string txt, double scale)
        {
            _Db.MText mText = new _Db.MText();
            mText.SetDatabaseDefaults();
            mText.TextHeight = 2.5 * scale;
            mText.Contents   = txt;
            mText.Location   = ip;

            _c.modelSpace.AppendEntity(mText);
            _c.trans.AddNewlyCreatedDBObject(mText, true);
        }
Esempio n. 10
0
        private List <_Db.MText> getAllText(string layer)
        {
            List <_Db.MText> txt = new List <_Db.MText>();

            _Db.BlockTableRecord btr = _c.trans.GetObject(_c.modelSpace.Id, _Db.OpenMode.ForWrite) as _Db.BlockTableRecord;

            foreach (_Db.ObjectId id in btr)
            {
                _Db.Entity currentEntity = _c.trans.GetObject(id, _Db.OpenMode.ForWrite, false) as _Db.Entity;

                if (currentEntity != null)
                {
                    if (currentEntity is _Db.MText)
                    {
                        _Db.MText br = currentEntity as _Db.MText;
                        if (br.Layer == layer)
                        {
                            txt.Add(br);
                        }
                    }

                    if (currentEntity is _Db.DBText)
                    {
                        _Db.DBText br = currentEntity as _Db.DBText;
                        if (br.Layer == layer)
                        {
                            _Db.MText myMtext = new _Db.MText();
                            myMtext.Contents = br.TextString;
                            myMtext.Location = br.Position;
                            txt.Add(myMtext);
                        }
                    }

                    if (currentEntity is _Db.MLeader)
                    {
                        _Db.MLeader br = currentEntity as _Db.MLeader;
                        if (br.Layer == layer)
                        {
                            if (br.ContentType == _Db.ContentType.MTextContent)
                            {
                                _Db.MText leaderText = br.MText;
                                txt.Add(leaderText);
                            }
                        }
                    }
                }
            }

            return(txt);
        }
Esempio n. 11
0
        private List <_Db.MText> getSelectedText()
        {
            List <_Db.MText> txt = new List <_Db.MText>();

            _Ed.PromptSelectionResult selection = _c.ed.GetSelection();
            if (selection.Status == _Ed.PromptStatus.OK)
            {
                _Db.ObjectId[] objIds = selection.Value.GetObjectIds();

                foreach (_Db.ObjectId objId in objIds)
                {
                    _Db.Entity currentEntity = _c.trans.GetObject(objId, _Db.OpenMode.ForRead) as _Db.Entity;

                    if (currentEntity == null)
                    {
                        continue;
                    }

                    if (currentEntity is _Db.MText)
                    {
                        _Db.MText br = currentEntity as _Db.MText;
                        txt.Add(br);
                    }
                    else if (currentEntity is _Db.DBText)
                    {
                        _Db.DBText br      = currentEntity as _Db.DBText;
                        _Db.MText  myMtext = new _Db.MText();

                        myMtext.Contents = br.TextString;
                        myMtext.Layer    = br.Layer;
                        myMtext.Location = br.Position;
                        txt.Add(myMtext);
                    }
                    else if (currentEntity is _Db.MLeader)
                    {
                        _Db.MLeader br = currentEntity as _Db.MLeader;

                        if (br.ContentType == _Db.ContentType.MTextContent)
                        {
                            _Db.MText leaderText = br.MText;
                            leaderText.Layer = br.Layer;
                            txt.Add(leaderText);
                        }
                    }
                }
            }

            return(txt);
        }
Esempio n. 12
0
        private void AddLengthLine()
        {
            //AcDb.DBText oText;
            AcDb.MText oMText;

            AcDb.Line     lineCur = null;
            AcDb.ObjectId idLineCur;

            AcGe.Point2d startPoint = this.Parcel.Points.ToArray()[this.Parcel.Points.Count - 1];
            AcGe.Point3d midPoint;

            foreach (AcGe.Point2d endPoint in this.Parcel.Points)
            {
                midPoint = new AcGe.Point3d((endPoint.X + startPoint.X) / 2, (endPoint.Y + startPoint.Y) / 2, 0);



                lineCur = new AcDb.Line(new AcGe.Point3d(startPoint.X, startPoint.Y, 0),
                                        new AcGe.Point3d(endPoint.X, endPoint.Y, 0));

                lineCur.ColorIndex = 222;
                lineCur.LineWeight = AcDb.LineWeight.LineWeight030;
                idLineCur          = ServiceCAD.InsertObject(lineCur);

                ServiceCAD.ZoomCenter(midPoint, 1);

                /*
                 * oText = new AcDb.DBText();
                 * oText.Height = 2 * this.SettingsForm.ScaleDrawing;
                 * oText.TextString = startPoint.GetDistanceTo(endPoint).ToString("0.00").Replace(",",".");
                 * //oText.Layer = settingsDrawing.Plan.LengthLine.Layer;
                 *
                 * ServiceCAD.ManualInsertText(oText);
                 */

                oMText            = new AcDb.MText();
                oMText.TextHeight = 2 * this.SettingsForm.ScaleDrawing;
                oMText.Attachment = AcDb.AttachmentPoint.MiddleCenter;
                //oMText.Layer = settingsDrawing.Plan.LengthLine.Layer;

                oMText.Contents = startPoint.GetDistanceTo(endPoint).ToString("0.00").Replace(",", ".");

                ServiceCAD.ZoomCenter(midPoint, 1);
                ServiceSimpleElements.ManualInsertMText(oMText);
                ServiceCAD.DeleteObject(idLineCur);

                startPoint = endPoint;
            }
        }
Esempio n. 13
0
        private List <_Db.MText> getAllText(string layer)
        {
            List <_Db.MText> txts = new List <_Db.MText>();

            foreach (_Db.ObjectId id in _c.modelSpace)
            {
                _Db.Entity currentEntity = _c.trans.GetObject(id, _Db.OpenMode.ForWrite, false) as _Db.Entity;

                if (currentEntity == null)
                {
                    continue;
                }

                if (currentEntity is _Db.MText)
                {
                    _Db.MText mtxt = currentEntity as _Db.MText;

                    if (mtxt.Layer == layer)
                    {
                        txts.Add(mtxt);
                    }
                }
                else if (currentEntity is _Db.DBText)
                {
                    _Db.DBText dbt = currentEntity as _Db.DBText;
                    if (dbt.Layer == layer)
                    {
                        _Db.MText mtxt = new _Db.MText();
                        mtxt.Contents = dbt.TextString;
                        mtxt.Location = dbt.Position;
                        txts.Add(mtxt);
                    }
                }
                else if (currentEntity is _Db.MLeader)
                {
                    _Db.MLeader ml = currentEntity as _Db.MLeader;
                    if (ml.Layer == layer)
                    {
                        if (ml.ContentType == _Db.ContentType.MTextContent)
                        {
                            _Db.MText mtxt = ml.MText;
                            txts.Add(mtxt);
                        }
                    }
                }
            }

            return(txts);
        }
Esempio n. 14
0
        private void insertText(_Ge.Point3d ptInsert, _Db.AttachmentPoint a, string txt, double rotation)
        {
            _Db.BlockTableRecord btr = _c.trans.GetObject(_c.modelSpace.Id, _Db.OpenMode.ForWrite) as _Db.BlockTableRecord;

            using (_Db.MText acMText = new _Db.MText())
            {
                acMText.Attachment = a;
                acMText.Location   = ptInsert;
                acMText.Contents   = txt;
                acMText.TextHeight = textHeight;
                acMText.Rotation   = rotation;

                btr.AppendEntity(acMText);
                _c.trans.AddNewlyCreatedDBObject(acMText, true);
            }
        }
Esempio n. 15
0
        private void AddNumdersPoints()
        {
            int iCurNumberPoint = 0;

            //AcDb.DBText oText;
            AcDb.MText oMText;

            AcDb.Circle   circleCurPoint = null;
            AcDb.ObjectId idCircleCurPoint;

            foreach (AcGe.Point2d point in this.Parcel.Points)
            {
                iCurNumberPoint += 1;

                circleCurPoint = new AcDb.Circle(
                    new AcGe.Point3d(point.X, point.Y, 0),
                    new AcGe.Vector3d(0, 0, 1),
                    1.75 * this.SettingsForm.ScaleDrawing);

                circleCurPoint.ColorIndex = 222;
                circleCurPoint.LineWeight = AcDb.LineWeight.LineWeight030;
                idCircleCurPoint          = ServiceCAD.InsertObject(circleCurPoint);

                /*
                 * oText = new AcDb.DBText();
                 * oText.TextString = Convert.ToString(iCurNumberPoint);
                 * oText.Height = settingsDrawing.Plan.NumberPoint.TextHeight * this.SettingsForm.ScaleDrawing;
                 * //oText.Layer = settingsDrawing.Plan.NumberPoint.Layer;
                 */

                oMText            = new AcDb.MText();
                oMText.TextHeight = 2 * this.SettingsForm.ScaleDrawing;
                oMText.Attachment = AcDb.AttachmentPoint.MiddleCenter;
                //oMText.Layer = settingsDrawing.Plan.LengthLine.Layer;

                oMText.Contents = Convert.ToString(iCurNumberPoint);

                ServiceCAD.ZoomCenter(new AcGe.Point3d(point.X, point.Y, 0), 1);
                ServiceSimpleElements.ManualInsertMText(oMText);
                ServiceCAD.DeleteObject(idCircleCurPoint);
            }
        }
Esempio n. 16
0
        private void AddTextNeighbors()
        {
            AcDb.MText oMText = new AcDb.MText();
            oMText.TextHeight = 2.5 * this.SettingsForm.ScaleDrawing;
            oMText.Width      = 300;
            oMText.Height     = 100;
            oMText.Attachment = AcDb.AttachmentPoint.MiddleLeft;
            //oMText.Layer = settingsDrawing.Plan.Neighbors.Layer;

            oMText.Contents = "\\L{\\fArial|b1|i0|c204|p34;Опис меж:}\\l\r\n";

            int indexContentsNeighbors = -1;

            foreach (TextNeighbors textNeighbors in this.allTextNeighbors)
            {
                indexContentsNeighbors++;
                if (indexContentsNeighbors > 0)
                {
                    oMText.Contents += "\r\n";
                    if (indexContentsNeighbors == 1)
                    {
                        oMText.Contents += "\r\n" + "\\L{\\fArial|b1|i0|c204|p34;Інші землекористувачі:}\\l" + "";
                    }

                    if (this.allTextNeighbors.Count > 2)
                    {
                        oMText.Contents += "\r\n" + "{\\fArial|b1|i0|c204|p34;Контур №" + indexContentsNeighbors.ToString("0") + "}";
                    }
                    oMText.Contents += "\r\n";
                }

                foreach (string value in textNeighbors.ToListValue())
                {
                    oMText.Contents += "\r\n" + value;
                }
            }

            ServiceSimpleElements.ManualInsertMText(oMText);
        }
Esempio n. 17
0
        public void renameText(string find, string replace)
        {
            foreach (_Db.ObjectId id in _c.modelSpace)
            {
                _Db.Entity currentEntity = _c.trans.GetObject(id, _Db.OpenMode.ForWrite, false) as _Db.Entity;

                if (currentEntity == null)
                {
                    continue;
                }
                if (currentEntity is _Db.MText)
                {
                    _Db.MText txt = currentEntity as _Db.MText;
                    txt.Contents = txt.Contents.Replace(find, replace);
                }
                if (currentEntity is _Db.DBText)
                {
                    _Db.DBText txt = currentEntity as _Db.DBText;
                    txt.TextString = txt.TextString.Replace(find, replace);
                }
            }
        }
Esempio n. 18
0
        /// <summary>
        /// Створює коллекцію мультітекстових обектів заголовку таблиці та заголовків колонок таблиці.
        /// </summary>
        /// <param name="titleTable">Заголовок таблиці.</param>
        /// <param name="settingTable">Налаштування таблиці.</param>
        /// <returns>
        /// Повертає <see cref="T:AcDb.DBObjectCollection"/>, що містить мультитекстові обекти заголовку таблиці та заголовків колонок таблиці
        /// </returns>

        internal static AcDb.DBObjectCollection GetCapTables(string titleTable, SettingTable settingTable)
        {
            AcDb.DBObjectCollection objects = new AcDb.DBObjectCollection();

            AcDb.MText   textValue;
            AcGe.Point3d insertPoint = AcGe.Point3d.Origin;

            /*Заголовок таблиці*/
            textValue                   = new AcDb.MText();
            textValue.TextHeight        = settingTable.TextHeight;
            textValue.LineSpaceDistance = settingTable.TextHeight * 0.7;
            textValue.Attachment        = AcDb.AttachmentPoint.BottomCenter;
            textValue.Contents          = titleTable;
            textValue.Location          = settingTable.BasePointDrawing
                                          .Add(new AcGe.Vector3d(settingTable.GetWidthTable() / 2, settingTable.TextHeight, 0));
            objects.Add(textValue);

            /*Заголовоки колонок таблиці*/
            double colWidth = 0;

            foreach (ColumnTable value in settingTable.Columns)
            {
                colWidth   += value.Width;
                insertPoint = new AcGe.Point3d(colWidth - value.Width / 2, settingTable.TextHeight / 2 * -1, 0);

                textValue                   = new AcDb.MText();
                textValue.TextHeight        = settingTable.TextHeight;
                textValue.LineSpaceDistance = settingTable.TextHeight * 2;
                textValue.Attachment        = AcDb.AttachmentPoint.TopCenter;
                textValue.Contents          = value.Name;
                textValue.Location          = settingTable.BasePointDrawing.Add(insertPoint.GetAsVector());

                objects.Add(textValue);
            }
            return(objects);
        }
Esempio n. 19
0
        /// <summary>
        /// Створює коллекцію текстових обектів значень данних таблиці обмежень земельної ділянки.
        /// </summary>
        /// <param name="parcel">Ділянка, що є вихідною для таблиці.</param>
        /// <param name="settingTable">Налаштування таблиці.</param>
        /// <returns>
        ///  Повертає <see cref="T:AcDb.DBObjectCollection"/>, що містить текстові значення данний таблиці обмежень земельної ділянки.
        /// </returns>

        internal static AcDb.DBObjectCollection GetDataTableLimiting(LandParcel parcel, SettingTable settingTable)
        {
            AcDb.DBObjectCollection objects = new AcDb.DBObjectCollection();

            AcDb.MText   valueMText;
            AcGe.Point3d insertPoint;
            AcDb.Line    lineRows;

            LandPolygon polygonLimiting;

            double steepRow    = settingTable.TextHeight * 6;
            double heightTable = settingTable.GetHeightCapTable() * -1;

            List <HatchPolygon> listMissingHatch = new List <HatchPolygon>();

            for (int index = 0; index < parcel.Limiting.Count; index++)
            {
                polygonLimiting = parcel.Limiting.ToArray()[index];

                double colWidth = 0;

                if (index > 0)
                {
                    lineRows = new AcDb.Line(
                        new AcGe.Point3d(0, heightTable, 0),
                        new AcGe.Point3d(settingTable.GetWidthTable(), heightTable, 0));

                    objects.Add(lineRows);
                }

                heightTable -= steepRow;



                foreach (ColumnTable col in settingTable.Columns)
                {
                    colWidth += col.Width;

                    insertPoint = new AcGe.Point3d();
                    insertPoint = new AcGe.Point3d(colWidth - col.Width / 2, (heightTable + steepRow / 2), 0);

                    valueMText                   = new AcDb.MText();
                    valueMText.Width             = col.Width * 0.9;
                    valueMText.TextHeight        = settingTable.TextHeight;
                    valueMText.LineSpaceDistance = settingTable.TextHeight * 1.5;
                    valueMText.Attachment        = AcDb.AttachmentPoint.MiddleCenter;
                    valueMText.Location          = insertPoint;

                    if (col.Format.IndexOf("LegendLimiting") > -1)
                    {
                        AcGe.Point2dCollection pointsHatch = new AcGe.Point2dCollection(new AcGe.Point2d[]
                        {
                            new AcGe.Point2d(insertPoint.X - col.Width / 2 + 2, heightTable + steepRow - 2),
                            new AcGe.Point2d(insertPoint.X - col.Width / 2 + 2, heightTable + 2),
                            new AcGe.Point2d(insertPoint.X - col.Width / 2 + col.Width - 2, heightTable + 2),
                            new AcGe.Point2d(insertPoint.X - col.Width / 2 + col.Width - 2, heightTable + steepRow - 2)
                        });

                        AcDb.Polyline2d polylineLimiting = ServiceSimpleElements.CreatePolyline2d(pointsHatch, true);
                        AcDb.Hatch      hatch            =
                            ServiceSimpleElements.CreateHatch(ServiceCAD.InsertObject(polylineLimiting), true);

                        HatchPolygon hatchLimiting = HatchPolygon.GetHatchLimiting(polygonLimiting);

                        if (hatchLimiting != null)
                        {
                            hatch.ColorIndex = hatchLimiting.ColorIndex;
                            hatch.SetHatchPattern(AcDb.HatchPatternType.UserDefined, hatchLimiting.Pattern.Name);
                            hatch.PatternAngle = hatchLimiting.Pattern.Angle;
                            hatch.PatternSpace = hatchLimiting.Pattern.Space;
                        }
                        else
                        {
                            string type = polygonLimiting.FindInfo("OK").Value;
                            string name = polygonLimiting.FindInfo("OX").Value;
                            listMissingHatch.Add(new HatchPolygon(type, name, 0, PatternHatch.DEFAULT));
                        }

                        objects.Add(hatch);
                        polylineLimiting = ServiceSimpleElements.CreatePolyline2d(pointsHatch, true);
                        objects.Add(polylineLimiting);
                    }
                    else if (col.Format.IndexOf("CodeLimiting") > -1)
                    {
                        valueMText.Contents = polygonLimiting.FindInfo("OK").Value;
                        objects.Add(valueMText);
                    }
                    else if (col.Format.IndexOf("NameLimiting") > -1)
                    {
                        valueMText.Contents = polygonLimiting.FindInfo("OX").Value;
                        objects.Add(valueMText);
                    }
                    else if (col.Format.IndexOf("LegalActsLimiting") > -1)
                    {
                        valueMText.Contents = polygonLimiting.FindInfo("OD").Value;
                        objects.Add(valueMText);
                    }
                    else if (col.Format.IndexOf("AreaLimiting") > -1)
                    {
                        double area = Convert.ToDouble(polygonLimiting.FindInfo("AO").Value.Replace(".", ","));
                        valueMText.Contents = (area / 10000).ToString("0.0000").Replace(",", ".");;
                        objects.Add(valueMText);
                    }
                }
            }

            if (listMissingHatch.Count > 0)
            {
                CurrentCAD.Editor.WriteMessage("\n\nПобудова таблиці омеженнь\n Не визначено штриховку: \n");
                CurrentCAD.Editor.WriteMessage(ServiceXml.GetStringXml <List <HatchPolygon> >(listMissingHatch));
            }

            return(objects);
        }
Esempio n. 20
0
 public MTextPlacementJig(AcDb.MText mText)
     : base((AcDb.Entity)mText)
 {
     _angle   = mText.Rotation;
     _txtSize = mText.Height;
 }