← Inbox

C3DO-0739 · 261101: line from 523 to 330 [C3D-L523] done

Draw one line from point 523 (IPS NE) to point 330 (IPF 1 IN OTP) on the current layer.

Script file
C3DO-0739.cs
Target
261101 - 5491 Roswell Rd NE R2.dwg · model space
Author
claude
Approved
yes · auto-auth
Timeout
60s

C# payload

Point3d? a=null,b=null;
foreach(ObjectId id in CivilDoc.CogoPoints){ var p=(Autodesk.Civil.DatabaseServices.CogoPoint)Tx.GetObject(id,OpenMode.ForRead);
 if(p.PointNumber==523) a=new Point3d(p.Easting,p.Northing,0); if(p.PointNumber==330) b=new Point3d(p.Easting,p.Northing,0); }
if(a==null||b==null){ Log("STOP - point 523 or 330 not found"); return; }
var ms=(BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db),OpenMode.ForRead);
foreach(ObjectId id in ms){ var l=Tx.GetObject(id,OpenMode.ForRead) as Line; if(l!=null&&((l.StartPoint.DistanceTo(a.Value)<0.001&&l.EndPoint.DistanceTo(b.Value)<0.001)||(l.StartPoint.DistanceTo(b.Value)<0.001&&l.EndPoint.DistanceTo(a.Value)<0.001))){ Log("line 523-330 already there: "+l.Handle+" on "+l.Layer); return; } }
var ln=new Line(a.Value,b.Value); ln.SetDatabaseDefaults(Db);
ms.UpgradeOpen(); ms.AppendEntity(ln); Tx.AddNewlyCreatedDBObject(ln,true);
double az=Math.Atan2(b.Value.X-a.Value.X,b.Value.Y-a.Value.Y)*180/Math.PI; if(az<0) az+=360;
Log("line "+ln.Handle+" on "+ln.Layer+" 523 "+a.Value.X.ToString("F4")+","+a.Value.Y.ToString("F4")+" -> 330 "+b.Value.X.ToString("F4")+","+b.Value.Y.ToString("F4")+" length "+ln.Length.ToString("F2")+" az "+az.ToString("F6")+" (verified)");
Ed.Regen();

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\261101 - Project\261101 - 5491 Roswell Rd NE R2.dwg
Message
Executed C3DO-0739 (0 entities touched).
Entities
—
Duration
492 ms
Civil 3D
25.0.0.0

Log

line 2184E on SS-V-WALK 523 2232597.4229,1420644.3630 -> 330 2232597.0250,1420463.4706 length 180.89 az 180.126030 (verified)

Notes

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

No notes yet.