← Inbox

C3D-0363 · Export all CogoPoints from the active drawing as PNEZD [C3D-ALLPTS2] done

Writes every CogoPoint (point,northing,easting,elevation,description) comma-delimited, sorted by number, to '<drawing name> - POINTS PNEZD.txt' - in E:\DATA if that folder exists, otherwise beside the drawing. Reads back and echoes the count, first 5 and last 3 rows.

Script file
C3D-0363.cs
Target
281 MARANTHA 2607.dwg · model space
Author
claude
Approved
yes · auto-auth
Timeout
120s

C# payload

// Every CogoPoint in the active drawing, PNEZD comma, beside the drawing. E:\DATA if present.
var civ = Autodesk.Civil.ApplicationServices.CivilApplication.ActiveDocument;
Log("drawing: " + Db.Filename);

var rows = new List<KeyValuePair<uint,string>>();
foreach (ObjectId id in civ.CogoPoints) {
    var p = (Autodesk.Civil.DatabaseServices.CogoPoint)Tx.GetObject(id, OpenMode.ForRead);
    var sb = new System.Text.StringBuilder();
    foreach (char c in (p.RawDescription ?? "")) sb.Append(c == ',' ? ' ' : c);
    string d = sb.ToString().Trim();
    rows.Add(new KeyValuePair<uint,string>((uint)p.PointNumber,
        string.Format("{0},{1:F4},{2:F4},{3:F4},{4}", p.PointNumber, p.Northing, p.Easting, p.Elevation, d)));
}
if (rows.Count == 0) { Log("no CogoPoints - nothing written"); return; }
rows.Sort((a,b) => a.Key.CompareTo(b.Key));

string EDIR = "E:" + ((char)92) + "DATA";
string dir = System.IO.Directory.Exists(EDIR) ? EDIR : System.IO.Path.GetDirectoryName(Db.Filename);
if (!System.IO.Directory.Exists(EDIR)) Log(EDIR + " not present - writing beside the drawing");
string outPath = System.IO.Path.Combine(dir,
    System.IO.Path.GetFileNameWithoutExtension(Db.Filename) + " - POINTS PNEZD.txt");

var text = new System.Text.StringBuilder();
foreach (var r in rows) text.Append(r.Value).Append("\r\n");
System.IO.File.WriteAllText(outPath, text.ToString(), new System.Text.UTF8Encoding(false));

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));
Log("  first 5:"); for (int i=0;i<System.Math.Min(5,lines.Length);i++) Log("    " + lines[i]);
Log("  last 3:");  for (int i=System.Math.Max(0,lines.Length-3);i<lines.Length;i++) Log("    " + lines[i]);

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\251009 - 281 Maranatha Trail, Lawrenceville, GA 30045, USA\281 MARANTHA 2607.dwg
Message
Executed C3D-0363 (0 entities touched).
Entities
Duration
963 ms
Civil 3D
25.0.0.0

Log

drawing: C:\Users\sanja\OneDrive\_SurveyDisco\251009 - 281 Maranatha Trail, Lawrenceville, GA 30045, USA\281 MARANTHA 2607.dwg
E:\DATA not present - writing beside the drawing
WROTE C:\Users\sanja\OneDrive\_SurveyDisco\251009 - 281 Maranatha Trail, Lawrenceville, GA 30045, USA\281 MARANTHA 2607 - POINTS PNEZD.txt
  1051 points, 1051 lines, 49156 bytes
  first 5:
    1,1425717.5575,2359293.9599,996.7683,TRAV
    2,1425869.5426,2359508.3196,982.4701,TRAV
    3,1425529.9502,2359683.7342,997.0159,TRAV
    4,1425491.0948,2359550.1225,997.6997,TRAV
    5,1425591.9173,2359521.9884,995.6298,TRAV
  last 3:
    9071,1425793.5025,2359598.2409,973.4900,IPF
    9072,1425805.7507,2359542.9202,973.4900,IPF
    9073,1425745.9374,2359375.2673,973.4900,IPF

Notes

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

No notes yet.