← Inbox

C3D-TBCPOLY3DLIST · List Polyline3d entities on SS-V-ROAD-CURB done

Read-only: identify which Polyline3d entities on SS-V-ROAD-CURB are the 33 just drawn by C3D-TBCDRAW before erasing anything to redraw as splines.

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

C# payload

// READ-ONLY first pass: list every Polyline3d on SS-V-ROAD-CURB with its handle + vertex count + first
// vertex, so we can positively identify which ones are the 33 just drawn by C3D-TBCDRAW (vs any that
// may have pre-existed) before erasing anything.
using System;
using System.Linq;
using System.Collections.Generic;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;

const string LAYER = "SS-V-ROAD-CURB";

int count = 0;
foreach (ObjectId id in ModelSpace)
{
    var ent = Tx.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
    if (ent == null) continue;
    if (ent.Layer != LAYER) continue;
    if (ent is Polyline3d p3)
    {
        count++;
        var verts = new List<Point3d>();
        foreach (ObjectId vid in p3)
        {
            var v = Tx.GetObject(vid, OpenMode.ForRead) as PolylineVertex3d;
            if (v != null) verts.Add(v.Position);
        }
        Log($"handle={ent.Handle} verts={verts.Count} first=({verts.FirstOrDefault().X:0.00},{verts.FirstOrDefault().Y:0.00})");
    }
}
Log($"total Polyline3d on '{LAYER}': {count}");

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

Log

handle=20D66 verts=5 first=(2428141.27,1064465.53)
handle=20D6D verts=4 first=(2428098.86,1064560.50)
handle=20D73 verts=8 first=(2427895.79,1064547.77)
handle=20D7D verts=8 first=(2427983.53,1064712.47)
handle=20D87 verts=2 first=(2428023.77,1064744.33)
handle=20D8B verts=2 first=(2428041.49,1064735.59)
handle=20D8F verts=8 first=(2428065.81,1064742.28)
handle=20D99 verts=8 first=(2428083.96,1064764.03)
handle=20DA3 verts=7 first=(2428059.46,1064777.83)
handle=20DAC verts=2 first=(2428152.42,1064827.01)
handle=20DB0 verts=8 first=(2428107.41,1064820.85)
handle=20DBA verts=4 first=(2428052.68,1064821.24)
handle=20DC0 verts=5 first=(2427994.88,1064802.03)
handle=20DC7 verts=7 first=(2427993.49,1064774.78)
handle=20DD0 verts=2 first=(2428017.25,1064763.88)
handle=20DD4 verts=15 first=(2427983.14,1064820.25)
handle=20DE5 verts=17 first=(2427933.18,1064803.66)
handle=20DF8 verts=19 first=(2427885.49,1064728.61)
handle=20E0D verts=10 first=(2427753.24,1064651.18)
handle=20E19 verts=11 first=(2427796.19,1064605.18)
handle=20E26 verts=20 first=(2427876.57,1064539.16)
handle=20E3C verts=7 first=(2427889.22,1064480.15)
handle=20E45 verts=9 first=(2427915.77,1064450.71)
handle=20E50 verts=12 first=(2427976.43,1064514.09)
handle=20E5E verts=22 first=(2428009.98,1064526.05)
handle=20E76 verts=5 first=(2427999.30,1064444.49)
handle=20E7D verts=5 first=(2427981.34,1064423.05)
handle=20E84 verts=14 first=(2428045.95,1064370.83)
handle=20E94 verts=6 first=(2428104.89,1064444.99)
handle=20E9C verts=7 first=(2428111.61,1064367.07)
handle=20EA5 verts=6 first=(2428196.65,1064492.69)
handle=20EAD verts=5 first=(2428301.11,1064567.16)
handle=20EB4 verts=16 first=(2427809.34,1064557.12)
total Polyline3d on 'SS-V-ROAD-CURB': 33

Notes

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

No notes yet.