← Inbox

C3D-0346 · Snapshot: point groups, point/label styles, and what every point carries [C3D-PTSNAP2] done

Read-only, retry of C3D-0345 which failed to compile (PointGroup has no QueryBuilder on this build). Group query definition is now read by reflection over Include/Exclude/Query properties. Lists every point group with member count and assigned styles, all point and point-label styles, a census of the style+label combination each CogoPoint carries, points by layer, and the 16 CP/OTP/IPF control points with their individual styles.

Script file
C3D-0346.cs
Target
active · model space
Author
claude
Approved
yes · auto-auth
Timeout
120s

C# payload

// Snapshot of the point setup: every point group, every point style / label style, and which
// points carry which.
var civ = Autodesk.Civil.ApplicationServices.CivilApplication.ActiveDocument;
Log("drawing: " + Db.Filename);
Log("");

// ---------- POINT GROUPS ----------
Log("=== POINT GROUPS ===");
foreach (ObjectId gid in civ.PointGroups) {
    var g = Tx.GetObject(gid, OpenMode.ForRead) as Autodesk.Civil.DatabaseServices.PointGroup;
    if (g == null) continue;
    uint[] nums = null;
    try { nums = g.GetPointNumbers(); } catch { }
    string ps = "", ls = "";
    try { if (!g.PointStyleId.IsNull) ps = ((Autodesk.Civil.DatabaseServices.Styles.PointStyle)Tx.GetObject(g.PointStyleId, OpenMode.ForRead)).Name; } catch { }
    try { if (!g.PointLabelStyleId.IsNull) ls = ((Autodesk.Civil.DatabaseServices.Styles.LabelStyle)Tx.GetObject(g.PointLabelStyleId, OpenMode.ForRead)).Name; } catch { }
    Log(string.Format("GROUP \"{0}\"  points={1}", g.Name, nums == null ? -1 : nums.Length));
    Log(string.Format("     pointStyle = \"{0}\"", ps));
    Log(string.Format("     labelStyle = \"{0}\"", ls));
    // group query, whatever the API exposes on this build
    foreach (var pi in g.GetType().GetProperties()) {
        string n = pi.Name;
        if (n.IndexOf("Include", StringComparison.OrdinalIgnoreCase) < 0 &&
            n.IndexOf("Exclude", StringComparison.OrdinalIgnoreCase) < 0 &&
            n.IndexOf("Query",   StringComparison.OrdinalIgnoreCase) < 0) continue;
        if (pi.GetIndexParameters().Length > 0) continue;
        string v; try { var o = pi.GetValue(g, null); v = o == null ? "null" : o.ToString(); }
        catch { continue; }
        if (v.Length == 0 || v == "False") continue;
        if (v.Length > 70) v = v.Substring(0,70) + "...";
        Log(string.Format("     {0} = {1}", n, v));
    }
    if (nums != null && nums.Length > 0 && nums.Length <= 40) {
        var s = new System.Text.StringBuilder("     nums: ");
        foreach (var u in nums) s.Append(u).Append(" ");
        Log(s.ToString());
    }
}

// ---------- STYLES DEFINED ----------
Log("");
Log("=== POINT STYLES ===");
foreach (ObjectId sid in civ.Styles.PointStyles) {
    var s = Tx.GetObject(sid, OpenMode.ForRead) as Autodesk.Civil.DatabaseServices.Styles.PointStyle;
    if (s != null) Log("   " + s.Name);
}
Log("=== POINT LABEL STYLES ===");
foreach (ObjectId sid in civ.Styles.LabelStyles.PointLabelStyles.LabelStyles) {
    var s = Tx.GetObject(sid, OpenMode.ForRead) as Autodesk.Civil.DatabaseServices.Styles.LabelStyle;
    if (s != null) Log("   " + s.Name);
}

