← Inbox

C3D-0172 · READ-ONLY: layout plot settings, viewports and title block [LAY-READ] done

Reports every layout with its plot device, paper size, rotation, units, margins, origin and scale, plus each viewport centre, size, view centre, view height, scale, twist and lock state, and every block insert with position and rotation, as the basis for building a landscape twin. No changes.

Script file
C3D-0172.cs
Target
260714 · paper space
Author
claude
Approved
yes · reviewer
Timeout
240s

C# payload

// READ-ONLY. Everything needed to build a landscape twin of the 11X17 layout:
// plot settings (device, paper size, units, rotation, origin, scale), the viewport(s) with their
// centre/size/scale/frozen state, and the title block insert. Nothing is modified.
var dict = (DBDictionary)Tx.GetObject(Db.LayoutDictionaryId, OpenMode.ForRead);
Log("drawing: " + Db.Filename);

foreach (DBDictionaryEntry de in dict) {
    var lay = (Layout)Tx.GetObject(de.Value, OpenMode.ForRead);
    Log("");
    Log("=== LAYOUT \"" + lay.LayoutName + "\"  tab=" + lay.TabOrder + " ===");
    Log("  plot device   " + lay.PlotConfigurationName);
    Log("  paper size    " + lay.CanonicalMediaName);
    Log("  plot type     " + lay.PlotType);
    Log("  plot rotation " + lay.PlotRotation);
    Log("  plot units    " + lay.PlotPaperUnits);
    Log(String.Format("  paper size    {0:F4} x {1:F4}", lay.PlotPaperSize.X, lay.PlotPaperSize.Y));
    Log(String.Format("  margins       L{0:F4} B{1:F4} R{2:F4} T{3:F4}",
        lay.PlotPaperMargins.MinPoint.X, lay.PlotPaperMargins.MinPoint.Y,
        lay.PlotPaperMargins.MaxPoint.X, lay.PlotPaperMargins.MaxPoint.Y));
    Log(String.Format("  plot origin   {0:F4},{1:F4}", lay.PlotOrigin.X, lay.PlotOrigin.Y));
    Log("  std scale     " + lay.UseStandardScale + "  type=" + lay.StdScaleType
        + "  custom=" + lay.CustomPrintScale.Numerator + ":" + lay.CustomPrintScale.Denominator);
    Log(String.Format("  plot window   {0:F4},{1:F4} -> {2:F4},{3:F4}",
        lay.PlotWindowArea.MinPoint.X, lay.PlotWindowArea.MinPoint.Y,
        lay.PlotWindowArea.MaxPoint.X, lay.PlotWindowArea.MaxPoint.Y));

    var btr = (BlockTableRecord)Tx.GetObject(lay.BlockTableRecordId, OpenMode.ForRead);
    int nEnt = 0, nVp = 0;
    foreach (ObjectId id in btr) {
        nEnt++;
        var vp = Tx.GetObject(id, OpenMode.ForRead) as Viewport;
        if (vp == null) continue;
        nVp++;
        Log(String.Format("    VIEWPORT [{0}] number={1} on={2}", vp.Handle, vp.Number, vp.On));
        Log(String.Format("      centre {0:F4},{1:F4}  size {2:F4} x {3:F4}",
            vp.CenterPoint.X, vp.CenterPoint.Y, vp.Width, vp.Height));
        Log(String.Format("      viewCentre {0:F4},{1:F4}  viewHeight {2:F4}  scale 1:{3:F4}  locked={4}",
            vp.ViewCenter.X, vp.ViewCenter.Y, vp.ViewHeight, vp.CustomScale, vp.Locked));
        Log("      twist " + (vp.TwistAngle * 180.0 / Math.PI).ToString("F4"));
    }
    Log("  entities=" + nEnt + "  viewports=" + nVp);

    foreach (ObjectId id in btr) {
        var br = Tx.GetObject(id, OpenMode.ForRead) as BlockReference;
        if (br == null) continue;
        Log(String.Format("    BLOCK \"{0}\" [{1}] at {2:F4},{3:F4} scale {4:F4} rot {5:F2} layer={6}",
            br.Name, br.Handle, br.Position.X, br.Position.Y, br.ScaleFactors.X,
            br.Rotation * 180.0 / Math.PI, br.Layer));
    }
}

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\SS_BLOCK_11X17.dwg
Message
Executed C3D-0172 (0 entities touched).
Entities
Duration
506 ms
Civil 3D
25.0.0.0

