← Inbox

C3D-260619-STATE · Current drawing state done

Read-only snapshot: points, point groups, sites/parcels with areas, model space contents by layer with off/frozen/locked flags, and all layouts.

Script file
C3D-260619-STATE.cs
Target
260619 · model space
Author
claude
Approved
yes · auto-auth
Timeout
180s

C# payload

// READ-ONLY: current state of the drawing after the user's manual edits.
var cdoc = CivilDoc;
Log("=== DRAWING ===");
Log("  CogoPoints: " + cdoc.CogoPoints.Count + "   PointGroups: " + cdoc.PointGroups.Count);

Log("=== SITES / PARCELS ===");
foreach (ObjectId sid in cdoc.GetSiteIds())
{
    var site = Tx.GetObject(sid, OpenMode.ForRead) as Site;
    if (site == null) continue;
    var pids = site.GetParcelIds();
    if (pids.Count == 0 && site.Name.StartsWith("{")) continue;
    Log("  Site '" + site.Name + "' (" + pids.Count + " parcels)");
    foreach (ObjectId pid in pids)
    {
        var p = Tx.GetObject(pid, OpenMode.ForRead) as Parcel;
        if (p != null) Log("      '" + p.Name + "' layer='" + p.Layer + "' area=" + p.Area.ToString("F0") + " sf (" + (p.Area/43560.0).ToString("F3") + " ac)");
    }
}

var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForRead);

Log("=== MODEL SPACE by layer (non-empty) ===");
var byLayer = new Dictionary<string, Dictionary<string,int>>();
foreach (ObjectId id in ms)
{
    var e = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
    if (e == null) continue;
    if (!byLayer.ContainsKey(e.Layer)) byLayer[e.Layer] = new Dictionary<string,int>();
    var k = e.GetType().Name;
    byLayer[e.Layer][k] = byLayer[e.Layer].ContainsKey(k) ? byLayer[e.Layer][k]+1 : 1;
}
var lt = (LayerTable)Tx.GetObject(Db.LayerTableId, OpenMode.ForRead);
var names = new List<string>(byLayer.Keys); names.Sort();
foreach (var n in names)
{
    var ltr = lt.Has(n) ? (LayerTableRecord)Tx.GetObject(lt[n], OpenMode.ForRead) : null;
    var flags = ltr == null ? "" : (ltr.IsOff ? " OFF" : "") + (ltr.IsFrozen ? " FROZEN" : "") + (ltr.IsLocked ? " LOCKED" : "");
    var parts = new List<string>();
    int tot = 0;
    foreach (var kv in byLayer[n]) { parts.Add(kv.Value + " " + kv.Key); tot += kv.Value; }
    Log("  " + n.PadRight(28) + tot.ToString().PadLeft(5) + "  " + string.Join(", ", parts) + flags);
}

Log("=== LAYOUTS ===");
var layDict = (DBDictionary)Tx.GetObject(Db.LayoutDictionaryId, OpenMode.ForRead);
foreach (DBDictionaryEntry de in layDict)
{
    var lay = (Layout)Tx.GetObject(de.Value, OpenMode.ForRead);
    var btr = (BlockTableRecord)Tx.GetObject(lay.BlockTableRecordId, OpenMode.ForRead);
    int cnt = 0; foreach (ObjectId x in btr) cnt++;
    Log("  '" + lay.LayoutName + "' tab=" + lay.TabOrder + " entities=" + cnt +
        " paper=" + (lay.PlotPaperSize.X/25.4).ToString("F1") + "x" + (lay.PlotPaperSize.Y/25.4).ToString("F1") + "in");
}

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260619 - 3625 Stonewall Tell Rd, Atlanta, GA 30349, USA\260619 - 3625 Stonewall Tell Rd ROTATE.dwg
Message
Executed C3D-260619-STATE (0 entities touched).
Entities
Duration
2017 ms
Civil 3D
25.0.0.0

Log

=== DRAWING ===
  CogoPoints: 377   PointGroups: 27
=== SITES / PARCELS ===
  Site 'SITE' (2 parcels)
      'TRACT "A"' layer='SS-BOUNDARY LAND LOT' area=43299 sf (0.994 ac)
      'TRACT "B"' layer='C-PROP' area=144351 sf (3.314 ac)
  Site 'CURB' (0 parcels)
  Site 'CURB|1' (0 parcels)
=== MODEL SPACE by layer (non-empty) ===
  0                             375  375 CogoPoint
  00_WORK                         1  1 CogoPoint
  BLOCK_NOTES_DB                  6  4 Ole2Frame, 2 NoteLabel FROZEN
  C-ANNO                         39  9 GeneralSegmentLabel, 25 MText, 5 NoteLabel
  C-ANNO-TABL-TTBL                5  5 Site
  C-PROP                          1  1 Parcel
  C-PROP-LINE                     3  3 ParcelSegment FROZEN
  C-PROP-LINE-TEXT                1  1 BlockReference
  C-ROAD-MARK                     1  1 Circle
  SS-0-FRAME                     84  1 CogoPoint, 27 MText, 22 Line, 6 GeneralSegmentLabel, 19 DBText, 1 DBPoint, 2 Polyline, 4 AlignedDimension, 1 Ole2Frame, 1 LineAngularDimension2 FROZEN
  SS-BOUNDARY                     6  3 MText, 2 Line, 1 Polyline
  SS-BOUNDARY LAND LOT           16  4 MText, 3 Line, 1 Parcel, 8 Polyline
  SS-BOUNDARY PLAT RED           14  10 Line, 4 GeneralSegmentLabel FROZEN
  SS-BOUNDARY PROPOSED            2  2 Line
  SS-BOUNDARY TRACT NF            1  1 Polyline
  SS-BOUNDARY-NF NE               7  6 Line, 1 AlignedDimension
  SS-BUFFER LANDSCAPE             2  2 Site
  SS-HERO TRACT A                 7  1 Polyline, 6 Line
  SS-HERO TRACT A ANNO            6  6 BlockReference
  SS-HERO TRACT B                11  1 Polyline, 10 Line
  SS-HERO TRACT B ANNO            5  5 BlockReference
  SS-POWER                        3  1 Circle, 1 Line, 1 Polyline
  SS-RIGHT-OF-WAY                23  23 Line
  SS-V-BLDG-OTLN                  5  2 Polyline, 3 Line
  SS-V-ROAD-CNTR                 36  36 Line
  SS-V-ROAD-CURB                 80  1 Site, 11 Polyline, 65 Line, 2 Arc, 1 Hatch
  SS-V-ROAD-EPVM                  1  1 Polyline
  TB1                             1  1 AlignedDimension
=== LAYOUTS ===
  '11X17' tab=1 entities=142 paper=11.0x17.0in
  '22X17 A' tab=3 entities=142 paper=22.0x17.0in
  '22X17 B' tab=4 entities=142 paper=22.0x17.0in
  '22X17 C' tab=5 entities=242 paper=22.0x17.0in
  'HOUSEDIM' tab=2 entities=337 paper=11.0x17.0in
  'Model' tab=0 entities=742 paper=8.5x11.0in

Notes

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

No notes yet.