C3D-0344 · Write a PNEZD file of the CP / OTP / IPF control points [C3D-CPFILE] done
Writes the 16 control points (descriptions starting CP, OTP or IPF) as PNEZD comma to '<drawing name> - CONTROL PNEZD.txt' beside the DWG, sorted by point number. Reads the file back and echoes every line.
C# payload
// PNEZD comma file of the CP / OTP / IPF control points only.
var civ = Autodesk.Civil.ApplicationServices.CivilApplication.ActiveDocument;
string dwg = Db.Filename;
string dir = System.IO.Path.GetDirectoryName(dwg);
string bas = System.IO.Path.GetFileNameWithoutExtension(dwg);
string outPath = System.IO.Path.Combine(dir, bas + " - CONTROL PNEZD.txt");
Log("drawing: " + dwg);
var rows = new List<KeyValuePair<long,string>>();
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 first = d.Length == 0 ? "" : d.Split(' ')[0].ToUpper();
if (first != "CP" && first != "OTP" && first != "IPF") continue;
rows.Add(new KeyValuePair<long,string>(p.PointNumber,
string.Format("{0},{1:F4},{2:F4},{3:F4},{4}",
p.PointNumber, p.Northing, p.Easting, p.Elevation, d.Replace(","," "))));
}
if (rows.Count == 0) { Log("no CP/OTP/IPF points found - nothing written"); return; }
rows.Sort((a,b) => a.Key.CompareTo(b.Key));
var sb = new System.Text.StringBuilder();
foreach (var r in rows) sb.Append(r.Value).Append("\r\n");
System.IO.File.WriteAllText(outPath, sb.ToString());
var lines = System.IO.File.ReadAllLines(outPath);
Log("WROTE " + outPath);
Log(string.Format(" {0} points, {1} lines, {2} bytes", rows.Count, lines.Length,
new System.IO.FileInfo(outPath).Length));
foreach (var l in lines) Log(" " + l);
Result
Log
drawing: C:\Users\sanja\OneDrive\_SurveyDisco\260714 - 285 Huckaby Rd, Brooks, GA 30205, USA\260714 - 285 Huckaby Rd R2.dwg
WROTE C:\Users\sanja\OneDrive\_SurveyDisco\260714 - 285 Huckaby Rd, Brooks, GA 30205, USA\260714 - 285 Huckaby Rd R2 - CONTROL PNEZD.txt
16 points, 16 lines, 725 bytes
364,1207312.9316,2206379.5725,854.2948,IPF
406,1207293.5077,2203443.1704,823.3011,OTP
500,1207293.3588,2203443.1687,823.2429,IPF
510,1206809.8163,2203438.7211,837.3701,IPF 4" POST
520,1206709.9971,2203439.2944,854.2900,IPF
521,1206719.6631,2205253.5086,854.2900,IPF
522,1206798.9689,2205255.8347,854.2900,IPF
523,1206809.1899,2206344.7867,854.2900,IPF
524,1206809.4208,2206364.7110,854.2948,CP RW S
525,1206717.3657,2204844.8382,854.2900,IPF
526,1206967.3546,2204842.4917,854.2900,IPF
527,1206969.7050,2205260.7851,854.2900,IPF
528,1206948.9038,2205260.1811,854.2900,IPF
529,1206959.1267,2206349.1408,854.2900,CP LEGAL
531,1206959.1830,2206355.1445,854.2900,IPF
535,1206959.3160,2206369.3074,854.2900,CP RW NNotes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.