← Inbox

C3D-0359 · 168.1' and 122.0': make the dimension text read along the line, not horizontal [C3D-DIMALIGN] done

Sets Dimtih=false and Dimtoh=false as a per-object override on the two AlignedDimensions (handles 21C7B and 21C55) so the measurement rotates to align with the dimension line and reads up the arrows instead of sitting flat between them. The Standard dim style is not modified, so no other dimension changes. Recomputes and reads back the text rotation to verify.

Script file
C3D-0359.cs
Target
260714 - 285 Huckaby Rd R4.dwg · model space
Author
claude
Approved
yes · auto-auth
Timeout
120s

C# payload

// Make 168.1' and 122.0' read ALONG the dimension line instead of horizontal between the arrows.
// Per-object override only: Dimtih=false (text-inside not horizontal), Dimtoh=false. The dim
// style stays as-is, so no other dimension in the drawing changes.
var handles = new string[] { "21C7B", "21C55" };
Log("drawing: " + Db.Filename);

var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForRead);
int changed = 0;
foreach (ObjectId id in ms) {
    var probe = Tx.GetObject(id, OpenMode.ForRead) as Dimension;
    if (probe == null) continue;
    string h = probe.Handle.ToString();
    bool target = false;
    foreach (var t in handles) if (string.Equals(h, t, StringComparison.OrdinalIgnoreCase)) target = true;
    if (!target) continue;

    var dim = (Dimension)Tx.GetObject(id, OpenMode.ForWrite);
    bool bih = dim.Dimtih, boh = dim.Dimtoh;
    dim.Dimtih = false;
    dim.Dimtoh = false;
    dim.RecomputeDimensionBlock(true);
    changed++;

    var back = (Dimension)Tx.GetObject(id, OpenMode.ForRead);
    Log(string.Format("[{0}] \"{1}\"  Dimtih {2}->{3}  Dimtoh {4}->{5}  textRot now {6:F4} (verified)",
        h, back.DimensionText, bih, back.Dimtih, boh, back.Dimtoh, back.TextRotation));
}
Log("");
Log("aligned " + changed + " dimension(s) to read along the line");
Ed.Regen();

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260714 - 285 Huckaby Rd, Brooks, GA 30205, USA\260714 - 285 Huckaby Rd R4.dwg
Message
Executed C3D-0359 (0 entities touched).
Entities
Duration
457 ms
Civil 3D
25.0.0.0

Log

drawing: C:\Users\sanja\OneDrive\_SurveyDisco\260714 - 285 Huckaby Rd, Brooks, GA 30205, USA\260714 - 285 Huckaby Rd R4.dwg
[21C55] "122.0'"  Dimtih True->False  Dimtoh True->False  textRot now 0.0000 (verified)
[21C7B] "168.1'"  Dimtih True->False  Dimtoh True->False  textRot now 0.0000 (verified)

aligned 2 dimension(s) to read along the line

Notes

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

No notes yet.