C3D-260619-PGDEPS · Check point group dependencies error
Read-only: which surfaces are built from point groups, and whether the .1 duplicate groups carry style overrides, before deleting any of them.
C# payload
// READ-ONLY: before deleting any ".1" point group, check what depends on them.
// Surfaces built from point groups, and the point-group display/override chain, would break.
var cdoc = CivilDoc;
Log("CogoPoints in drawing: " + cdoc.CogoPoints.Count);
var dot = 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.EndsWith(".1")) dot.Add(pg.Name);
}
Log(dot.Count + " groups ending in '.1': " + string.Join(", ", dot));
// surfaces and what they are built from
Log("--- surfaces ---");
foreach (ObjectId sid in cdoc.GetSurfaceIds())
{
var surf = Tx.GetObject(sid, OpenMode.ForRead) as Autodesk.Civil.DatabaseServices.Surface;
if (surf == null) continue;
Log(" surface '" + surf.Name + "' type=" + surf.GetType().Name);
var tin = surf as TinSurface;
if (tin != null)
{
try {
var defs = tin.PointGroupsDefinition;
foreach (ObjectId g in defs)
{
var pg = Tx.GetObject(g, OpenMode.ForRead) as PointGroup;
Log(" built from point group: '" + (pg == null ? "?" : pg.Name) + "'");
}
} catch (System.Exception ex) { Log(" (pointgroup defs: " + ex.Message + ")"); }
}
}
// does any group carry style/label overrides that others inherit?
Log("--- group detail ---");
foreach (ObjectId id in cdoc.PointGroups)
{
var pg = Tx.GetObject(id, OpenMode.ForRead) as PointGroup;
if (pg == null || !pg.Name.EndsWith(".1")) continue;
uint[] nums; try { nums = pg.GetPointNumbers(); } catch { nums = new uint[0]; }
bool ovr = false;
try { ovr = pg.IsPointStyleOverridden || pg.IsPointLabelStyleOverridden; } catch { }
Log(" '" + pg.Name + "' pts=" + nums.Length + " styleOverride=" + ovr);
}
Result
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.