← Inbox

C3D-TBCUNDO · Clear SS-V-ROAD-CURB layer error

Erase everything on layer SS-V-ROAD-CURB so the straight-chord curb polylines can be redrawn as splines through the same TBC points.

Script file
C3D-TBCUNDO.cs
Target
active document · model space
Author
claude
Approved
yes · auto-auth
Timeout
60s

C# payload

// Erase everything on layer SS-V-ROAD-CURB (user confirmed OK to clear entirely) so the straight-chord
// polylines from C3D-TBCDRAW can be redrawn as splines through the same TBC points.
using System;
using System.Collections.Generic;
using Autodesk.AutoCAD.DatabaseServices;

const string LAYER = "SS-V-ROAD-CURB";

var toErase = new List<ObjectId>();
foreach (ObjectId id in ModelSpace)
{
    var ent = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
    if (ent == null) continue;
    if (ent.Layer == LAYER) toErase.Add(id);
}
Log($"Found {toErase.Count} entities on '{LAYER}' to erase.");
int erased = 0;
foreach (var id in toErase)
{
    var ent = Tx.GetObject(id, OpenMode.ForWrite) as Autodesk.AutoCAD.DatabaseServices.Entity;
    ent.Erase();
    erased++;
}
Log($"Erased {erased}.");

Result

Status
error
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260709 - 1512 Bass Rd, Macon, GA 31210, USA\260709 - 1512 Bass Rd.dwg
Message
eNotApplicable
Entities
Duration
373 ms
Civil 3D
25.0.0.0

Log

Found 90 entities on 'SS-V-ROAD-CURB' to erase.

Notes

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

No notes yet.