← Inbox

C3DO-0811 · septic: move source note off side B/L, well label off 23' dim [C3D-S4FIX] done

Moves two SS-SEPTIC MTexts placed in C3DO-0809: the source note clear of the 50' side B/L line and the 150' well label clear of the 23' dimension.

Script file
C3DO-0811.cs
Target
260714 - 285 Huckaby Rd 22x17.dwg · model space
Author
claude
Approved
yes · auto-auth
Timeout
60s

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; }

// move the source note off the 50' side B/L and the well label off the 23' dim
var O=new Point2d(2206226.902,1207076.391); var SE=new Point2d(2206263.701,1207076.258);
var u=(SE-O)/(SE-O).Length; var n=new Vector2d(u.Y,-u.X);
Point3d P3(double a,double d){ var p=O+u*a+n*d; return new Point3d(p.X,p.Y,0); }
foreach(ObjectId id in MS){ if(!(Tx.GetObject(id,OpenMode.ForRead) is MText m) || m.Layer!="SS-SEPTIC") continue;
  if(m.Contents.StartsWith("SEPTIC SYSTEM SHOWN")){ m.UpgradeOpen(); m.TextHeight=3; m.Width=118; m.Location=new Point3d(2206212,1207046,0); var ex=m.GeometricExtents; Log("note now y "+F(ex.MinPoint.Y)+"-"+F(ex.MaxPoint.Y)+" x "+F(ex.MinPoint.X)+"-"+F(ex.MaxPoint.X)+" (side B/L at ~1207004)"); }
  else if(m.Contents.StartsWith("150'")){ m.UpgradeOpen(); m.Location=P3(17,18.5); var ex=m.GeometricExtents; Log("well label now x "+F(ex.MinPoint.X)+"-"+F(ex.MaxPoint.X)+" y "+F(ex.MinPoint.Y)+"-"+F(ex.MaxPoint.Y)); } }
Ed.Regen();

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260714 - 285 Huckaby Rd, Brooks, GA 30205, USA\260714 - 285 Huckaby Rd 22x17.dwg
Message
Executed C3DO-0811 (0 entities touched).
Entities
—
Duration
558 ms
Civil 3D
25.0.0.0

Log

well label now x 2206243.831-2206278.625 y 1207056.561-1207058.973
note now y 1207023.929-1207068.498 x 2206093.921-2206212.08 (side B/L at ~1207004)

Notes

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

No notes yet.