← Inbox

C3D-MHTEXTMOVE · Nudge SSMH text right ~1.5 letters done

Shift all SEWER_MANHOLE_TEXT entities right by 1.5x text height.

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

C# payload

// Nudge all SEWER_MANHOLE_TEXT entities to the RIGHT by ~1.5 letter-widths (1.5 x text height).
using System;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;

double shift = 0;
int moved = 0;
foreach (ObjectId id in ModelSpace)
{
    var e = Tx.GetObject(id, OpenMode.ForRead);
    if (!(e is DBText t) || !string.Equals(t.Layer, "SEWER_MANHOLE_TEXT", StringComparison.OrdinalIgnoreCase)) continue;
    if (shift == 0) { shift = t.Height * 1.5; Log($"text height {t.Height:0.00} -> shifting right {shift:0.00} ft"); }
    var w = (DBText)Tx.GetObject(id, OpenMode.ForWrite);
    w.Position = new Point3d(w.Position.X + shift, w.Position.Y, w.Position.Z);
    if (w.Justify != AttachmentPoint.BaseLeft)
        w.AlignmentPoint = new Point3d(w.AlignmentPoint.X + shift, w.AlignmentPoint.Y, w.AlignmentPoint.Z);
    moved++;
}
Log($"DONE. moved {moved} SEWER_MANHOLE_TEXT entities right by {shift:0.00} ft.");

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

Log

text height 6.50 -> shifting right 9.75 ft
DONE. moved 27 SEWER_MANHOLE_TEXT entities right by 9.75 ft.

Notes

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

No notes yet.