예제 #1
0
        private List <_Ge.Point3d> getArcPoints(_Db.Arc arc)
        {
            List <_Ge.Point3d> points = new List <_Ge.Point3d>();

            _Ge.Point3d center = arc.Center;

            points.Add(center);

            return(points);
        }
예제 #2
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);
        }