C3D-OLDCONTENT · Dump legacy layer contents (read-only) done
Entity types + text content on every old layer, to map to HCWA layers without guessing.
C# payload
// READ-ONLY: dump entity type + text content for every non-empty legacy layer, so we can map them
// to the correct HCWA layers without guessing.
using System;
using System.Collections.Generic;
using Autodesk.AutoCAD.DatabaseServices;
var db = Db;
var oldLayers = new[]{ "P-GRID","P-GRID-TEXT","P-GROUND","P-INTC","P-MHOL","P-PIPE","P-TEXT",
"V-CREEK","V-CTRL","V-ESMT-SSE","V-GRID","V-GRID-TEXT","V-HIDE","V-PTS-OG",
"V-SSWR-MHOL","V-SSWR-PIPE","V-SSWR-TEXT","V-WTF" };
using (var tr = db.TransactionManager.StartTransaction())
{
var ms = (BlockTableRecord)tr.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(db), OpenMode.ForRead);
var byLayer = new Dictionary<string,List<string>>(StringComparer.OrdinalIgnoreCase);
foreach (var l in oldLayers) byLayer[l] = new List<string>();
foreach (ObjectId id in ms)
{
var e = tr.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
if (e == null || !byLayer.ContainsKey(e.Layer)) continue;
string tn = e.GetType().Name;
string extra = "";
if (e is DBText t) extra = $" '{t.TextString}'";
else if (e is MText m) extra = $" '{m.Text.Replace("\n"," ")}'";
else if (e is BlockReference br) {
var btr = (BlockTableRecord)tr.GetObject(br.BlockTableRecord, OpenMode.ForRead);
extra = $" block='{btr.Name}'";
}
else if (e is Circle c) extra = $" r={c.Radius:0.00}";
else if (e is Polyline pl) extra = $" verts={pl.NumberOfVertices} closed={pl.Closed} len={pl.Length:0.0}";
else if (e is Line ln) extra = $" len={ln.Length:0.0}";
byLayer[e.Layer].Add($"{tn}{extra}");
}
foreach (var l in oldLayers)
{
var items = byLayer[l];
Log($"== {l} ({items.Count}) ==");
// group by type for a compact summary, but show text content individually
var typeCounts = new SortedDictionary<string,int>(StringComparer.OrdinalIgnoreCase);
var textSamples = new List<string>();
foreach (var it in items)
{
var type = it.Split(' ')[0];
typeCounts[type] = typeCounts.TryGetValue(type, out var c) ? c+1 : 1;
if (it.StartsWith("DBText") || it.StartsWith("MText")) textSamples.Add(it);
}
foreach (var kv in typeCounts) Log($" {kv.Key}: {kv.Value}");
foreach (var s in textSamples) Log($" TEXT: {s}");
}
tr.Commit();
}
Result
Log
== P-GRID (15) ==
Line: 14
Polyline: 1
== P-GRID-TEXT (21) ==
DBText: 21
TEXT: DBText '665'
TEXT: DBText '665'
TEXT: DBText '675'
TEXT: DBText '675'
TEXT: DBText '685'
TEXT: DBText '685'
TEXT: DBText '695'
TEXT: DBText '695'
TEXT: DBText '705'
TEXT: DBText '705'
TEXT: DBText '715'
TEXT: DBText '715'
TEXT: DBText '725'
TEXT: DBText '725'
TEXT: DBText 'STA 0+00'
TEXT: DBText 'STA 0+80'
TEXT: DBText 'STA 2+39'
TEXT: DBText 'STA 5+98'
TEXT: DBText 'STA 6+78'
TEXT: DBText 'STA 8+33'
TEXT: DBText 'STA 8+53'
== P-GROUND (2) ==
Line: 1
Spline: 1
== P-INTC (1) ==
Line: 1
== P-MHOL (14) ==
Line: 14
== P-PIPE (1) ==
Polyline: 1
== P-TEXT (81) ==
DBText: 41
Line: 26
Solid: 14
TEXT: DBText 'PROFILE - SS OUTFALL (A-6 TO EX. SSMH 106)'
TEXT: DBText 'H 1"=60' V 1"=20' (VE 3x) DATUM 665-725'
TEXT: DBText 'SSMH A-6 (100)'
TEXT: DBText 'TOP = 722.67'
TEXT: DBText 'INV = 712.37'
TEXT: DBText 'SSMH A-5 (101)'
TEXT: DBText 'TOP = 721.43'
TEXT: DBText 'INV = 699.48'
TEXT: DBText 'SSMH A-4 (102)'
TEXT: DBText 'TOP = 691.24'
TEXT: DBText 'INV = 677.28'
TEXT: DBText 'SSMH A-3 (1112)'
TEXT: DBText 'TOP = 682.93'
TEXT: DBText 'INV = 673.31'
TEXT: DBText 'SSMH A-2 (1113)'
TEXT: DBText 'TOP = 688.43'
TEXT: DBText 'INV = 673.16'
TEXT: DBText 'SSMH A-1 (1114)'
TEXT: DBText 'TOP = 687.02'
TEXT: DBText 'INV = 672.02'
TEXT: DBText 'EXISTING SSMH 106'
TEXT: DBText 'TOP = 686.37'
TEXT: DBText 'INV IN = 671.92 (8" PVC, CALC PER AS-BUILT A-1)'
TEXT: DBText 'INV IN = 671.03 (EXISTING 36" DIP, RECORD)'
TEXT: DBText 'INV OUT = 671.03 (RECORD)'
TEXT: DBText '36" INVERTS PER DESIGN 80/20 CALCULATION'
TEXT: DBText '80' @ 16.2%'
TEXT: DBText '60' PVC / 20' DIP'
TEXT: DBText '159' @ 13.9%'
TEXT: DBText '60' DIP / 100' PVC'
TEXT: DBText '359' 8" PVC'
TEXT: DBText '@ 1.1%'
TEXT: DBText '80' 8" DIP'
TEXT: DBText '@ 0.2%'
TEXT: DBText '155' 8" PVC'
TEXT: DBText '@ 0.7%'
TEXT: DBText '20' 8" PVC SDR 26'
TEXT: DBText '@ 0.5%'
TEXT: DBText 'EXISTING 36" DIP S.S. LINE'
TEXT: DBText '(WOLF CREEK INTERCEPTOR)'
TEXT: DBText 'existing ground - splined from design profile (Sewer Line A) grid'
== V-CREEK (22) ==
CogoPoint: 22
== V-CTRL (1) ==
DBText: 1
TEXT: DBText 'TBM EL 683.93 (PT 1000)'
== V-ESMT-SSE (1) ==
DBText: 1
TEXT: DBText '20' SANITARY SEWER EASEMENT'
== V-GRID (13) ==
Line: 13
== V-GRID-TEXT (13) ==
DBText: 13
TEXT: DBText 'E 2296900'
TEXT: DBText 'E 2297000'
TEXT: DBText 'E 2297100'
TEXT: DBText 'E 2297200'
TEXT: DBText 'E 2297300'
TEXT: DBText 'E 2297400'
TEXT: DBText 'N 1279500'
TEXT: DBText 'N 1279600'
TEXT: DBText 'N 1279700'
TEXT: DBText 'N 1279800'
TEXT: DBText 'N 1279900'
TEXT: DBText 'N 1280000'
TEXT: DBText 'N 1280100'
== V-HIDE (22) ==
CogoPoint: 22
== V-PTS-OG (28) ==
Circle: 8
CogoPoint: 18
Line: 2
== V-SSWR-MHOL (0) ==
== V-SSWR-PIPE (1) ==
Polyline: 1
== V-SSWR-TEXT (21) ==
DBText: 21
TEXT: DBText 'SSMH A-6 (100)'
TEXT: DBText 'R 722.67'
TEXT: DBText 'I 712.37'
TEXT: DBText 'SSMH A-5 (101)'
TEXT: DBText 'R 721.43'
TEXT: DBText 'I 699.48'
TEXT: DBText 'SSMH A-4 (102)'
TEXT: DBText 'R 691.24'
TEXT: DBText 'I 677.28'
TEXT: DBText 'SSMH A-3 (1112)'
TEXT: DBText 'R 682.93'
TEXT: DBText 'I 673.31'
TEXT: DBText 'SSMH A-2 (1113)'
TEXT: DBText 'R 688.43'
TEXT: DBText 'I 673.16'
TEXT: DBText 'SSMH A-1 (1114)'
TEXT: DBText 'R 687.02'
TEXT: DBText 'I 672.02'
TEXT: DBText 'EXISTING SSMH 106'
TEXT: DBText 'R 686.37'
TEXT: DBText 'I 671.92 (8") / 671.03 (36" REC)'
== V-WTF (36) ==
AlignedDimension: 8
CogoPoint: 20
GeneralSegmentLabel: 7
Polyline: 1Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.