C3D-0091 · Delete the empty CURVE DELTA OFF style [RM-CURVE-STYLE] done
Removes the hollow CURVE DELTA OFF parcel curve label style that never received the ARC/CHD/RAD format, so the user can copy the real style in Toolspace onto a clean slate. Targeted by exact name, aborts if any label references it, and verifies removal.
C# payload
// Delete the empty "CURVE DELTA OFF" parcel curve label style I created.
//
// It never got the ARC/CHD/RAD format - it carries Standard's "L=..., R=..." and has no Delta
// component - so it is a broken shell. The user will copy the real style in Toolspace instead.
//
// Targeted by EXACT name in the ParcelLabelStyles.CurveLabelStyles collection only. The style is
// checked to be unreferenced before erasing: if any label in the drawing uses it, ABORT.
const string DST = "CURVE DELTA OFF";
var civil = CivilApplication.ActiveDocument;
Log("drawing: " + Db.Filename);
ObjectId dstId = ObjectId.Null;
foreach (ObjectId sid in civil.Styles.LabelStyles.ParcelLabelStyles.CurveLabelStyles) {
var s = Tx.GetObject(sid, OpenMode.ForRead) as Autodesk.Civil.DatabaseServices.Styles.LabelStyle;
if (s != null && s.Name == DST) { dstId = sid; break; }
}
if (dstId.IsNull) { Log("\"" + DST + "\" not present - nothing to do"); return; }
// is anything using it?
int users = 0;
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForRead);
foreach (ObjectId id in ms) {
var lbl = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.Civil.DatabaseServices.Label;
if (lbl == null) continue;
try { if (lbl.StyleId == dstId) users++; } catch { }
}
if (users > 0) { Log("ABORT: " + users + " label(s) use this style - not deleting"); return; }
var w = Tx.GetObject(dstId, OpenMode.ForWrite);
w.Erase();
Log("erased \"" + DST + "\" (0 labels were using it)");
// verify it is gone
bool still = false;
foreach (ObjectId sid in civil.Styles.LabelStyles.ParcelLabelStyles.CurveLabelStyles) {
var s = Tx.GetObject(sid, OpenMode.ForRead) as Autodesk.Civil.DatabaseServices.Styles.LabelStyle;
if (s != null && !s.IsErased && s.Name == DST) still = true;
}
Log("remaining parcel curve styles:");
foreach (ObjectId sid in civil.Styles.LabelStyles.ParcelLabelStyles.CurveLabelStyles) {
var s = Tx.GetObject(sid, OpenMode.ForRead) as Autodesk.Civil.DatabaseServices.Styles.LabelStyle;
if (s != null && !s.IsErased) Log(" " + s.Name);
}
Log("\"" + DST + "\" still present: " + still + " (verified)");
Ed.Regen();
Result
Log
drawing: C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\260612 - CSTORE WATER ABS 30.dwg erased "CURVE DELTA OFF" (0 labels were using it) remaining parcel curve styles: Delta over Length and Radius Standard "CURVE DELTA OFF" still present: False (verified)
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.