← Inbox

C3D-0269 · 260714 Huckaby: what sticks past the left border in SS_BLOCK_17X11 done

READ-ONLY. Lists every entity near the left extent of the block definition to identify what extends past the border line.

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

C# payload

// Find what sticks 0.09 past the border on the left, and set the sheet border lines to exact
// coordinates so the frame is a clean rectangle rather than whatever the geometry happens to be.
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);
var def = (BlockTableRecord)Tx.GetObject(bt["SS_BLOCK_17X11"], OpenMode.ForRead);

double x0=1e30,y0=1e30,x1=-1e30,y1=-1e30;
foreach (ObjectId id in def) {
    var ent = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
    if (ent == null) continue;
    double a,b,c,d;
    var ad = ent as AttributeDefinition;
    if (ad != null) { a=c=ad.Position.X; b=d=ad.Position.Y; }
    else { try { var e=ent.GeometricExtents; a=e.MinPoint.X;b=e.MinPoint.Y;c=e.MaxPoint.X;d=e.MaxPoint.Y; } catch { continue; } }
    if (a<x0)x0=a; if (b<y0)y0=b; if (c>x1)x1=c; if (d>y1)y1=d;
}
Log(string.Format("definition extents ({0:F4},{1:F4})-({2:F4},{3:F4})", x0,y0,x1,y1));
Log("");
Log("--- entities within 0.15 of the LEFT extent ---");
foreach (ObjectId id in def) {
    var ent = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
    if (ent == null) continue;
    double a,b,c,d;
    var ad = ent as AttributeDefinition;
    if (ad != null) { a=c=ad.Position.X; b=d=ad.Position.Y; }
    else { try { var e=ent.GeometricExtents; a=e.MinPoint.X;b=e.MinPoint.Y;c=e.MaxPoint.X;d=e.MaxPoint.Y; } catch { continue; } }
    if (a > x0 + 0.15) continue;
    string extra = "";
    var ln = ent as Line;
    if (ln != null) extra = string.Format(" ({0:F4},{1:F4})->({2:F4},{3:F4})", ln.StartPoint.X, ln.StartPoint.Y, ln.EndPoint.X, ln.EndPoint.Y);
    var dt = ent as DBText;
    if (dt != null) extra = " \"" + dt.TextString + "\"";
    var mt = ent as MText;
    if (mt != null) extra = " \"" + mt.Contents.Replace("\n"," ").Substring(0, Math.Min(30, mt.Contents.Length)) + "\"";
    if (ad != null) extra = " TAG=" + ad.Tag;
    Log(string.Format("[{0}] {1,-20} ({2:F4},{3:F4})-({4:F4},{5:F4}){6}", ent.Handle, ent.GetType().Name, a,b,c,d, extra));
}

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

Log

definition extents (-16.3400,0.0000)-(0.0000,10.3400)

--- entities within 0.15 of the LEFT extent ---
[20DEE] Line                 (-16.2987,10.2996)-(-0.0416,10.2996) (-16.2987,10.2996)->(-0.0416,10.2996)
[20DEF] Line                 (-16.3400,10.3400)-(0.0000,10.3400) (-16.3400,10.3400)->(0.0000,10.3400)
[20DF2] Line                 (-16.2966,1.6730)-(-8.8540,1.6742) (-16.2966,1.6742)->(-8.8540,1.6730)
[20DF3] Line                 (-16.2967,1.4194)-(-8.8540,1.4206) (-16.2967,1.4206)->(-8.8540,1.4194)
[20DF4] Line                 (-16.2967,1.1658)-(-8.8540,1.1670) (-16.2967,1.1670)->(-8.8540,1.1658)
[20DF5] Line                 (-16.2967,0.9122)-(-8.8540,0.9134) (-16.2967,0.9134)->(-8.8540,0.9122)
[20DF6] Line                 (-16.2967,1.9278)-(-8.9751,1.9278) (-16.2967,1.9278)->(-8.9751,1.9278)
[20DFA] Line                 (-16.2967,2.5478)-(-6.5363,2.5478) (-16.2967,2.5478)->(-6.5363,2.5478)
[20DFB] DBText               (-16.2576,2.4274)-(-15.3838,2.4990) "PREPARED FOR:"
[20E3C] Line                 (-16.2967,0.0407)-(-16.2967,2.5478) (-16.2967,2.5478)->(-16.2967,0.0407)
[20E3F] Line                 (-16.2967,2.5478)-(-6.5363,2.5478) (-6.5363,2.5478)->(-16.2967,2.5478)
[20E42] Line                 (-16.3400,0.0000)-(0.0000,0.0000) (-16.3400,0.0000)->(0.0000,0.0000)
[20E43] Line                 (-16.3400,0.0000)-(-16.3400,10.3400) (-16.3400,10.3400)->(-16.3400,0.0000)
[20E4C] AttributeDefinition  (-16.2369,1.7573)-(-16.2369,1.7573) TAG=SITE_ADDRESS
[20E4D] AttributeDefinition  (-16.2332,0.9875)-(-16.2332,0.9875) TAG=REF_DB_PG
[20E54] AttributeDefinition  (-16.2832,2.6514)-(-16.2832,2.6514) TAG=SURVEY_TYPE

Notes

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

No notes yet.