← Inbox

C3D-0265 · 260714 Huckaby: where is the paper vs the border on 17X11 done

READ-ONLY. Reports the printable area and the paper edges in layout coordinates alongside the block and viewport extents, to see exactly how far the border overhangs.

Script file
C3D-0265.cs
Target
260714 - 285 Huckaby Rd.dwg · model space
Author
claude
Approved
yes · auto-auth
Timeout
60s

C# payload

// Exactly where is the paper, and where is the border? Report both in the SAME coordinate space.
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;

    var m = lay.PlotPaperMargins;
    double pw = lay.PlotPaperSize.X / 25.4, ph = lay.PlotPaperSize.Y / 25.4;
    double ml = m.MinPoint.X / 25.4, mb = m.MinPoint.Y / 25.4;
    double mr = m.MaxPoint.X / 25.4, mt = m.MaxPoint.Y / 25.4;
    Log("media   : " + lay.CanonicalMediaName + "  rot=" + lay.PlotRotation);
    Log(string.Format("paper   : {0:F3} x {1:F3} in", pw, ph));
    Log(string.Format("margins : L{0:F3} B{1:F3} R{2:F3} T{3:F3} in", ml, mb, mr, mt));
    Log(string.Format("PRINTABLE AREA in layout coords: ({0:F3},{1:F3}) - ({2:F3},{3:F3})  = {4:F3} x {5:F3}",
        0.0, 0.0, pw - ml - mr, ph - mb - mt, pw - ml - mr, ph - mb - mt));
    Log("   (layout origin 0,0 is the LOWER-LEFT of the PRINTABLE area, not the paper)");
    Log(string.Format("   so the paper edges are at x {0:F3}..{1:F3}, y {2:F3}..{3:F3}",
        -ml, pw - ml, -mb, ph - mb));
    Log("");
    foreach (ObjectId id in rec) {
        var ent = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
        if (ent == null) continue;
        var br = ent as BlockReference;
        var vp = ent as Viewport;
        if (br == null && vp == null) continue;
        try {
            var e = ent.GeometricExtents;
            string nm = br != null ? ("BLOCK " + br.Name) : ("VIEWPORT#" + vp.Number);
            Log(string.Format("{0,-24} ({1:F3},{2:F3}) - ({3:F3},{4:F3})", nm,
                e.MinPoint.X, e.MinPoint.Y, e.MaxPoint.X, e.MaxPoint.Y));
        } catch { }
    }
}

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260714 - 285 Huckaby Rd, Brooks, GA 30205, USA\260714 - 285 Huckaby Rd.dwg
Message
Executed C3D-0265 (0 entities touched).
Entities
Duration
327 ms
Civil 3D
25.0.0.0

Log

media   : ANSI_B_(17.00_x_11.00_Inches)  rot=Degrees000
paper   : 17.000 x 11.000 in
margins : L0.250 B0.750 R0.250 T0.750 in
PRINTABLE AREA in layout coords: (0.000,0.000) - (16.500,9.500)  = 16.500 x 9.500
   (layout origin 0,0 is the LOWER-LEFT of the PRINTABLE area, not the paper)
   so the paper edges are at x -0.250..16.750, y -0.750..10.250

BLOCK SS_BLOCK_17X11     (0.000,0.000) - (17.000,11.000)
VIEWPORT#1               (-4.031,-0.921) - (25.724,16.449)
VIEWPORT#2               (0.333,3.100) - (19.470,13.416)
BLOCK SS_LEGEND          (14.091,7.771) - (16.795,10.979)

Notes

What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.

No notes yet.