C3D-0342 · Export all CogoPoints as PNEZD comma to the drawing folder [C3D-PTEXPORT] done
Writes every CogoPoint as PNEZD (point,northing,easting,elevation,description) comma-delimited to '<drawing name> - POINTS PNEZD.txt' beside the DWG. Reads the file back to verify the line count and echoes the first 5 / last 3 rows, the N/E/Z ranges and a description-code census.
C# payload
// Export every CogoPoint as PNEZD comma to the drawing's own folder.
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 + " - POINTS PNEZD.txt");
Log("drawing: " + dwg);
var sb = new System.Text.StringBuilder();
int n = 0;
double N0=1e30,N1=-1e30,E0=1e30,E1=-1e30,Z0=1e30,Z1=-1e30;
var descs = new Dictionary<string,int>();
foreach (ObjectId id in civ.CogoPoints) {
var cp = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.Civil.DatabaseServices.CogoPoint;
if (cp == null) continue;
string raw = cp.RawDescription ?? "";
string full = "";
try { full = cp.FullDescription ?? ""; } catch { }
string d = raw.Length > 0 ? raw : full;
d = d.Replace(",", " ").Trim();
sb.AppendFormat("{0},{1:F4},{2:F4},{3:F4},{4}\r\n",
cp.PointNumber, cp.Northing, cp.Easting, cp.Elevation, d);
n++;
N0=Math.Min(N0,cp.Northing); N1=Math.Max(N1,cp.Northing);
E0=Math.Min(E0,cp.Easting); E1=Math.Max(E1,cp.Easting);
Z0=Math.Min(Z0,cp.Elevation);Z1=Math.Max(Z1,cp.Elevation);
string key = d.Length==0 ? "(blank)" : d.Split(' ')[0];
if (!descs.ContainsKey(key)) descs[key]=0;
descs[key]++;
}
if (n == 0) { Log("no CogoPoints in the drawing - nothing written"); return; }
System.IO.File.WriteAllText(outPath, sb.ToString());
// read it back
var lines = System.IO.File.ReadAllLines(outPath);
Log(string.Format("WROTE {0}", outPath));
Log(string.Format(" points: {0} lines in file: {1} ({2} bytes)",
n, lines.Length, new System.IO.FileInfo(outPath).Length));
Log(string.Format(" N {0:F2}..{1:F2} E {2:F2}..{3:F2} Z {4:F2}..{5:F2}", N0,N1,E0,E1,Z0,Z1));
Log(" first 5:");
for (int i = 0; i < Math.Min(5, lines.Length); i++) Log(" " + lines[i]);
Log(" last 3:");
for (int i = Math.Max(0, lines.Length-3); i < lines.Length; i++) Log(" " + lines[i]);
Log(" description codes:");
var keys = new List<string>(descs.Keys); keys.Sort();
foreach (var k in keys) Log(string.Format(" {0,-16} x{1}", k, descs[k]));
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 - POINTS PNEZD.txt
points: 163 lines in file: 163 (7252 bytes)
N 1206710.00..1207403.37 E 2203403.96..2206424.23 Z 0.00..864.53
first 5:
100,1207049.6486,2206399.6902,857.4595,DWY EP
101,1207087.2302,2206401.3037,856.3631,DWY EP
102,1207086.5289,2206413.2256,856.5543,CL
103,1207086.0318,2206424.2255,856.2969,EP
104,1207085.2089,2206392.2984,856.9281,DWY
last 3:
624,1207059.1019,2206268.5400,861.3044,HL
625,1207091.3785,2206293.8958,861.8162,HL
626,1207091.2759,2206285.1218,862.2289,HL
description codes:
4INPOST x1
A/C x1
CL x10
CLEAN x1
CON x3
CP x2
DECK x2
DWY x38
EP x5
FC x2
FL x3
GAS x2
HC x7
HL x4
IPF x12
OTP x1
POB x1
PORCH x2
PP x1
STEP x2
SW x33
TML x11
WALL x14
WELL x4
WV x1Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.