← Inbox

C3D-0153 · READ-ONLY: do the as-built labels exist and what size are they [ASB-CHK] done

Reports each WALL/CONC/SIDEWALK/FENCE label with its stored TextHeight, actual drawn extents in feet, visibility and colour, plus the overall site extent for scale comparison. No changes.

Script file
C3D-0153.cs
Target
active document · model space
Author
claude
Approved
yes · reviewer
Timeout
180s

C# payload

// READ-ONLY. Do the four as-built labels exist, and what are their real height and extents?
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForRead);
Log("drawing: " + Db.Filename);
int n = 0;
foreach (ObjectId id in ms) {
    var mt = Tx.GetObject(id, OpenMode.ForRead) as MText;
    if (mt == null || mt.IsErased) continue;
    string c = mt.Contents.Trim().ToUpper();
    if (c != "WALL" && c != "CONC" && c != "SIDEWALK" && c != "FENCE") continue;
    n++;
    double w = 0, h = 0;
    try { var e = mt.GeometricExtents; w = e.MaxPoint.X-e.MinPoint.X; h = e.MaxPoint.Y-e.MinPoint.Y; } catch { }
    Log(String.Format("[{0}] \"{1}\" layer={2} TextHeight={3} at {4:F2},{5:F2}  drawn size {6:F3} x {7:F3} ft  visible={8} color={9}",
        mt.Handle, mt.Contents, mt.Layer, mt.TextHeight, mt.Location.X, mt.Location.Y, w, h, mt.Visible, mt.Color));
}
Log("as-built labels found: " + n);

// how big is the site, for scale
var lt = (LayerTable)Tx.GetObject(Db.LayerTableId, OpenMode.ForRead);
double minx=1e18,maxx=-1e18,miny=1e18,maxy=-1e18;
foreach (ObjectId id in ms) {
    var pl = Tx.GetObject(id, OpenMode.ForRead) as Polyline;
    if (pl == null || pl.IsErased) continue;
    var e = pl.GeometricExtents;
    if (e.MinPoint.X<minx) minx=e.MinPoint.X; if (e.MaxPoint.X>maxx) maxx=e.MaxPoint.X;
    if (e.MinPoint.Y<miny) miny=e.MinPoint.Y; if (e.MaxPoint.Y>maxy) maxy=e.MaxPoint.Y;
}
Log(String.Format("site extent: {0:F0} x {1:F0} ft", maxx-minx, maxy-miny));
Log("a 0.08 ft tall label is 1/" + ((maxx-minx)/0.08).ToString("F0") + " of the site width");

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260802 - 4082 Sweetbriar Ln, Forest Park, GA 30297, USA\260802 - 4082 Sweetbriar Ln.dwg
Message
Executed C3D-0153 (0 entities touched).
Entities
Duration
372 ms
Civil 3D
25.0.0.0

Log

drawing: C:\Users\sanja\OneDrive\_SurveyDisco\260802 - 4082 Sweetbriar Ln, Forest Park, GA 30297, USA\260802 - 4082 Sweetbriar Ln.dwg
[20C89] "WALL" layer=V-STRC-WALL TextHeight=0.08 at 2238240.08,1325110.00  drawn size 0.306 x 0.181 ft  visible=True color=BYLAYER
[20C8A] "CONC" layer=X-DRIV-CONC TextHeight=0.08 at 2238210.22,1325139.07  drawn size 0.315 x 0.196 ft  visible=True color=BYLAYER
[20C8F] "SIDEWALK" layer=SS-V-ROAD-EPVM TextHeight=0.08 at 2238232.65,1325138.60  drawn size 0.570 x 0.307 ft  visible=True color=BYLAYER
[20C91] "FENCE" layer=SS-X-FENCE TextHeight=0.08 at 2238320.85,1325110.30  drawn size 0.373 x 0.262 ft  visible=True color=BYLAYER
as-built labels found: 4
site extent: 238 x 218 ft
a 0.08 ft tall label is 1/2970 of the site width

Notes

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

No notes yet.