← Inbox

C3D-RD508 · Read pt 508 + compute endpoint (read-only) done

Get COGO 508 E/N and the S83°36'43"E 75.23' endpoint for C3D-23.

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

C# payload

// READ-ONLY: get COGO point #508 easting/northing + compute the S83°36'43"E 75.23' endpoint.
using System;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.Civil.ApplicationServices;
using Autodesk.Civil.DatabaseServices;

var db = Db;
var cdoc = CivilDocument.GetCivilDocument(db);
using (var tr = db.TransactionManager.StartTransaction())
{
    bool found=false;
    foreach (ObjectId id in cdoc.CogoPoints)
    {
        var cp = tr.GetObject(id, OpenMode.ForRead) as CogoPoint;
        if (cp == null) continue;
        if ((int)cp.PointNumber == 508)
        {
            double e=cp.Easting, n=cp.Northing;
            // bearing S 83°36'43" E: azimuth from north = 180 - (83 + 36/60 + 43/3600)
            double q = 83 + 36/60.0 + 43/3600.0;
            double az = 180.0 - q;            // S..E quadrant
            double azr = az * Math.PI/180.0;
            double dist = 75.23;
            double ex = e + dist*Math.Sin(azr);
            double ny = n + dist*Math.Cos(azr);
            Log($"PT 508: E={e:0.000} N={n:0.000} desc='{cp.RawDescription}'");
            Log($"CALL S83°36'43\"E 75.23' -> az={az:0.0000}deg");
            Log($"ENDPOINT: E={ex:0.000} N={ny:0.000}");
            found=true;
            break;
        }
    }
    if(!found) Log("PT 508 NOT FOUND");
    tr.Commit();
}

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260619 - 3625 Stonewall Tell Rd, Atlanta, GA 30349, USA\260619 - 3625 Stonewall Tell Rd.dwg
Message
Executed C3D-RD508 (0 entities touched).
Entities
Duration
536 ms
Civil 3D
25.0.0.0

Log

PT 508: E=2166393.496 N=1330090.878 desc='IPF'
CALL S83°36'43"E 75.23' -> az=96.3881deg
ENDPOINT: E=2166468.259 N=1330082.507

Notes

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

No notes yet.