← Inbox

C3D-260619-DELMH1 · Delete point group MH.1 error

Erases the duplicate point group MH.1. Group definition only - CogoPoints untouched, verified by count before/after.

Script file
C3D-260619-DELMH1.cs
Target
260619 · model space
Author
claude
Approved
yes · auto-auth
Timeout
60s

C# payload

// Delete the duplicate point group "MH.1". Deleting a PointGroup removes only the group
// definition - the CogoPoints themselves are untouched.
// Host owns Tx; host regens after commit.
const string NAME = "MH.1";
var cdoc = CivilDoc;
Log("CogoPoints before: " + cdoc.CogoPoints.Count);

ObjectId target = ObjectId.Null;
foreach (ObjectId id in cdoc.PointGroups)
{
    var pg = Tx.GetObject(id, OpenMode.ForRead) as PointGroup;
    if (pg != null && pg.Name == NAME) { target = id; break; }
}
if (target.IsNull) { Log("'" + NAME + "' not found."); return; }

var g = (PointGroup)Tx.GetObject(target, OpenMode.ForWrite);
uint[] had; try { had = g.GetPointNumbers(); } catch { had = new uint[0]; }
Log("erasing '" + NAME + "' (it listed " + had.Length + " points)");
g.Erase();

int left = 0;
foreach (ObjectId id in cdoc.PointGroups)
{
    var pg = Tx.GetObject(id, OpenMode.ForRead) as PointGroup;
    if (pg != null && !pg.IsErased) left++;
}
Log("point groups now: " + left + ";  CogoPoints after: " + cdoc.CogoPoints.Count + " (verified)");

Result

Status
error
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260619 - 3625 Stonewall Tell Rd, Atlanta, GA 30349, USA\260619 - 3625 Stonewall Tell Rd ROTATE.dwg
Message
eNullObjectId
Entities
Duration
484 ms
Civil 3D
25.0.0.0

Log

CogoPoints before: 374
erasing 'MH.1' (it listed 6 points)

Notes

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

No notes yet.