← Inbox

C3D-0337 · 17X11: what is drawn near the site, and what falls inside the 3x3 notch [C3D-EXT] done

Read-only. Filters model space to entities near the current viewport window (ignoring the 0,0 junk), reports the real drawn extents in model feet AND in sheet inches, the slack on each side of the viewport, and lists every entity whose sheet position lands in the 3x3 notch at x<3 / y>8.

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

C# payload

// What is actually drawn near the site, and where it falls inside the CURRENT viewport window,
// in sheet inches. This tells us exactly what the 3x3 notch (sheet 0..3 / 8..11) is covering.
const double VCX = 2204922.3227, VCY = 1206632.6191;
const double VH  = 2051.7701, FTPI = 200.0;
const double FX0 = 0.3733, FY0 = 0.3707, FW = 16.2551, FH = 10.2589;   // vp frame on sheet

// model -> sheet
// sheet = frameOrigin + (model - windowMin) / FTPI
double winW = VH * (FW / FH);
double MX0 = VCX - winW/2, MY0 = VCY - VH/2;

Log("drawing: " + Db.Filename);
Log(string.Format("window: x {0:F2}..{1:F2}  y {2:F2}..{3:F2}", MX0, MX0+winW, MY0, MY0+VH));

var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForRead);

// entities near the site only (ignore the 0,0 junk and anything far away)
double SX0 = MX0 - 2000, SX1 = MX0 + winW + 2000;
double SY0 = MY0 - 2000, SY1 = MY0 + VH + 2000;

double X0=1e30,Y0=1e30,X1=-1e30,Y1=-1e30; int cnt=0, far=0;
var inNotch = new List<string>();

foreach (ObjectId id in ms) {
    var e = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
    if (e == null || e.IsErased || !e.Visible) continue;
    Autodesk.AutoCAD.DatabaseServices.Extents3d ex;
    try { ex = e.GeometricExtents; } catch { continue; }
    double ax=ex.MinPoint.X, ay=ex.MinPoint.Y, bx=ex.MaxPoint.X, by=ex.MaxPoint.Y;
    if (bx < SX0 || ax > SX1 || by < SY0 || ay > SY1) { far++; continue; }
    X0=Math.Min(X0,ax); Y0=Math.Min(Y0,ay); X1=Math.Max(X1,bx); Y1=Math.Max(Y1,by);
    cnt++;

    // does it land in the notch? notch = sheet x 0..3, y 8..11
    double sx0 = FX0 + (ax - MX0)/FTPI, sy0 = FY0 + (ay - MY0)/FTPI;
    double sx1 = FX0 + (bx - MX0)/FTPI, sy1 = FY0 + (by - MY0)/FTPI;
    if (sx0 < 3.0 && sy1 > 8.0) {
        string what = e.GetType().Name; string txt="";
        var m=e as MText; var d=e as DBText;
        if (m!=null) txt=m.Contents; else if (d!=null) txt=d.TextString;
        if (txt.Length>44) txt=txt.Substring(0,44);
        inNotch.Add(string.Format("  [{0}] {1,-18} sheet ({2,6:F2},{3,6:F2})-({4,6:F2},{5,6:F2}) layer={6,-22} \"{7}\"",
            e.Handle, what, sx0, sy0, sx1, sy1, e.Layer, txt.Replace("\n"," ")));
    }
}

Log(string.Format("near-site entities: {0}  (skipped {1} far away)", cnt, far));
Log(string.Format("DRAWN EXTENTS: x {0:F2}..{1:F2}  y {2:F2}..{3:F2}   ({4:F2} x {5:F2} ft)",
    X0, X1, Y0, Y1, X1-X0, Y1-Y0));
double sx0d = FX0 + (X0-MX0)/FTPI, sy0d = FY0 + (Y0-MY0)/FTPI;
double sx1d = FX0 + (X1-MX0)/FTPI, sy1d = FY0 + (Y1-MY0)/FTPI;
Log(string.Format("  on the sheet : ({0:F3},{1:F3}) - ({2:F3},{3:F3})", sx0d, sy0d, sx1d, sy1d));
Log(string.Format("  slack: left {0:F3}in  right {1:F3}in  bottom {2:F3}in  top {3:F3}in",
    sx0d - FX0, (FX0+FW) - sx1d, sy0d - FY0, (FY0+FH) - sy1d));

