← Inbox

C3DO-0775 · 261101: north line N85°55'02"E 266.48 [C3D-NORTHFIX] error

Hold the NW corner and set the NE corner of boundary 21856 at N85°55'02"E 266.48 from it (east line follows). Then try the same vertex move on parcel 2185A's segment 21859 by grip; if the parcel will not take it, it is left as is and logged.

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

C# payload

Func<string,ObjectId> oid=hs=>{ ObjectId id; Db.TryGetObjectId(new Handle(Convert.ToInt64(hs,16)),out id); return id; };
Func<Point3d,Point3d,string> brg=(a,b)=>{ double az=Math.Atan2(b.X-a.X,b.Y-a.Y)*180/Math.PI; if(az<0) az+=360; string ns,ew; double d;
 if(az<90){ns="N";ew="E";d=az;} else if(az<180){ns="S";ew="E";d=180-az;} else if(az<270){ns="S";ew="W";d=az-180;} else {ns="N";ew="W";d=360-az;}
 int D=(int)d; int M=(int)((d-D)*60); double S=((d-D)*60-M)*60; return ns+D.ToString("00")+"°"+M.ToString("00")+"'"+S.ToString("00.0")+"\""+ew+" "+a.DistanceTo(b).ToString("F2"); };
var pl=Tx.GetObject(oid("21856"),OpenMode.ForRead) as Polyline; if(pl==null){ Log("STOP - 21856 not found"); return; }
var V=new Point3d[4]; for(int i=0;i<4;i++){ var q=pl.GetPoint2dAt(i); V[i]=new Point3d(q.X,q.Y,0); }
double az=(85+55.0/60+2.0/3600)*Math.PI/180;
var NE=new Point3d(V[1].X+266.48*Math.Sin(az),V[1].Y+266.48*Math.Cos(az),0);
Log("NW "+V[1].X.ToString("F4")+","+V[1].Y.ToString("F4")+" held; NE "+V[2].X.ToString("F4")+","+V[2].Y.ToString("F4")+" -> "+NE.X.ToString("F4")+","+NE.Y.ToString("F4")+" (moves "+V[2].DistanceTo(NE).ToString("F3")+")");
foreach(ObjectId id in CivilDoc.CogoPoints){ var cp=(Autodesk.Civil.DatabaseServices.CogoPoint)Tx.GetObject(id,OpenMode.ForRead); if(cp.PointNumber==523) Log("new NE to point 523: "+NE.DistanceTo(new Point3d(cp.Easting,cp.Northing,0)).ToString("F3")); }
pl.UpgradeOpen(); pl.SetPointAt(2,new Point2d(NE.X,NE.Y));
var W=new Point3d[4]; for(int i=0;i<4;i++){ var q=pl.GetPoint2dAt(i); W[i]=new Point3d(q.X,q.Y,0); }
Log("POLYLINE 21856 (verified): W "+brg(W[0],W[1])+" | N "+brg(W[1],W[2])+" | E "+brg(W[2],W[3])+" | S "+brg(W[3],W[0])+" | area "+pl.Area.ToString("F2"));
var segId=oid("21859"); var seg=Tx.GetObject(segId,OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity;
if(seg==null){ Log("parcel segment 21859 not found"); Ed.Regen(); return; }
foreach(var m in seg.GetType().GetMethods()) if(m.Name.Contains("Point")||m.Name.Contains("Vertex")||m.Name.Contains("Element")||m.Name.Contains("Grip")) Log("  seg method "+m.Name+"("+string.Join(",",m.GetParameters().Select(p=>p.ParameterType.Name))+")");
var g=new Point3dCollection(); var sm=new IntegerCollection(); var gi=new IntegerCollection();
try{ seg.GetGripPoints(g,sm,gi); }catch(Exception ex){ Log("  GetGripPoints failed: "+ex.Message); }
string gs=""; foreach(Point3d p in g) gs+=" "+p.X.ToString("F3")+","+p.Y.ToString("F3"); Log("  grips "+g.Count+":"+gs);
int k=-1; for(int i=0;i<g.Count;i++) if(g[i].DistanceTo(V[2])<0.005){ k=i; break; }
if(k<0){ Log("parcel NOT updated - no grip on the NE vertex"); Ed.Regen(); return; }
try{ seg.UpgradeOpen(); seg.MoveGripPointsAt(new IntegerCollection(new[]{k}), NE-V[2]); }catch(Exception ex){ Log("parcel grip move failed: "+ex.Message); }
var par=(Autodesk.Civil.DatabaseServices.Parcel)Tx.GetObject(oid("2185A"),OpenMode.ForRead); var bc=par.BaseCurve; string pv="";
double worst=0; for(int i=0;i<(int)bc.EndParam;i++){ var q=bc.GetPointAtParameter(i); double d=1e9; foreach(var w in W) d=Math.Min(d,w.DistanceTo(new Point3d(q.X,q.Y,0))); worst=Math.Max(worst,d); pv+=" "+q.X.ToString("F4")+","+q.Y.ToString("F4"); }
Log("PARCEL 2185A vertices"+pv+" | worst gap to 21856 "+worst.ToString("F4")+" | area "+par.Area.ToString("F2"));
Ed.Regen();

Result

Status
error
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\261101 - Project\261101 - 5491 Roswell Rd NE R2.dwg
Message
eWasErased
Entities
—
Duration
414 ms
Civil 3D
25.0.0.0

Notes

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

No notes yet.