C3DO-0846 · 261103 title block: read attribute boxes + PREP_FOR row (read-only) [C3D-TBY] done
Read-only: attribute extents and the title block dividers / text on the PREP FOR row.
C# payload
string F(double v)=>v.ToString("0.###");
ObjectId H(string h)=>Db.GetObjectId(false,new Handle(Convert.ToInt64(h,16)),0);
ObjectId Lyr(string name,short c){ var lt=(LayerTable)Tx.GetObject(Db.LayerTableId,OpenMode.ForRead); if(lt.Has(name)) return lt[name]; lt.UpgradeOpen(); var r=new LayerTableRecord{Name=name,Color=Autodesk.AutoCAD.Colors.Color.FromColorIndex(Autodesk.AutoCAD.Colors.ColorMethod.ByAci,c)}; var id=lt.Add(r); Tx.AddNewlyCreatedDBObject(r,true); Log("layer created "+name); return id; }
ObjectId Put(BlockTableRecord btr, Autodesk.AutoCAD.DatabaseServices.Entity e, string layer){ e.SetDatabaseDefaults(Db); e.Layer=layer; var id=btr.AppendEntity(e); Tx.AddNewlyCreatedDBObject(e,true); return id; }
var LM=LayoutManager.Current;
BlockTableRecord PS(string name){ var l=(Layout)Tx.GetObject(LM.GetLayoutId(name),OpenMode.ForRead); return (BlockTableRecord)Tx.GetObject(l.BlockTableRecordId,OpenMode.ForWrite); }
var BT=(BlockTable)Tx.GetObject(Db.BlockTableId,OpenMode.ForRead);
var MS=(BlockTableRecord)Tx.GetObject(BT[BlockTableRecord.ModelSpace],OpenMode.ForWrite);
bool HasText(BlockTableRecord btr,string contains){ foreach(ObjectId id in btr){ var o=Tx.GetObject(id,OpenMode.ForRead); if(o is MText m && m.Contents.Contains(contains)) return true; if(o is DBText t && t.TextString.Contains(contains)) return true; } return false; }
// read-only: title block attribute boxes + the block definition's line work near the PREP_FOR row
var br=(BlockReference)Tx.GetObject(H("20355"),OpenMode.ForRead);
foreach(ObjectId aid in br.AttributeCollection){ var a=(AttributeReference)Tx.GetObject(aid,OpenMode.ForRead); var x=a.GeometricExtents; Log(a.Tag+" x "+F(x.MinPoint.X)+"-"+F(x.MaxPoint.X)+" y "+F(x.MinPoint.Y)+"-"+F(x.MaxPoint.Y)+" h "+F(a.Height)); }
var pf=br.AttributeCollection.Cast<ObjectId>().Select(i=>(AttributeReference)Tx.GetObject(i,OpenMode.ForRead)).First(a=>a.Tag=="PREP_FOR"); var px=pf.GeometricExtents;
var def=(BlockTableRecord)Tx.GetObject(br.BlockTableRecord,OpenMode.ForRead); var m=br.BlockTransform;
foreach(ObjectId id in def){ var e=Tx.GetObject(id,OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity; if(e==null) continue;
if(e is Line l){ var s=l.StartPoint.TransformBy(m); var t=l.EndPoint.TransformBy(m); if(Math.Abs(s.X-t.X)<0.01 && Math.Min(s.Y,t.Y)<px.MaxPoint.Y && Math.Max(s.Y,t.Y)>px.MinPoint.Y) Log("vertical divider x "+F(s.X)+" y "+F(Math.Min(s.Y,t.Y))+"-"+F(Math.Max(s.Y,t.Y))); }
string txt=e is DBText d?d.TextString:(e is MText mt?mt.Contents:null); if(txt!=null){ try{ var x=e.GeometricExtents; var a=x.MinPoint.TransformBy(m); var b=x.MaxPoint.TransformBy(m); if(a.Y<px.MaxPoint.Y+0.05 && b.Y>px.MinPoint.Y-0.05) Log("def text x "+F(a.X)+"-"+F(b.X)+" y "+F(a.Y)+"-"+F(b.Y)+" | "+txt); }catch{} } }
Result
Log
JOB_NO x 5.718-7.229 y 1.352-1.468 h 0.117 SITE_ADDRESS x 0.679-4.651 y 2.118-2.274 h 0.117 REF_DB_PG x 0.683-2.722 y 1.299-1.455 h 0.117 LAND_LOT x 3.191-4.447 y 1.888-2.005 h 0.117 DISTRICT x 3.195-4.473 y 1.622-1.739 h 0.117 COUNTY x 3.188-4.544 y 1.3-1.455 h 0.117 DATE x 5.742-7.18 y 1.838-2.016 h 0.117 SUBDIVISION_NAME_LOT x 5.555-8.01 y 2.139-2.256 h 0.117 PREP_FOR x 0.736-6.257 y 2.524-2.674 h 0.15 SURVEY_TYPE x 0.65-3.717 y 3.108-3.308 h 0.2 FIRM_PANEL x 7.724-8.279 y 3.032-3.097 h 0.055 FIRM_DATE x 8.33-9.558 y 3.031-3.096 h 0.055 FLOOD_ZONE x 9.788-10.657 y 3.041-3.096 h 0.055 def text x 7.032-10.615 y 2.462-2.832 | ALL MATTERS OF TITLE ARE EXCEPTED. THIS PLAT IS SUBJECT TO ALL LEGAL EASEMENTS AND RIGHTS-OF-WAY PUBLIC OR PRIVATE. vertical divider x 6.919 y 2.338-2.998 vertical divider x 4.889 y 2.609-2.742 vertical divider x 4.639 y 2.582-2.615 vertical divider x 4.639 y 2.609-2.742 vertical divider x 5.389 y 2.609-2.742 vertical divider x 5.639 y 2.575-2.742 vertical divider x 5.139 y 2.575-2.742 def text x 4.587-6.771 y 2.442-2.547 | 50 25 0 50 vertical divider x 6.639 y 2.575-2.609 vertical divider x 6.639 y 2.609-2.742 vertical divider x 0.617 y 0.331-2.998 vertical divider x 10.815 y 0.287-7.17 vertical divider x 10.772 y 0.331-16.721 vertical divider x 0.165 y 0.287-16.765
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.