C3D-0280 · 260714 Huckaby: find the oversized entity and measure the real site done
READ-ONLY. Lists every model entity larger than 2000 ft, and measures the extents of the CogoPoints alone (the actual surveyed site) with the scale needed to fit the border.
C# payload
Log("drawing: " + Db.Filename);
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForRead);
int total = 0;
var big = new List<string>();
double px0=1e30,py0=1e30,px1=-1e30,py1=-1e30; // extents of the COGO POINTS only
foreach (ObjectId id in ms) {
var ent = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
if (ent == null) continue;
total++;
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; }
double w = c-a, h = d-b;
var cp = ent as CogoPoint;
if (cp != null) {
double px = cp.Easting, py = cp.Northing;
if (px<px0)px0=px; if (py<py0)py0=py; if (px>px1)px1=px; if (py>py1)py1=py;
}
if (w > 2000 || h > 2000)
big.Add(string.Format(" {0,-14} layer={1,-26} {2:F0} x {3:F0} ft ({4:F1},{5:F1})-({6:F1},{7:F1})",
ent.GetType().Name, ent.Layer, w, h, a,b,c,d));
}
Log("model entities: " + total);
Log("");
Log("--- anything bigger than 2000 ft ---");
foreach (var s in big) Log(s);
Log("count: " + big.Count);
Log("");
Log(string.Format("COGO POINT extents ({0:F2},{1:F2})-({2:F2},{3:F2}) = {4:F1} x {5:F1} ft",
px0,py0,px1,py1,px1-px0,py1-py0));
double need = Math.Max((px1-px0)/16.34, (py1-py0)/10.34);
Log(string.Format("the SURVEYED SITE fits the border at 1\"={0:F1}'", need));
foreach (double s in new double[]{20,30,40,50,60}) {
Log(string.Format(" 1\"={0,3:F0}' covers {1:F0} x {2:F0} ft fits={3}",
s, 16.34*s, 10.34*s, (px1-px0)<=16.34*s && (py1-py0)<=10.34*s ? "YES" : "no"));
}
Result
Log
drawing: C:\Users\sanja\OneDrive\_SurveyDisco\260714 - 285 Huckaby Rd, Brooks, GA 30205, USA\260714 - 285 Huckaby Rd.dwg model entities: 37 --- anything bigger than 2000 ft --- count: 0 COGO POINT extents (1000000000000000019884624838656.00,1000000000000000019884624838656.00)-(-1000000000000000019884624838656.00,-1000000000000000019884624838656.00) = -2000000000000000039769249677312.0 x -2000000000000000039769249677312.0 ft the SURVEYED SITE fits the border at 1"=-122399020807833545062595166208.0' 1"= 20' covers 327 x 207 ft fits=YES 1"= 30' covers 490 x 310 ft fits=YES 1"= 40' covers 654 x 414 ft fits=YES 1"= 50' covers 817 x 517 ft fits=YES 1"= 60' covers 980 x 620 ft fits=YES
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.