C3D-0253 · 260714 Huckaby: audit the 17X11 sheet against 11X17 done
READ-ONLY. Compares both block definitions (extents, entity counts, stray viewports) and both layouts (media, rotation, paper size, viewports with scale/lock, blocks, all paper-space text) to find what is missing or wrong on the new landscape sheet.
C# payload
// Full audit of the 17X11 sheet vs the 11X17 sheet it was cloned from.
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);
// ---------- 1. block definition contents
foreach (string bn in new[] { "SS_BLOCK_11X17", "SS_BLOCK_17X11" }) {
if (!bt.Has(bn)) { Log(bn + " MISSING"); continue; }
var btr = (BlockTableRecord)Tx.GetObject(bt[bn], OpenMode.ForRead);
int vps = 0, lines = 0, texts = 0, attrs = 0, other = 0;
double x0=1e30,y0=1e30,x1=-1e30,y1=-1e30;
foreach (ObjectId id in btr) {
var ent = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
if (ent == null) continue;
if (ent is Viewport) { vps++; continue; }
if (ent is Line) lines++;
else if (ent is DBText || ent is MText) texts++;
else if (ent is AttributeDefinition) attrs++;
else other++;
var ad = ent as AttributeDefinition;
double a,b,c,d;
if (ad != null) { a=c=ad.Position.X; b=d=ad.Position.Y; }
else { try { var e=ent.GeometricExtents; a=e.MinPoint.X;b=e.MinPoint.Y;c=e.MaxPoint.X;d=e.MaxPoint.Y; } catch { continue; } }
if (a<x0)x0=a; if (b<y0)y0=b; if (c>x1)x1=c; if (d>y1)y1=d;
}
Log(string.Format("{0}: extents ({1:F3},{2:F3})-({3:F3},{4:F3}) = {5:F3} x {6:F3} lines={7} text={8} attrs={9} other={10} STRAY-VIEWPORTS={11}",
bn, x0,y0,x1,y1, x1-x0, y1-y0, lines, texts, attrs, other, vps));
}
// ---------- 2. layouts
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 != "11X17" && lay.LayoutName != "17X11") continue;
Log("");
Log("=== " + lay.LayoutName + " === media=" + lay.CanonicalMediaName + " ctb=" + lay.CurrentStyleSheet
+ " rot=" + lay.PlotRotation + " type=" + lay.PlotType);
var margins = lay.PlotPaperMargins;
var psize = lay.PlotPaperSize;
Log(string.Format(" paper size {0:F3} x {1:F3}", psize.X, psize.Y));
int ents = 0;
foreach (ObjectId id in rec) {
var o = Tx.GetObject(id, OpenMode.ForRead);
ents++;
var vp = o as Viewport;
if (vp != null) {
double sc = 0; try { sc = vp.CustomScale; } catch { }
Log(string.Format(" VP#{0} on={1} locked={2} paper=({3:F3},{4:F3}) {5:F3}x{6:F3} view=({7:F2},{8:F2}) h={9:F2} 1\"={10:F2}'",
vp.Number, vp.On, vp.Locked, vp.CenterPoint.X, vp.CenterPoint.Y, vp.Width, vp.Height,
vp.ViewCenter.X, vp.ViewCenter.Y, vp.ViewHeight, sc>0?1.0/sc:0));
continue;
}
var br = o as BlockReference;
if (br != null) {
var e = br.GeometricExtents;
Log(string.Format(" BLOCK {0} at ({1:F3},{2:F3}) ext ({3:F3},{4:F3})-({5:F3},{6:F3}) attrs={7}",
br.Name, br.Position.X, br.Position.Y, e.MinPoint.X,e.MinPoint.Y,e.MaxPoint.X,e.MaxPoint.Y,
br.AttributeCollection.Count));
continue;
}
var mt = o as MText;
if (mt != null) { Log(string.Format(" MTEXT ({0:F2},{1:F2}) \"{2}\"", mt.Location.X, mt.Location.Y,
mt.Contents.Replace("\n"," ").Substring(0, Math.Min(40, mt.Contents.Length)))); continue; }
var dt = o as DBText;
if (dt != null) { Log(string.Format(" TEXT ({0:F2},{1:F2}) \"{2}\"", dt.Position.X, dt.Position.Y, dt.TextString)); continue; }
}
Log(" total entities: " + ents);
}
Result
Log
SS_BLOCK_11X17: extents (-10.650,0.000)-(0.000,16.477) = 10.650 x 16.477 lines=85 text=23 attrs=0 other=0 STRAY-VIEWPORTS=1 SS_BLOCK_17X11: extents (-17.000,0.000)-(0.000,11.000) = 17.000 x 11.000 lines=84 text=23 attrs=0 other=0 STRAY-VIEWPORTS=1 === 17X11 === media=ANSI_full_bleed_B ctb=monochrome.ctb rot=Degrees090 type=Layout paper size 279.400 x 431.800 BLOCK SS_BLOCK_17X11 at (17.290,0.290) ext (0.290,0.290)-(17.290,11.290) attrs=13 VP#1 on=True locked=False paper=(10.815,7.698) 29.447x17.191 view=(10.85,7.76) h=17.37 1"=1.01' VP#2 on=True locked=True paper=(8.790,7.173) 16.914x8.147 view=(2089122.64,1226671.03) h=80462.18 1"=9876.30' total entities: 3 === 11X17 === media=ANSI_full_bleed_B_(11.00_x_17.00_Inches) ctb=monochrome.ctb rot=Degrees000 type=Layout paper size 279.400 x 431.800 VP#-1 on=True locked=False paper=(13.826,10.022) 37.125x21.673 view=(13.83,10.02) h=21.67 1"=1.00' TEXT (10.57,13.45) "GA W.GRID" MTEXT (7.82,7.43) "NOTE: PROPERTY LINES SHOWN ON THIS SURVE" TEXT (8.35,4.11) "Call FREE" TEXT (8.35,3.92) "325-5000" TEXT (7.80,4.21) "UTILITIES PROTECTION CENTER" TEXT (8.34,3.78) "THROUGHOUT GEORGIA" TEXT (8.35,4.01) "IN METRO ATLANTA" TEXT (8.34,3.69) "1-800-282-7411" TEXT (7.82,3.55) "THREE WORKING DAYS BEFORE YOU DIG" MTEXT (7.80,5.04) "FIELD CLOSURE=1'IN 20,000+ \PANGLE POINT" VP#-1 on=True locked=True paper=(5.492,8.519) 10.549x16.373 view=(1036448.40,465018.49) h=532.00 1"=32.49' BLOCK SS_LEGEND at (10.818,13.153) ext (7.590,13.371)-(10.294,16.578) attrs=0 TEXT (0.65,3.39) "VICINITY MAP (NOT TO SCALE)" BLOCK SS_BLOCK_11X17 at (10.815,0.287) ext (0.165,0.287)-(10.815,16.765) attrs=13 total entities: 141
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.