C3D-0348 · READ-ONLY: probe the PointGroup API surface before building the stake-out recipe [C3D-APIPROBE] error
Reflects over PointGroup and the PointGroups collection to list every property and method available on this Civil 3D build (QueryBuilder does not exist here, so membership must be set another way). Also dumps the current group order, checks that the intended point and label styles exist by exact name, and tests whether E:\DATA is reachable from the plugin. Writes nothing.
C# payload
// READ-ONLY. What the PointGroup / PointGroupRoot API actually exposes on this build, so the
// stake-out group can be built without a compile failure.
var civ = Autodesk.Civil.ApplicationServices.CivilApplication.ActiveDocument;
Log("drawing: " + Db.Filename);
Log("");
// ---- PointGroup: every member, so we know how to set membership
ObjectId first = ObjectId.Null;
foreach (ObjectId gid in civ.PointGroups) { first = gid; break; }
if (first.IsNull) { Log("no point groups"); return; }
var g = Tx.GetObject(first, OpenMode.ForRead);
Log("=== PointGroup type: " + g.GetType().FullName + " ===");
Log("--- properties ---");
foreach (var pi in g.GetType().GetProperties()) {
string acc = (pi.CanRead ? "get" : "") + (pi.CanWrite ? "/set" : "");
Log(string.Format(" {0,-34} {1,-34} {2}", pi.Name, pi.PropertyType.Name, acc));
}
Log("--- methods (declared, non-property) ---");
foreach (var mi in g.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(" {0} {1}({2})", mi.ReturnType.Name, mi.Name, sb.ToString()));
}
// ---- PointGroupRoot: how groups are created and ordered
Log("");
Log("=== PointGroups collection: " + civ.PointGroups.GetType().FullName + " ===");
foreach (var mi in civ.PointGroups.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(" {0} {1}({2})", mi.ReturnType.Name, mi.Name, sb.ToString()));
}
Log("--- properties ---");
foreach (var pi in civ.PointGroups.GetType().GetProperties())
Log(string.Format(" {0,-30} {1}", pi.Name, pi.PropertyType.Name));
// ---- group DRAW ORDER, which decides which style wins
Log("");
Log("=== current group order (index = priority) ===");
int i = 0;
foreach (ObjectId gid in civ.PointGroups) {
var pg = Tx.GetObject(gid, OpenMode.ForRead);
var np = pg.GetType().GetProperty("Name");
Log(string.Format(" [{0,2}] {1}", i++, np.GetValue(pg, null)));
}
// ---- the label styles we need, do they exist by these exact names?
Log("");
Log("=== label styles we intend to use ===");
foreach (string want in new string[]{"Point#-Elevation-Description","Description Only [IPF]","Description Only"}) {
bool found = false;
foreach (ObjectId sid in civ.Styles.LabelStyles.PointLabelStyles.LabelStyles) {
var st = Tx.GetObject(sid, OpenMode.ForRead);
if (((string)st.GetType().GetProperty("Name").GetValue(st,null)) == want) { found = true; break; }
}
Log(string.Format(" \"{0}\" {1}", want, found ? "EXISTS" : "MISSING"));
}
foreach (string want in new string[]{"Iron Pin","Iron Pin [LARGE]","Basic"}) {
bool found = false;
foreach (ObjectId sid in civ.Styles.PointStyles) {
var st = Tx.GetObject(sid, OpenMode.ForRead);
if (((string)st.GetType().GetProperty("Name").GetValue(st,null)) == want) { found = true; break; }
}
Log(string.Format(" pointStyle \"{0}\" {1}", want, found ? "EXISTS" : "MISSING"));
}
// ---- does E:\DATA exist from the plugin's side?
Log("");
Log("E:\DATA exists: " + System.IO.Directory.Exists(@"E:\DATA"));
Result
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.