C3DO-0796 · 261101 ALTA 5/7: Parcel One / Parcel Two common line from the record calls [C3D-A5COMMON] done
Redline item 12: plot the unmonumented common line between Parcel One (Bldg A) and Parcel Two (Bldg B) from DB 69685/361 Exh A calls (S04 35 35 E 57.50, N85 35 55 E 110.05, S04 27 07 E 107.89), rotated to the survey basis from the held W line, ends snapped to the surveyed N and S lines; new layer SS-PARCEL-COMMON (adjoiner linetype). Record call labels on each leg and PARCEL ONE 0.687 AC / PARCEL TWO 0.340 AC labels. Logs the fit.
C# payload
string F(double v)=>v.ToString("0.###");
ObjectId H(string h)=>Db.GetObjectId(false,new Handle(Convert.ToInt64(h,16)),0);
ObjectId Lyr(string name,short c){ var lt=(LayerTable)Tx.GetObject(Db.LayerTableId,OpenMode.ForRead); if(lt.Has(name)) return lt[name]; lt.UpgradeOpen(); var r=new LayerTableRecord{Name=name,Color=Autodesk.AutoCAD.Colors.Color.FromColorIndex(Autodesk.AutoCAD.Colors.ColorMethod.ByAci,c)}; var id=lt.Add(r); Tx.AddNewlyCreatedDBObject(r,true); Log("layer created "+name); return id; }
ObjectId Put(BlockTableRecord btr, Autodesk.AutoCAD.DatabaseServices.Entity e, string layer){ e.SetDatabaseDefaults(Db); e.Layer=layer; var id=btr.AppendEntity(e); Tx.AddNewlyCreatedDBObject(e,true); return id; }
var LM=LayoutManager.Current;
BlockTableRecord PS(string name){ var l=(Layout)Tx.GetObject(LM.GetLayoutId(name),OpenMode.ForRead); return (BlockTableRecord)Tx.GetObject(l.BlockTableRecordId,OpenMode.ForWrite); }
var BT=(BlockTable)Tx.GetObject(Db.BlockTableId,OpenMode.ForRead);
var MS=(BlockTableRecord)Tx.GetObject(BT[BlockTableRecord.ModelSpace],OpenMode.ForWrite);
bool HasText(BlockTableRecord btr,string contains){ foreach(ObjectId id in btr){ var o=Tx.GetObject(id,OpenMode.ForRead); if(o is MText m && m.Contents.Contains(contains)) return true; if(o is DBText t && t.TextString.Contains(contains)) return true; } return false; }
string D=@"\U+00B0";
var SW=new Point2d(2232335.826,1420451.371); var NW=new Point2d(2232331.615,1420625.39); var NE=new Point2d(2232597.423,1420644.363); var SE=new Point2d(2232597.585,1420479.555);
double Az(Point2d a,Point2d b){ double z=Math.Atan2(b.X-a.X,b.Y-a.Y)*180/Math.PI; return (z+360)%360; }
double Rec(string ns,int d,int m,int s,string ew){ double a=d+m/60.0+s/3600.0; if(ns=="N"&&ew=="E") return a; if(ns=="S"&&ew=="E") return 180-a; if(ns=="S"&&ew=="W") return 180+a; return 360-a; }
Point2d Mv(Point2d p,double az,double l){ double r=az*Math.PI/180; return new Point2d(p.X+l*Math.Sin(r),p.Y+l*Math.Cos(r)); }
double rot=Az(SW,NW)-Rec("N",1,52,10,"W"); Log("basis rotation (W line measured - record) = "+(rot*3600).ToString("0")+" sec");
var p1=Mv(SW,Rec("N",1,52,10,"W")+rot,174.07); var p2=Mv(p1,Rec("N",85,37,35,"E")+rot,99.81); var p3=Mv(p2,Rec("S",4,35,35,"E")+rot,57.50); var p4=Mv(p3,Rec("N",85,35,55,"E")+rot,110.05); var p5=Mv(p4,Rec("S",4,27,7,"E")+rot,107.89); var p6=Mv(p5,Rec("S",83,22,17,"W")+rot,218.01);
Log("record P1 vs NW IPS "+F((p1-NW).Length)+" ; Parcel One closes on POB "+F((p6-SW).Length));
Point2d Ix(Point2d a,Point2d b,Point2d c,Point2d d){ var r=b-a; var s=d-c; double den=r.X*s.Y-r.Y*s.X; double t=((c.X-a.X)*s.Y-(c.Y-a.Y)*s.X)/den; return a+r*t; }
var nEnd=Ix(p3,p2,NW,NE); var sEnd=Ix(p4,p5,SE,SW);
Log("common line N end on surveyed N line: record pt is "+F((p2-nEnd).Length)+"' from it, "+F((nEnd-NW).Length)+"' from NW corner (record 99.81)");
Log("common line S end on surveyed S line: record pt is "+F((p5-sEnd).Length)+"' from it, "+F((sEnd-SW).Length)+"' from POB (record 218.01)");
var adj=(LayerTableRecord)Tx.GetObject(((LayerTable)Tx.GetObject(Db.LayerTableId,OpenMode.ForRead))["V-GIS-PROP-ADJ"],OpenMode.ForRead);
var lid=Lyr("SS-PARCEL-COMMON",7); var lr=(LayerTableRecord)Tx.GetObject(lid,OpenMode.ForWrite); lr.LinetypeObjectId=adj.LinetypeObjectId;
bool have=false; foreach(ObjectId id in MS){ var e=Tx.GetObject(id,OpenMode.ForRead) as Autodesk.AutoCAD.DatabaseServices.Entity; if(e!=null && e.Layer=="SS-PARCEL-COMMON" && e is Polyline) have=true; }
if(!have){ var pl=new Polyline(); int i=0; foreach(var v in new[]{nEnd,p3,p4,sEnd}) pl.AddVertexAt(i++,v,0,0,0); Put(MS,pl,"SS-PARCEL-COMMON"); pl.LinetypeScale=1.0; Log("common line drawn: "+F(pl.Length)+"' ("+pl.Handle+")"); } else Log("common line already present");
var styl=((MText)Tx.GetObject(H("21495"),OpenMode.ForRead)).TextStyleId;
bool Exists(string txt){ foreach(ObjectId id in MS){ var e=Tx.GetObject(id,OpenMode.ForRead) as MText; if(e!=null && e.Contents==txt) return true; } return false; }
void SegLbl(Point2d a,Point2d b,string txt){ if(Exists(txt)){ Log(" exists: "+txt); return; } double r=Math.Atan2(b.Y-a.Y,b.X-a.X); while(r>100*Math.PI/180) r-=Math.PI; while(r<=-80*Math.PI/180) r+=Math.PI;
var mid=new Point2d((a.X+b.X)/2,(a.Y+b.Y)/2); var up=new Vector2d(-Math.Sin(r),Math.Cos(r));
var m=new MText{ Location=new Point3d(mid.X+up.X*1.0,mid.Y+up.Y*1.0,0), Contents=txt, TextHeight=2.0, Rotation=r, Attachment=AttachmentPoint.BottomCenter }; m.SetDatabaseDefaults(Db); m.TextStyleId=styl; m.BackgroundFill=true; m.UseBackgroundColor=true; m.BackgroundScaleFactor=1.15;
Put(MS,m,"C-PROP-LINE-TEXT"); Log(" + "+txt); }
SegLbl(nEnd,p3,"(R) S04"+D+"35'35\"E 57.50'"); SegLbl(p3,p4,"(R) N85"+D+"35'55\"E 110.05'"); SegLbl(p4,sEnd,"(R) S04"+D+"27'07\"E 107.89'");
void Pt(double x,double y,string txt){ if(Exists(txt)){ Log(" exists: "+txt.Replace("\\P"," / ")); return; } var m=new MText{ Location=new Point3d(x,y,0), Contents=txt, TextHeight=2.0, Attachment=AttachmentPoint.MiddleCenter }; m.SetDatabaseDefaults(Db); m.TextStyleId=styl; m.BackgroundFill=true; m.UseBackgroundColor=true; m.BackgroundScaleFactor=1.15; Put(MS,m,"C-ANNO"); Log(" + "+txt.Replace("\\P"," / ")); }
Pt(2232515,1420548,@"PARCEL ONE\P(BUILDING A)\P0.687 AC (RECORD)");
Pt(2232575,1420525,@"PARCEL TWO\P(BUILDING B)\P0.340 AC (RECORD)");
Pt((nEnd.X+p3.X)/2+9,(nEnd.Y+p3.Y)/2-12,@"COMMON LINE\PNOT MONUMENTED,\PPLOTTED FROM\PRECORD CALLS");
Ed.Regen();
Result
Log
basis rotation (W line measured - record) = 1740 sec record P1 vs NW IPS 0 ; Parcel One closes on POB 0.013 common line N end on surveyed N line: record pt is 0.335' from it, 99.809' from NW corner (record 99.81) common line S end on surveyed S line: record pt is 0.01' from it, 218.002' from POB (record 218.01) layer created SS-PARCEL-COMMON common line drawn: 275.765' (21DEF) + (R) S04\U+00B035'35"E 57.50' + (R) N85\U+00B035'55"E 110.05' + (R) S04\U+00B027'07"E 107.89' + PARCEL ONE / (BUILDING A) / 0.687 AC (RECORD) + PARCEL TWO / (BUILDING B) / 0.340 AC (RECORD) + COMMON LINE / NOT MONUMENTED, / PLOTTED FROM / RECORD CALLS
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.