← Inbox

C3D-0065 · Put the 20 CL points back on layer 0 [CL-BACK-TO-0] done

Moves the CogoPoints with description CL from SS-ROAD-CL back to layer 0, leaving the centerline linework on SS-ROAD-CL untouched. Idempotent, verifies both the point layers and that the linework is still there.

Script file
C3D-0065.cs
Target
260612 · model space
Author
claude
Approved
yes · reviewer
Timeout
180s

C# payload

// Put the CL points back on layer 0. The linework stays on SS-ROAD-CL - only the points move.
// Exact description match on "CL" (20 points, confirmed C3D-0064). Idempotent; reads back to verify.
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForRead);

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 == "0") { skipped++; continue; }

    var cp = (CogoPoint)Tx.GetObject(id, OpenMode.ForWrite);
    string was = cp.Layer;
    cp.Layer = "0";
    moved++;
    Log(String.Format("  pt {0,-6} CL   {1} -> 0", cp.PointNumber, was));
}

Log("");
Log("moved " + moved + " back to 0, already on 0: " + skipped);

int on0 = 0, onCl = 0, lines = 0;
foreach (ObjectId id in ms) {
    var o = Tx.GetObject(id, OpenMode.ForRead);
    var cp = o as CogoPoint;
    if (cp != null && (cp.RawDescription ?? "").Trim().ToUpper() == "CL") {
        if (cp.Layer == "0") on0++; else onCl++;
        continue;
    }
    var ent = o as Autodesk.AutoCAD.DatabaseServices.Entity;
    if (ent != null && ent.Layer == "SS-ROAD-CL") lines++;
}
Log("CL points on 0: " + on0 + ", elsewhere: " + onCl + "   SS-ROAD-CL linework intact: " + lines + " (verified)");
Ed.Regen();

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\260612 - CSTORE WATER ABS 30.dwg
Message
Executed C3D-0065 (0 entities touched).
Entities
Duration
786 ms
Civil 3D
25.0.0.0

Log

  pt 132    CL   SS-ROAD-CL -> 0
  pt 139    CL   SS-ROAD-CL -> 0
  pt 145    CL   SS-ROAD-CL -> 0
  pt 154    CL   SS-ROAD-CL -> 0
  pt 158    CL   SS-ROAD-CL -> 0
  pt 164    CL   SS-ROAD-CL -> 0
  pt 172    CL   SS-ROAD-CL -> 0
  pt 476    CL   SS-ROAD-CL -> 0
  pt 482    CL   SS-ROAD-CL -> 0
  pt 483    CL   SS-ROAD-CL -> 0
  pt 519    CL   SS-ROAD-CL -> 0
  pt 527    CL   SS-ROAD-CL -> 0
  pt 1005   CL   SS-ROAD-CL -> 0
  pt 1012   CL   SS-ROAD-CL -> 0
  pt 1017   CL   SS-ROAD-CL -> 0
  pt 1024   CL   SS-ROAD-CL -> 0
  pt 1029   CL   SS-ROAD-CL -> 0
  pt 1036   CL   SS-ROAD-CL -> 0
  pt 1039   CL   SS-ROAD-CL -> 0
  pt 1045   CL   SS-ROAD-CL -> 0

moved 20 back to 0, already on 0: 0
CL points on 0: 20, elsewhere: 0   SS-ROAD-CL linework intact: 4 (verified)

Notes

What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.

No notes yet.