Пример #1
0
        private bool insertFormSide(_Ge.Point3d ptPos, double dir, double rotation)
        {
            _Ed.PromptStringOptions pStrOpts = new _Ed.PromptStringOptions("\nFormSide: ");
            pStrOpts.AllowSpaces = false;
            _Ed.PromptResult pStrRes = _c.ed.GetString(pStrOpts);
            string           result  = pStrRes.StringResult;

            if (pStrRes.Status == _Ed.PromptStatus.Cancel)
            {
                return(false);
            }

            _Ge.Point3d         insert = ptPos;
            _Db.AttachmentPoint a      = _Db.AttachmentPoint.BottomCenter;

            if (rotation == 0.0)
            {
                a = _Db.AttachmentPoint.BottomCenter;
                double newX = ptPos.X - (bigCircleOffset - bigCircleRadius) * dir / 2;
                double newY = ptPos.Y + textOffset;
                insert = new _Ge.Point3d(newX, newY, ptPos.Z);
            }
            else
            {
                a = _Db.AttachmentPoint.MiddleRight;
                double newX = ptPos.X - textOffset;
                double newY = ptPos.Y - (bigCircleOffset - bigCircleRadius) * dir / 2;
                insert = new _Ge.Point3d(newX, newY, ptPos.Z);
            }

            insertText(insert, a, result, 0);
            return(true);
        }
Пример #2
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);
            }
        }
Пример #3
0
        private bool insertNumber(_Ge.Point3d center, double rotation)
        {
            _Ed.PromptStringOptions pStrOpts = new _Ed.PromptStringOptions("\nNumber: ");
            pStrOpts.AllowSpaces = false;
            _Ed.PromptResult pStrRes = _c.ed.GetString(pStrOpts);
            string           result  = pStrRes.StringResult;

            if (pStrRes.Status == _Ed.PromptStatus.Cancel)
            {
                return(false);
            }

            _Db.AttachmentPoint a = _Db.AttachmentPoint.MiddleCenter;
            if (result.Length > 2)
            {
                _Ge.Point3d insert = center;

                a = _Db.AttachmentPoint.BottomRight;
                if (rotation == 0.0)
                {
                    double newX = center.X;
                    double newY = center.Y + textOffset;

                    insert = new _Ge.Point3d(newX, newY, center.Z);
                }
                else
                {
                    double newX = center.X - textOffset;
                    double newY = center.Y;

                    insert = new _Ge.Point3d(newX, newY, center.Z);
                }

                insertText(insert, a, result, rotation);
                return(false);
            }
            else
            {
                a = _Db.AttachmentPoint.MiddleCenter;
                insertText(center, a, result, 0.0);
                return(true);
            }
        }