Log

drawing: C:\Users\sanja\OneDrive\_SurveyDisco\SS_BLOCK_11X17.dwg

=== LAYOUT "11X17"  tab=1 ===
  plot device   AutoCAD PDF (General Documentation).pc3
  paper size    ANSI_full_bleed_B_(11.00_x_17.00_Inches)
  plot type     Layout
  plot rotation Degrees000
  plot units    Inches
  paper size    279.4000 x 431.8000
  margins       L0.0000 B0.0000 R0.0000 T0.0000
  plot origin   0.0000,0.0000
  std scale     True  type=StdScale1To1  custom=1:1
  plot window   0.0000,0.0000 -> 0.0000,0.0000
    VIEWPORT [E1D8] number=1 on=True
      centre 10.1079,6.5494  size 29.9719 x 14.3683
      viewCentre 15.5657,12.3190  viewHeight 33.4162  scale 1:0.4300  locked=False
      twist 0.0000
    VIEWPORT [1FDA0] number=2 on=True
      centre 5.4915,8.5190  size 10.5489 x 16.3730
      viewCentre 1094611.3035,650238.5327  viewHeight 491.1889  scale 1:0.0333  locked=True
      twist 0.0000
  entities=214  viewports=2
    BLOCK "SS_LEGEND" [1FDBA] at 10.8175,13.1528 scale 1.0000 rot 0.00 layer=SS-BOUNDARY
    BLOCK "SS_BLOCK_11X17" [20355] at 10.8150,0.2874 scale 1.0000 rot 0.00 layer=BLOCK_TB2

=== LAYOUT "HOUSEDIM"  tab=2 ===
  plot device   AutoCAD PDF (General Documentation).pc3
  paper size    ANSI_full_bleed_B_(11.00_x_17.00_Inches)
  plot type     Layout
  plot rotation Degrees000
  plot units    Inches
  paper size    279.4000 x 431.8000
  margins       L0.0000 B0.0000 R0.0000 T0.0000
  plot origin   0.0000,0.0000
  std scale     True  type=StdScale1To1  custom=1:1
  plot window   0.0000,0.0000 -> 0.0000,0.0000
    VIEWPORT [1E655] number=-1 on=False
      centre 13.8561,8.7409  size 40.9760 x 18.9868
      viewCentre 13.8561,8.7409  viewHeight 18.9868  scale 1:1.0000  locked=False
      twist 0.0000
    VIEWPORT [1E658] number=-1 on=False
      centre 5.5003,8.5278  size 10.5664 x 16.3905
      viewCentre 2354969.3920,1490786.3933  viewHeight 327.8106  scale 1:0.0500  locked=True
      twist 0.0000
  entities=338  viewports=2
    BLOCK "Water Valve" [1E7B4] at 0.5043,14.1573 scale 0.6981 rot 0.00 layer=V-NODE-WATR
    BLOCK "Catch Basin" [1E7B5] at 0.5043,14.3451 scale 1.2499 rot 0.00 layer=V-NODE-STRM
    BLOCK "Drainage MH" [1E7B6] at 0.5043,14.0294 scale 0.9999 rot 0.00 layer=V-NODE-STRM
    BLOCK "Existing Hyd" [1E7B7] at 0.5043,13.8950 scale 0.7235 rot 0.00 layer=V-NODE-WATR
    BLOCK "STA" [1E7B8] at 0.5043,13.7016 scale 0.0833 rot 0.00 layer=V-CTRL-HCPT

=== LAYOUT "Model"  tab=0 ===
  plot device   AutoCAD PDF (General Documentation).pc3
  paper size    ANSI_A_(8.50_x_11.00_Inches)
  plot type     Window
  plot rotation Degrees000
  plot units    Inches
  paper size    215.9000 x 279.4000
  margins       L5.0000 B17.0000 R5.0000 T17.0000
  plot origin   0.0000,152.4000
  std scale     True  type=ScaleToFit  custom=1:2.287135562527798
  plot window   1054537.8540,591745.6267 -> 1054556.3942,591753.0691
  entities=140  viewports=0
    BLOCK "3136" [1D03D] at 159914.7383,-436844.4106 scale 1.0000 rot 8.67 layer=SS-V-BLDG-OTLN

Notes

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

No notes yet.