← Inbox

C3D-READBLDG · Read building linework done

Read-only: full vertex geometry of everything on SS-V-BLDG-OTLN and SS-V-BLDG-FACE.

Script file
C3D-READBLDG.cs
Target
active document · model space
Author
claude
Approved
yes · auto-auth
Timeout
60s

C# payload

// READ-ONLY: dump geometry on the building outline + building face layers.
var layers = new List<string> { "SS-V-BLDG-OTLN", "SS-V-BLDG-FACE" };
foreach (ObjectId id in ModelSpace)
{
    var ent = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
    if (ent == null || !layers.Contains(ent.Layer)) continue;

    var p3 = ent as Polyline3d;
    if (p3 != null)
    {
        var vs = new List<Point3d>();
        foreach (ObjectId vid in p3)
        {
            var v = Tx.GetObject(vid, OpenMode.ForRead) as PolylineVertex3d;
            if (v != null) vs.Add(v.Position);
        }
        double len = 0;
        for (int i = 1; i < vs.Count; i++) len += vs[i].DistanceTo(vs[i-1]);
        var sb = new System.Text.StringBuilder();
        sb.Append($"P3D [{ent.Layer}] h={ent.Handle} verts={vs.Count} len={len:F1} closed={p3.Closed} :");
        foreach (var v in vs) sb.Append($" ({v.X:F2},{v.Y:F2},{v.Z:F2})");
        Log(sb.ToString());
        continue;
    }
    var pl = ent as Polyline;
    if (pl != null)
    {
        var sb = new System.Text.StringBuilder();
        sb.Append($"PLINE [{ent.Layer}] h={ent.Handle} verts={pl.NumberOfVertices} len={pl.Length:F1} closed={pl.Closed} :");
        for (int i = 0; i < pl.NumberOfVertices; i++) { var p = pl.GetPoint2dAt(i); sb.Append($" ({p.X:F2},{p.Y:F2})"); }
        Log(sb.ToString());
        continue;
    }
    Log($"{ent.GetType().Name} [{ent.Layer}] h={ent.Handle}");
}

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260709 - 1512 Bass Rd, Macon, GA 31210, USA\260709 - 1512 Bass Rd.dwg
Message
Executed C3D-READBLDG (0 entities touched).
Entities
Duration
410 ms
Civil 3D
25.0.0.0

Log

PLINE [SS-V-BLDG-OTLN] h=1CE27 verts=4 len=83.0 closed=True : (2429030.07,1064550.96) (2429025.21,1064534.41) (2429048.46,1064528.05) (2429053.53,1064544.65)
BlockReference [SS-V-BLDG-OTLN] h=1D03D
P3D [SS-V-BLDG-OTLN] h=20EB8 verts=9 len=193.2 closed=True : (2428083.72,1064504.86,419.17) (2428060.34,1064523.02,419.03) (2428078.37,1064498.18,419.19) (2428053.24,1064460.52,419.11) (2428051.06,1064462.44,419.30) (2428042.45,1064446.81,418.86) (2428040.11,1064448.37,419.55) (2428005.91,1064452.83,419.14) (2428029.23,1064434.88,419.05)
P3D [SS-V-BLDG-FACE] h=20EC4 verts=9 len=208.4 closed=False : (2428077.43,1064509.84,419.17) (2428081.23,1064514.45,419.25) (2428071.60,1064522.11,419.12) (2428067.87,1064517.20,419.03) (2428036.88,1064429.36,419.00) (2428029.62,1064420.35,419.03) (2427999.19,1064444.18,418.99) (2428005.91,1064452.83,419.14) (2428029.41,1064434.73,419.20)

Notes

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

No notes yet.