C3DO-0761 · 261101: Turn 277 - boundary 0°29'00" about 243 to take in the south curb [C3D-TURN277] done
Rotate boundary polyline 21856 (C-PROP-BNDY) clockwise about point 243 by the angle that puts every vertex of south curb lines 21434 and 216AC on or inside the south line (about 0°29'00"; SE corner moves about 2.22' south). Angle is taken from the drawing.
C# payload
Func<string,ObjectId> oid=hs=>{ ObjectId id; Db.TryGetObjectId(new Handle(Convert.ToInt64(hs,16)),out id); return id; };
Point3d? p243=null; foreach(ObjectId id in CivilDoc.CogoPoints){ var cp=(Autodesk.Civil.DatabaseServices.CogoPoint)Tx.GetObject(id,OpenMode.ForRead); if(cp.PointNumber==243) p243=new Point3d(cp.Easting,cp.Northing,0); }
if(p243==null){ Log("STOP - point 243 not found"); return; }
var pl=Tx.GetObject(oid("21856"),OpenMode.ForRead) as Polyline;
if(pl==null){ Log("STOP - boundary polyline 21856 not found"); return; }
var sw=pl.GetPoint2dAt(0); if(sw.GetDistanceTo(new Point2d(p243.Value.X,p243.Value.Y))>0.005){ Log("STOP - v0 is not on 243"); return; }
var se=pl.GetPoint2dAt(3);
double south=Math.Atan2(se.Y-sw.Y,se.X-sw.X);
// curb vertices from 21434 (front) and 216AC (back), south of the line
double th=0;
foreach(var h in new[]{"21434","216AC"}){ var c=Tx.GetObject(oid(h),OpenMode.ForRead) as Polyline; if(c==null){ Log("STOP - curb "+h+" not found"); return; }
for(int i=0;i<c.NumberOfVertices;i++){ var q=c.GetPoint2dAt(i); double d=Math.Atan2(q.Y-sw.Y,q.X-sw.X)-south; if(d<th) th=d; } }
if(th>=0){ Log("curb already inside - nothing to do"); return; }
for(int i=0;i<pl.NumberOfVertices;i++) Log(" before v"+i+" "+pl.GetPoint2dAt(i).X.ToString("F4")+","+pl.GetPoint2dAt(i).Y.ToString("F4"));
pl.UpgradeOpen(); pl.TransformBy(Matrix3d.Rotation(th,Vector3d.ZAxis,p243.Value));
Log("rotated 21856 "+(-th*180/Math.PI*3600).ToString("F2")+" sec clockwise about 243");
for(int i=0;i<pl.NumberOfVertices;i++) Log(" after v"+i+" "+pl.GetPoint2dAt(i).X.ToString("F4")+","+pl.GetPoint2dAt(i).Y.ToString("F4"));
var nse=pl.GetPoint2dAt(3); double ns=Math.Atan2(nse.Y-sw.Y,nse.X-sw.X); double worst=1e9;
foreach(var h in new[]{"21434","216AC"}){ var c=(Polyline)Tx.GetObject(oid(h),OpenMode.ForRead);
for(int i=0;i<c.NumberOfVertices;i++){ var q=c.GetPoint2dAt(i); double off=Math.Sin(Math.Atan2(q.Y-sw.Y,q.X-sw.X)-ns)*q.GetDistanceTo(sw); if(off<worst) worst=off; } }
Log("closest curb vertex north of new south line by "+worst.ToString("F4")+" ft (verified)");
double az=Math.Atan2(sw.X-nse.X,sw.Y-nse.Y)*180/Math.PI; if(az<0) az+=360; Log("south line az (SE->243) "+az.ToString("F6"));
Ed.Regen();
Result
Log
before v0 2232335.8260,1420451.3711 before v1 2232330.1475,1420625.3485 before v2 2232597.4069,1420645.7891 before v3 2232597.3379,1420481.7614 rotated 21856 1739.74 sec clockwise about 243 after v0 2232335.8260,1420451.3711 after v1 2232331.6151,1420625.3902 after v2 2232599.0374,1420643.5759 after v3 2232597.5849,1420479.5546 closest curb vertex north of new south line by -0.0000 ft (verified) south line az (SE->243) 263.854649
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.