← Inbox

C3D-LLPT · Pin CONTRACT.dwg location (read-only) done

Site centroid + owner/adjoiner/parcel text to identify the address on Lake Laurel Drive

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

C# payload

// Read-only side db: get the site centroid of CONTRACT.dwg + any address/owner text, and dump
// a few boundary/monument points so we can pin the location.
string path = @"C:\Users\sanja\OneDrive\_SurveyDisco\_DRAFTS\CONTRACT.dwg";
if (!System.IO.File.Exists(path)) { Log("not found"); return; }
using (var sdb = new Database(false, true)) {
    sdb.ReadDwgFile(path, System.IO.FileShare.Read, true, null);
    using (var t = sdb.TransactionManager.StartTransaction()) {
        var bt = (BlockTable)t.GetObject(sdb.BlockTableId, OpenMode.ForRead);
        var ms = (BlockTableRecord)t.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForRead);
        double minx=double.MaxValue,miny=double.MaxValue,maxx=double.MinValue,maxy=double.MinValue;
        foreach (ObjectId id in ms) {
            var e = t.GetObject(id, OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
            if (e == null) continue;
            try { var ex = e.GeometricExtents;
                if (ex.MinPoint.X>1000){ if(ex.MinPoint.X<minx)minx=ex.MinPoint.X; if(ex.MaxPoint.X>maxx)maxx=ex.MaxPoint.X; }
                if (ex.MinPoint.Y>1000){ if(ex.MinPoint.Y<miny)miny=ex.MinPoint.Y; if(ex.MaxPoint.Y>maxy)maxy=ex.MaxPoint.Y; }
            } catch { }
        }
        double cx=(minx+maxx)/2, cy=(miny+maxy)/2;
        Log($"SITE EXTENTS ({minx:F1},{miny:F1})-({maxx:F1},{maxy:F1})");
        Log($"SITE CENTRE E={cx:F2} N={cy:F2}  size {maxx-minx:F0}x{maxy-miny:F0} ft");
        // owner / address-ish text
        foreach (ObjectId btrId in bt) {
            var btr = (BlockTableRecord)t.GetObject(btrId, OpenMode.ForRead);
            foreach (ObjectId id in btr) {
                var o = t.GetObject(id, OpenMode.ForRead);
                string s = null;
                if (o is MText mt) s=(mt.Contents??"").Replace("\\P"," / ");
                else if (o is DBText tx) s=tx.TextString;
                else continue;
                if (string.IsNullOrWhiteSpace(s)) continue;
                var u=s.ToUpperInvariant();
                if (u.Contains("LAUREL")||u.Contains("N/F")||u.Contains("NOW OR")||u.Contains("OWNER")||
                    u.Contains("DEED")||u.Contains("PLAT")||u.Contains("PARCEL")||u.Contains("SUBDIVISION")||
                    u.Contains("MILLEDGE")||u.Contains("BALDWIN")||u.Contains("COUNTY")||u.Contains("CITY"))
                    Log($"  \"{s.Trim()}\"");
            }
        }
        t.Commit();
    }
}

Result

Status
success
Drawing file
C:\Users\sanja\Downloads\GUS.dwg
Message
Executed C3D-LLPT (0 entities touched).
Entities
Duration
433 ms
Civil 3D
25.0.0.0

Log

SITE EXTENTS (2297515.7,1490746.7)-(2299949.0,1492660.3)
SITE CENTRE E=2298732.33 N=1491703.49  size 2433x1914 ft
  "LAKE LAUREL DRIVE"
  "TAX PARCEL 137 483"
  "N/F / {\H0.8x;CHEEK GREGORY DEXTER SR & / CHEEK MARILYN DIANE / ZONED A1 / TAX PAR. 137 013}"
  "N/F / {\H0.8x;MATHIS LORENE W / ZONED A1 / TAX PAR. 137 012}"
  "N/F / {\H0.8x;ROBINSON DARREN & / ROBINSON SYLIAN / ZONED RES2 / TAX PAR. 137 526}"
  "N/F / {\H0.8x;DAKA SIREESHA & / DAKA VENKATA PHANI / ZONED RES2 / TAX PAR. 137 527}"
  "{\Fdim|c0;\W0.75; / FOR PROPOSED SEWER MAIN TYING INTO EXXISTING SEWER, THE CROWNS MUST MATCH TO PREVENT ANY BACKUP INTO THE PROPOSED SUBDIVISION IN THE FUTURE.}"

Notes

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

No notes yet.