← Inbox

C3D-260619-DELDOT1 · Remove all duplicate .1 point groups done

Removes every point group whose name ends in .1 (duplicates that arrived with the SS_BLOCK_22X17 import; some still report 564 points on a 374-point drawing). Group definitions only - verifies the CogoPoint count is unchanged. _All Points untouched.

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

C# payload

// Remove every remaining duplicate point group whose name ends in ".1".
// These came in with the SS_BLOCK_22X17 import (that DWG carried 564 CogoPoints and its own
// point groups; AutoCAD suffixed ".1" on each name collision). Several still report point
// counts from that drawing - e.g. TOPO.1 / No Display.1 claim 564 points on a drawing with 374.
//
// Uses PointGroupCollection.Remove(name) - Erase() on the ObjectId throws eNullObjectId.
// PointGroup.DeletePoints() would destroy the CogoPoints; NOT used.
// The _All Points group is never touched. CogoPoint count is verified unchanged at the end.
// Host owns Tx; host regens after commit.
var cdoc = CivilDoc;
int before = (int)cdoc.CogoPoints.Count;
Log("CogoPoints before: " + before);

var names = new List<string>();
foreach (ObjectId id in cdoc.PointGroups)
{
    var pg = Tx.GetObject(id, OpenMode.ForRead) as PointGroup;
    if (pg == null) continue;
    if (pg.Name == "_All Points") continue;
    if (!pg.Name.EndsWith(".1")) continue;
    uint[] had; try { had = pg.GetPointNumbers(); } catch { had = new uint[0]; }
    names.Add(pg.Name);
    Log("  queued '" + pg.Name + "' (listed " + had.Length + " points)");
}
Log(names.Count + " duplicate group(s) to remove.");

int removed = 0, failed = 0;
foreach (var n in names)
{
    try { cdoc.PointGroups.Remove(n); removed++; }
    catch (System.Exception ex) { failed++; Log("  FAILED '" + n + "': " + ex.Message); }
}

var leftDot = new List<string>();
int left = 0;
foreach (ObjectId id in cdoc.PointGroups)
{
    var pg = Tx.GetObject(id, OpenMode.ForRead) as PointGroup;
    if (pg == null) continue;
    left++;
    if (pg.Name.EndsWith(".1")) leftDot.Add(pg.Name);
}
int after = (int)cdoc.CogoPoints.Count;
Log("removed " + removed + ", failed " + failed + "; point groups now " + left +
    (leftDot.Count > 0 ? "; still ending .1: " + string.Join(", ", leftDot) : "; no '.1' groups remain"));
Log("CogoPoints after: " + after + (after == before ? " (unchanged - verified)" : " (CHANGED! " + before + " -> " + after + ")"));

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260619 - 3625 Stonewall Tell Rd, Atlanta, GA 30349, USA\260619 - 3625 Stonewall Tell Rd ROTATE.dwg
Message
Executed C3D-260619-DELDOT1 (0 entities touched).
Entities
Duration
516 ms
Civil 3D
25.0.0.0

Log

CogoPoints before: 374
  queued 'NORTHING_EASTING.1' (listed 0 points)
  queued 'UTIL.1' (listed 39 points)
  queued 'IPF NS.1' (listed 7 points)
  queued 'TREES.1' (listed 3 points)
  queued 'PP.1' (listed 11 points)
  queued 'FH.1' (listed 1 points)
  queued 'POB.1' (listed 0 points)
  queued 'FF.1' (listed 3 points)
  queued 'No Display.1' (listed 564 points)
  queued 'Display [SPECIFIC].1' (listed 51 points)
  queued 'TOPO.1' (listed 564 points)
  queued 'FENCE.1' (listed 7 points)
  queued 'GAS.1' (listed 19 points)
  queued 'TBC.1' (listed 179 points)
  queued 'CL.1' (listed 4 points)
  queued 'WALL ELEV.1' (listed 19 points)
  queued 'BUILDING.1' (listed 14 points)
17 duplicate group(s) to remove.
removed 17, failed 0; point groups now 28; no '.1' groups remain
CogoPoints after: 374 (unchanged - verified)

Notes

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

No notes yet.