← Inbox

C3D-REALCOORD · Hunt for real state-plane coords in GUS.dwg (read-only) done

Find monument N/E text notes and any COGO points already at true GA-West values to anchor a transform

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

C# payload

// Read-only: hunt for REAL state-plane coordinate values in GUS.dwg that could anchor a transform.
// Two sources: (a) text notes that spell out an N=/E= or lat/long for a monument, and
// (b) COGO points whose Easting/Northing already sit in the true GA-West state-plane range.
// GA West (EPSG:2240) real site values for GA are roughly E 2,000,000-2,400,000 / N 600,000-1,500,000,
// so we flag points and text that look like true SP coords vs the drawing's shifted geometry.
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);

Log("=== text notes with explicit coordinate values ===");
var rxNE = new System.Text.RegularExpressions.Regex(
    @"([NEne])\s*[:=]?\s*([0-9]{6,7}(?:\.[0-9]+)?)", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
var rxLL = new System.Text.RegularExpressions.Regex(
    @"(3[0-5]\.[0-9]{3,})|(-8[0-9]\.[0-9]{3,})|(LAT|LONG|LATITUDE|LONGITUDE)", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
int notes = 0;
foreach (ObjectId btrId in bt) {
    var btr = (BlockTableRecord)Tx.GetObject(btrId, OpenMode.ForRead);
    string where = btr.Name;
    if (btr.IsLayout) { var lay = (Layout)Tx.GetObject(btr.LayoutId, OpenMode.ForRead); where = "LAYOUT:" + lay.LayoutName; }
    foreach (ObjectId id in btr) {
        var o = Tx.GetObject(id, OpenMode.ForRead);
        string s = null;
        if (o is MText mt) s = (mt.Contents ?? "").Replace("\\P"," / ");
        else if (o is DBText t) s = t.TextString ?? "";
        else if (o is BlockReference br && br.AttributeCollection != null) {
            foreach (ObjectId aid in br.AttributeCollection) {
                var ar = (AttributeReference)Tx.GetObject(aid, OpenMode.ForRead);
                var v = ar.TextString ?? "";
                if (rxNE.IsMatch(v) || rxLL.IsMatch(v)) { Log($"  [{where}] ATTR {ar.Tag}=\"{v.Trim()}\""); notes++; }
            }
            continue;
        }
        if (string.IsNullOrWhiteSpace(s)) continue;
        if (rxNE.IsMatch(s) || rxLL.IsMatch(s)) {
            var u = s.ToUpperInvariant();
            // skip elevation/invert notes that also have 6-digit-ish numbers
            if (u.Contains("INV")||u.Contains("TOP=")||u.Contains("IE")||u.Contains("FFE")||u.Contains("RIM")) continue;
            Log($"  [{where}] \"{s.Trim()}\"");
            notes++;
        }
    }
}
Log($"coordinate-note candidates: {notes}");

Log("=== COGO points: do any sit at TRUE GA-West state-plane values? ===");
int n=0, real=0;
foreach (ObjectId id in CivilDoc.CogoPoints) {
    var cp = (Autodesk.Civil.DatabaseServices.CogoPoint)Tx.GetObject(id, OpenMode.ForRead);
    n++;
    bool looksReal = cp.Easting > 1900000 && cp.Easting < 2500000 && cp.Northing > 500000 && cp.Northing < 1600000;
    if (looksReal) { real++; if (real<=8) Log($"  #{cp.PointNumber} '{cp.RawDescription}' E={cp.Easting:F3} N={cp.Northing:F3}  <- in SP range"); }
}
Log($"cogo points total={n}, in-state-plane-range={real}");
Log($"COORD SYS CODE (file label): {CivilDoc.Settings.DrawingSettings.UnitZoneSettings.CoordinateSystemCode}");

Result

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

Log

=== text notes with explicit coordinate values ===
  [LAYOUT:Model] "{\H0.8x;NOW OR FORMERLY / \H1.25x;\LPLACEMAKER LLC / \H0.8x;\l1516 BASS ROAD / PLAT BOOK 93 PAGE 873 / DEED BOOK 9474 PAGE 212 / TAX PARCEL K003-0547 / ZONED PDE}"
  [LAYOUT:Model] "{\H0.8x;NOW OR FORMERLY / \H1.25x;\LPHG MACON LLC / \H0.8x;\l107 PROVIDENCE BOULEVARD / PLAT BOOK 94 PAGE 528 / DEED BOOK 10430 PAGE 109 / TAX PARCEL K003-0568 / ZONED C-2}"
  [LAYOUT:Model] "{\Fitalic|c0;\Q0;\L\C7;PARCEL "B"  / \Fsimplex|c0;\H0.83333x;\Q15;\C6;0.454 ACRES / 19,772 SQ. FT. / \l / PLAT CLOSURE=1:179,434}"
  [LAYOUT:Model] "{\Fitalic|c0;\Q0;\L\C7;PARCEL "C" COMBINED  / \Fsimplex|c0;\H0.83333x;\Q15;\C6;0.858 ACRES TOTAL / 37,384 SQ. FT. TOTAL\l /  / PLAT CLOSURE=1:76,148}"
  [LAYOUT:Model] "{\H0.8x;NOW OR FORMERLY / \H1.25x;\LBASS CAPITAL GROUP I LLC\C3; / \H0.8x;\l\C256;1510 BASS ROAD / PLAT BOOK 92 PAGE 653 / DEED BOOK 9987 PAGE 47 / TAX PARCEL K003-0527 / ZONED PDE}"
  [LAYOUT:Model] "TO COORDINATE INSTALLATION WITH"
  [LAYOUT:C2-SITE] "OF THE LONGER SIDES OF THE SPACE OR BY CURBING OR BY OTHER ACCEPTABLE METHOD"
  [LAYOUT:C2-SITE] "12. EACH BUILDING AND ITS LOCATION RELATIVE TO PROPERTY LINES"
coordinate-note candidates: 8
=== COGO points: do any sit at TRUE GA-West state-plane values? ===
  #9078 'ICV' E=2355855.526 N=1391061.598  <- in SP range
  #9084 'WM' E=2355792.444 N=1391105.345  <- in SP range
  #9085 'WM' E=2355794.261 N=1391107.022  <- in SP range
  #9133 'SGN' E=2355735.589 N=1391529.364  <- in SP range
  #9137 'WV' E=2355764.315 N=1391544.736  <- in SP range
  #9203 'FIP' E=2356009.132 N=1391584.301  <- in SP range
  #9204 'SSMH' E=2356006.852 N=1391583.312  <- in SP range
  #9205 'WV' E=2356002.326 N=1391579.612  <- in SP range
cogo points total=22, in-state-plane-range=22
COORD SYS CODE (file label): GAHP-WF

Notes

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

No notes yet.