// ---------- POINTS: style/label census ----------
Log("");
Log("=== POINTS: which style + label style each carries ===");
var combo = new Dictionary<string,int>();
var byLayer = new Dictionary<string,int>();
int total = 0;
foreach (ObjectId id in civ.CogoPoints) {
    var p = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.Civil.DatabaseServices.CogoPoint;
    if (p == null) continue;
    total++;
    string ps = "(none)", ls = "(none)";
    try { if (!p.StyleId.IsNull) ps = ((Autodesk.Civil.DatabaseServices.Styles.PointStyle)Tx.GetObject(p.StyleId, OpenMode.ForRead)).Name; } catch { }
    try { if (!p.LabelStyleId.IsNull) ls = ((Autodesk.Civil.DatabaseServices.Styles.LabelStyle)Tx.GetObject(p.LabelStyleId, OpenMode.ForRead)).Name; } catch { }
    string k = ps + "   +   " + ls;
    if (!combo.ContainsKey(k)) combo[k]=0;
    combo[k]++;
    if (!byLayer.ContainsKey(p.Layer)) byLayer[p.Layer]=0;
    byLayer[p.Layer]++;
}
foreach (var kv in combo) Log(string.Format("   {0,-64} x{1}", kv.Key, kv.Value));
Log("");
Log("=== POINTS BY LAYER ===");
foreach (var kv in byLayer) Log(string.Format("   {0,-30} x{1}", kv.Key, kv.Value));
Log("");
Log("total CogoPoints: " + total);

// ---------- the control points specifically ----------
Log("");
Log("=== CONTROL POINTS (CP / OTP / IPF) with their styles ===");
foreach (ObjectId id in civ.CogoPoints) {
    var p = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.Civil.DatabaseServices.CogoPoint;
    if (p == null) continue;
    string d = (p.RawDescription ?? "").Trim();
    string f = d.Length==0 ? "" : d.Split(' ')[0].ToUpper();
    if (f != "CP" && f != "OTP" && f != "IPF") continue;
    string ps = "(none)", ls = "(none)";
    try { if (!p.StyleId.IsNull) ps = ((Autodesk.Civil.DatabaseServices.Styles.PointStyle)Tx.GetObject(p.StyleId, OpenMode.ForRead)).Name; } catch { }
    try { if (!p.LabelStyleId.IsNull) ls = ((Autodesk.Civil.DatabaseServices.Styles.LabelStyle)Tx.GetObject(p.LabelStyleId, OpenMode.ForRead)).Name; } catch { }
    Log(string.Format("   {0,5}  {1,-14} layer={2,-16} style=\"{3}\"  label=\"{4}\"",
        p.PointNumber, d, p.Layer, ps, ls));
}

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260714 - 285 Huckaby Rd, Brooks, GA 30205, USA\260714 - 285 Huckaby Rd R2 SO.dwg
Message
Executed C3D-0346 (0 entities touched).
Entities
Duration
451 ms
Civil 3D
25.0.0.0

Log

drawing: C:\Users\sanja\OneDrive\_SurveyDisco\260714 - 285 Huckaby Rd, Brooks, GA 30205, USA\260714 - 285 Huckaby Rd R2 SO.dwg

=== POINT GROUPS ===
GROUP "CL"  points=11
     pointStyle = "Bound"
     labelStyle = ""
     nums: 102 357 356 355 354 353 352 351 350 349 149 
GROUP "CP"  points=3
     pointStyle = "Iron Pin"
     labelStyle = "Point#-Elevation-Description"
     nums: 524 529 535 
GROUP "PP"  points=1
     pointStyle = "Utility Pole"
     labelStyle = ""
     nums: 347 
GROUP "POB"  points=1
     pointStyle = "Drill Hole"
     labelStyle = "Northing and Easting"
     nums: 534 
GROUP "IPF NS"  points=13
     pointStyle = "Iron Pin"
     labelStyle = "Point#-Elevation-Description"
     nums: 364 510 406 500 520 521 522 523 525 526 527 528 531 
GROUP "MH"  points=0
     pointStyle = "Storm Sewer Manhole"
     labelStyle = ""
GROUP "FH"  points=0
     pointStyle = "Hydrant (existing)"
     labelStyle = ""
GROUP "FF"  points=1
     pointStyle = "Basic"
     labelStyle = "Elevation and Description"
     nums: 509 
