C3D-0279 · 260714 Huckaby: real extents excluding origin junk, and boundary size done
READ-ONLY. Logs the drawing filename for proof, measures model extents ignoring anything at (0,0), reports the scale needed to fit the 16.34x10.34 border and a table of standard scales, and lists every closed boundary polyline with area.
C# payload
// Log the drawing name so this result is provably from the right file, then measure what the
// boundary needs and what is dragging the extents out.
Log("drawing: " + Db.Filename);
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForRead);
// ignore anything sitting at the origin - it is not real site geometry
double x0=1e30,y0=1e30,x1=-1e30,y1=-1e30;
int atOrigin = 0, counted = 0;
foreach (ObjectId id in ms) {
var ent = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
if (ent == null) continue;
double a,b,c,d;
try { var e = ent.GeometricExtents; a=e.MinPoint.X;b=e.MinPoint.Y;c=e.MaxPoint.X;d=e.MaxPoint.Y; } catch { continue; }
if (Math.Abs(a) < 1.0 && Math.Abs(b) < 1.0) { atOrigin++; continue; }
counted++;
if (a<x0)x0=a; if (b<y0)y0=b; if (c>x1)x1=c; if (d>y1)y1=d;
}
Log(string.Format("real geometry ({0} entities, {1} ignored at origin):", counted, atOrigin));
Log(string.Format(" extents ({0:F2},{1:F2})-({2:F2},{3:F2}) = {4:F1} x {5:F1} ft", x0,y0,x1,y1,x1-x0,y1-y0));
double need = Math.Max((x1-x0)/16.34, (y1-y0)/10.34);
Log(string.Format(" fits 16.34 x 10.34 in at 1\"={0:F1}' (1:{1:F0})", need, need*12));
foreach (double s in new double[]{20,30,40,50,60,80,100}) {
Log(string.Format(" 1\"={0,3:F0}' -> covers {1:F0} x {2:F0} ft fits={3}",
s, 16.34*s, 10.34*s, (x1-x0) <= 16.34*s && (y1-y0) <= 10.34*s ? "YES" : "no"));
}
Log("");
// the boundary polylines specifically
Log("--- closed polylines on SS-BOUNDARY* ---");
foreach (ObjectId id in ms) {
var pl = Tx.GetObject(id, OpenMode.ForRead) as Polyline;
if (pl == null) continue;
if (pl.Layer.ToUpper().IndexOf("BOUND") < 0) continue;
var e = pl.GeometricExtents;
Log(string.Format(" [{0}] layer={1,-22} verts={2,2} len={3:F1} closed={4} area={5:F0} sf ({6:F2} ac) ({7:F1},{8:F1})-({9:F1},{10:F1})",
pl.Handle, pl.Layer, pl.NumberOfVertices, pl.Length, pl.Closed, pl.Area, pl.Area/43560.0,
e.MinPoint.X, e.MinPoint.Y, e.MaxPoint.X, e.MaxPoint.Y));
}
Result
Log
drawing: C:\Users\sanja\OneDrive\_SurveyDisco\260714 - 285 Huckaby Rd, Brooks, GA 30205, USA\260714 - 285 Huckaby Rd.dwg
real geometry (64 entities, 8 ignored at origin):
extents (2194612.27,1200318.92)-(2209488.91,1215195.56) = 14876.6 x 14876.6 ft
fits 16.34 x 10.34 in at 1"=1438.7' (1:17265)
1"= 20' -> covers 327 x 207 ft fits=no
1"= 30' -> covers 490 x 310 ft fits=no
1"= 40' -> covers 654 x 414 ft fits=no
1"= 50' -> covers 817 x 517 ft fits=no
1"= 60' -> covers 980 x 620 ft fits=no
1"= 80' -> covers 1307 x 827 ft fits=no
1"=100' -> covers 1634 x 1034 ft fits=no
--- closed polylines on SS-BOUNDARY* ---Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.