← Inbox

C3D-0032 · Slope label under each sewer line [SEW-SLOPE] done

Adds a slope label under each of the 14 sewer-line length labels on SEWER_LINE_TEXT, from the CSV FLOW_PCT matched by endpoint coordinates. Four read N/A where the CSV has no slope.

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

C# payload

// Slope label under each sewer line -> SEWER_LINE_TEXT.
//
// Sits directly under the existing length label: same midpoint and rotation, offset to the
// LOWER side of the line with TopCenter attachment so the two read as a stacked pair.
//
// Values are FLOW_PCT from 260613_invert_v2.csv, matched to each line by comparing the line's
// endpoints against the segment table's manhole coordinates (not by assuming an order).
// 10 of 14 have a slope; the other four read N/A and nothing is inferred:
//   * 2EC86 / 2EC87 / 2EC89 - the segment exists but FLOW_PCT is blank, because A16, A12 and
//     358 have no recorded invert
//   * 2E95F (12ft test-MH stub) and 2EC88 (55ft PVC stub) are not in the segment table at all
//
// Host owns Tx; host regens after commit.
const string LAYER = "SEWER_LINE_TEXT";
const double H = 3.0;

var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForWrite);
EnsureLayer(LAYER, 3);

    {
        var mt = new MText {
            Location   = new Point3d(2296655.180, 1280052.064, 0.0),
            Contents   = @"N/A",
            TextHeight = H,
            Rotation   = -4.714212,
            Attachment = AttachmentPoint.TopCenter,
        };
        mt.Layer = LAYER;
        ms.AppendEntity(mt);
        Tx.AddNewlyCreatedDBObject(mt, true);
        Log("  2E95F  slope N/A");
    }
    {
        var mt = new MText {
            Location   = new Point3d(2296445.497, 1279949.288, 0.0),
            Contents   = @"N/A",
            TextHeight = H,
            Rotation   = -0.015789,
            Attachment = AttachmentPoint.TopCenter,
        };
        mt.Layer = LAYER;
        ms.AppendEntity(mt);
        Tx.AddNewlyCreatedDBObject(mt, true);
        Log("  2EC86  slope N/A");
    }
    {
        var mt = new MText {
            Location   = new Point3d(2296560.228, 1279996.580, 0.0),
            Contents   = @"N/A",
            TextHeight = H,
            Rotation   = 0.792605,
            Attachment = AttachmentPoint.TopCenter,
        };
        mt.Layer = LAYER;
        ms.AppendEntity(mt);
        Tx.AddNewlyCreatedDBObject(mt, true);
        Log("  2EC87  slope N/A");
    }
    {
        var mt = new MText {
            Location   = new Point3d(2296576.909, 1280046.311, 0.0),
            Contents   = @"N/A",
            TextHeight = H,
            Rotation   = -0.119565,
            Attachment = AttachmentPoint.TopCenter,
        };
        mt.Layer = LAYER;
        ms.AppendEntity(mt);
        Tx.AddNewlyCreatedDBObject(mt, true);
        Log("  2EC88  slope N/A");
    }
    {
        var mt = new MText {
            Location   = new Point3d(2296647.790, 1280042.852, 0.0),
            Contents   = @"N/A",
            TextHeight = H,
            Rotation   = -0.003487,
            Attachment = AttachmentPoint.TopCenter,
        };
        mt.Layer = LAYER;
        ms.AppendEntity(mt);
        Tx.AddNewlyCreatedDBObject(mt, true);
        Log("  2EC89  slope N/A");
    }
    {
        var mt = new MText {
            Location   = new Point3d(2296700.382, 1280033.211, 0.0),
            Contents   = @"6.98%",
            TextHeight = H,
            Rotation   = -0.728088,
            Attachment = AttachmentPoint.TopCenter,
        };
        mt.Layer = LAYER;
        ms.AppendEntity(mt);
        Tx.AddNewlyCreatedDBObject(mt, true);
        Log("  2EC8A  slope 6.98%");
    }
    {
        var mt = new MText {
            Location   = new Point3d(2296772.353, 1280057.932, 0.0),
            Contents   = @"1.29%",
            TextHeight = H,
            Rotation   = 0.558332,
            Attachment = AttachmentPoint.TopCenter,
        };
        mt.Layer = LAYER;
        ms.AppendEntity(mt);
        Tx.AddNewlyCreatedDBObject(mt, true);
        Log("  2EC8B  slope 1.29%");
    }
    {
        var mt = new MText {
            Location   = new Point3d(2296850.511, 1280063.058, 0.0),
            Contents   = @"15.60%",
            TextHeight = H,
            Rotation   = -0.876410,
            Attachment = AttachmentPoint.TopCenter,
        };
        mt.Layer = LAYER;
        ms.AppendEntity(mt);
        Tx.AddNewlyCreatedDBObject(mt, true);
        Log("  2EC8C  slope 15.60%");
    }
    {
        var mt = new MText {
            Location   = new Point3d(2296927.115, 1279971.213, 0.0),
            Contents   = @"12.58%",
            TextHeight = H,
            Rotation   = -0.875236,
            Attachment = AttachmentPoint.TopCenter,
        };
        mt.Layer = LAYER;
        ms.AppendEntity(mt);
        Tx.AddNewlyCreatedDBObject(mt, true);
        Log("  2EC8D  slope 12.58%");
    }
    {
        var mt = new MText {
            Location   = new Point3d(2297113.077, 1279791.373, 0.0),
            Contents   = @"1.16%",
            TextHeight = H,
            Rotation   = -0.721503,
            Attachment = AttachmentPoint.TopCenter,
        };
        mt.Layer = LAYER;
        ms.AppendEntity(mt);
        Tx.AddNewlyCreatedDBObject(mt, true);
        Log("  2EC8E  slope 1.16%");
    }
    {
        var mt = new MText {
            Location   = new Point3d(2297256.375, 1279635.717, 0.0),
            Contents   = @"0.47%",
            TextHeight = H,
            Rotation   = -1.329162,
            Attachment = AttachmentPoint.TopCenter,
        };
        mt.Layer = LAYER;
        ms.AppendEntity(mt);
        Tx.AddNewlyCreatedDBObject(mt, true);
        Log("  2EC8F  slope 0.47%");
    }
    {
        var mt = new MText {
            Location   = new Point3d(2297346.432, 1279605.080, 0.0),
            Contents   = @"0.60%",
            TextHeight = H,
            Rotation   = 0.135922,
            Attachment = AttachmentPoint.TopCenter,
        };
        mt.Layer = LAYER;
        ms.AppendEntity(mt);
        Tx.AddNewlyCreatedDBObject(mt, true);
        Log("  2EC90  slope 0.60%");
    }
    {
        var mt = new MText {
            Location   = new Point3d(2297420.647, 1279608.763, 0.0),
            Contents   = @"2.41%",
            TextHeight = H,
            Rotation   = -1.481337,
            Attachment = AttachmentPoint.TopCenter,
        };
        mt.Layer = LAYER;
        ms.AppendEntity(mt);
        Tx.AddNewlyCreatedDBObject(mt, true);
        Log("  2EC91  slope 2.41%");
    }
    {
        var mt = new MText {
            Location   = new Point3d(2296685.686, 1280046.995, 0.0),
            Contents   = @"2.25%",
            TextHeight = H,
            Rotation   = -0.841381,
            Attachment = AttachmentPoint.TopCenter,
        };
        mt.Layer = LAYER;
        ms.AppendEntity(mt);
        Tx.AddNewlyCreatedDBObject(mt, true);
        Log("  2EC92  slope 2.25%");
    }

int n = 0;
foreach (ObjectId id in ms) {
    var e = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
    if (e != null && e.Layer == LAYER && e is MText) n++;
}
Log("SEWER_LINE_TEXT now holds " + n + " label(s) - 14 lengths + 14 slopes (verified)");

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

Log

  2E95F  slope N/A
  2EC86  slope N/A
  2EC87  slope N/A
  2EC88  slope N/A
  2EC89  slope N/A
  2EC8A  slope 6.98%
  2EC8B  slope 1.29%
  2EC8C  slope 15.60%
  2EC8D  slope 12.58%
  2EC8E  slope 1.16%
  2EC8F  slope 0.47%
  2EC90  slope 0.60%
  2EC91  slope 2.41%
  2EC92  slope 2.25%
SEWER_LINE_TEXT now holds 28 label(s) - 14 lengths + 14 slopes (verified)

Notes

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

No notes yet.