コード例 #1
0
ファイル: PolyService.cs プロジェクト: YB9527/CADDevelop
        public Polyline Poly3dToPolyLine(Polyline3d poly3d)
        {
            Point3dCollection point3dCollection = new Point3dCollection();

            poly3d.GetStretchPoints(point3dCollection);
            Point2dCollection pc = this.Point3dCollectionTo2d(point3dCollection);

            return(this.Poly2dTiPolyline(pc, 0.0));
        }
コード例 #2
0
ファイル: NFService.cs プロジェクト: YB9527/CADDevelop
        public string getWindowText(Point3d pt1, Point3d pt2)
        {
            Editor editor = Application.DocumentManager.MdiActiveDocument.Editor;

            TypedValue[] array = new TypedValue[]
            {
                new TypedValue(0, "TEXT")
            };
            SelectionFilter   selectionFilter   = new SelectionFilter(array);
            Point3dCollection point3dCollection = new Point3dCollection();
            Point3d           point3d           = new Point3d(pt2.X, pt1.Y, 0.0);
            Point3d           point3d2          = new Point3d(pt1.X, pt2.Y, 0.0);

            point3dCollection.Add(pt1);
            point3dCollection.Add(point3d2);
            point3dCollection.Add(pt2);
            point3dCollection.Add(point3d);
            Polyline3d        polyline3d         = this.CreatePolye(point3dCollection);
            double            area               = polyline3d.Area;
            Point3dCollection point3dCollection2 = new Point3dCollection();

            polyline3d.GetStretchPoints(point3dCollection2);
            PromptSelectionResult ents             = editor.SelectCrossingPolygon(point3dCollection2);
            DBObjectCollection    entityCollection = this.GetEntityCollection(ents);
            string text = "";

            foreach (Entity entity in entityCollection)
            {
                if (entity is DBText)
                {
                    DBText dBText = entity as DBText;
                    if (dBText != null)
                    {
                        if (!dBText.TextString.Equals(""))
                        {
                        }
                        text += dBText.TextString;
                    }
                }
            }
            return(text);
        }
