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); }
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); } }