C3DO-0744 · 261101: deed boundary polyline on C-PROP-BNDY (redo) [C3D-DEEDPOLY] done
Redraw the deed-fit boundary as a closed polyline on C-PROP-BNDY: SW on 243, NW and NE by the deed calls (N01°52'10"W 174.07', N85°37'35"E 268.04'), SE held. Skips if the same polyline is already there.
C# payload
Func<string,ObjectId> oid=hs=>{ ObjectId id; Db.TryGetObjectId(new Handle(Convert.ToInt64(hs,16)),out id); return id; };
Func<double,double,double,double> D=(d,m,s)=>(d+m/60+s/3600)*Math.PI/180;
Func<Point3d,double,double,Point3d> go=(p,az,l)=>new Point3d(p.X+l*Math.Sin(az),p.Y+l*Math.Cos(az),0);
Func<Point3d,Point3d,string> brg=(p,q)=>{ double a=Math.Atan2(q.X-p.X,q.Y-p.Y)*180/Math.PI; if(a<0)a+=360; return a.ToString("F6")+" "+p.DistanceTo(q).ToString("F3"); };
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 missing"); return; }
var SW=p243.Value; var SE=new Point3d(2232597.3379,1420481.7614,0);
var sid=oid("214DE"); if(!sid.IsNull&&!sid.IsErased){ var seg=Tx.GetObject(sid,OpenMode.ForRead) as Curve; if(seg!=null){ var q=seg.GetPointAtParameter(3); SE=new Point3d(q.X,q.Y,0); Log("SE from parcel segment 214DE"); } } else Log("parcel segment 214DE not found - SE from the C3DO-0741 read");
var NW=go(SW,2*Math.PI-D(1,52,10),174.07); var NE=go(NW,D(85,37,35),268.04);
var P=new[]{SW,NW,NE,SE};
var ms=(BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db),OpenMode.ForRead);
var old=oid("21856"); Log("polyline 21856 "+(old.IsNull?"not found":old.IsErased?"erased":"still there"));
foreach(ObjectId id in ms){ var e=Tx.GetObject(id,OpenMode.ForRead) as Polyline; if(e==null||e.Layer!="C-PROP-BNDY"||e.NumberOfVertices!=4) continue; bool same=true; for(int i=0;i<4;i++) if(e.GetPoint2dAt(i).GetDistanceTo(new Point2d(P[i].X,P[i].Y))>0.001) same=false; if(same){ Log("already there: "+e.Handle+" - nothing drawn"); return; } }
var lt=(LayerTable)Tx.GetObject(Db.LayerTableId,OpenMode.ForRead); if(!lt.Has("C-PROP-BNDY")){ Log("STOP - layer C-PROP-BNDY missing"); return; }
var pl=new Polyline(); pl.SetDatabaseDefaults(Db); pl.Layer="C-PROP-BNDY";
for(int i=0;i<4;i++) pl.AddVertexAt(i,new Point2d(P[i].X,P[i].Y),0,0,0); pl.Closed=true;
ms.UpgradeOpen(); ms.AppendEntity(pl); Tx.AddNewlyCreatedDBObject(pl,true);
Log("NEW POLYLINE "+pl.Handle+" on "+pl.Layer+" (verified): W "+brg(SW,NW)+" | N "+brg(NW,NE)+" | E "+brg(NE,SE)+" | S "+brg(SE,SW)+" area "+pl.Area.ToString("F2"));
Ed.Regen();
Result
Log
parcel segment 214DE not found - SE from the C3DO-0741 read polyline 21856 still there already there: 21856 - nothing drawn
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.