← Inbox

C3D-0130 · READ-ONLY: linework snapshot BEFORE manual edits [SNAP-BEFORE] done

Captures every polyline, line and arc outside layer 0 with full vertex coordinates, per-vertex bulge, closed flag, length and area, as the baseline for diffing against a second snapshot after the user converts sections to arcs and closes buildings. No changes.

Script file
C3D-0130.cs
Target
active document · model space
Author
claude
Approved
yes · reviewer
Timeout
240s

C# payload

// READ-ONLY SNAPSHOT of all linework, for diffing against a second snapshot after the user's
// manual edits (arcs via bulges, closed buildings, re-drawn sections).
//
// Captures per polyline: handle, layer, closed flag, vertex count, length, area if closed, and
// EVERY vertex with its BULGE - the bulge is what turns a straight segment into an arc, so it is
// the field that proves an edit happened. Nothing is modified.
var ms = (BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db), OpenMode.ForRead);
Log("SNAPSHOT drawing: " + Db.Filename);

int n = 0, arcs = 0, closed = 0;
foreach (ObjectId id in ms) {
    Autodesk.AutoCAD.DatabaseServices.DBObject o;
    try { o = Tx.GetObject(id, OpenMode.ForRead); } catch { continue; }
    var ent = o as Autodesk.AutoCAD.DatabaseServices.Entity;
    if (ent == null) continue;

    var pl = o as Polyline;
    var ln = o as Line;
    var ar = o as Arc;
    if (pl == null && ln == null && ar == null) continue;

    string lay; try { lay = ent.Layer; } catch { continue; }
    if (lay == "0") continue;   // points/blocks live there; linework does not

    n++;
    if (pl != null) {
        if (pl.Closed) closed++;
        int nb = 0;
        for (int i = 0; i < pl.NumberOfVertices; i++) if (Math.Abs(pl.GetBulgeAt(i)) > 1e-9) nb++;
        if (nb > 0) arcs++;
        Log(String.Format("POLY [{0}] {1} closed={2} verts={3} len={4:F3} area={5:F3} arcsegs={6}",
            pl.Handle, lay, pl.Closed, pl.NumberOfVertices, pl.Length, pl.Closed ? pl.Area : 0.0, nb));
        for (int i = 0; i < pl.NumberOfVertices; i++) {
            var v = pl.GetPoint2dAt(i);
            Log(String.Format("   V {0} {1:F4} {2:F4} bulge={3:F6}", i, v.X, v.Y, pl.GetBulgeAt(i)));
        }
    } else if (ln != null) {
        Log(String.Format("LINE [{0}] {1} len={2:F3}  {3:F4},{4:F4} -> {5:F4},{6:F4}",
            ln.Handle, lay, ln.Length, ln.StartPoint.X, ln.StartPoint.Y, ln.EndPoint.X, ln.EndPoint.Y));
    } else {
        Log(String.Format("ARC  [{0}] {1} r={2:F3} len={3:F3} centre={4:F4},{5:F4}",
            ar.Handle, lay, ar.Radius, ar.Length, ar.Center.X, ar.Center.Y));
    }
}
Log("");
Log("SNAPSHOT TOTALS: entities=" + n + "  closed polylines=" + closed + "  polylines with arc segments=" + arcs);

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260802 - 4082 Sweetbriar Ln, Forest Park, GA 30297, USA\260802 - 4082 Sweetbriar Ln.dwg
Message
Executed C3D-0130 (0 entities touched).
Entities
Duration
523 ms
Civil 3D
25.0.0.0

Log

SNAPSHOT drawing: C:\Users\sanja\OneDrive\_SurveyDisco\260802 - 4082 Sweetbriar Ln, Forest Park, GA 30297, USA\260802 - 4082 Sweetbriar Ln.dwg
POLY [20AD7] SS-V-ROAD-CNTR closed=False verts=3 len=70.962 area=0.000 arcsegs=0
   V 0 2238231.9730 1325302.3760 bulge=0.000000
   V 1 2238219.0610 1325270.8120 bulge=0.000000
   V 2 2238205.9980 1325236.3450 bulge=0.000000
POLY [20AD8] SS-V-ROAD-CNTR closed=False verts=8 len=191.853 area=0.000 arcsegs=0
   V 0 2238247.3300 1325258.8210 bulge=0.000000
   V 1 2238270.1940 1325245.3390 bulge=0.000000
   V 2 2238295.3760 1325226.3080 bulge=0.000000
   V 3 2238315.7150 1325209.3060 bulge=0.000000
   V 4 2238319.8060 1325205.1570 bulge=0.000000
   V 5 2238340.2280 1325181.0830 bulge=0.000000
   V 6 2238356.6930 1325159.5920 bulge=0.000000
   V 7 2238377.4800 1325122.2160 bulge=0.000000
POLY [20AD9] SS-V-ROAD-CURB closed=False verts=4 len=85.263 area=0.000 arcsegs=0
   V 0 2238189.4780 1325229.1720 bulge=0.000000
   V 1 2238193.9930 1325240.9330 bulge=0.000000
   V 2 2238207.5960 1325275.4690 bulge=0.000000
   V 3 2238220.5470 1325308.5720 bulge=0.000000
