C3DO-0823 · C4 cycle 2 markup: Tract 2 rear B/L 50' (flag lot), note, west contiguous area [C3D-M2MARKUP] done
Per the C4 Cycle 2 markup: Tract 2 rear (west) B/L moved from 75' to 50' off the west line (side B/Ls extended to it), label 75'->50', note REAR B/L IS 50' SINCE TRACT 2 IS A FLAG LOT, west-of-stream contiguous area 4.32 ac (188,214 sf) -> 4.41 ac (192,039 sf) on the label and the legend.
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; }
// 260714 C4 Cycle 2 markup: Tract 2 rear (west) B/L 75' -> 50' ("This should be 50' since this is a flag lot"),
// add that note, and update the west-of-stream contiguous area (recomputed with the 50' B/L: 192,039 sf = 4.41 ac).
// west line of the parent tract (P5 -> P4)
var W1=new Point2d(2203439.776,1207293.677); var W2=new Point2d(2203439.294,1206709.997);
var t=(W2-W1)/(W2-W1).Length; var n=new Vector2d(-t.Y,t.X); if(n.X<0) n=-n; // east, into the tract
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 u=((c.X-a.X)*s.Y-(c.Y-a.Y)*s.X)/den; return a+r*u; }
var R1=W1+n*50; var R2=W2+n*50; // new rear B/L line, 50' off the west line
var ln=(Line)Tx.GetObject(H("23565"),OpenMode.ForWrite); var sN=(Line)Tx.GetObject(H("23564"),OpenMode.ForWrite); var sS=(Line)Tx.GetObject(H("23566"),OpenMode.ForWrite);
double dOld=Math.Abs((new Point2d(ln.StartPoint.X,ln.StartPoint.Y)-W1).DotProduct(n));
if(dOld<49 || dOld>51){
var cN=Ix(R1,R2,new Point2d(sN.StartPoint.X,sN.StartPoint.Y),new Point2d(sN.EndPoint.X,sN.EndPoint.Y));
var cS=Ix(R1,R2,new Point2d(sS.StartPoint.X,sS.StartPoint.Y),new Point2d(sS.EndPoint.X,sS.EndPoint.Y));
string o=F(ln.StartPoint.X)+","+F(ln.StartPoint.Y)+" - "+F(ln.EndPoint.X)+","+F(ln.EndPoint.Y);
ln.StartPoint=new Point3d(cN.X,cN.Y,ln.StartPoint.Z); ln.EndPoint=new Point3d(cS.X,cS.Y,ln.EndPoint.Z);
sN.EndPoint=new Point3d(cN.X,cN.Y,sN.EndPoint.Z); sS.StartPoint=new Point3d(cS.X,cS.Y,sS.StartPoint.Z);
Log("rear B/L 23565 "+o+" -> "+F(cN.X)+","+F(cN.Y)+" - "+F(cS.X)+","+F(cS.Y)+" ; side B/Ls 23564/23566 extended to it");
var tick=(Line)Tx.GetObject(H("23567"),OpenMode.ForWrite); tick.TransformBy(Matrix3d.Displacement(new Vector3d(-n.X*25,-n.Y*25,0))); Log("tick 23567 moved 25' west with it");
} else Log("rear B/L already at 50' - line not moved");
Log("rear B/L now "+F(Math.Abs((new Point2d(ln.StartPoint.X,ln.StartPoint.Y)-W1).DotProduct(n)))+"' / "+F(Math.Abs((new Point2d(ln.EndPoint.X,ln.EndPoint.Y)-W1).DotProduct(n)))+"' off the west line (verified)");
// label
var lb=(MText)Tx.GetObject(H("242AA"),OpenMode.ForWrite);
if(lb.Contents.StartsWith("75'")){ lb.Contents="50' REAR B/L"; lb.Location=lb.Location-new Vector3d(n.X*25,n.Y*25,0); }
Log("label 242AA '"+lb.Contents+"' @"+F(lb.Location.X)+","+F(lb.Location.Y));
// the reviewer's note
bool have=false; foreach(ObjectId id in MS){ if(Tx.GetObject(id,OpenMode.ForRead) is MText m && m.Contents.Contains("FLAG LOT")) have=true; }
if(!have){ var nt=new MText{Location=new Point3d(2203500,1206815,0),Contents=@"REAR B/L IS 50' SINCE\PTRACT 2 IS A FLAG LOT",TextHeight=8,Attachment=AttachmentPoint.MiddleLeft};
nt.SetDatabaseDefaults(Db); nt.TextStyleId=lb.TextStyleId; nt.BackgroundFill=true; nt.UseBackgroundColor=true; nt.BackgroundScaleFactor=1.15; Put(MS,nt,lb.Layer); var ex=nt.GeometricExtents; Log("flag-lot note on "+lb.Layer+" x "+F(ex.MinPoint.X)+"-"+F(ex.MaxPoint.X)+" y "+F(ex.MinPoint.Y)+"-"+F(ex.MaxPoint.Y)); }
// contiguous area, west of stream
var cw=(MText)Tx.GetObject(H("242A1"),OpenMode.ForWrite); string c0=cw.Contents; if(c0.Contains("4.32")) cw.Contents=c0.Replace("4.32 AC","4.41 AC"); Log("242A1 '"+c0+"' -> '"+cw.Contents+"'");
var lg=(MText)Tx.GetObject(H("23D95"),OpenMode.ForWrite); string g0=lg.Contents; if(g0.Contains("188,214")) lg.Contents=g0.Replace("4.32 AC (188,214 SQ FT)","4.41 AC (192,039 SQ FT)");
Log("legend 23D95 now: "+lg.Contents.Replace("\\P"," / ")+(lg.Contents.Contains("192,039")?" (verified)":" (NOT CHANGED)"));
Ed.Regen();
Result
Log
rear B/L 23565 2203514.735,1207244.167 - 2203514.336,1206760.398 -> 2203489.735,1207244.003 - 2203489.336,1206760.264 ; side B/Ls 23564/23566 extended to it tick 23567 moved 25' west with it rear B/L now 50' / 50' off the west line (verified) label 242AA '50' REAR B/L' @2203479.579,1206934.535 flag-lot note on C-ANNO x 2203500-2203657.333 y 1206803.571-1206826.429 242A1 'CONTIGUOUS AREA 4.32 AC' -> 'CONTIGUOUS AREA 4.41 AC' legend 23D95 now: / CONTIGUOUS AREA - / TRACT 1 2.26 AC (98,267 SQ FT) / TRACT 2 - WEST OF STREAM 4.41 AC (192,039 SQ FT) / TRACT 2 - EAST OF STREAM 4.83 AC (210,252 SQ FT) (verified)
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.