Exemplo n.º 1
0
 private void createCircle(_Db.BlockTableRecord btr, double radius, _Ge.Point3d ip)
 {
     using (_Db.Circle circle = new _Db.Circle())
     {
         circle.Center     = ip;
         circle.Radius     = radius;
         circle.ColorIndex = 2;
         btr.AppendEntity(circle);
         _c.trans.AddNewlyCreatedDBObject(circle, true);
     }
 }
Exemplo n.º 2
0
        private void insertCircle(_Ge.Point3d center, double radius)
        {
            _Db.BlockTableRecord btr = _c.trans.GetObject(_c.modelSpace.Id, _Db.OpenMode.ForWrite) as _Db.BlockTableRecord;

            using (_Db.Circle circle = new _Db.Circle())
            {
                circle.Center = center;
                circle.Radius = radius;
                btr.AppendEntity(circle);
                _c.trans.AddNewlyCreatedDBObject(circle, true);
            }
        }
Exemplo n.º 3
0
 private void createCircle(double radius, int index, _Ge.Point3d ip)
 {
     using (_Db.Circle circle = new _Db.Circle())
     {
         circle.Center     = ip;
         circle.Radius     = radius;
         circle.ColorIndex = index;
         circle.Layer      = kontrollLayer;
         _c.modelSpace.AppendEntity(circle);
         _c.trans.AddNewlyCreatedDBObject(circle, true);
     }
 }
Exemplo n.º 4
0
        private void createCircle(double radius, int index, _Ge.Point3d ip)
        {
            _Db.BlockTableRecord btr = _c.trans.GetObject(_c.modelSpace.Id, _Db.OpenMode.ForWrite) as _Db.BlockTableRecord;

            using (_Db.Circle circle = new _Db.Circle())
            {
                circle.Center     = ip;
                circle.Radius     = radius;
                circle.ColorIndex = index;
                circle.Layer      = kontrollLayer;
                btr.AppendEntity(circle);
                _c.trans.AddNewlyCreatedDBObject(circle, true);
            }
        }
Exemplo n.º 5
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);
            }
        }
Exemplo n.º 6
0
        private List <_Ge.Point3d> getCirclePoints(_Db.Circle circle)
        {
            List <_Ge.Point3d> points = new List <_Ge.Point3d>();

            _Ge.Point3d center = circle.Center;
            double      r      = circle.Radius;

            _Ge.Point3d a = new _Ge.Point3d(center.X + r, center.Y, 0);
            _Ge.Point3d b = new _Ge.Point3d(center.X - r, center.Y, 0);
            _Ge.Point3d c = new _Ge.Point3d(center.X, center.Y + r, 0);
            _Ge.Point3d d = new _Ge.Point3d(center.X, center.Y - r, 0);

            points.Add(center);
            points.Add(a);
            points.Add(b);
            points.Add(c);
            points.Add(d);

            return(points);
        }
Exemplo n.º 7
0
        private List <_Ge.Point3d> handle(_Db.Entity ent)
        {
            List <_Ge.Point3d> points = new List <_Ge.Point3d>();

            if (ent == null)
            {
                return(points);
            }


            if (ent is _Db.Curve && !(ent is _Db.Polyline || ent is _Db.Polyline2d || ent is _Db.Polyline3d))
            {
                try
                {
                    _Db.Curve cur = ent as _Db.Curve;

                    int segs = 3; //(ent is Line ? 3 : 20);

                    double param = cur.EndParam - cur.StartParam;

                    for (int i = 0; i < segs; i++)
                    {
                        try
                        {
                            _Ge.Point3d pt = cur.GetPointAtParameter(cur.StartParam + (i * param / (segs - 1)));
                            points.Add(pt);
                        }
                        catch { }
                    }
                }
                catch { }
            }
            else
            {
                _Db.DBObjectCollection objectCollection = new _Db.DBObjectCollection();
                try
                {
                    ent.Explode(objectCollection);
                    if (objectCollection.Count > 0)
                    {
                        foreach (_Db.DBObject bid in objectCollection)
                        {
                            _Db.Entity ent2 = bid as _Db.Entity;
                            if (ent2 != null && ent2.Visible)
                            {
                                List <_Ge.Point3d> currentPoints = handle(ent2);
                                points.AddRange(currentPoints);
                            }
                            bid.Dispose();
                        }
                    }
                }
                catch { }
            }

            if (ent is _Db.Circle)
            {
                _Db.Circle         circle       = ent as _Db.Circle;
                List <_Ge.Point3d> circlePoints = getCirclePoints(circle);
                points.AddRange(circlePoints);
            }
            else if (ent is _Db.Arc)
            {
                _Db.Arc            arc       = ent as _Db.Arc;
                List <_Ge.Point3d> arcPoints = getArcPoints(arc);
                points.AddRange(arcPoints);
            }

            return(points);
        }