← Inbox

C3D-0350 · READ-ONLY: enumerate point label styles and inspect PointGroupQuery [C3D-APIPROBE3] done

C3D-0349 gave the PointGroup API (SetQuery/GetQuery for membership, PointGroups.Add, DrawOrder for priority) but died enumerating label styles. This opens each label style ObjectId properly and lists the names, does the same for point styles, then dumps every property and method on PointGroupQuery so group membership can be defined correctly. Also checks the E: data folder. Writes nothing.

Script file
C3D-0350.cs
Target
260714 - 285 Huckaby Rd R2.dwg · model space
Author
claude
Approved
yes · auto-auth
Timeout
120s

C# payload

// READ-ONLY. (a) how to enumerate point LABEL styles, (b) what PointGroupQuery exposes.
var civ = Autodesk.Civil.ApplicationServices.CivilApplication.ActiveDocument;
Log("drawing: " + Db.Filename);
Log("");

// ---- (a) point label styles: walk it as ObjectIds and open each properly
Log("=== PointLabelStyles container ===");
var cont = civ.Styles.LabelStyles.PointLabelStyles;
Log("type: " + cont.GetType().FullName);
foreach (var pi in cont.GetType().GetProperties())
    Log(string.Format("   prop {0,-24} {1}", pi.Name, pi.PropertyType.Name));
Log("");
Log("=== LabelStyles members ===");
try {
    var coll = cont.LabelStyles;
    Log("collection type: " + coll.GetType().FullName + "  count=" + coll.Count);
    foreach (ObjectId sid in coll) {
        var st = Tx.GetObject(sid, OpenMode.ForRead);
        string nm = "?";
        try { nm = ((Autodesk.Civil.DatabaseServices.Styles.LabelStyle)st).Name; }
        catch (System.Exception e1) {
            try { nm = (string)st.GetType().GetProperty("Name").GetValue(st, null); }
            catch (System.Exception e2) { nm = "<" + st.GetType().Name + ": " + e2.Message + ">"; }
        }
        Log("   " + nm + "    [" + st.GetType().Name + "]");
    }
} catch (System.Exception e) { Log("LabelStyles: " + e.Message); }

// ---- point styles, same treatment
Log("");
Log("=== PointStyles members ===");
foreach (ObjectId sid in civ.Styles.PointStyles) {
    var st = Tx.GetObject(sid, OpenMode.ForRead);
    string nm = "?";
    try { nm = ((Autodesk.Civil.DatabaseServices.Styles.PointStyle)st).Name; }
    catch (System.Exception e) { nm = "<" + e.Message + ">"; }
    Log("   " + nm);
}

// ---- (b) PointGroupQuery: how membership gets defined
Log("");
Log("=== PointGroupQuery ===");
ObjectId gid0 = ObjectId.Null;
foreach (ObjectId gid in civ.PointGroups) { gid0 = gid; break; }
var g = (Autodesk.Civil.DatabaseServices.PointGroup)Tx.GetObject(gid0, OpenMode.ForRead);
Log("sample group: " + g.Name);
var q = g.GetQuery();
Log("query type: " + q.GetType().FullName);
foreach (var pi in q.GetType().GetProperties()) {
    string acc = (pi.CanRead ? "get" : "") + (pi.CanWrite ? "/set" : "");
    string val = "";
    try { var o = pi.GetValue(q, null); val = o == null ? "null" : o.ToString(); } catch { val = "<err>"; }
    if (val.Length > 60) val = val.Substring(0,60) + "...";
    Log(string.Format("   {0,-30} {1,-14} {2,-8} = {3}", pi.Name, pi.PropertyType.Name, acc, val));
}
foreach (var mi in q.GetType().GetMethods()) {
    if (mi.Name.StartsWith("get_") || mi.Name.StartsWith("set_")) continue;
    if (mi.DeclaringType == typeof(object)) continue;
    var ps = mi.GetParameters();
    var sb = new System.Text.StringBuilder();
    foreach (var p in ps) { if (sb.Length>0) sb.Append(", "); sb.Append(p.ParameterType.Name).Append(" ").Append(p.Name); }
    Log(string.Format("   method {0} {1}({2})", mi.ReturnType.Name, mi.Name, sb.ToString()));
}

// ---- E: folder
string EDIR = "E:" + ((char)92) + "DATA";
Log("");
Log(EDIR + " exists: " + System.IO.Directory.Exists(EDIR));

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260714 - 285 Huckaby Rd, Brooks, GA 30205, USA\260714 - 285 Huckaby Rd R2.dwg
Message
Executed C3D-0350 (0 entities touched).
Entities
Duration
392 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.dwg

=== PointLabelStyles container ===
type: Autodesk.Civil.DatabaseServices.Styles.LabelStylesPointRoot
   prop LabelStyles              LabelStyleCollection
   prop DefaultLabelStyle        LabelStyleDefault
   prop AutoDelete               Boolean
   prop IsDisposed               Boolean
   prop UnmanagedObject          IntPtr

=== LabelStyles members ===
collection type: Autodesk.Civil.DatabaseServices.Styles.LabelStyleCollection  count=9
   Description Only [IPF]    [LabelStyle]
   Elevation Only    [LabelStyle]
   Point#-Elevation-Description [HANDICAP]    [LabelStyle]
   Elevation and Description    [LabelStyle]
   Northing and Easting    [LabelStyle]
   Point Number Only    [LabelStyle]
   Point# and Description    [LabelStyle]
   Point#-Elevation-Description    [LabelStyle]
   Description Only    [LabelStyle]

=== PointStyles members ===
   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

=== PointGroupQuery ===
sample group: PP
query type: Autodesk.Civil.DatabaseServices.StandardPointGroupQuery
   PointGroups                    IList`1        get      = System.Collections.Generic.List`1[System.String]
   ExcludeFullDescriptions        String         get/set  = 
   IncludeFullDescriptions        String         get/set  = 
   ExcludeRawDescriptions         String         get/set  = 
   IncludeRawDescriptions         String         get/set  = *PP*
   ExcludeNames                   String         get/set  = 
   IncludeNames                   String         get/set  = 
   ExcludeElevations              String         get/set  = 
   IncludeElevations              String         get/set  = 
   ExcludeNumbers                 String         get/set  = 
   IncludeNumbers                 String         get/set  = 
   IncludeAllPoints               Boolean        get/set  = False
   QueryString                    String         get      = (RawDescription='*PP*')
   UseCaseSensitiveMatch          Boolean        get/set  = False

E:\DATA exists: False

Notes

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

No notes yet.