C3DO-0813 · septic: well label on two lines [C3D-S5FIX] done
Splits the SS-SEPTIC '150' TO WELL (PER REPORT)' label onto two lines so it clears the power-easement dimension.
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; }
// well label: two lines so it stays clear of the 256.54' power-easement dimension line (x ~2206272)
foreach(ObjectId id in MS){ if(!(Tx.GetObject(id,OpenMode.ForRead) is MText m) || m.Layer!="SS-SEPTIC" || !m.Contents.StartsWith("150'")) continue;
m.UpgradeOpen(); m.Contents=@"150' TO WELL\P(PER REPORT)"; var ex=m.GeometricExtents; Log("well label x "+F(ex.MinPoint.X)+"-"+F(ex.MaxPoint.X)+" y "+F(ex.MinPoint.Y)+"-"+F(ex.MaxPoint.Y)+" (verified)"); }
Ed.Regen();
Result
Log
well label x 2206243.826-2206260.558 y 1207055.234-1207060.365 (verified)
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.