C3D-INSP619C · Layers matching PARCEL/PROP (read-only) done
List any layer with PARCEL/PROP in the name + the layer the Civil parcels sit on.
C# payload
// READ-ONLY: is there a layer named/containing "PARCEL"? list all layers matching, with flags,
// and what the Civil parcels actually sit on.
using System;
using System.Linq;
using System.Collections.Generic;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.Civil.ApplicationServices;
using Autodesk.Civil.DatabaseServices;
var db = Db;
using (var tr = db.TransactionManager.StartTransaction())
{
var lt = (LayerTable)tr.GetObject(db.LayerTableId, OpenMode.ForRead);
var hits = new List<string>();
foreach (ObjectId id in lt)
{
var l = (LayerTableRecord)tr.GetObject(id, OpenMode.ForRead);
if (l.Name.IndexOf("PARCEL", StringComparison.OrdinalIgnoreCase) >= 0
|| l.Name.IndexOf("PROP", StringComparison.OrdinalIgnoreCase) >= 0)
hits.Add($"{l.Name} off={l.IsOff} frozen={l.IsFrozen} plot={l.IsPlottable} color={l.Color.ColorIndex}");
}
Log($"LAYERS matching PARCEL/PROP ({hits.Count}):");
foreach (var h in hits.OrderBy(x=>x)) Log($" {h}");
tr.Commit();
}
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);
Log($"PARCEL #{p.Number} '{p.Name}' {p.Area/43560.0:0.000}ac layer='{p.Layer}'");
}
}
tr.Commit();
}
Result
Log
LAYERS matching PARCEL/PROP (18): A-PROP-LINE off=False frozen=False plot=True color=7 C-PROP off=False frozen=False plot=True color=7 C-PROP-BNDY off=False frozen=False plot=True color=150 C-PROP-BRNG off=False frozen=False plot=True color=92 C-PROP-LINE off=False frozen=False plot=True color=230 C-PROP-LINE-TEXT off=False frozen=False plot=True color=2 C-PROP-LOTS off=False frozen=False plot=True color=6 C-PROP-PARCEL off=False frozen=False plot=True color=4 C-PROP-PATT off=False frozen=False plot=True color=150 C-PROP-RSRV off=False frozen=False plot=True color=94 C-PROP-TEXT off=False frozen=False plot=True color=92 C-ROAD-PROF-PROP off=False frozen=False plot=True color=150 PARCEL off=False frozen=False plot=True color=7 PROPERTY LINES off=False frozen=False plot=True color=5 SS-OUTSITEPROP off=False frozen=False plot=True color=210 SS-PROPOSED off=False frozen=False plot=True color=10 SS-PROPOSED-DRIVE off=False frozen=False plot=True color=7 X-PROP-CRNR off=False frozen=False plot=True color=21 PARCEL #5 'TRACT B' 3.314ac layer='C-PROP' PARCEL #6 'TRACT A' 0.994ac layer='C-PROP'
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.