GROUP "GAS"  points=2
     pointStyle = "Gas METER"
     labelStyle = ""
     nums: 511 506 
GROUP "TBC"  points=0
     pointStyle = "Test Pit"
     labelStyle = ""
GROUP "No Display"  points=164
     pointStyle = ""
     labelStyle = ""
GROUP "BUILDING"  points=9
     pointStyle = "Basic"
     labelStyle = "Description Only"
     nums: 171 166 165 162 159 151 150 147 144 
GROUP "NORTHING_EASTING"  points=0
     pointStyle = "Iron Pin [LARGE]"
     labelStyle = "Northing and Easting"
GROUP "FENCE"  points=43
     pointStyle = "Basic"
     labelStyle = "Point#-Elevation-Description"
GROUP "Display [SPECIFIC]"  points=73
     pointStyle = "Basic"
     labelStyle = "Description Only"
GROUP "TOPO"  points=140
     pointStyle = "Basic"
     labelStyle = "Point#-Elevation-Description"
GROUP "WALL ELEV"  points=6
     pointStyle = "Sign (single pole)"
     labelStyle = "Elevation and Description"
     nums: 143 159 175 158 140 139 
GROUP "TREES"  points=0
     pointStyle = "Tree"
     labelStyle = "Description Only"
GROUP "WALL"  points=14
     pointStyle = "Test Pit"
     labelStyle = "Description Only"
     nums: 348 345 344 343 342 341 340 339 338 337 336 335 334 333 
GROUP "UTIL"  points=4
     pointStyle = "Test Pit"
     labelStyle = "Description Only"
     nums: 102 148 164 149 
GROUP "WM"  points=1
     pointStyle = "Water Valve"
     labelStyle = ""
     nums: 164 
GROUP "_All Points"  points=164
     pointStyle = "Basic"
     labelStyle = "Point#-Elevation-Description"

=== POINT STYLES ===
   Horizontal Curve Point
   Water Shutoff
   Benchmark
   Gas Valve
   Vertical Curve Point
   Guy Pole
   STA
   Bound
   Shrub - 5ft
   Catch Basin
   Sign (single pole)
   Storm Sewer Manhole
   Gas METER
   Utility Pole
   Well
   Tree
   Iron Pin
   Sanitary Sewer Manhole
   Hydrant (proposed)
   Basic
   Drill Hole
   Standard
   Water Valve
   Iron Pin [LARGE]
   Hydrant (existing)
   Test Pit
=== POINT LABEL STYLES ===
   Description Only [IPF]
   Elevation Only
   Point#-Elevation-Description [HANDICAP]
   Elevation and Description
   Northing and Easting
   Point Number Only
   Point# and Description
   Point#-Elevation-Description
   Description Only

=== POINTS: which style + label style each carries ===
   (none)   +   (none)                                              x164

=== POINTS BY LAYER ===
   0                              x162
   SS-0-FRAME                     x2

total CogoPoints: 164

=== CONTROL POINTS (CP / OTP / IPF) with their styles ===
     364  IPF            layer=0                style="(none)"  label="(none)"
     406  OTP            layer=0                style="(none)"  label="(none)"
     500  IPF            layer=SS-0-FRAME       style="(none)"  label="(none)"
     510  IPF 4" POST    layer=0                style="(none)"  label="(none)"
     520  IPF            layer=0                style="(none)"  label="(none)"
     521  IPF            layer=0                style="(none)"  label="(none)"
     522  IPF            layer=0                style="(none)"  label="(none)"
     523  IPF            layer=0                style="(none)"  label="(none)"
     524  CP RW S        layer=0                style="(none)"  label="(none)"
     525  IPF            layer=0                style="(none)"  label="(none)"
     526  IPF            layer=0                style="(none)"  label="(none)"
     527  IPF            layer=0                style="(none)"  label="(none)"
     528  IPF            layer=0                style="(none)"  label="(none)"
     529  CP LEGAL       layer=0                style="(none)"  label="(none)"
     531  IPF            layer=0                style="(none)"  label="(none)"
     535  CP RW N        layer=0                style="(none)"  label="(none)"

Notes

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

No notes yet.