C3D-0273 · 260714 Huckaby: what is still off the 17X11 paper done
READ-ONLY. Lists every entity whose extents fall outside the paper bounds.
C# payload
// What is off the paper on 17X11? Paper x -0.250..16.750, y -0.750..10.250.
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);
foreach (ObjectId btrId in bt) {
var rec = (BlockTableRecord)Tx.GetObject(btrId, OpenMode.ForRead);
if (!rec.IsLayout) continue;
var lay = (Layout)Tx.GetObject(rec.LayoutId, OpenMode.ForRead);
if (lay.LayoutName != "17X11") continue;
int off = 0;
foreach (ObjectId id in rec) {
var ent = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
if (ent == null) continue;
var vp = ent as Viewport;
if (vp != null && vp.Number == 1) continue;
double x0,y0,x1,y1;
try { var e = ent.GeometricExtents; x0=e.MinPoint.X;y0=e.MinPoint.Y;x1=e.MaxPoint.X;y1=e.MaxPoint.Y; }
catch { continue; }
if (x0 >= -0.251 && x1 <= 16.751 && y0 >= -0.751 && y1 <= 10.251) continue;
off++;
string what = ent.GetType().Name;
var br = ent as BlockReference; if (br != null) what = "BLOCK " + br.Name;
var mt = ent as MText; if (mt != null) what = "MTEXT \"" + mt.Contents.Replace("\n"," ").Substring(0,Math.Min(30,mt.Contents.Length)) + "\"";
var dt = ent as DBText; if (dt != null) what = "TEXT \"" + dt.TextString + "\"";
if (vp != null) what = "VIEWPORT#" + vp.Number;
if (off <= 30) Log(string.Format("OFF [{0}] {1,-40} ({2:F3},{3:F3})-({4:F3},{5:F3}) layer={6}",
ent.Handle, what, x0,y0,x1,y1, ent.Layer));
}
Log("total off-paper: " + off);
}
Result
Log
OFF [20E73] VIEWPORT#2 (0.083,2.350)-(19.220,12.666) layer=BLOCK_TB2 OFF [20E86] Line (6.467,-0.417)-(17.033,-0.417) layer=TB1 OFF [20EC6] MTEXT "FIELD CLOSURE=1'IN 20,000+ \PA" (14.055,3.438)-(16.920,4.292) layer=BLOCK_CLOSURE OFF [20ECD] Polyline2d (16.541,8.035)-(16.807,8.728) layer=BLOCK_NORTH_ARROW OFF [20EE4] TEXT "GA W.GRID" (16.742,7.109)-(16.818,7.760) layer=BLOCK_NORTH_ARROW OFF [20F09] Polyline2d (16.551,8.847)-(16.818,9.540) layer=BLOCK_NORTH_ARROW OFF [20F2A] Polyline2d (16.675,8.752)-(16.871,8.865) layer=BLOCK_NORTH_ARROW OFF [20F3A] Polyline2d (16.643,8.167)-(16.756,8.660) layer=BLOCK_NORTH_ARROW OFF [20F76] Polyline2d (16.675,8.816)-(16.829,8.902) layer=BLOCK_NORTH_ARROW total off-paper: 9
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.