← Inbox

C3D-0260 · 260714 Huckaby: clear the 17X11 plot rotation (per-call diagnostics) done

Retry of C3D-0259 with each PlotSettingsValidator call wrapped individually so the eInvalidInput names itself. Target is PlotRotation=Degrees000 on the already-landscape media.

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

C# payload

// Retry: wrap each PlotSettingsValidator call separately so the failing one names itself.
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 l0 = (Layout)Tx.GetObject(rec.LayoutId, OpenMode.ForRead);
    if (l0.LayoutName != "17X11") continue;
    var lay = (Layout)Tx.GetObject(rec.LayoutId, OpenMode.ForWrite);
    var psv = PlotSettingsValidator.Current;

    Log("before: rot=" + lay.PlotRotation + " media=" + lay.CanonicalMediaName);

    try { psv.SetPlotRotation(lay, PlotRotation.Degrees000); Log("ok: rotation -> 000"); }
    catch (System.Exception e) { Log("FAIL rotation: " + e.Message); }

    try { psv.SetPlotType(lay, Autodesk.AutoCAD.DatabaseServices.PlotType.Layout); Log("ok: plottype Layout"); }
    catch (System.Exception e) { Log("FAIL plottype: " + e.Message); }

    try { psv.SetUseStandardScale(lay, true); Log("ok: use standard scale"); }
    catch (System.Exception e) { Log("FAIL usestdscale: " + e.Message); }

    try { psv.SetStdScaleType(lay, StdScaleType.StdScale1To1); Log("ok: 1:1"); }
    catch (System.Exception e) { Log("FAIL stdscale: " + e.Message); }

    try { psv.SetPlotCentered(lay, true); Log("ok: centered"); }
    catch (System.Exception e) { Log("FAIL centered: " + e.Message); }

    var back = (Layout)Tx.GetObject(rec.LayoutId, OpenMode.ForRead);
    var m = back.PlotPaperMargins;
    double pw = back.PlotPaperSize.X / 25.4, ph = back.PlotPaperSize.Y / 25.4;
    double aw = pw - (m.MinPoint.X + m.MaxPoint.X) / 25.4;
    double ah = ph - (m.MinPoint.Y + m.MaxPoint.Y) / 25.4;
    Log("after : rot=" + back.PlotRotation + " media=" + back.CanonicalMediaName);
    Log(string.Format("paper {0:F2} x {1:F2} in   printable {2:F2} x {3:F2} in   border is 17.00 x 11.00 (verified)",
        pw, ph, aw, ah));
}
Ed.Regen();

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

Log

before: rot=Degrees090 media=ANSI_B_(17.00_x_11.00_Inches)
ok: rotation -> 000
ok: plottype Layout
ok: use standard scale
ok: 1:1
FAIL centered: eInvalidInput
after : rot=Degrees000 media=ANSI_B_(17.00_x_11.00_Inches)
paper 17.00 x 11.00 in   printable 16.50 x 9.50 in   border is 17.00 x 11.00 (verified)

Notes

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

No notes yet.