← Inbox

C3D-SEGHORZ · Make segment labels horizontal done

Set rotation=0 on all SEWER_LINE_TEXT distance/grade labels.

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

C# payload

// Set all distance/grade segment labels on SEWER_LINE_TEXT to horizontal (rotation 0).
using System;
using Autodesk.AutoCAD.DatabaseServices;

int n = 0;
foreach (ObjectId id in ModelSpace)
{
    var e = Tx.GetObject(id, OpenMode.ForRead);
    if (!(e is DBText t) || !string.Equals(t.Layer, "SEWER_LINE_TEXT", StringComparison.OrdinalIgnoreCase)) continue;
    if (t.Rotation == 0) continue;
    var w = (DBText)Tx.GetObject(id, OpenMode.ForWrite);
    Log($"  '{w.TextString}' rot {w.Rotation * 180 / Math.PI:0.0} -> 0");
    w.Rotation = 0;
    n++;
}
Log($"DONE. {n} labels set horizontal.");

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

Log

  '80' 15.8%' rot 309.7 -> 0
  '159' 12.4%' rot 309.8 -> 0
  '359' 1.1%' rot 318.7 -> 0
  '80' 0.6%' rot 283.9 -> 0
  '155' 0.7%' rot 7.8 -> 0
  '20' 0.8%' rot 275.2 -> 0
DONE. 6 labels set horizontal.

Notes

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

No notes yet.