C3D-0487 · Find ELEV text incl blocks 260904 (read-only) [C3D-0489] done
Search paper space and nested blocks for ELEV text (legend typo).
C# payload
var lmgr=LayoutManager.Current; var lay=(Layout)Tx.GetObject(lmgr.GetLayoutId("11X17"),OpenMode.ForRead); var ps=(BlockTableRecord)Tx.GetObject(lay.BlockTableRecordId,OpenMode.ForRead);
foreach(ObjectId eid in ps){
var e=Tx.GetObject(eid,OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
string s=null; if(e is DBText t) s=t.TextString; else if(e is MText m) s=m.Contents;
if(s!=null && s.ToUpper().Contains("ELEV")) Log(e.GetType().Name+" h="+e.Handle+" '"+s+"'");
// also nested block (legend may be a block)
if(e is BlockReference br){ var bd=(BlockTableRecord)Tx.GetObject(br.BlockTableRecord,OpenMode.ForRead); foreach(ObjectId nid in bd){ var ne=Tx.GetObject(nid,OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity; string ns=null; if(ne is DBText nt) ns=nt.TextString; else if(ne is MText nm) ns=nm.Contents; if(ns!=null && ns.ToUpper().Contains("ELEV")) Log(" in block "+bd.Name+": "+ne.GetType().Name+" h="+ne.Handle+" '"+ns+"'"); } }
}
Result
Log
in block SS_LEGEND: MText h=2135C 'IPF IRON PIN FOUND \PIPP IRON PIN PROPOSED\PR/W RIGHT OF WAY\PRWM RIGHT OF WAY MARKER \PMAG MAGNETIC \PPOB POINT OF BEGINNING\PPOC POINT OF COMMENCEMENT\PB/L BUILDING LINE \PD.E. DRAINAGE EASEMENT\PN/F NOW OR FORMERLY \PL.L. LAND LOT\PPP POWER POLE \P DROP INLET\P WATER VALVE\P SEWER MANHOLE\P FIRE HYDRANT\P ELEVATION POINT\P PROPERTY CORNER\P FENCE'
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.