← Inbox

C3D-0481 · Find VICINITY label + TB frame + rasters 260904 (read-only) [C3D-0483] done

Locate the VICINITY MAP label, title-block extents, and any existing raster on each layout to place the vicinity map.

Script file
C3D-0481.cs
Target
260904 - 920 W Sandtown Rd SW.dwg · model space
Author
claude
Approved
yes · auto-auth
Timeout
60s

C# payload


var lm=(DBDictionary)Tx.GetObject(Db.LayoutDictionaryId,OpenMode.ForRead);
foreach(System.Collections.DictionaryEntry de in lm){ string ln=(string)de.Key; if(ln=="Model") continue; var lay=(Layout)Tx.GetObject((ObjectId)de.Value,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;
    if(e is DBText t && t.TextString.ToUpper().Contains("VICINITY")){ var ext=t.GeometricExtents; Log(ln+" VICINITY DBText '"+t.TextString+"' ext="+ext.MinPoint.X.ToString("F3")+","+ext.MinPoint.Y.ToString("F3")+" -> "+ext.MaxPoint.X.ToString("F3")+","+ext.MaxPoint.Y.ToString("F3")); }
    if(e is MText m && m.Contents.ToUpper().Contains("VICINITY")){ var ext=m.GeometricExtents; Log(ln+" VICINITY MText '"+m.Contents+"' ext="+ext.MinPoint.X.ToString("F3")+","+ext.MinPoint.Y.ToString("F3")+" -> "+ext.MaxPoint.X.ToString("F3")+","+ext.MaxPoint.Y.ToString("F3")); }
    if(e is BlockReference br){ var bd=(BlockTableRecord)Tx.GetObject(br.BlockTableRecord,OpenMode.ForRead); if(bd.Name.IndexOf("SS_BLOCK",StringComparison.OrdinalIgnoreCase)>=0){ try{ var ext=br.GeometricExtents; Log(ln+" TB '"+bd.Name+"' ext="+ext.MinPoint.X.ToString("F3")+","+ext.MinPoint.Y.ToString("F3")+" -> "+ext.MaxPoint.X.ToString("F3")+","+ext.MaxPoint.Y.ToString("F3")); }catch{} } }
    if(e is RasterImage ri){ Log(ln+" EXISTING RASTER handle="+ri.Handle); }
  }
}

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260904 - 920 W Sandtown Rd SW, Marietta, GA 30064, USA\260904 - 920 W Sandtown Rd SW.dwg
Message
Executed C3D-0481 (0 entities touched).
Entities
Duration
393 ms
Civil 3D
25.0.0.0

Log

11X17 TB 'SS_BLOCK_11X17' ext=0.165,0.287 -> 10.815,16.765
11X17 VICINITY DBText 'VICINITY MAP (NOT TO SCALE)' ext=8.603,4.493 -> 9.944,4.580
HOUSEDIM VICINITY DBText 'VICINITY MAP (NOT TO SCALE)' ext=1.184,3.570 -> 2.972,3.686

Notes

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

No notes yet.