C3D-260619-PROPTEXT · Diagnose C-PROP-TEXT error
Read-only: state of all PROP layers, what sits on C-PROP-TEXT, and which label styles push their output onto that layer via the style display layer rather than the entity layer.
C# payload
// READ-ONLY: what is going on with C-PROP-TEXT.
// Layer state, what sits on it, and - since Civil 3D labels can be forced onto a layer by their
// STYLE rather than by the entity's own layer - which label styles point at it.
const string L = "C-PROP-TEXT";
var lt = (LayerTable)Tx.GetObject(Db.LayerTableId, OpenMode.ForRead);
Log("--- layers containing PROP ---");
foreach (ObjectId id in lt)
{
var ltr = (LayerTableRecord)Tx.GetObject(id, OpenMode.ForRead);
if (!ltr.Name.ToUpper().Contains("PROP")) continue;
Log(" '" + ltr.Name + "' off=" + ltr.IsOff + " frozen=" + ltr.IsFrozen + " locked=" + ltr.IsLocked +
" plot=" + ltr.IsPlottable + " colour=" + ltr.Color.ColorIndex +
" linetype=" + ((LinetypeTableRecord)Tx.GetObject(ltr.LinetypeObjectId, OpenMode.ForRead)).Name);
}
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForRead);
Log("--- model-space entities on '" + L + "' ---");
int n = 0;
foreach (ObjectId id in ms)
{
var e = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
if (e == null || e.Layer != L) continue;
n++;
string extra = "";
var lbl = e as Autodesk.Civil.DatabaseServices.Label;
if (lbl != null)
{
try {
var pid = lbl.FeatureId;
var pe = pid.IsNull ? null : Tx.GetObject(pid, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
extra = " PARENT=" + (pe == null ? "none" : pe.GetType().Name + " on '" + pe.Layer + "'");
extra += " style='" + lbl.StyleName + "'";
} catch (System.Exception ex) { extra = " (" + ex.Message + ")"; }
}
Log(" " + e.GetType().Name + " h=" + e.Handle + extra);
if (n > 40) { Log(" ..."); break; }
}
if (n == 0) Log(" (nothing on it in model space)");
// which label styles force their output onto C-PROP-TEXT?
Log("--- label styles whose display layer is '" + L + "' ---");
var cdoc = CivilDoc;
int hits = 0;
foreach (ObjectId id in ms)
{
var lbl = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.Civil.DatabaseServices.Label;
if (lbl == null) continue;
try {
var st = Tx.GetObject(lbl.StyleId, OpenMode.ForRead) as Autodesk.Civil.DatabaseServices.Styles.LabelStyle;
if (st == null) continue;
var layerId = st.GetDisplayStyleLabel(Autodesk.Civil.LabelDisplayStyleType.Plan).LayerId;
var ltr = Tx.GetObject(layerId, OpenMode.ForRead) as LayerTableRecord;
if (ltr == null || ltr.Name != L) continue;
hits++;
Log(" " + lbl.GetType().Name + " h=" + lbl.Handle + " style='" + st.Name + "' -> layer '" + ltr.Name + "' (entity layer '" + lbl.Layer + "')");
if (hits > 25) { Log(" ..."); break; }
} catch { }
}
if (hits == 0) Log(" (none)");
Result
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.