POLY [20ADA] SS-V-ROAD-CURB closed=False verts=3 len=15.045 area=0.000 arcsegs=0
   V 0 2238243.1810 1325283.8330 bulge=0.000000
   V 1 2238242.4580 1325292.0670 bulge=0.000000
   V 2 2238244.4930 1325298.5340 bulge=0.000000
POLY [20ADB] SS-V-ROAD-CURB closed=False verts=12 len=180.462 area=0.000 arcsegs=0
   V 0 2238366.3900 1325113.7110 bulge=0.000000
   V 1 2238357.0880 1325133.3980 bulge=0.000000
   V 2 2238347.7900 1325147.5190 bulge=0.000000
   V 3 2238345.2340 1325151.1670 bulge=0.000000
   V 4 2238344.2040 1325154.0180 bulge=0.000000
   V 5 2238331.0420 1325172.5560 bulge=0.000000
   V 6 2238311.5980 1325195.2670 bulge=0.000000
   V 7 2238307.7550 1325199.3850 bulge=0.000000
   V 8 2238288.0860 1325216.7030 bulge=0.000000
   V 9 2238264.8800 1325233.8790 bulge=0.000000
   V 10 2238250.3390 1325242.3300 bulge=0.000000
   V 11 2238246.3840 1325243.5330 bulge=0.000000
POLY [20ADC] SS-V-ROAD-CURB closed=False verts=8 len=46.359 area=0.000 arcsegs=0
   V 0 2238246.3840 1325243.5330 bulge=0.000000
   V 1 2238239.3530 1325244.1430 bulge=0.000000
   V 2 2238233.3920 1325243.8030 bulge=0.000000
   V 3 2238227.2030 1325241.0450 bulge=0.000000
   V 4 2238222.0060 1325236.8430 bulge=0.000000
   V 5 2238219.9670 1325233.5330 bulge=0.000000
   V 6 2238218.0960 1325229.7990 bulge=0.000000
   V 7 2238213.7870 1325218.8050 bulge=0.000000
POLY [20ADD] SS-V-ROAD-CURB closed=False verts=10 len=205.607 area=0.000 arcsegs=0
   V 0 2238387.7660 1325130.7040 bulge=0.000000
   V 1 2238370.0430 1325162.5600 bulge=0.000000
   V 2 2238368.0550 1325165.8550 bulge=0.000000
   V 3 2238351.4930 1325189.1020 bulge=0.000000
   V 4 2238328.6940 1325215.6130 bulge=0.000000
   V 5 2238325.4450 1325219.0870 bulge=0.000000
   V 6 2238303.2480 1325237.8560 bulge=0.000000
   V 7 2238277.5060 1325257.0050 bulge=0.000000
   V 8 2238251.6550 1325271.1000 bulge=0.000000
   V 9 2238246.9780 1325275.5310 bulge=0.000000
POLY [20ADE] V-STRC-WALL closed=False verts=2 len=37.899 area=0.000 arcsegs=0
   V 0 2238288.1370 1325091.5650 bulge=0.000000
   V 1 2238252.5970 1325104.7270 bulge=0.000000
POLY [20ADF] V-STRC-WALL closed=False verts=2 len=10.782 area=0.000 arcsegs=0
   V 0 2238192.0170 1325128.4340 bulge=0.000000
   V 1 2238181.9330 1325132.2510 bulge=0.000000
POLY [20AE0] X-DRIV-CONC closed=False verts=5 len=54.094 area=0.000 arcsegs=0
   V 0 2238228.0880 1325131.5930 bulge=0.000000
   V 1 2238196.3140 1325145.0660 bulge=0.000000
   V 2 2238191.7730 1325145.7160 bulge=0.000000
   V 3 2238194.7860 1325155.2610 bulge=0.000000
   V 4 2238199.1040 1325152.7690 bulge=0.000000
POLY [20AE2] X-DRIV-CONC closed=False verts=2 len=15.237 area=0.000 arcsegs=0
   V 0 2238190.1460 1325158.6880 bulge=0.000000
   V 1 2238184.6500 1325144.4770 bulge=0.000000
POLY [20AE3] X-DRIV-CONC closed=False verts=2 len=2.886 area=0.000 arcsegs=0
   V 0 2238230.3950 1325139.5820 bulge=0.000000
   V 1 2238233.0420 1325138.4310 bulge=0.000000
POLY [20AE4] X-DRIV-CONC closed=False verts=2 len=9.571 area=0.000 arcsegs=0
   V 0 2238262.7960 1325126.8130 bulge=0.000000
   V 1 2238258.9120 1325118.0650 bulge=0.000000
POLY [20AE5] X-DRIV-CONC closed=False verts=4 len=68.944 area=0.000 arcsegs=0
   V 0 2238255.6310 1325169.6900 bulge=0.000000
   V 1 2238276.4590 1325160.4790 bulge=0.000000
   V 2 2238265.6600 1325137.2880 bulge=0.000000
   V 3 2238246.6590 1325145.2150 bulge=0.000000
POLY [20AE6] SS-V-ROAD-EPVM closed=False verts=2 len=2.326 area=0.000 arcsegs=0
   V 0 2238238.9990 1325153.2450 bulge=0.000000
   V 1 2238237.0070 1325154.4450 bulge=0.000000

SNAPSHOT TOTALS: entities=15  closed polylines=0  polylines with arc segments=0

Notes

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

No notes yet.