C3D-0063 · Move the 20 CL points to SS-ROAD-CL [MOVE-CL-PTS] done
Moves CogoPoints with the exact description CL from layer 0 to SS-ROAD-CL, the layer already holding the centerline linework. CL YELLOW LINE SPLITS is striping and is not moved. Idempotent, reads back to verify.
C# payload
// Move the CL points to SS-ROAD-CL.
//
// Target chosen from what the drawing already does (C3D-0061): SS-ROAD-CL holds the 4 centerline
// linework entities; SS-V-ROAD-CNTR is empty. Not guessed between the two.
//
// EXACT description match on "CL" only - 20 points. "CL YELLOW LINE SPLITS" (pt 494) is striping,
// not centerline, and is deliberately NOT moved. Idempotent: a point already on the target is
// skipped. Reads back to verify.
const string TARGET = "SS-ROAD-CL";
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForRead);
var lt = (LayerTable)Tx.GetObject(Db.LayerTableId, OpenMode.ForRead);
if (!lt.Has(TARGET)) { Log("ABORT: " + TARGET + " missing"); return; }
int moved = 0, skipped = 0;
foreach (ObjectId id in ms) {
var cp0 = Tx.GetObject(id, OpenMode.ForRead) as CogoPoint;
if (cp0 == null) continue;
if ((cp0.RawDescription ?? "").Trim().ToUpper() != "CL") continue;
if (cp0.Layer == TARGET) { skipped++; continue; }
var cp = (CogoPoint)Tx.GetObject(id, OpenMode.ForWrite);
string was = cp.Layer;
cp.Layer = TARGET;
moved++;
Log(String.Format(" pt {0,-6} CL {1} -> {2}", cp.PointNumber, was, TARGET));
}
Log("");
Log("moved " + moved + ", already correct " + skipped);
int v = 0;
foreach (ObjectId id in ms) {
var cp = Tx.GetObject(id, OpenMode.ForRead) as CogoPoint;
if (cp != null && cp.Layer == TARGET) v++;
}
Log(TARGET + " now holds " + v + " CogoPoints (verified)");
Ed.Regen();
Result
Log
pt 132 CL 0 -> SS-ROAD-CL pt 139 CL 0 -> SS-ROAD-CL pt 145 CL 0 -> SS-ROAD-CL pt 154 CL 0 -> SS-ROAD-CL pt 158 CL 0 -> SS-ROAD-CL pt 164 CL 0 -> SS-ROAD-CL pt 172 CL 0 -> SS-ROAD-CL pt 476 CL 0 -> SS-ROAD-CL pt 482 CL 0 -> SS-ROAD-CL pt 483 CL 0 -> SS-ROAD-CL pt 519 CL 0 -> SS-ROAD-CL pt 527 CL 0 -> SS-ROAD-CL pt 1005 CL 0 -> SS-ROAD-CL pt 1012 CL 0 -> SS-ROAD-CL pt 1017 CL 0 -> SS-ROAD-CL pt 1024 CL 0 -> SS-ROAD-CL pt 1029 CL 0 -> SS-ROAD-CL pt 1036 CL 0 -> SS-ROAD-CL pt 1039 CL 0 -> SS-ROAD-CL pt 1045 CL 0 -> SS-ROAD-CL moved 20, already correct 0 SS-ROAD-CL now holds 20 CogoPoints (verified)
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.