C3DO-0794 · 261101 ALTA 4/7: record calls, found-pipe ties, improvements at the lines, curb cut [C3D-A4PLAN] done
Redline items 4, 5, 6, 7 on the plan (model space, C-PROP-LINE-TEXT / C-ANNO, masked MText): (R) record call outside each line; ties from the SE corner to the 1in OTP and 1/2in OTP not held; distance and side to the line for the FMLS steps/walk, FMLS walls, SE wall corner, lighted sign (sign easement 13648/46), SBUC, Roswell Rd curb and curb islands, NW walls, east-parking fence/wall; CURB CUT at the Roswell Rd entrance. Offsets computed in-script from the linework and points.
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);
var A=new Dictionary<string,Point2d>{{"W",SW},{"N",NW},{"E",NE},{"S",SE}}; var B=new Dictionary<string,Point2d>{{"W",NW},{"N",NE},{"E",SE},{"S",SW}};
var ROT=new Dictionary<string,double>{{"W",Math.Atan2(NW.Y-SW.Y,NW.X-SW.X)},{"N",Math.Atan2(NE.Y-NW.Y,NE.X-NW.X)},{"E",Math.Atan2(NE.Y-SE.Y,NE.X-SE.X)},{"S",Math.Atan2(SE.Y-SW.Y,SE.X-SW.X)}};
Vector2d T(string k){ var v=B[k]-A[k]; return v/v.Length; }
Vector2d Nn(string k){ var t=T(k); return new Vector2d(t.Y,-t.X); } // inside normal (ring is clockwise)
Point3d P(string k,double s,double o){ var p=A[k]+T(k)*s+Nn(k)*o; return new Point3d(p.X,p.Y,0); }
(double s,double o) SO(string k,Point3d p){ var v=new Vector2d(p.X-A[k].X,p.Y-A[k].Y); return (v.DotProduct(T(k)), v.DotProduct(Nn(k))); }
List<Point3d> Samp(string h){ var c=(Curve)Tx.GetObject(H(h),OpenMode.ForRead); var L=c.GetDistanceAtParameter(c.EndParam); int n=Math.Max(2,(int)(L/0.25)); var r=new List<Point3d>(); for(int i=0;i<=n;i++) r.Add(c.GetPointAtDist(L*i/n)); return r; }
(double mn,double mx) Rng(string k,string[] hs,double s0,double s1){ double mn=1e9,mx=-1e9; foreach(var h in hs) foreach(var p in Samp(h)){ var q=SO(k,p); if(q.s<s0||q.s>s1) continue; if(q.o<mn) mn=q.o; if(q.o>mx) mx=q.o; } return (mn,mx); }
string f2(double v)=>Math.Abs(v).ToString("0.0");
var styl=((MText)Tx.GetObject(H("21495"),OpenMode.ForRead)).TextStyleId;
int added=0;
bool Exists(string txt){ foreach(ObjectId id in MS){ var e=Tx.GetObject(id,OpenMode.ForRead) as MText; if(e!=null && e.Contents==txt){ Log(" exists: "+txt.Replace("\\P"," / ")); return true; } } return false; }
void Lbl(string k,double s,double o,string txt,double h,string layer){
if(Exists(txt)) return;
bool upOut=(k=="W"||k=="N"); var at= o<0 ? (upOut?AttachmentPoint.BottomCenter:AttachmentPoint.TopCenter) : (upOut?AttachmentPoint.TopCenter:AttachmentPoint.BottomCenter);
var m=new MText{ Location=P(k,s,o), Contents=txt, TextHeight=h, Rotation=ROT[k], Attachment=at };
m.SetDatabaseDefaults(Db); m.TextStyleId=styl; m.BackgroundFill=true; m.UseBackgroundColor=true; m.BackgroundScaleFactor=1.15;
Put(MS,m,layer); added++; Log(" + ["+k+" sta "+F(s)+" off "+F(o)+"] "+txt.Replace("\\P"," / ")); }
void LblXY(Point3d p,string txt,double h,AttachmentPoint at){
if(Exists(txt)) return;
var m=new MText{ Location=p, Contents=txt, TextHeight=h, Attachment=at }; m.SetDatabaseDefaults(Db); m.TextStyleId=styl; m.BackgroundFill=true; m.UseBackgroundColor=true; m.BackgroundScaleFactor=1.15;
Put(MS,m,"C-ANNO"); added++; Log(" + [xy "+F(p.X)+","+F(p.Y)+"] "+txt.Replace("\\P"," / ")); }
// ---- item 4: record calls
Log("item 4 record calls (DB 69685/361 Exh A outer lines):");
Lbl("W",87.0,-14.0,"(R) N01"+D+"52'10\"W 174.07'",2.5,"C-PROP-LINE-TEXT");
Lbl("N",133.2,-23.0,"(R) N85"+D+"37'35\"E 268.04'",2.2,"C-PROP-LINE-TEXT");
Lbl("E",82.4,-14.0,"(R) S00"+D+"01'25\"W 164.04'",2.5,"C-PROP-LINE-TEXT");
Lbl("S",131.6,-15.5,"(R) S83"+D+"22'17\"W 263.28'",2.5,"C-PROP-LINE-TEXT");
// ---- item 5: found pipes not held
Log("item 5 monument ties:");
foreach(ObjectId pid in CivilDoc.CogoPoints){ var cp=(Autodesk.Civil.DatabaseServices.CogoPoint)Tx.GetObject(pid,OpenMode.ForRead); if(cp.PointNumber!=330 && cp.PointNumber!=328) continue;
double dn=cp.Northing-SE.Y, de=cp.Easting-SE.X, dd=Math.Sqrt(dn*dn+de*de);
string txt="NOT HELD - "+dd.ToString("0.00")+"' FROM SE CORNER\\P("+Math.Abs(dn).ToString("0.00")+"' "+(dn<0?"S":"N")+", "+Math.Abs(de).ToString("0.00")+"' "+(de<0?"W":"E")+")";
Log(" pt "+cp.PointNumber+" "+cp.RawDescription+": dN "+F(dn)+" dE "+F(de)+" dist "+F(dd));
LblXY(new Point3d(cp.Easting+4.0,cp.Northing-4.5,0),txt,2.2,AttachmentPoint.TopLeft); }
// ---- item 6: improvements at the lines
Log("item 6 improvements at the lines:");
var st=Rng("S",new[]{"219D4","219DA","219DC","219CF","219D0","219D1","219D2"},125,145); Log(" FMLS steps/walk S-offset "+F(st.mn)+".."+F(st.mx));
Lbl("S",134,-20.5,"CONC. STEPS & WALK (FMLS)\\P"+f2(Math.Max(st.mx,0))+"'-"+f2(st.mn)+"' S OF LINE",1.8,"C-ANNO");
var w1=Rng("S",new[]{"219D7","2142B"},138,255); Log(" FMLS wall west part S-offset "+F(w1.mn)+".."+F(w1.mx));
Lbl("S",195,-8.0,"WALL (FMLS) "+f2(w1.mx)+"'-"+f2(w1.mn)+"' S OF LINE",1.8,"C-ANNO");
var w2=Rng("S",new[]{"219DD","21AA8"},52,131.6); Log(" FMLS wall east part S-offset "+F(w2.mn)+".."+F(w2.mx));
Lbl("S",70,-14.0,"WALL (FMLS) "+f2(w2.mx)+"'-"+f2(w2.mn)+"' S OF LINE",1.8,"C-ANNO");
var w3=Rng("S",new[]{"21AC9","21AD2","21AD1","21AD4","21AC8"},48,62); Log(" SE wall corner S-offset "+F(w3.mn)+".."+F(w3.mx));
Lbl("S",56,-9.0,"WALL CORNER "+f2(w3.mx)+"' N OF LINE",1.8,"C-ANNO");
foreach(ObjectId pid in CivilDoc.CogoPoints){ var cp=(Autodesk.Civil.DatabaseServices.CogoPoint)Tx.GetObject(pid,OpenMode.ForRead);
if(cp.PointNumber==245){ var q=SO("S",cp.Location); Log(" SIGN pt 245 S-offset "+F(q.o)+" sta "+F(q.s)); Lbl("S",238,-15.0,"LIGHTED SIGN "+f2(q.o)+"' S OF LINE\\P(SIGN EASEMENT DB 13648/46)",1.8,"C-ANNO"); }
if(cp.PointNumber==244){ var q=SO("W",cp.Location); Log(" SBUC pt 244 W-offset "+F(q.o)); LblXY(new Point3d(cp.Easting-3.0,cp.Northing-6.0,0),"SBUC "+f2(q.o)+"' W OF LINE\\P(IN R/W)",1.8,AttachmentPoint.TopRight); } }
var cb=Rng("W",new[]{"21431","214C5","214C6"},54,153); Log(" W curb offsets "+F(cb.mn)+".."+F(cb.mx));
Lbl("W",140,-6.0,"CURB "+f2(cb.mx)+"' E TO "+f2(cb.mn)+"' W OF LINE",1.8,"C-ANNO");
var i1=Rng("W",new[]{"2142D","2142E","214BE","214BF","214C2","214C3"},-10,22); Log(" S island W-offsets "+F(i1.mn)+".."+F(i1.mx));
Lbl("W",5,-20.0,"CURB ISLAND (R/W)\\P"+f2(i1.mn)+"' W OF LINE, NOSE AT LINE",1.8,"C-ANNO");
var i2=Rng("W",new[]{"2142F","214BC","214C4","21430","214BB","214C0"},44,181); Log(" N island W-offsets "+F(i2.mn)+".."+F(i2.mx));
Lbl("W",150,-22.5,"CURB ISLAND (R/W) NOSE AT LINE TO "+f2(i2.mn)+"' W",1.8,"C-ANNO");
// ---- item 7: curb cut
Log("item 7 curb cut:"); Lbl("W",33.5,-5.0,"CURB CUT",2.5,"C-ANNO");
// ---- NW wall
var nw1=Rng("W",new[]{"219B8","21B7C","21429","219BA","21B7A","21B7B"},150,175); Log(" NW wall W-offsets "+F(nw1.mn)+".."+F(nw1.mx));
Lbl("W",162,-5.0,"WALL "+f2(nw1.mn)+"' E OF LINE",1.8,"C-ANNO");
var nw2=Rng("N",new[]{"219BA","219BB","216D0","21429"},0,80); Log(" N wall N-offsets "+F(nw2.mn)+".."+F(nw2.mx));
Lbl("N",28,4.0,"WALL "+f2(nw2.mn)+"' S OF LINE",1.8,"C-ANNO");
// ---- east parking fence / wall
var eIds=new List<ObjectId>(); foreach(ObjectId id in MS) eIds.Add(id);
foreach(ObjectId id in eIds){ var c=Tx.GetObject(id,OpenMode.ForRead) as Curve; if(c==null) continue; if(!(c.Layer.StartsWith("SS-X-FENCE")||c.Layer=="V-STRC-WALL")) continue;
double L; try{ L=c.GetDistanceAtParameter(c.EndParam);}catch{continue;} if(L<20) continue; int n=(int)(L/0.5); double mn=1e9,s0=1e9,s1=-1e9,oMax=-1e9; int cnt=0;
for(int i=0;i<=n;i++){ var p=c.GetPointAtDist(L*i/n); var q=SO("E",p); if(q.s<0||q.s>164.8||q.o<0||q.o>70) continue; cnt++; if(q.o<mn){mn=q.o;} if(q.s<s0)s0=q.s; if(q.s>s1)s1=q.s; if(q.o>oMax)oMax=q.o; }
if(cnt<10||s1-s0<20||oMax-mn>15) continue;
Log(" E-side "+c.Layer+" "+c.Handle+" sta "+F(s0)+"-"+F(s1)+" W-offset "+F(mn)+".."+F(oMax));
string what=c.Layer.StartsWith("SS-X-FENCE")?"FENCE":"WALL";
Lbl("E",(s0+s1)/2,Math.Max(mn-3.0,1.0),what+" "+f2(mn)+"'-"+f2(oMax)+"' W OF LINE",1.8,"C-ANNO"); }
Log("labels added: "+added);
Ed.Regen();
Result
Log
item 4 record calls (DB 69685/361 Exh A outer lines): + [W sta 87 off -14] (R) N01\U+00B052'10"W 174.07' + [N sta 133.2 off -23] (R) N85\U+00B037'35"E 268.04' + [E sta 82.4 off -14] (R) S00\U+00B001'25"W 164.04' + [S sta 131.6 off -15.5] (R) S83\U+00B022'17"W 263.28' item 5 monument ties: pt 328 IPF 1\2" OTP: dN -102.238 dE 17.712 dist 103.761 + [xy 2232619.297,1420372.817] NOT HELD - 103.76' FROM SE CORNER / (102.24' S, 17.71' E) pt 330 IPF 1" OTP: dN -16.084 dE -0.56 dist 16.094 + [xy 2232601.025,1420458.971] NOT HELD - 16.09' FROM SE CORNER / (16.08' S, 0.56' W) item 6 improvements at the lines: FMLS steps/walk S-offset -16.258..0.189 + [S sta 134 off -20.5] CONC. STEPS & WALK (FMLS) / 0.2'-16.3' S OF LINE FMLS wall west part S-offset -11.31..-5.024 + [S sta 195 off -8] WALL (FMLS) 5.0'-11.3' S OF LINE FMLS wall east part S-offset -5.992..-2.614 + [S sta 70 off -14] WALL (FMLS) 2.6'-6.0' S OF LINE SE wall corner S-offset -8.221..2.341 + [S sta 56 off -9] WALL CORNER 2.3' N OF LINE SBUC pt 244 W-offset -4.382 + [xy 2232328.399,1420447.177] SBUC 4.4' W OF LINE / (IN R/W) SIGN pt 245 S-offset -1.752 sta 259.723 + [S sta 238 off -15] LIGHTED SIGN 1.8' S OF LINE / (SIGN EASEMENT DB 13648/46) W curb offsets -1.806..2.139 + [W sta 140 off -6] CURB 2.1' E TO 1.8' W OF LINE S island W-offsets -14.241..2.233 + [W sta 5 off -20] CURB ISLAND (R/W) / 14.2' W OF LINE, NOSE AT LINE N island W-offsets -29.149..2.191 + [W sta 150 off -22.5] CURB ISLAND (R/W) NOSE AT LINE TO 29.1' W item 7 curb cut: + [W sta 33.5 off -5] CURB CUT NW wall W-offsets -1.806..42.828 + [W sta 162 off -5] WALL 1.8' E OF LINE N wall N-offsets 9.615..18.706 + [N sta 28 off 4] WALL 9.6' S OF LINE E-side SS-X-FENCE 2142A sta 47.484-161.712 W-offset 46.201..56.994 + [E sta 104.598 off 43.201] FENCE 46.2'-57.0' W OF LINE E-side V-STRC-WALL 2172A sta 47.325-161.712 W-offset 46.201..54.995 + [E sta 104.518 off 43.201] WALL 46.2'-55.0' W OF LINE labels added: 20
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.