C3D-0053 · READ-ONLY: ParcelSegments on C-PROP-LINE, guarded reads [PSEG-CPROP-2] rejected
Previous run died with eNotApplicable on a style read. Every property read is individually guarded. Lists each C-PROP-LINE parcel segment with endpoints, length, style and description, plus every parcel with its site, layer, style and area. No changes.
C# payload
// READ-ONLY. The ParcelSegments on C-PROP-LINE revert when their layer is changed - the layer is
// driven by the parcel style, not the entity.
//
// Last run died with eNotApplicable on a style read (StyleName/StyleId on a segment whose parent
// does not support it). Every property read here is individually guarded so one bad member cannot
// kill the run. Nothing is modified.
var civil = CivilApplication.ActiveDocument;
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("=== ParcelSegments on C-PROP-LINE ===");
int n = 0;
foreach (ObjectId id in ms) {
ParcelSegment ps = null;
try { ps = Tx.GetObject(id, OpenMode.ForRead) as ParcelSegment; } catch { continue; }
if (ps == null) continue;
string lay = safe(() => ps.Layer);
if (lay != "C-PROP-LINE") continue;
n++;
Log("");
Log("SEGMENT [" + ps.Handle + "] layer=" + lay);
Log(" start/end " + safe(() => String.Format("{0:F2},{1:F2} -> {2:F2},{3:F2}",
ps.StartPoint.X, ps.StartPoint.Y, ps.EndPoint.X, ps.EndPoint.Y)));
Log(" length " + safe(() => {
var c = ps.BaseCurve;
return c.GetDistanceAtParameter(c.EndParam).ToString("F2");
}));
Log(" style " + safe(() => ps.StyleName));
Log(" desc " + safe(() => ps.Description));
}
Log("");
Log("C-PROP-LINE segments found: " + n);
Log("");
Log("=== every parcel: site, layer, style, area ===");
foreach (ObjectId sid in civil.GetSiteIds()) {
var site = (Site)Tx.GetObject(sid, OpenMode.ForRead);
foreach (ObjectId pid in site.GetParcelIds()) {
var p = (Parcel)Tx.GetObject(pid, OpenMode.ForRead);
Log(" site \"" + safe(() => site.Name) + "\" parcel \"" + safe(() => p.Name)
+ "\" [" + p.ObjectId.Handle + "] layer=" + safe(() => p.Layer)
+ " style=" + safe(() => p.StyleName)
+ " area=" + safe(() => p.Area.ToString("F2")));
}
}
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.