← Inbox

C3D-0098 · Append - 8" PVC to the sewer length labels (re-run) [PVC-SUFFIX-2] done

Appends the 8 inch PVC suffix to the SEWER_LINE_TEXT length labels, excluding 12.07, 8.66, 30.97 and the 55.14 six inch stub per the user. Idempotent - labels already carrying a PVC suffix are untouched - and lists every length label afterwards to verify.

Script file
C3D-0098.cs
Target
260612 · model space
Author
claude
Approved
yes · reviewer
Timeout
180s

C# payload

// Append  - 8" PVC  to the sewer length labels.
//
// EXCLUDED per the user: 12.07, 8.66, 30.97, and 55.14 (the 6" stub).
// Matches on the leading number so a label that already carries a suffix is still recognised.
// Idempotent: anything already containing PVC is left alone.
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForRead);

var EXCLUDE = new HashSet<string>(new string[] { "12.07", "8.66", "30.97", "55.14" });

int done = 0, already = 0, skipped = 0;
foreach (ObjectId id in ms) {
    var probe = Tx.GetObject(id, OpenMode.ForRead) as MText;
    if (probe == null || probe.Layer != "SEWER_LINE_TEXT") continue;

    string cur = probe.Contents.Trim();
    if (cur.IndexOf('%') >= 0) continue;                    // slope label
    if (cur.IndexOf("PVC") >= 0) { already++; continue; }   // already suffixed
    if (cur.IndexOf('\'') < 0) continue;                    // not a length label

    string num = cur.Substring(0, cur.IndexOf('\''));
    if (EXCLUDE.Contains(num)) { skipped++; Log("  [" + probe.Handle + "] " + cur + "  EXCLUDED"); continue; }

    var w = (MText)Tx.GetObject(id, OpenMode.ForWrite);
    w.Contents = cur + " - 8\" PVC";
    done++;
    Log("  [" + probe.Handle + "] " + cur + "  ->  " + w.Contents);
}

Log("");
Log("appended: " + done + "   already had PVC: " + already + "   excluded: " + skipped);

foreach (ObjectId id in ms) {
    var mt = Tx.GetObject(id, OpenMode.ForRead) as MText;
    if (mt == null || mt.Layer != "SEWER_LINE_TEXT") continue;
    string c = mt.Contents.Trim();
    if (c.IndexOf('%') >= 0) continue;
    Log("  VERIFY " + c);
}
Ed.Regen();

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\260612 - CSTORE WATER ABS 30.dwg
Message
Executed C3D-0098 (0 entities touched).
Entities
Duration
1051 ms
Civil 3D
25.0.0.0

Log

  [2EF4E] 12.07'  EXCLUDED
  [2EF4F] 132.52'  ->  132.52' - 8" PVC
  [2EF50] 133.21'  ->  133.21' - 8" PVC
  [2EF51] 55.14'  EXCLUDED
  [2EF52] 86.31'  ->  86.31' - 8" PVC
  [2EF53] 30.97'  EXCLUDED
  [2EF54] 133.46'  ->  133.46' - 8" PVC
  [2EF55] 80.46'  ->  80.46' - 8" PVC
  [2EF56] 161.58'  ->  161.58' - 8" PVC
  [2EF57] 359.02'  ->  359.02' - 8" PVC
  [2EF58] 80.02'  ->  80.02' - 8" PVC
  [2EF59] 155.37'  ->  155.37' - 8" PVC
  [2EF5A] 19.54'  ->  19.54' - 8" PVC
  [2EF5B] 8.66'  EXCLUDED

appended: 10   already had PVC: 0   excluded: 4
  VERIFY 12.07'
  VERIFY 132.52' - 8" PVC
  VERIFY 133.21' - 8" PVC
  VERIFY 55.14'
  VERIFY 86.31' - 8" PVC
  VERIFY 30.97'
  VERIFY 133.46' - 8" PVC
  VERIFY 80.46' - 8" PVC
  VERIFY 161.58' - 8" PVC
  VERIFY 359.02' - 8" PVC
  VERIFY 80.02' - 8" PVC
  VERIFY 155.37' - 8" PVC
  VERIFY 19.54' - 8" PVC
  VERIFY 8.66'

Notes

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

No notes yet.