C3D-0246 · 260714 Huckaby: trim the leftover right-edge segment in SS_BLOCK_17X11 done
Erases 20E4A, the redundant right-edge segment left at the old sheet height (13.765-16.477) which held the block extents at 16.477, and clamps the remaining right-edge line to terminate at y=11.000. Verifies the block is 17.000 x 11.000 on read-back.
C# payload
// SS_BLOCK_17X11: the right outer edge was three stacked segments (0..6.883, 6.883..13.765,
// 13.765..16.477). The first two were remapped, but 20E4A had BOTH endpoints above the panel so
// the remap left it at the old sheet height, holding the block extents at 16.477.
// The right edge only needs to reach the new top (11.000), so this segment is redundant - the
// two below it already cover 0..13.765. Trim it to close the corner at 11.000 and no further.
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);
var btr = (BlockTableRecord)Tx.GetObject(bt["SS_BLOCK_17X11"], OpenMode.ForRead);
ObjectId id;
if (!Db.TryGetObjectId(new Handle(Convert.ToInt64("20E4A", 16)), out id)) { Log("20E4A not found"); return; }
var stray = (Line)Tx.GetObject(id, OpenMode.ForWrite);
Log(string.Format("stray was ({0:F3},{1:F3})->({2:F3},{3:F3})",
stray.StartPoint.X, stray.StartPoint.Y, stray.EndPoint.X, stray.EndPoint.Y));
stray.Erase();
Log("erased 20E4A (redundant right-edge segment above the new sheet top)");
// the remaining right-edge piece must terminate exactly at the top border
foreach (ObjectId oid in btr) {
var ln = Tx.GetObject(oid, OpenMode.ForWrite) as Line;
if (ln == null) continue;
bool vertical = Math.Abs(ln.EndPoint.X - ln.StartPoint.X) < 0.001;
bool atRightEdge = Math.Abs(ln.StartPoint.X) < 0.001;
if (!vertical || !atRightEdge) continue;
double lo = Math.Min(ln.StartPoint.Y, ln.EndPoint.Y);
double hi = Math.Max(ln.StartPoint.Y, ln.EndPoint.Y);
if (hi > 11.0 || hi < 10.9) {
ln.StartPoint = new Point3d(0, lo, 0);
ln.EndPoint = new Point3d(0, 11.0, 0);
Log(string.Format("right edge [{0}] -> (0.000,{1:F3})->(0.000,11.000)", ln.Handle, lo));
}
}
// verify final extents
double bx0=1e30, by0=1e30, bx1=-1e30, by1=-1e30;
foreach (ObjectId oid in btr) {
var ent = Tx.GetObject(oid, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
if (ent == null || ent is Viewport || ent.IsErased) continue;
double x0,y0,x1,y1;
var ad = ent as AttributeDefinition;
if (ad != null) { x0=x1=ad.Position.X; y0=y1=ad.Position.Y; }
else { 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<bx0) bx0=x0; if (y0<by0) by0=y0; if (x1>bx1) bx1=x1; if (y1>by1) by1=y1;
}
Log(string.Format("BLOCK extents now ({0:F3},{1:F3})-({2:F3},{3:F3}) = {4:F3} x {5:F3} (want 17.000 x 11.000) (verified)",
bx0,by0,bx1,by1,bx1-bx0,by1-by0));
Ed.Regen();
Result
Log
stray was (-0.000,13.765)->(0.000,16.477) erased 20E4A (redundant right-edge segment above the new sheet top) right edge [20E40] -> (0.000,0.000)->(0.000,11.000) BLOCK extents now (-17.000,0.000)-(0.000,11.000) = 17.000 x 11.000 (want 17.000 x 11.000) (verified)
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.