← Inbox

C3DO-0719 · 261101 redline 7: vicinity map done

Redline item 7: the VICINITY MAP (NOT TO SCALE) label had no map. Google Static Maps roadmap, zoom 16, centred on the site (33.904947, -84.378005 from the GA West coordinates; the card has none), saved as 261101-vicinity.png beside the drawing and attached as a raster over the label on 11X17, 2.3 in square, inside the title block.

Script file
C3DO-0719.cs
Target
261101 - 5491 Roswell Rd NE.dwg · model space
Author
claude
Approved
yes · auto-auth
Timeout
60s

C# payload


string PNG=@"C:\Users\sanja\OneDrive\_SurveyDisco\261101 - Project\261101-vicinity.png";
if(!System.IO.File.Exists(PNG)){ Log("PNG missing: "+PNG+" - nothing done"); return; }
var ld=(DBDictionary)Tx.GetObject(Db.LayoutDictionaryId,OpenMode.ForRead);
var lo=(Layout)Tx.GetObject(ld.GetAt("11X17"),OpenMode.ForRead);
var ps=(BlockTableRecord)Tx.GetObject(lo.BlockTableRecordId,OpenMode.ForWrite);
DBText lbl=null; Extents3d tb=new Extents3d(); bool haveTb=false;
foreach(ObjectId id in ps){ var o=Tx.GetObject(id,OpenMode.ForRead);
 if(o is RasterImage && !(o is Wipeout)){ Log("a raster is already on 11X17 ["+((RasterImage)o).Handle+"] - nothing done"); return; }
 var t=o as DBText; if(t!=null&&t.TextString.StartsWith("VICINITY MAP")) lbl=t;
 var br=o as BlockReference; if(br!=null&&br.Name=="SS_BLOCK_11X17"){ tb=br.GeometricExtents; haveTb=true; } }
if(lbl==null||!haveTb){ Log("label or title block not found - nothing done"); return; }
var le=lbl.GeometricExtents; double S=2.30, x0=le.MinPoint.X, y0=le.MaxPoint.Y+0.06;
if(x0<tb.MinPoint.X||y0+S>tb.MaxPoint.Y||x0+S>tb.MaxPoint.X){ Log("image would leave the title block - nothing done"); return; }
var dictId=RasterImageDef.GetImageDictionary(Db); if(dictId.IsNull) dictId=RasterImageDef.CreateImageDictionary(Db);
var dict=(DBDictionary)Tx.GetObject(dictId,OpenMode.ForWrite);
const string NAME="261101-vicinity";
RasterImageDef def;
if(dict.Contains(NAME)){ def=(RasterImageDef)Tx.GetObject(dict.GetAt(NAME),OpenMode.ForWrite); def.SourceFileName=PNG; def.Load(); }
else{ def=new RasterImageDef(); def.SourceFileName=PNG; def.Load(); dict.SetAt(NAME,def); Tx.AddNewlyCreatedDBObject(def,true); }
var img=new RasterImage(); img.SetDatabaseDefaults(); img.ImageDefId=def.ObjectId; img.Layer="BLOCK_CLOSURE";
img.Orientation=new CoordinateSystem3d(new Point3d(x0,y0,0),new Vector3d(S,0,0),new Vector3d(0,S,0));
img.ShowImage=true;
ps.AppendEntity(img); Tx.AddNewlyCreatedDBObject(img,true);
img.AssociateRasterDef(def); RasterImage.EnableReactors(true);
var ie=img.GeometricExtents;
Log("item 7 vicinity map placed over the label: x "+ie.MinPoint.X.ToString("F2")+"-"+ie.MaxPoint.X.ToString("F2")+" y "+ie.MinPoint.Y.ToString("F2")+"-"+ie.MaxPoint.Y.ToString("F2")+", inside the title block (verified) ["+img.Handle+"]");
Ed.Regen();

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\261101 - Project\261101 - 5491 Roswell Rd NE.dwg
Message
Executed C3DO-0719 (0 entities touched).
Entities
—
Duration
517 ms
Civil 3D
25.0.0.0

Log

item 7 vicinity map placed over the label: x 0.66-2.96 y 3.52-5.82, inside the title block (verified) [214A0]

Notes

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

No notes yet.