Beispiel #1
0
        private PointSet method_5(Autodesk.AutoCAD.DatabaseServices.Arc arc_0, double double_1)
        {
            PointSet result;

            try
            {
                PointSet pointSet            = new PointSet();
                double   arg_0D_0            = arc_0.StartParam;
                double   endParam            = arc_0.EndParam;
                double   distanceAtParameter = arc_0.GetDistanceAtParameter(endParam);
                if (double_1 > 0.0 && double_1 < distanceAtParameter)
                {
                    int    num  = (int)Math.Max(Math.Ceiling(distanceAtParameter / double_1), 4.0);
                    double num2 = distanceAtParameter / (double)num;
                    if (!arc_0.Closed)
                    {
                        num++;
                    }
                    for (int i = 0; i < num; i++)
                    {
                        pointSet.Add(Conversions.ToCeometricPoint(arc_0.GetPointAtDist((double)i * num2)));
                    }
                }
                else if (arc_0.Closed)
                {
                    pointSet.Add(Conversions.ToCeometricPoint(arc_0.Center));
                }
                else
                {
                    pointSet.Add(Conversions.ToCeometricPoint(arc_0.StartPoint));
                    pointSet.Add(Conversions.ToCeometricPoint(arc_0.EndPoint));
                }
                result = pointSet;
            }
            catch (System.Exception ex)
            {
                Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("Can not subdivide arc (handle: " + arc_0.Handle.ToString() + ")\n");
                result = null;
            }
            return(result);
        }
Beispiel #2
0
        private PointSet method_1(ObjectId[] objectId_0, double double_1)
        {
            if (objectId_0 == null)
            {
                return(null);
            }
            Editor        arg_14_0        = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
            Database      workingDatabase = HostApplicationServices.WorkingDatabase;
            PointSet      pointSet        = new PointSet();
            PointSet      pointSet2       = new PointSet();
            ProgressMeter progressMeter   = new ProgressMeter();

            progressMeter.SetLimit(objectId_0.Length);
            progressMeter.Start("Computing points on entities");
            try
            {
                using (Transaction transaction = workingDatabase.TransactionManager.StartTransaction())
                {
                    for (int i = 0; i < objectId_0.Length; i++)
                    {
                        progressMeter.MeterProgress();
                        if (i % 10000 == 0)
                        {
                            System.Windows.Forms.Application.DoEvents();
                        }
                        Entity entity = (Entity)objectId_0[i].GetObject((OpenMode)0);
                        string text   = entity.ToString();
                        if (text.ToUpper().Contains("POLYLINE"))
                        {
                            text = "PLINE";
                        }
                        string key;
                        switch (key = text)
                        {
                        case "Autodesk.AutoCAD.DatabaseServices.Line":
                        {
                            Autodesk.AutoCAD.DatabaseServices.Line dbl = (Autodesk.AutoCAD.DatabaseServices.Line)transaction.GetObject(objectId_0[i], (OpenMode)0, true);
                            pointSet2 = PointGeneration.SubdivideLine(dbl, double_1);
                            break;
                        }

                        case "Autodesk.AutoCAD.DatabaseServices.DBText":
                        {
                            DBText dbtext_ = (DBText)transaction.GetObject(objectId_0[i], (OpenMode)0, true);
                            pointSet2 = this.method_2(dbtext_);
                            break;
                        }

                        case "Autodesk.AutoCAD.DatabaseServices.Circle":
                        {
                            Autodesk.AutoCAD.DatabaseServices.Circle circle_ = (Autodesk.AutoCAD.DatabaseServices.Circle)transaction.GetObject(objectId_0[i], (OpenMode)0, true);
                            pointSet2 = this.method_3(circle_, double_1);
                            break;
                        }

                        case "Autodesk.AutoCAD.DatabaseServices.Ellipse":
                        {
                            Autodesk.AutoCAD.DatabaseServices.Ellipse ellipse_ = (Autodesk.AutoCAD.DatabaseServices.Ellipse)transaction.GetObject(objectId_0[i], (OpenMode)0, true);
                            pointSet2 = this.method_4(ellipse_, double_1);
                            break;
                        }

                        case "Autodesk.AutoCAD.DatabaseServices.Arc":
                        {
                            Autodesk.AutoCAD.DatabaseServices.Arc arc_ = (Autodesk.AutoCAD.DatabaseServices.Arc)transaction.GetObject(objectId_0[i], (OpenMode)0, true);
                            pointSet2 = this.method_5(arc_, double_1);
                            break;
                        }

                        case "Autodesk.AutoCAD.DatabaseServices.Spline":
                        {
                            Spline spline_ = (Spline)transaction.GetObject(objectId_0[i], (OpenMode)0, true);
                            pointSet2 = this.method_6(spline_, double_1);
                            break;
                        }

                        case "Autodesk.AutoCAD.DatabaseServices.Face":
                        {
                            Face face_ = (Face)transaction.GetObject(objectId_0[i], (OpenMode)0, true);
                            pointSet2 = this.method_7(face_);
                            break;
                        }

                        case "PLINE":
                        {
                            DBObject @object = transaction.GetObject(objectId_0[i], (OpenMode)0);
                            pointSet2 = PointGeneration.SubdividePolyline(@object, transaction, double_1);
                            break;
                        }
                        }
                        if (pointSet2 != null)
                        {
                            pointSet.Add(pointSet2);
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                progressMeter.Stop();
                throw;
            }
            progressMeter.Stop();
            if (pointSet.Count == 0)
            {
                return(null);
            }
            pointSet.RemoveMultiplePoints3d();
            return(pointSet);
        }