← Inbox

C3DO-0757 · 261101: legend - realign symbols after RBF/WM [C3D-LEGEND3] done

C3DO-0755 added two text lines but missed the symbols (legend had been moved). Slide the symbol rows and sample lines beside the legend text down by the measured shift so DROP INLET's symbol sits on its line again.

Script file
C3DO-0757.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; };
var mid=oid("2191D"); var mt=(MText)Tx.GetObject(mid,OpenMode.ForRead); var sp=(BlockTableRecord)Tx.GetObject(mt.OwnerId,OpenMode.ForRead);
double y=0; var c=new DBObjectCollection(); mt.Explode(c); double di=0, wm=0; foreach(Autodesk.AutoCAD.DatabaseServices.DBObject o in c){ var t=o as DBText; if(t!=null){ if(t.TextString.Trim()=="DROP INLET") di=t.Position.Y; if(t.TextString.Trim()=="WM WATER METER") wm=t.Position.Y; } o.Dispose(); }
double xl=mt.Location.X-0.05, xr=mt.Location.X+0.30;
var cb=(BlockReference)Tx.GetObject(oid("2191F"),OpenMode.ForRead); double cbc=(cb.GeometricExtents.MinPoint.Y+cb.GeometricExtents.MaxPoint.Y)/2;
double dy=(di+0.045)-cbc; Log("DROP INLET baseline "+di.ToString("F4")+", its symbol center "+cbc.ToString("F4")+", shift "+dy.ToString("F4"));
if(Math.Abs(dy)<0.05){ Log("already aligned - nothing to do"); return; }
int n=0; foreach(ObjectId id in sp){ if(id==mid) continue; var e=(Autodesk.AutoCAD.DatabaseServices.Entity)Tx.GetObject(id,OpenMode.ForRead); if(e is Viewport) continue; Extents3d x; try{ x=e.GeometricExtents; }catch{ continue; }
 if(x.MinPoint.X>=xl&&x.MaxPoint.X<=xr&&x.MaxPoint.Y<wm+0.2&&x.MinPoint.Y>6.0){ e.UpgradeOpen(); e.TransformBy(Matrix3d.Displacement(new Vector3d(0,dy,0))); n++; } }
Log("moved "+n+" symbol/sample pieces "+dy.ToString("F4")+" back onto their words (verified against DROP INLET)");
Ed.Regen();

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\261101 - Project\261101 - 5491 Roswell Rd NE R2.dwg
Message
Executed C3DO-0757 (0 entities touched).
Entities
—
Duration
481 ms
Civil 3D
25.0.0.0

Log

DROP INLET baseline 7.9945, its symbol center 8.3559, shift -0.3164
moved 34 symbol/sample pieces -0.3164 back onto their words (verified against DROP INLET)

Notes

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

No notes yet.