← Inbox

C3D-STRAIGHTDIST · Straight-line manhole-to-manhole distances done

Point-to-point distance for each consecutive SSMH pair 7000-7013.

Script file
C3D-STRAIGHTDIST.cs
Target
active document · model space
Author
claude
Approved
yes · claude (read-only)
Timeout
60s

C# payload

// READ-ONLY: straight-line distance between each consecutive pair of SSMH points (7000-7013).
// Pipes run manhole to manhole — straight, no bends between them.
using System;
using System.Linq;
using System.Collections.Generic;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using Autodesk.Civil.ApplicationServices;
using Autodesk.Civil.DatabaseServices;

var db = Db;
var pts = new Dictionary<int, Point2d>();
var cdoc = CivilDocument.GetCivilDocument(db);
using (var tr = db.TransactionManager.StartTransaction())
{
    foreach (ObjectId id in cdoc.CogoPoints)
    {
        var cp = tr.GetObject(id, OpenMode.ForRead) as CogoPoint;
        if (cp == null) continue;
        int n = (int)cp.PointNumber;
        if (n >= 7000 && n <= 7013) pts[n] = new Point2d(cp.Easting, cp.Northing);
    }
    tr.Commit();
}
Log($"points: {pts.Count}");
for (int n = 7000; n <= 7013; n++)
{
    if (!pts.ContainsKey(n) || !pts.ContainsKey(n+1)) continue;
    if (n+1 > 7013) continue;
    double d = pts[n].GetDistanceTo(pts[n+1]);
    Log($"{n} -> {n+1}: {d: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-STRAIGHTDIST (0 entities touched).
Entities
Duration
297 ms
Civil 3D
25.0.0.0

Log

points: 14
7000 -> 7001: 131.40 ft
7001 -> 7002: 133.16 ft
7002 -> 7003: 55.11 ft
7003 -> 7004: 102.24 ft
7004 -> 7005: 33.74 ft
7005 -> 7006: 39.38 ft
7006 -> 7007: 133.78 ft
7007 -> 7008: 80.44 ft
7008 -> 7009: 158.93 ft
7009 -> 7010: 358.79 ft
7010 -> 7011: 80.01 ft
7011 -> 7012: 155.35 ft
7012 -> 7013: 19.51 ft

Notes

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

No notes yet.