C3D-0079 · READ-ONLY: find the curve label style behind the ARC/CHD/RAD labels [CURVE-STYLE-FIND] error
Identifies the style definition behind the four-line ARC/CHD/bearing/RAD curve labels so it can be recreated in another drawing: reports each curve label type, its style name and parent, and enumerates the parcel and general curve label style collections. No changes.
C# payload
// READ-ONLY. Find WHERE the curve label format lives so it can be recreated in another drawing.
//
// The four-line ARC/CHD/bearing/RAD label is an instance of a Civil label STYLE. What has to be
// captured is the style definition - its name, which style collection owns it, and the settings
// that produce the leader. Find the label, then name the style behind it.
//
// Read one curve label and report: its concrete type, its style name, and the owning collection.
// Nothing is modified.
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForRead);
Func<Func<string>, string> safe = f => { try { return f(); } catch (System.Exception ex) { return "<" + ex.GetType().Name + ">"; } };
Log("=== curve-ish labels in model space ===");
int n = 0;
foreach (ObjectId id in ms) {
var lbl = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.Civil.DatabaseServices.Label;
if (lbl == null) continue;
string tn = lbl.GetType().Name;
// curve labels: ParcelSegmentLabel on an arc, GeneralSegmentLabel, CurveLabel...
if (tn.IndexOf("Segment") < 0 && tn.IndexOf("Curve") < 0) continue;
n++;
if (n > 12) continue;
var ent = (Autodesk.AutoCAD.DatabaseServices.Entity)lbl;
Log("");
Log("[" + lbl.Handle + "] " + tn + " layer=" + safe(() => ent.Layer));
Log(" StyleName " + safe(() => lbl.StyleName));
Log(" StyleId " + safe(() => lbl.StyleId.ToString()));
try {
var par = Tx.GetObject(lbl.FeatureId, OpenMode.ForRead);
Log(" parent " + par.GetType().Name + " [" + par.Handle + "]");
var pseg = par as ParcelSegment;
if (pseg != null) Log(" parent curve? BaseCurve=" + safe(() => pseg.BaseCurve.GetType().Name));
} catch (System.Exception ex) { Log(" parent: " + ex.Message); }
}
Log("");
Log("total segment/curve labels: " + n);
// where the STYLE definitions live
var civil = CivilApplication.ActiveDocument;
Log("");
Log("=== label style collections ===");
try {
var pls = civil.Styles.LabelStyles.ParcelLabelStyles;
Log(" ParcelLabelStyles.LineLabelStyles:");
foreach (ObjectId sid in pls.LineLabelStyles.LabelStyles)
Log(" " + safe(() => ((Autodesk.Civil.DatabaseServices.Styles.StyleBase)Tx.GetObject(sid, OpenMode.ForRead)).Name));
Log(" ParcelLabelStyles.CurveLabelStyles:");
foreach (ObjectId sid in pls.CurveLabelStyles.LabelStyles)
Log(" " + safe(() => ((Autodesk.Civil.DatabaseServices.Styles.StyleBase)Tx.GetObject(sid, OpenMode.ForRead)).Name));
} catch (System.Exception ex) { Log(" parcel label styles: " + ex.Message); }
try {
var gls = civil.Styles.LabelStyles.GeneralLabelStyles;
Log(" GeneralLabelStyles.CurveLabelStyles:");
foreach (ObjectId sid in gls.CurveLabelStyles.LabelStyles)
Log(" " + safe(() => ((Autodesk.Civil.DatabaseServices.Styles.StyleBase)Tx.GetObject(sid, OpenMode.ForRead)).Name));
} catch (System.Exception ex) { Log(" general label styles: " + ex.Message); }
Result
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.