← Inbox

C3D-MHRELABEL · Relabel manholes: F3 rims + INV IN/OUT, drop pt#s done

Update 21 SEWER_MANHOLE_TEXT labels to final worksheet data: names without (pt#), R = Rim F3, I line -> INV IN + new INV OUT line below. EXISTING 106 keeps 36-inch REC note.

Script file
C3D-MHRELABEL.cs
Target
SS_Outfall_260612_SHEET.dwg · model space
Author
claude
Approved
yes · auto-auth
Timeout
60s

C# payload

// Update the 21 SEWER_MANHOLE_TEXT labels to the final worksheet data (Rim F3 + corrected inverts):
// - name line: drop the "(pt#)" -> "SSMH A-6" (EXISTING SSMH 106 name unchanged)
// - R line: new F3 rim
// - I line: becomes "INV IN x.xx"; a new "INV OUT x.xx" line is added 7' below (same style, cloned)
// - EXISTING 106: single line "INV IN 672.27 (8") / 671.03 (36" REC)" — keeps the 36" record info
// Edits by handle (verified via read-only dump). Idempotent: skips the OUT clone if already applied.
using System;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;

DBText ByHandle(string h)
{
    var id = Db.GetObjectId(false, new Handle(Convert.ToInt64(h, 16)), 0);
    return (DBText)Tx.GetObject(id, OpenMode.ForWrite);
}

void SetText(DBText t, string s)
{
    Log($"  '{t.TextString}' -> '{s}'");
    t.TextString = s;
}

// nameH, newName, rH, newR, iH, invIn, invOut (null = no OUT line)
var updates = new (string nameH, string newName, string rH, string newR, string iH, string invIn, string invOut)[]
{
    ("9C", "SSMH A-6", "9D", "R 724.74", "9E", "INV IN 712.38", "INV OUT 712.33"),
    ("A0", "SSMH A-5", "A1", "R 721.47", "A2", "INV IN 699.61", "INV OUT 697.37"),
    ("A4", "SSMH A-4", "A5", "R 691.25", "A6", "INV IN 677.65", "INV OUT 677.52"),
    ("A8", "SSMH A-3", "A9", "R 682.84", "AA", "INV IN 673.76", "INV OUT 673.80"),
    ("AC", "SSMH A-2", "AD", "R 688.33", "AE", "INV IN 673.32", "INV OUT 673.38"),
    ("B0", "SSMH A-1", "B1", "R 687.27", "B2", "INV IN 672.56", "INV OUT 672.63"),
    ("B4", "EXISTING SSMH 106", "B5", "R 686.97", "B6", "INV IN 672.27 (8\") / 671.03 (36\" REC)", null),
};

int added = 0;
foreach (var u in updates)
{
    Log($"== {u.newName} ==");
    SetText(ByHandle(u.nameH), u.newName);
    SetText(ByHandle(u.rH), u.newR);

    var iText = ByHandle(u.iH);
    bool alreadyDone = iText.TextString.StartsWith("INV IN", StringComparison.OrdinalIgnoreCase);
    SetText(iText, u.invIn);

    if (u.invOut != null && !alreadyDone)
    {
        var clone = (DBText)iText.Clone();
        clone.TextString = u.invOut;
        clone.Position = new Point3d(iText.Position.X, iText.Position.Y - 7.0, iText.Position.Z);
        if (clone.Justify != AttachmentPoint.BaseLeft)
            clone.AlignmentPoint = new Point3d(iText.AlignmentPoint.X, iText.AlignmentPoint.Y - 7.0, iText.AlignmentPoint.Z);
        ModelSpace.AppendEntity(clone);
        Tx.AddNewlyCreatedDBObject(clone, true);
        Log($"  + added '{u.invOut}'");
        added++;
    }
}
Log($"DONE. 7 manholes relabeled, {added} INV OUT lines added. Values = final worksheet (Rim F3, corrected inverts).");

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260613 - 5030 E Lake Pkwy, Stockbridge, GA 30281, USA\SS_Outfall_260612_SHEET.dwg
Message
Executed C3D-MHRELABEL (0 entities touched).
Entities
Duration
408 ms
Civil 3D
25.0.0.0

Log

== SSMH A-6 ==
  'SSMH A-6 (100)' -> 'SSMH A-6'
  'R 722.67' -> 'R 724.74'
  'I 712.37' -> 'INV IN 712.38'
  + added 'INV OUT 712.33'
== SSMH A-5 ==
  'SSMH A-5 (101)' -> 'SSMH A-5'
  'R 721.43' -> 'R 721.47'
  'I 699.48' -> 'INV IN 699.61'
  + added 'INV OUT 697.37'
== SSMH A-4 ==
  'SSMH A-4 (102)' -> 'SSMH A-4'
  'R 691.24' -> 'R 691.25'
  'I 677.28' -> 'INV IN 677.65'
  + added 'INV OUT 677.52'
== SSMH A-3 ==
  'SSMH A-3 (1112)' -> 'SSMH A-3'
  'R 682.93' -> 'R 682.84'
  'I 673.31' -> 'INV IN 673.76'
  + added 'INV OUT 673.80'
== SSMH A-2 ==
  'SSMH A-2 (1113)' -> 'SSMH A-2'
  'R 688.43' -> 'R 688.33'
  'I 673.16' -> 'INV IN 673.32'
  + added 'INV OUT 673.38'
== SSMH A-1 ==
  'SSMH A-1 (1114)' -> 'SSMH A-1'
  'R 687.02' -> 'R 687.27'
  'I 672.02' -> 'INV IN 672.56'
  + added 'INV OUT 672.63'
== EXISTING SSMH 106 ==
  'EXISTING SSMH 106' -> 'EXISTING SSMH 106'
  'R 686.37' -> 'R 686.97'
  'I 671.92 (8") / 671.03 (36" REC)' -> 'INV IN 672.27 (8") / 671.03 (36" REC)'
DONE. 7 manholes relabeled, 6 INV OUT lines added. Values = final worksheet (Rim F3, corrected inverts).

Notes

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

No notes yet.