Log("");
Log("--- what currently falls in the 3x3 notch (sheet x<3, y>8) ---");
foreach (var s in inNotch) Log(s);
Log("  count: " + inNotch.Count);

Result

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

Log

drawing: C:\Users\sanja\OneDrive\_SurveyDisco\260714 - 285 Huckaby Rd, Brooks, GA 30205, USA\260714 - 285 Huckaby Rd R3.dwg
window: x 2203296.82..2206547.82  y 1205606.73..1207658.50
near-site entities: 160  (skipped 14 far away)
DRAWN EXTENTS: x 2194612.27..2209488.91  y 1200318.92..1215195.56   (14876.64 x 14876.64 ft)
  on the sheet : (-43.049,-26.068) - (31.334,48.315)
  slack: left -43.423in  right -14.705in  bottom -26.439in  top -37.685in

--- what currently falls in the 3x3 notch (sheet x<3, y>8) ---
  [1A9D7] Circle             sheet (-43.05,-26.07)-( 31.33, 48.31) layer=SS-FLOW WELL           ""
  [20B7F] Line               sheet (  1.09,  5.89)-(  1.09,  8.81) layer=PARCEL                 ""
  [20B81] Line               sheet (  1.09,  8.81)-( 15.79,  8.90) layer=PARCEL                 ""
  [20B82] DBText             sheet (  1.24,  8.52)-(  1.86,  8.89) layer=LABELS                 "P5"
  [20BF7] CogoPoint          sheet (  1.10,  8.80)-(  1.11,  8.80) layer=SS-0-FRAME             ""
  [20BF8] CogoPoint          sheet (  1.10,  8.80)-(  1.11,  8.81) layer=0                      ""
  [20CB1] Line               sheet (  0.38,  9.19)-(  8.23,  9.24) layer=SS-V-POWER-CL          ""
  [20CDB] Polyline           sheet (  1.23,  8.81)-(  1.24,  8.92) layer=SS-X-FENCE             ""
  [21237] Polyline           sheet (  1.09,  5.89)-( 15.79,  8.90) layer=SS-BOUNDARY MAG        ""
  [21454] Site               sheet (  1.09,  5.89)-( 15.79,  8.90) layer=SS-BUFFER SETBACK      ""
  [21456] ParcelSegment      sheet (  1.09,  5.89)-( 15.79,  8.90) layer=C-PROP-LINE            ""
  [21457] Parcel             sheet (  1.09,  5.89)-( 15.79,  8.90) layer=C-PROP                 ""
  [214A5] Polyline           sheet (  1.09,  5.89)-( 15.79,  8.90) layer=SS-BOUNDARY            ""
  [214A6] Site               sheet (  1.09,  5.89)-( 15.79,  8.90) layer=SS-BOUNDARY            ""
  [214A8] ParcelSegment      sheet (  1.09,  5.89)-( 15.79,  8.90) layer=C-PROP-LINE            ""
  [214A9] Parcel             sheet (  1.09,  5.89)-( 15.79,  8.90) layer=SS-BOUNDARY            ""
  [214AB] ParcelSegmentLabel sheet (  1.09,  8.19)-(  1.09,  8.20) layer=SS-0-FRAME             ""
  [21595] NoteLabel          sheet (  1.47,  8.91)-(  1.48,  8.91) layer=C-ANNO                 ""
  [2170D] Line               sheet (  0.39,  8.14)-(  1.09,  8.23) layer=SS-BUFFER SETBACK      ""
  [21715] Line               sheet (  1.11,  8.80)-(  1.11, 10.01) layer=SS-BUFFER SETBACK      ""
  [217EF] Polyline           sheet (  1.08,  5.91)-( 15.79,  8.91) layer=SS-BOUNDARY RED        ""
  [21AD9] Line               sheet (  0.38,  8.81)-(  8.23,  8.87) layer=SS-V-POWER-EASEMENT    ""
  [21ADA] Line               sheet (  0.38,  9.56)-(  8.23,  9.62) layer=SS-V-POWER-EASEMENT    ""
  [21CFD] AlignedDimension   sheet (  2.90,  8.84)-(  4.31,  9.59) layer=SS-V-POWER-EASEMENT    ""
  count: 24

Notes

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

No notes yet.