public static void UnfreezeAll() { Document doc = Application.DocumentManager.MdiActiveDocument; using (doc.LockDocument()) { Database db = doc.Database; RegAppIsoline(db); using (var t = db.TransactionManager.StartTransaction()) { var bt = db.BlockTableId.GetObject(OpenMode.ForRead) as BlockTable; foreach (var idBtr in bt) { var btr = idBtr.GetObject(OpenMode.ForRead) as BlockTableRecord; List <Line> linesInBtr = new List <Line>(); foreach (var idEnt in btr) { if (idEnt.ObjectClass.Name == "AcDbLine") { var line = idEnt.GetObject(OpenMode.ForRead, false, true) as Line; Isoline isoline = new Isoline(line); // Если это штрих, то удвляем ее, она автоматом построится при overrule if (isoline.IsDash) { line.UpgradeOpen(); line.Erase(); } } } } t.Commit(); } } }
public static void ReverseIsolines() { Document doc = Application.DocumentManager.MdiActiveDocument; using (doc.LockDocument()) { Editor ed = doc.Editor; RegAppIsoline(doc.Database); PromptSelectionResult result = ed.SelectImplied(); if (result.Status == PromptStatus.OK) { var selIds = result.Value.GetObjectIds(); if (selIds.Count() > 0) { using (var t = doc.Database.TransactionManager.StartTransaction()) { foreach (var item in selIds) { if (item.ObjectClass.IsDerivedFrom(Isoline.RxCurve)) { Isoline isoline = new Isoline(item); if (isoline.IsIsoline) { isoline.ReverseIsoline(); } } } t.Commit(); } } } } }
public override void Explode(Entity entity, DBObjectCollection entitySet) { Curve curve = entity as Curve; if (curve != null) { Isoline isoline = new Isoline(curve); if (isoline.IsIsoline) { var lines = isoline.GetLines(curve); foreach (var line in lines) { entitySet.Add(line); } //isoline.Activate(false); fatal Isoline.RemoveXData(entity); } } if (entity is Line) { entitySet.Add((DBObject)entity.Clone()); return; } base.Explode(entity, entitySet); }
/// <summary> /// Превратить все штрихи в отдельные линии /// </summary> public static void FreezeAll() { Document doc = Application.DocumentManager.MdiActiveDocument; using (doc.LockDocument()) { Database db = doc.Database; RegAppIsoline(db); using (var t = db.TransactionManager.StartTransaction()) { var bt = db.BlockTableId.GetObject(OpenMode.ForRead) as BlockTable; foreach (var idBtr in bt) { var btr = idBtr.GetObject(OpenMode.ForRead) as BlockTableRecord; List <Line> linesInBtr = new List <Line>(); foreach (var idEnt in btr) { if (idEnt.ObjectClass.IsDerivedFrom(RxCurve)) { var curve = idEnt.GetObject(OpenMode.ForRead, false, true) as Curve; Isoline isoline = new Isoline(curve); if (isoline.IsIsoline) { var lines = isoline.GetLines(curve); linesInBtr.AddRange(lines); } } } if (linesInBtr.Count > 0) { btr.UpgradeOpen(); foreach (var line in linesInBtr) { // Пометить линию как бергштрих SetDashXData(line); btr.AppendEntity(line); t.AddNewlyCreatedDBObject(line, true); } } } t.Commit(); } } }
public static void ActivateIsolines(bool activate) { Document doc = Application.DocumentManager.MdiActiveDocument; using (doc.LockDocument()) { RegAppIsoline(doc.Database); Editor ed = doc.Editor; PromptSelectionResult result = ed.SelectImplied(); if (result.Status == PromptStatus.OK) { var selIds = result.Value.GetObjectIds(); if (selIds.Count() > 0) { using (var t = doc.Database.TransactionManager.StartTransaction()) { foreach (var item in selIds) { if (item.ObjectClass.IsDerivedFrom(Isoline.RxCurve)) { Isoline isoline = new Isoline(item); // Активация изолинии if (activate) { if (!isoline.IsIsoline) { isoline.Activate(true); } } // Отключение изолинии else { if (isoline.IsIsoline) { isoline.Activate(false); } } } } t.Commit(); } } } } }
public override bool WorldDraw(Drawable drawable, WorldDraw wd) { // draw the base class bool ret = base.WorldDraw(drawable, wd); DB.Curve curve = drawable as DB.Curve; if (curve != null) { Isoline isoline = new Isoline(curve); if (isoline.IsIsoline) { var lines = isoline.GetLines(curve); foreach (var line in lines) { wd.Geometry.Draw(line); } } } // return the base return true; }
public override bool WorldDraw(Drawable drawable, WorldDraw wd) { // draw the base class bool ret = base.WorldDraw(drawable, wd); DB.Curve curve = drawable as DB.Curve; if (curve != null) { Isoline isoline = new Isoline(curve); if (isoline.IsIsoline) { var lines = isoline.GetLines(curve); foreach (var line in lines) { wd.Geometry.Draw(line); } } } // return the base return(true); }
/// <summary> /// Превратить все штрихи в отдельные линии /// </summary> public static void FreezeAll() { Document doc = Application.DocumentManager.MdiActiveDocument; using (doc.LockDocument()) { Database db = doc.Database; RegAppIsoline(db); using (var t = db.TransactionManager.StartTransaction()) { var bt = db.BlockTableId.GetObject(OpenMode.ForRead) as BlockTable; foreach (var idBtr in bt) { var btr = idBtr.GetObject(OpenMode.ForRead) as BlockTableRecord; List<Line> linesInBtr = new List<Line>(); foreach (var idEnt in btr) { if (idEnt.ObjectClass.IsDerivedFrom(RxCurve)) { var curve = idEnt.GetObject(OpenMode.ForRead, false, true) as Curve; Isoline isoline = new Isoline(curve); if (isoline.IsIsoline) { var lines = isoline.GetLines(curve); linesInBtr.AddRange(lines); } } } if (linesInBtr.Count > 0) { btr.UpgradeOpen(); foreach (var line in linesInBtr) { // Пометить линию как бергштрих SetDashXData(line); btr.AppendEntity(line); t.AddNewlyCreatedDBObject(line, true); } } } t.Commit(); } } }
public static void UnfreezeAll() { Document doc = Application.DocumentManager.MdiActiveDocument; using (doc.LockDocument()) { Database db = doc.Database; RegAppIsoline(db); using (var t = db.TransactionManager.StartTransaction()) { var bt = db.BlockTableId.GetObject(OpenMode.ForRead) as BlockTable; foreach (var idBtr in bt) { var btr = idBtr.GetObject(OpenMode.ForRead) as BlockTableRecord; List<Line> linesInBtr = new List<Line>(); foreach (var idEnt in btr) { if (idEnt.ObjectClass.Name == "AcDbLine") { var line = idEnt.GetObject(OpenMode.ForRead, false, true) as Line; Isoline isoline = new Isoline(line); // Если это штрих, то удвляем ее, она автоматом построится при overrule if (isoline.IsDash) { line.UpgradeOpen(); line.Erase(); } } } } t.Commit(); } } }
private static void UnActivateIsolines(object sender, EventArgs e) { Isoline.ActivateIsolines(false); }
private static void ReverseIsolines(object sender, EventArgs e) { Isoline.ReverseIsolines(); }
private static void ActivateIsolines(object sender, EventArgs e) { Isoline.ActivateIsolines(true); }