コード例 #1
0
ファイル: MyDB2.cs プロジェクト: 1833183060/autocad-dev
 public void decreaseResolution()
 {
     if (Resolution < 0)
     {
         Resolution = 0;
     }
     LayerUtil.setLayerProp(getFaceLayerName(), true);
     Resolution--;
     LayerUtil.setLayerProp(getFaceLayerName(), false);
 }
コード例 #2
0
ファイル: UserCmd.cs プロジェクト: 1833183060/autocad-dev
        public void increasePoint()
        {
            LayerUtil.setLayerProp(mydb.getFaceLayerName(), true);
            mydb.increaseResolution();
            if (LayerUtil.hasName(mydb.getFaceLayerName()))
            {
            }
            else
            {
                tri();
            }

            LayerUtil.setLayerProp(mydb.getFaceLayerName(), false);
        }
コード例 #3
0
ファイル: UserCmd.cs プロジェクト: 1833183060/autocad-dev
 public void decreasePoint()
 {
     LayerUtil.setLayerProp(mydb.getFaceLayerName(), true);
     mydb.decreaseResolution();
     LayerUtil.setLayerProp(mydb.getFaceLayerName(), false);
 }
コード例 #4
0
ファイル: UserCmd.cs プロジェクト: 1833183060/autocad-dev
        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);
            }
        }