← Inbox

C3D-TBCUNDO2 · Erase draft Polyline3d curb chords rejected

Erase only the 33 Polyline3d entities on SS-V-ROAD-CURB drawn by C3D-TBCDRAW, leaving pre-existing Lines/Polylines/FeatureLines/Site/Hatch/Wipeout/dimensions on that layer untouched.

Script file
C3D-TBCUNDO2.cs
Target
active document · model space
Author
claude
Approved
no
Timeout
60s

C# payload

// Erase only the 33 Polyline3d entities on SS-V-ROAD-CURB (the straight-chord draft from C3D-TBCDRAW).
// That layer also carries 18 Lines, 15 Polylines, 11 FeatureLines, dimensions, a Hatch, Wipeout, and a
// Civil Site object that are pre-existing production content - leave all of that alone, only remove
// the Polyline3d type since that's exactly what was added.
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) continue;
    if (ent is Polyline3d) toErase.Add(id);
}
Log($"Found {toErase.Count} Polyline3d 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}.");

Notes

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

No notes yet.