public static void DeleteEntitiesByLabel(IHeadsDocument doc, string strLabel, bool bCompaireAll) { IHdEntity[] entitis = doc.Entities; foreach (IHdEntity ent in entitis) { bool bDel = false; if (bCompaireAll) { if (ent.Label == strLabel) { bDel = true; } } else { if (ent.Label.StartsWith(strLabel)) { bDel = true; } } if (bDel) { ent.Delete(); } } }
public static IHdPolyline3D DrawRect(IHeadsDocument doc, CPoint3D ptBottomLeft, CPoint3D ptTopRight) { CPoint3D ptTopLeft = new CPoint3D(); ptTopLeft.X = ptBottomLeft.X; ptTopLeft.Y = ptTopRight.Y; ptTopLeft.Z = ptTopRight.Z; CPoint3D ptBottomRight = new CPoint3D(); ptBottomRight.X = ptTopRight.X; ptBottomRight.Y = ptBottomLeft.Y; ptBottomRight.Z = ptBottomLeft.Z; List <CPoint3D> listpt = new List <CPoint3D>(); listpt.Add(ptBottomLeft); listpt.Add(ptTopLeft); listpt.Add(ptTopRight); listpt.Add(ptBottomRight); IHdPolyline3D polyrect = doc.DrawPolyline3D(listpt); polyrect.Closed = true; return(polyrect); }
public static IHdArc DrawArc(IHeadsDocument doc, double xs, double ys, double xe, double ye, double xc, double yc, double rad) { IHdArc hdarc = null; double PI = Math.Atan(1.0) * 4.0; double th1 = 0; double th2 = 0; double h = 0; double l = 0; if (xs > xe) { h = ys - yc; l = Math.Abs(xs - xc); th1 = Math.Atan(h / l); if (l == 0) { return(hdarc); } th1 = th1 * (180 / PI); l = Math.Abs(xc - xe); th2 = Math.Atan(h / l); th2 = th2 * (180 / PI); th2 = 180 - th2; } else if (xs <= xe) // turn = 1 left // = added to exclude everything { h = yc - ys; l = Math.Abs(xc - xs); if (l == 0) { return(hdarc); } th1 = Math.Atan(h / l); th1 = th1 * (180 / PI); th1 = 180 + th1; l = Math.Abs(xe - xc); if (l == 0) { return(hdarc); } th2 = Math.Atan(h / l); th2 = th2 * (180 / PI); th2 = 360 - th2; } th1 = th1 * PI / 180; th2 = th2 * PI / 180; hdarc = doc.DrawArc(new CPoint3D(xc, yc, 0), rad, th1, th2); return(hdarc); }
public static IHdPolyline3D DrawPolyline3DDx(IHeadsDocument doc, bool bEngFunc, CLinetype linetype) { List <CPoint3D> ptList = new List <CPoint3D>(); ptList.Add(linetype.StartPoint); ptList.Add(linetype.EndPoint); IHdPolyline3D polyline = doc.DrawPolyline3D(ptList); DrawingUtil.SetLayerToEntity(bEngFunc, polyline, doc, linetype.Layer); polyline.Lineweight = eHEADS_LWEIGHT.LnWt000; polyline.Label = linetype.Label; return(polyline); }
private static void SetLayerToEntity(bool bEngFunc, IHdEntity hdEntity, IHeadsDocument doc, string strLayerName) { if (bEngFunc) { hdEntity.SetLayer(doc.GetActiveLayer()); } else { if (strLayerName.Trim() != string.Empty) { IHdLayer hdlayer = doc.AddLayer(strLayerName); hdEntity.SetLayer(hdlayer); } } }