← Inbox

C3D-TIENOTES · Pull tie/bearing/curve notes from GUS.dwg (read-only) done

Find monument ties, N/E callouts, bearings and curve data to anchor the state-plane shift

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

C# payload

// Read-only: pull every note/dimension that states a REAL value we could anchor a shift to.
// Looking for: monument tie notes, "N=/E=" callouts, bearing+distance calls on the boundary,
// curve data, and any point-of-beginning / benchmark text. Dumps them verbatim with the entity's
// own position so we can pair a stated value to a drawing location.
var bt = (BlockTable)Tx.GetObject(Db.BlockTableId, OpenMode.ForRead);

// bearings, distances, curve calls, N/E ties
var rxBearing = new System.Text.RegularExpressions.Regex(@"[NS]\s*\d{1,2}\D+\d{1,2}\D+\d{1,2}\D*[EW]");
var rxDist    = new System.Text.RegularExpressions.Regex(@"\b\d{1,4}\.\d{2}'?\b");
var rxNE      = new System.Text.RegularExpressions.Regex(@"[NE]\s*[:=]\s*\d{5,}");
var rxCurve   = new System.Text.RegularExpressions.Regex(@"\b(R|L|C|CB|CH|DELTA|RAD)\s*=", System.Text.RegularExpressions.RegexOptions.IgnoreCase);

int hits = 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 = "L:" + lay.LayoutName; }
    foreach (ObjectId id in btr) {
        var o = Tx.GetObject(id, OpenMode.ForRead);
        string s = null; double px = 0, py = 0;
        if (o is MText mt) { s = (mt.Contents ?? "").Replace("\\P"," / "); px = mt.Location.X; py = mt.Location.Y; }
        else if (o is DBText t) { s = t.TextString ?? ""; px = t.Position.X; py = t.Position.Y; }
        else continue;
        // strip mtext formatting to test cleanly
        var clean = System.Text.RegularExpressions.Regex.Replace(s, @"\\[A-Za-z][^;\\]*;|[{}]", "");
        bool tie   = rxNE.IsMatch(clean) || clean.ToUpperInvariant().Contains("MONUMENT") || clean.ToUpperInvariant().Contains("BENCHMARK") || clean.ToUpperInvariant().Contains("CONTROL") || clean.ToUpperInvariant().Contains("POINT OF BEGINNING") || clean.ToUpperInvariant().Contains("POB");
        bool bear  = rxBearing.IsMatch(clean);
        bool curve = rxCurve.IsMatch(clean);
        if (tie || bear || curve) {
            string tag = tie ? "TIE" : bear ? "BRG" : "CRV";
            Log($"  [{tag}][{where}] @({px:F1},{py:F1}) \"{clean.Trim()}\"");
            hits++;
        }
    }
}
Log($"anchor-candidate notes: {hits}");
Log("NOTE: pair a bearing/distance chain or a stated N/E to the drawing's boundary geometry to solve the shift.");

Result

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

Log

  [CRV][L:Model] @(2355701.5,1391513.4) "INV C=406.84"
  [BRG][L:Model] @(2355707.6,1391248.1) "N10°10'42"E / R=186.33'  / C=34.79' / A=34.84'"
  [BRG][L:Model] @(2355701.3,1391321.1) "N02°25'34"W / R=210.36'  / C=38.86' / A=38.92'"
  [BRG][L:Model] @(2355693.7,1391353.1) "N12°33'23"E / R=188.00'  / C=28.11' / A=28.14'"
  [BRG][L:Model] @(2355706.2,1391287.2) "N04°09'33"E / R=186.33'  / C=4.31' / A=4.31'"
  [BRG][L:Model] @(2355927.9,1391356.9) "N71°27'59"E"
  [BRG][L:Model] @(2356072.3,1391346.4) "S18°16'56"E"
  [BRG][L:Model] @(2356108.4,1391327.9) "N71°46'44"E"
  [BRG][L:Model] @(2356072.9,1391468.9) "S18°16'56"E / 137.85'"
  [BRG][L:Model] @(2355688.3,1391416.3) "S18°16'56"E / 137.85'"
  [TIE][L:C2-SITE] @(1.5,10.8) "15. CONTRACTOR SHALL MAINTAIN  APPROPRIATE TRAFFIC CONTROL"
  [CRV][*D41] @(2357371.7,1391309.6) "L=9'-11 1/2""
  [CRV][*D49] @(2357546.8,1392266.4) "L=18'-2""
  [CRV][*D50] @(2357738.3,1392023.6) "L=49'-11 1/2""
  [CRV][*D51] @(2357255.6,1392157.5) "L=43'-11 3/4""
anchor-candidate notes: 15
NOTE: pair a bearing/distance chain or a stated N/E to the drawing's boundary geometry to solve the shift.

Notes

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

No notes yet.