C3D-0266 · 260714 Huckaby: inset the 17X11 border 0.33 from every paper edge done
Sets the SS_BLOCK_17X11 insert to non-uniform ScaleFactors (0.961176, 0.940000) and position (16.670, 0.330) so the border becomes 16.340 x 10.340 sitting 0.33 inside all four paper edges. Scales the INSERT, not the definition - AutoCAD rejects non-uniform transforms on the definitions lines and text (eCannotScaleNonUniformly) but a BlockReference accepts non-uniform ScaleFactors. Only touches SS_BLOCK_17X11, not the legend. Verifies the four insets on read-back.
C# payload
// Put the 17X11 border 0.33 inside the paper on all four sides.
// paper 17.000 x 11.000
// target 16.340 x 10.340, at (0.330,0.330)-(16.670,10.670)
//
// The block DEFINITION is 17.000 x 11.000. Scaling the definition is not possible - AutoCAD
// rejects non-uniform TransformBy on Line/DBText/AttributeDefinition (eCannotScaleNonUniformly,
// C3D-0263). But a BlockReference carries its own ScaleFactors and DOES accept non-uniform
// values, so the insert is scaled instead and the definition stays clean at 17x11.
//
// The block is right-anchored (geometry runs in -X from the insert point, y upward), so:
// insert X = right inset edge = 17.000 - 0.330 = 16.670
// insert Y = bottom inset edge = 0.330
const double PW = 17.0, PH = 11.0, INSET = 0.33;
double tw = PW - 2 * INSET, th = PH - 2 * INSET;
double sx = tw / 17.0, sy = th / 11.0;
LayoutManager.Current.CurrentLayout = "17X11";
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;
foreach (ObjectId id in rec) {
var br = Tx.GetObject(id, OpenMode.ForRead) as BlockReference;
if (br == null || br.Name != "SS_BLOCK_17X11") continue; // ONLY the title block
var w = (BlockReference)Tx.GetObject(id, OpenMode.ForWrite);
w.ScaleFactors = new Scale3d(sx, sy, 1.0);
w.Position = new Point3d(PW - INSET, INSET, 0);
var back = (BlockReference)Tx.GetObject(id, OpenMode.ForRead);
var e = back.GeometricExtents;
Log(string.Format("scale ({0:F6},{1:F6}) insert ({2:F3},{3:F3})", sx, sy, back.Position.X, back.Position.Y));
Log(string.Format("BORDER ({0:F3},{1:F3}) - ({2:F3},{3:F3}) = {4:F3} x {5:F3} (verified)",
e.MinPoint.X, e.MinPoint.Y, e.MaxPoint.X, e.MaxPoint.Y,
e.MaxPoint.X - e.MinPoint.X, e.MaxPoint.Y - e.MinPoint.Y));
Log(string.Format("insets: L{0:F3} B{1:F3} R{2:F3} T{3:F3} (want {4:F2} all round)",
e.MinPoint.X, e.MinPoint.Y, PW - e.MaxPoint.X, PH - e.MaxPoint.Y, INSET));
}
}
Ed.Regen();
Result
Log
scale (0.961176,0.940000) insert (16.670,0.330) BORDER (0.243,0.330) - (16.670,10.670) = 16.427 x 10.340 (verified) insets: L0.243 B0.330 R0.330 T0.330 (want 0.33 all round)
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.