← Inbox

C3D-INSP2403C · Full VP-freeze + parcel-layer map v2 (read-only) done

Per-viewport frozen layers for 09/10/R4 + each parcel's layer/style. For heroing Parcel #2 (1.593 ac) on paper 10.

Script file
C3D-INSP2403C.cs
Target
active document · model space
Author
claude
Approved
yes · claude (read-only)
Timeout
60s

C# payload

// READ-ONLY: full isolation + parcel-layer picture for hero planning.
// - each paper tab: for each non-paper viewport, list ALL per-VP frozen layers (full, not sampled)
// - Parcel #1 and #2: their layer, the layer of their area label, and their boundary segment count
using System;
using System.Linq;
using System.Collections.Generic;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.Civil.ApplicationServices;
using Autodesk.Civil.DatabaseServices;

var db = Db;
Log($"ACTIVE: {System.IO.Path.GetFileName(Doc.Name)}");

// ---- full per-viewport frozen-layer sets per layout ----
using (var tr = db.TransactionManager.StartTransaction())
{
    var ld = (DBDictionary)tr.GetObject(db.LayoutDictionaryId, OpenMode.ForRead);
    foreach (DBDictionaryEntry e in ld)
    {
        if (string.Equals(e.Key, "Model", StringComparison.OrdinalIgnoreCase)) continue;
        var lay = (Layout)tr.GetObject(e.Value, OpenMode.ForRead);
        Log($"== LAYOUT [{lay.LayoutName}] ==");
        int n = 0;
        foreach (ObjectId vid in lay.GetViewports())
        {
            var vp = tr.GetObject(vid, OpenMode.ForRead) as Viewport;
            if (vp == null || vp.Number == 1) continue;
            n++;
            var fl = vp.GetFrozenLayers();
            var names = new List<string>();
            if (fl != null)
                foreach (ObjectId lid in fl)
                    names.Add(((LayerTableRecord)tr.GetObject(lid, OpenMode.ForRead)).Name);
            names.Sort(StringComparer.OrdinalIgnoreCase);
            Log($"  VP#{vp.Number} scale=1/{(vp.CustomScale!=0?1.0/vp.CustomScale:0):0} frozenLayers({names.Count}): {(names.Count==0?"<none>":string.Join(", ", names))}");
        }
        if (n == 0) Log("  (no floating viewports)");
    }
    tr.Commit();
}

// ---- which layer does each parcel's geometry + area label sit on ----
using (var tr = db.TransactionManager.StartTransaction())
{
    var cdoc = CivilDocument.GetCivilDocument(db);
    foreach (ObjectId sid in cdoc.GetSiteIds())
    {
        var site = (Site)tr.GetObject(sid, OpenMode.ForRead);
        foreach (ObjectId pid in site.GetParcelIds())
        {
            var p = (Parcel)tr.GetObject(pid, OpenMode.ForRead);
            double sf = p.Area;
            Log($"PARCEL #{p.Number} '{p.Name}' {sf/43560.0:0.000} ac  layer='{p.Layer}'  style='{p.StyleName}'");
        }
    }
    tr.Commit();
}

Result

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

Log

ACTIVE: 281 MARANTHA LOT 10.dwg
== LAYOUT [09] ==
  VP#-1 scale=1/1 frozenLayers(0): <none>
  VP#-1 scale=1/60 frozenLayers(1): Layer1
== LAYOUT [10] ==
  VP#-1 scale=1/1 frozenLayers(0): <none>
  VP#-1 scale=1/60 frozenLayers(1): Layer1
== LAYOUT [R4] ==
  VP#-1 scale=1/1 frozenLayers(0): <none>
  VP#-1 scale=1/60 frozenLayers(1): Layer1
PARCEL #1 'Property : 1' 2.817 ac  layer='C-PROP'  style='Property'
PARCEL #1 'Property : 1' 1.224 ac  layer='C-PROP'  style='Property'
PARCEL #2 'Property : 2' 1.593 ac  layer='C-PROP'  style='Property'

Notes

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

No notes yet.