C3D-0345 · Snapshot: point groups, point/label styles, and what every point carries [C3D-PTSNAP] error
Read-only. Lists every point group with its member count, assigned point style, label style and query definition; every point style and point label style defined in the drawing; a census of which style+label-style combination each CogoPoint carries; points by layer; and the 16 CP/OTP/IPF control points with their individual styles.
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));
try {
var q = g.QueryBuilder;
Log(string.Format(" query: incNum=\"{0}\" excNum=\"{1}\" incDesc=\"{2}\" excDesc=\"{3}\" incElev=\"{4}\"",
q.IncludeNumbers, q.ExcludeNumbers, q.IncludeRawDescriptions, q.ExcludeRawDescriptions, q.IncludeElevations));
} catch (System.Exception e) { Log(" query: " + e.Message); }
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
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.