← Inbox

C3D-0155 · As-built labels to height 0.8 [ASB-08] done

Sets the WALL, CONC, SIDEWALK and FENCE labels from 0.08 to 0.8 model units and reports the resulting drawn size of each.

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

C# payload

// Set the four as-built labels to height 0.8 (was 0.08 - unreadable on a 238 ft site).
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForWrite);
const double H = 0.8;
int n = 0;
foreach (ObjectId id in ms) {
    var mt0 = Tx.GetObject(id, OpenMode.ForRead) as MText;
    if (mt0 == null || mt0.IsErased) continue;
    string c = mt0.Contents.Trim().ToUpper();
    if (c != "WALL" && c != "CONC" && c != "SIDEWALK" && c != "FENCE") continue;
    var mt = (MText)Tx.GetObject(id, OpenMode.ForWrite);
    double was = mt.TextHeight;
    mt.TextHeight = H;
    n++;
    Log(String.Format("  [{0}] \"{1}\"  {2} -> {3}", mt.Handle, mt.Contents, was, H));
}
Log("labels resized: " + n);
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;
    var e = mt.GeometricExtents;
    Log(String.Format("  VERIFY \"{0}\" h={1} drawn {2:F2} x {3:F2} ft", mt.Contents, mt.TextHeight,
        e.MaxPoint.X-e.MinPoint.X, e.MaxPoint.Y-e.MinPoint.Y));
}
Ed.Regen();

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

Log

  [20C89] "WALL"  0.08 -> 0.8
  [20C8A] "CONC"  0.08 -> 0.8
  [20C8F] "SIDEWALK"  0.08 -> 0.8
  [20C91] "FENCE"  0.08 -> 0.8
labels resized: 4
  VERIFY "WALL" h=0.8 drawn 3.06 x 1.81 ft
  VERIFY "CONC" h=0.8 drawn 3.15 x 1.96 ft
  VERIFY "SIDEWALK" h=0.8 drawn 5.70 x 3.07 ft
  VERIFY "FENCE" h=0.8 drawn 3.73 x 2.62 ft

Notes

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

No notes yet.