← Inbox

C3D-0270 · 260714 Huckaby: confirm the 17X11 border sits on the paper done

READ-ONLY. Transforms the four sheet-border lines from the block definition into sheet coordinates and checks each against the 17x11 paper bounds.

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

C# payload

// Final check: the four border lines in SHEET coordinates vs the 17x11 paper.
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;
    Log("paper: " + lay.CanonicalMediaName + string.Format("  {0:F2} x {1:F2} in  rot={2}",
        lay.PlotPaperSize.X/25.4, lay.PlotPaperSize.Y/25.4, lay.PlotRotation));

    foreach (ObjectId id in rec) {
        var br = Tx.GetObject(id, OpenMode.ForRead) as BlockReference;
        if (br == null || br.Name != "SS_BLOCK_17X11") continue;
        var xform = br.BlockTransform;
        var d = (BlockTableRecord)Tx.GetObject(br.BlockTableRecord, OpenMode.ForRead);
        Log(string.Format("insert ({0:F3},{1:F3}) scale ({2:F4},{3:F4})",
            br.Position.X, br.Position.Y, br.ScaleFactors.X, br.ScaleFactors.Y));
        Log("");
        Log("--- the 4 sheet-border lines, in SHEET coordinates ---");
        foreach (string h in new[] { "20E42", "20E43", "20DEF" }) {
            ObjectId lid;
            if (!Db.TryGetObjectId(new Handle(Convert.ToInt64(h, 16)), out lid)) continue;
            var ln = Tx.GetObject(lid, OpenMode.ForRead) as Line;
            if (ln == null) continue;
            var s = ln.StartPoint.TransformBy(xform);
            var e = ln.EndPoint.TransformBy(xform);
            bool onPage = s.X >= -0.001 && s.X <= 17.001 && e.X >= -0.001 && e.X <= 17.001
                       && s.Y >= -0.001 && s.Y <= 11.001 && e.Y >= -0.001 && e.Y <= 11.001;
            Log(string.Format("[{0}] ({1:F3},{2:F3}) -> ({3:F3},{4:F3})   ON PAGE: {5}",
                h, s.X, s.Y, e.X, e.Y, onPage ? "YES" : "NO"));
        }
        // the right edge
        foreach (ObjectId oid in d) {
            var ln = Tx.GetObject(oid, OpenMode.ForRead) as Line;
            if (ln == null) continue;
            if (Math.Abs(ln.StartPoint.X) > 0.001 || Math.Abs(ln.EndPoint.X) > 0.001) continue;
            var s = ln.StartPoint.TransformBy(xform);
            var e = ln.EndPoint.TransformBy(xform);
            Log(string.Format("[{0}] ({1:F3},{2:F3}) -> ({3:F3},{4:F3})   right edge",
                ln.Handle, s.X, s.Y, e.X, e.Y));
        }
    }
}

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-0270 (0 entities touched).
Entities
Duration
851 ms
Civil 3D
25.0.0.0

Log

paper: ANSI_B_(17.00_x_11.00_Inches)  17.00 x 11.00 in  rot=Degrees000
insert (16.670,0.330) scale (1.0000,1.0000)

--- the 4 sheet-border lines, in SHEET coordinates ---
[20E42] (0.330,0.330) -> (16.670,0.330)   ON PAGE: YES
[20E43] (0.330,10.670) -> (0.330,0.330)   ON PAGE: YES
[20DEF] (0.330,10.670) -> (16.670,10.670)   ON PAGE: YES
[20E40] (16.670,0.330) -> (16.670,10.670)   right edge
[20E49] (16.670,6.800) -> (16.670,10.630)   right edge

Notes

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

No notes yet.