C3DO-0815 · septic: read note labels + SS-SEPTIC (read-only) [C3D-S6READ] done
Read-only: note label text near the 285 house and every entity on SS-SEPTIC.
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; }
// read-only: Civil note labels near the house + every SS-SEPTIC entity anywhere
foreach(ObjectId id in MS){ var o=Tx.GetObject(id,OpenMode.ForRead);
if(o is Autodesk.Civil.DatabaseServices.NoteLabel nl){ Extents3d ex; try{ ex=nl.GeometricExtents; }catch{ continue; } if(ex.MaxPoint.X<2206000||ex.MinPoint.X>2206350||ex.MaxPoint.Y<1206900||ex.MinPoint.Y>1207200) continue;
string t=""; try{ var exp=nl.GetType().GetMethod("GetTextComponentIds"); }catch{}
try{ t=string.Join(" / ", nl.GetTextComponentIds().Cast<ObjectId>().Select(c=>((Autodesk.Civil.DatabaseServices.Styles.LabelStyleTextComponent)Tx.GetObject(c,OpenMode.ForRead)).Text.Contents.Value)); }catch(System.Exception e){ t="(err "+e.Message+")"; }
var ov=""; try{ foreach(ObjectId c in nl.GetTextComponentIds()){ ov+=" | "+nl.GetTextComponentOverride(c); } }catch(System.Exception e){ ov=" (ovr err "+e.Message+")"; }
Log("NoteLabel "+nl.Handle+" ["+nl.Layer+"] "+F(ex.MinPoint.X)+","+F(ex.MinPoint.Y)+" - "+F(ex.MaxPoint.X)+","+F(ex.MaxPoint.Y)+" style: "+t+" override:"+ov); }
else if(o is Autodesk.AutoCAD.DatabaseServices.Entity e && e.Layer=="SS-SEPTIC") Log("SEPTIC "+e.GetType().Name+" "+e.Handle);
}
Result
Log
NoteLabel 21C4F [C-ANNO] 2206077.811,1207091.604 - 2206204.668,1207163.604 style: Note override: | \P#285 \P2-STORY\PFRAME HOUSE SEPTIC Polyline 2474D SEPTIC Polyline 2474F SEPTIC Polyline 24750 SEPTIC Polyline 24751 NoteLabel 247C6 [C-ANNO] 2206068.446,1207040.054 - 2206235.272,1207053.315 style: Note override: | SEPTIC TANK SEPTIC RotatedDimension 247E1
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.