← Inbox

C3DO-0748 · 261101 legend text line positions (read-only) [C3D-LEGPROBE] error

Read-only: the legend MText's line positions and the size of the point symbol blocks.

Script file
C3DO-0748.cs
Target
261101 - 5491 Roswell Rd NE R2.dwg · model space
Author
claude
Approved
yes · read-only
Timeout
60s

C# payload

var tbl=(BlockTable)Tx.GetObject(Db.BlockTableId,OpenMode.ForRead);
var lb=(BlockTableRecord)Tx.GetObject(tbl["SS_LEGEND"],OpenMode.ForRead);
foreach(ObjectId id in lb){ var m=Tx.GetObject(id,OpenMode.ForRead) as MText; if(m==null) continue;
 Log("MText ht="+m.TextHeight+" spacingFactor="+m.LineSpaceDistance+" style="+m.LineSpacingStyle+" factor="+m.LineSpacingFactor+" actualH="+m.ActualHeight+" loc="+m.Location);
 var c=new DBObjectCollection(); m.Explode(c); foreach(DBObject o in c){ var t=o as DBText; if(t!=null) Log("  frag y="+t.Position.Y.ToString("F4")+" x="+t.Position.X.ToString("F4")+" '"+t.TextString+"'"); o.Dispose(); } }
foreach(var bn in new[]{"Utility Pole","Gas Valve","Drill Hole","Iron Pin","_Wipeout_Circle","Catch Basin","Water Valve"}){ if(!tbl.Has(bn)){ Log("no block "+bn); continue; } var b=(BlockTableRecord)Tx.GetObject(tbl[bn],OpenMode.ForRead); var ext=new Extents3d(); bool any=false; foreach(ObjectId id in b){ var e=(Autodesk.AutoCAD.DatabaseServices.Entity)Tx.GetObject(id,OpenMode.ForRead); try{ ext.AddExtents(e.GeometricExtents); any=true; }catch{} } Log("block "+bn+(any?" ext "+ext.MinPoint+"-"+ext.MaxPoint:" empty")); }

Result

Status
error
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\261101 - Project\261101 - 5491 Roswell Rd NE R2.dwg
Message
Compile error: (5,56): error CS0104: 'DBObject' is an ambiguous reference between 'Autodesk.AutoCAD.DatabaseServices.DBObject' and 'Autodesk.Civil.DatabaseServices.DBObject'
Entities
—
Duration
352 ms
Civil 3D
25.0.0.0

Notes

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

No notes yet.