示例#1
0
        public void resetPoint()
        {
            if (PSList != null)
            {
                PSList.Clear();
            }

            Resolution = -1;
            PointSet ps = PreProcess.getPointFromText(tcSetting.Scale);

            addPS(ps);
        }
示例#2
0
        public List <Point3d> getInnerBo(ObjectId[] ids)
        {
            if (mydb.InnerBoPL == null || mydb.InnerBoPL.Count == 0)
            {
                Point3d?p = getInnerBoPoint();
                if (p == null)
                {
                    return(null);
                }
                if (mydb.InnerBoPL == null)
                {
                    mydb.InnerBoPL = new List <Point>();
                }
                mydb.InnerBoPL.Add(new Point(p.Value.X, p.Value.Y, p.Value.Z));
            }
            List <Point3d> lp = PreProcess.getOuterBoundaryFromLine(ids, MyConvert.toPoint3d(mydb.InnerBoPL[0]));

            return(lp);
        }
示例#3
0
        public void tri2()
        {
            Editor   ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
            PointSet ps = PreProcess.getPointFromText(mydb.tcSetting.Scale);

            ObjectId[] ids = PreProcess.getAllLines();

            List <Constraint> boundary = new List <Constraint>();

            //int plCount = 0;
            ObjectId[] objectIDs3 = CommandLineQuerries.GetObjectIDs(CommandLineQuerries.EntityType.PLINES, "Select boundaries (polylines)", false);
            if (objectIDs3 != null)
            {
                string text3 = " boundary";
                if (objectIDs3.Length > 1)
                {
                    text3 += "s";
                }
                //editor.WriteMessage(objectIDs3.Length + text3 + " selected.");
                //plCount = this.getPolylineCount(objectIDs3);
                List <Edge> list4 = Conversions.ToCeometricEdgeList(objectIDs3);
                for (int j = 0; j < list4.Count; j++)
                {
                    boundary.Add(new Constraint(list4[j], Constraint.ConstraintType.Boundary));
                }
            }
            else
            {
                //editor.WriteMessage("No boundaries selected.\n");
            }


            Triangulate tri = new Triangulate();

            //tri.TriangulateInternal(ps, new List<Constraint>(), new List<Constraint>());
            tri.TriangulateInternal(ps, new List <Constraint>(), boundary, null);
        }
示例#4
0
 public void resetLine()
 {
     mydb.LineIds = PreProcess.getAllLines();
 }
示例#5
0
        public void tri()
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            try
            {
                ObjectId   boundaryLayerId = LayerUtil.CreateLayer(boundaryLayerName, 127, false);
                PointSet   ps       = mydb.getAllPoint();
                ObjectId[] ids      = mydb.LineIds;
                ObjectId[] bidArray = Selection.getBoundarys();

                List <ObjectId> boundaryIds = null;
                if (bidArray == null || bidArray.Length <= 0)
                {
                    boundaryIds = new List <ObjectId>();
                }
                else
                {
                    boundaryIds = bidArray.ToList();
                }

                if (boundaryIds.Count <= 0)
                {
                    List <Point3d> pl = PreProcess.getOuterBoundaryFromLine(ids, null);
                    //List<ObjectId> plineIds = new List<ObjectId>();

                    ObjectId?plineId = MyDBUtility.addPolyline3d(pl, boundaryLayerId, true);

                    if (plineId != null)
                    {
                        boundaryIds.Add(plineId.Value);
                    }
                    List <Edge> el = MyConvert.ToEdgeList(pl);
                    if (el == null)
                    {
                        ed.WriteMessage("\nel==null");
                    }

                    for (int i = 0; i < el.Count; i++)
                    {
                        //boundary.Add(new Constraint(el[i], Constraint.ConstraintType.Boundary));
                    }
                    List <Point3d> pl2      = this.getInnerBo(ids);
                    ObjectId?      plineId2 = MyDBUtility.addPolyline3d(pl2, boundaryLayerId, true);
                    if (plineId2 != null)
                    {
                        boundaryIds.Add(plineId2.Value);
                    }
                    List <Edge> el2 = MyConvert.ToEdgeList(pl);
                    if (el2 == null)
                    {
                        ed.WriteMessage("\nel2==null");
                    }
                    else
                    {
                        for (int i = 0; i < el2.Count; i++)
                        {
                            //boundary.Add(new Constraint(el2[i], Constraint.ConstraintType.Boundary));
                        }
                    }
                }
                else
                {
                }
                List <Constraint> boundary = new List <Constraint>();
                List <Edge>       list4    = Conversions.ToCeometricEdgeList(boundaryIds.ToArray());
                for (int j = 0; j < list4.Count; j++)
                {
                    boundary.Add(new Constraint(list4[j], Constraint.ConstraintType.Boundary));
                }

                Triangulate tri = new Triangulate();
                //tri.TriangulateInternal(ps, new List<Constraint>(), new List<Constraint>());
                LayerUtil.setLayerProp(mydb.getFaceLayerName(), false);
                List <Triangle> tris = tri.TriangulateInternal(ps, new List <Constraint>(), boundary, mydb.getFaceLayerName());
                mydb.setTris(tris);
            }
            catch (System.Exception ex)
            {
                ed.WriteMessage("UserCmd 144 " + ex.Message);
            }
        }