コード例 #3
0
ファイル: NFService.cs プロジェクト: YB9527/CADDevelop
        public ArrayList readDWGNfTable()
        {
            ArrayList arrayList  = new ArrayList();
            Editor    editor     = Application.DocumentManager.MdiActiveDocument.Editor;
            Utils     utils      = new Utils();
            string    textString = utils.getTextEntity("请选择房产平面图单个图框标题文字").TextString;
            ArrayList result;

            if (textString == null)
            {
                editor.WriteMessage("你选择的不是单个的文字");
                result = null;
            }
            else
            {
                Point3dCollection point3dCollection = utils.findEntityPoints(textString);
                TypedValue[]      array             = new TypedValue[]
                {
                    new TypedValue(0, "LINE")
                };
                Point3dCollection point3dCollection2 = new Point3dCollection();
                foreach (Point3d point3d in point3dCollection)
                {
                    Point3d           point3d2           = new Point3d(point3d.X + 1.0, point3d.Y, 0.0);
                    Point3d           point3d3           = new Point3d(point3d.X + 1.0, point3d.Y - 5.0, 0.0);
                    Point3d           point3d4           = new Point3d(point3d.X, point3d.Y - 5.0, 0.0);
                    Point3dCollection point3dCollection3 = new Point3dCollection();
                    point3dCollection3.Add(point3d);
                    point3dCollection3.Add(point3d2);
                    point3dCollection3.Add(point3d3);
                    point3dCollection3.Add(point3d4);
                    Polyline3d        polyline3d         = utils.CreatePolye(point3dCollection3, true);
                    Point3dCollection point3dCollection4 = new Point3dCollection();
                    polyline3d.GetStretchPoints(point3dCollection4);
                    PromptSelectionResult ents             = editor.SelectCrossingPolygon(point3dCollection4);
                    DBObjectCollection    entityCollection = this.GetEntityCollection(ents);
                    foreach (Entity entity in entityCollection)
                    {
                        if (entity is Line)
                        {
                            Line line = entity as Line;
                            if (line.StartPoint.X > line.EndPoint.X)
                            {
                                point3dCollection2.Add(line.EndPoint);
                            }
                            else
                            {
                                point3dCollection2.Add(line.StartPoint);
                            }
                        }
                    }
                }
                foreach (Point3d point3d in point3dCollection2)
                {
                    Nf      nf         = new Nf();
                    Point3d point3d5   = new Point3d(point3d.X + 4.54, point3d.Y, 0.0);
                    Point3d pt         = new Point3d(point3d.X + 12.87, point3d.Y - 2.86, 0.0);
                    string  windowText = this.getWindowText(point3d5, pt);
                    nf.setZdnum(windowText);
                    if (windowText == null || "".Equals(windowText))
                    {
                        editor.WriteMessage(string.Concat(new object[]
                        {
                            "点是:(",
                            point3d.X + 4.54,
                            ",",
                            point3d.Y,
                            ")  编码没有填写 "
                        }));
                    }
                    point3d5   = new Point3d(point3d.X + 4.54, point3d.Y - 2.86, 0.0);
                    pt         = new Point3d(point3d.X + 12.87, point3d.Y - 5.72, 0.0);
                    windowText = this.getWindowText(point3d5, pt);
                    nf.setCbfmc(windowText);
                    if (windowText == null || "".Equals(windowText))
                    {
                        editor.WriteMessage("编码是:" + nf.getZdnum() + ", 名字没有填写 ");
                    }
                    point3d5   = new Point3d(point3d.X + 10.72, point3d.Y - 66.55, 0.0);
                    pt         = new Point3d(point3d.X + 42.9, point3d.Y - 68.95, 0.0);
                    windowText = this.getWindowText(point3d5, pt);
                    nf.setCbfdz(windowText);
                    if (windowText == null || "".Equals(windowText))
                    {
                        editor.WriteMessage("编码是:" + nf.getZdnum() + ", 房屋坐落没有填写 ");
                    }
                    point3d5   = new Point3d(point3d.X + 10.72, point3d.Y - 68.95, 0.0);
                    pt         = new Point3d(point3d.X + 21.45, point3d.Y - 71.35, 0.0);
                    windowText = this.getWindowText(point3d5, pt);
                    nf.setCzs(windowText);
                    if (windowText == null || "".Equals(windowText))
                    {
                        editor.WriteMessage("编码是:" + nf.getZdnum() + ", 层数没有填写 ");
                    }
                    point3d5   = new Point3d(point3d.X + 32.17, point3d.Y - 68.95, 0.0);
                    pt         = new Point3d(point3d.X + 42.9, point3d.Y - 71.35, 0.0);
                    windowText = this.getWindowText(point3d5, pt);
                    if (windowText == null || "".Equals(windowText))
                    {
                        editor.WriteMessage("编码是:" + nf.getZdnum() + ", 总面积没有填写 ");
                    }
                    nf.setZmj(windowText);
                    string[] hhmj = new string[3];
                    string[] zmmj = new string[3];
                    string[] qtmj = new string[3];
                    point3d5 = new Point3d(point3d.X, point3d.Y - 71.35, 0.0);
                    pt       = new Point3d(point3d.X + 10.72, point3d.Y - 73.75, 0.0);
                    string windowText2 = this.getWindowText(point3d5, pt);
                    this.setNfCS(nf, point3d5, windowText2, 0, hhmj, zmmj, qtmj);
                    point3d5    = new Point3d(point3d.X + 10.72, point3d.Y - 71.35, 0.0);
                    pt          = new Point3d(point3d.X + 21.45, point3d.Y - 73.75, 0.0);
                    windowText2 = this.getWindowText(point3d5, pt);
                    this.setNfCS(nf, point3d5, windowText2, 1, hhmj, zmmj, qtmj);
                    point3d5    = new Point3d(point3d.X + 21.45, point3d.Y - 71.35, 0.0);
                    pt          = new Point3d(point3d.X + 32.17, point3d.Y - 73.75, 0.0);
                    windowText2 = this.getWindowText(point3d5, pt);
                    this.setNfCS(nf, point3d5, windowText2, 2, hhmj, zmmj, qtmj);
                    string[] sub = new string[3];
                    point3d5    = new Point3d(point3d.X + 32.17, point3d.Y - 71.35, 0.0);
                    pt          = new Point3d(point3d.X + 42.9, point3d.Y - 73.75, 0.0);
                    windowText2 = this.getWindowText(point3d5, pt);
                    this.setSubTotal(nf, point3d5, sub);
                    point3d5 = new Point3d(point3d.X + 50.05, point3d.Y - 76.15, 0.0);
                    pt       = new Point3d(point3d.X + 64.35, point3d.Y - 78.55, 0.0);
                    string windowText3 = this.getWindowText(point3d5, pt);
                    nf.setYear(windowText3);
                    arrayList.Add(nf);
                }
                result = arrayList;
            }
            return(result);
        }