← Inbox

C3D-ALLPTS · List all point families error

Read-only: groups all COGO points by description prefix

Script file
C3D-ALLPTS.cs
Target
active document · model space
Author
claude
Approved
yes · auto-auth
Timeout
60s

C# payload

// READ-ONLY: dump every CogoPoint with description, group by description prefix
using System;
using System.Linq;
using System.Collections.Generic;
using Autodesk.Civil.ApplicationServices;
using Autodesk.Civil.DatabaseServices;
using Autodesk.AutoCAD.DatabaseServices;

var db = Db;
var cdoc = CivilDocument.GetCivilDocument(db);
using (var tr = Tx) {
    var pts = cdoc.CogoPoints;
    var byDesc = new Dictionary<string, List<int>>();

    foreach (var ptId in pts) {
        var pt = tr.GetObject(ptId, OpenMode.ForRead) as CogoPoint;
        if (pt == null) continue;
        string desc = pt.Description ?? "";
        string prefix = desc.Split()[0];

        if (!byDesc.ContainsKey(prefix))
            byDesc[prefix] = new List<int>();
        byDesc[prefix].Add(pt.PointNumber);
    }

    Log($"Point families found:");
    foreach (var kv in byDesc.OrderBy(x => x.Key)) {
        Log($"  {kv.Key:20} {kv.Value.Count:3} points  #{kv.Value.Min()}-{kv.Value.Max()}");
    }
}

Result

Status
error
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260709 - 1512 Bass Rd, Macon, GA 31210, USA\260709 - 1512 Bass Rd.dwg
Message
Compile error: (18,26): error CS1061: 'CogoPoint' does not contain a definition for 'Description' and no accessible extension method 'Description' accepting a first argument of type 'CogoPoint' could be found (are you missing a using directive or an assembly reference?); (23,28): error CS1503: Argument 1: cannot convert from 'uint' to 'int'
Entities
Duration
335 ms
Civil 3D
25.0.0.0

Notes

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

No notes yet.