C3D-0087 · Create curve label style CURVE DELTA OFF in CSTORE [MK-CURVE-STYLE2] error
Copies Delta over Length and Radius to a new parcel curve label style CURVE DELTA OFF with the Delta component invisible, in the 260612 CSTORE drawing. Contains no erase - if the style exists it is edited in place. Logs the drawing filename and reads the style back to verify.
C# payload
// Create parcel curve label style "CURVE DELTA OFF" in the CSTORE drawing.
//
// Copy of "Delta over Length and Radius", which emits the ARC/CHD/bearing/RAD format, with the
// Delta text component set invisible.
//
// NO ERASE ANYWHERE IN THIS SCRIPT. If the style already exists it is opened and edited in place.
// Nothing is ever deleted.
const string SRC = "Delta over Length and Radius";
const string DST = "CURVE DELTA OFF";
var civil = CivilApplication.ActiveDocument;
var curves = civil.Styles.LabelStyles.ParcelLabelStyles.CurveLabelStyles;
Log("drawing: " + Db.Filename);
ObjectId srcId = ObjectId.Null, dstId = ObjectId.Null;
foreach (ObjectId sid in curves) {
var s = Tx.GetObject(sid, OpenMode.ForRead) as Autodesk.Civil.DatabaseServices.Styles.LabelStyle;
if (s == null) continue;
if (s.Name == SRC) srcId = sid;
if (s.Name == DST) dstId = sid;
}
if (srcId.IsNull) { Log("ABORT: source style \"" + SRC + "\" not found"); return; }
if (dstId.IsNull) {
dstId = curves.Add(DST);
Log("created \"" + DST + "\"");
} else {
Log("\"" + DST + "\" already exists - editing in place, nothing erased");
}
var dst = (Autodesk.Civil.DatabaseServices.Styles.LabelStyle)Tx.GetObject(dstId, OpenMode.ForWrite);
dst.CopyFrom(Tx.GetObject(srcId, OpenMode.ForRead));
dst.Name = DST;
foreach (ObjectId cid in dst.GetComponents(Autodesk.Civil.DatabaseServices.Styles.LabelStyleComponentType.Text)) {
var c = Tx.GetObject(cid, OpenMode.ForWrite) as Autodesk.Civil.DatabaseServices.Styles.LabelStyleTextComponent;
if (c == null) continue;
if (c.Name == "Delta") c.General.Visible.Value = false;
}
// verify from the collection
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) continue;
Log("VERIFY \"" + s.Name + "\":");
foreach (ObjectId cid in s.GetComponents(Autodesk.Civil.DatabaseServices.Styles.LabelStyleComponentType.Text)) {
var c = Tx.GetObject(cid, OpenMode.ForRead) as Autodesk.Civil.DatabaseServices.Styles.LabelStyleTextComponent;
if (c == null) continue;
bool v = true; try { v = c.General.Visible.Value; } catch { }
Log(" \"" + c.Name + "\" visible=" + v);
}
}
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 created "CURVE DELTA OFF"
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.