C3DO-0834 · 261103: find the 59.04' line (read-only) [C3D-FIND5904] error
Read-only: lists every line, polyline segment, parcel segment, dimension or text that is / shows 59.04'.
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: every line / polyline segment / parcel segment ~59.04' long, and every text or dimension showing 59.04
bool Near(double L)=>Math.Abs(L-59.04)<0.006;
string P(Point3d p)=>F(p.X)+","+F(p.Y);
foreach(ObjectId id in MS){ var o=Tx.GetObject(id,OpenMode.ForRead);
if(o is Line l && Near(l.Length)) Log("LINE "+l.Handle+" ["+l.Layer+"] "+P(l.StartPoint)+" -> "+P(l.EndPoint)+" len "+F(l.Length));
else if(o is Polyline pl){ for(int i=0;i<(pl.Closed?pl.NumberOfVertices:pl.NumberOfVertices-1);i++){ var s=pl.GetPoint2dAt(i); var e=pl.GetPoint2dAt((i+1)%pl.NumberOfVertices); double L=s.GetDistanceTo(e); if(pl.GetBulgeAt(i)==0 && Near(L)) Log("PLINE "+pl.Handle+" ["+pl.Layer+"] seg "+i+" of "+pl.NumberOfVertices+(pl.Closed?" closed":"")+" "+F(s.X)+","+F(s.Y)+" -> "+F(e.X)+","+F(e.Y)+" len "+F(L)); } }
else if(o is Autodesk.Civil.DatabaseServices.ParcelSegment ps){ try{ var c=(Curve)ps.BaseCurve; } catch{} Log("PARCELSEG "+ps.Handle+" ["+ps.Layer+"] len "+F(ps.Length)+(Near(ps.Length)?" <== 59.04":"")); }
else if(o is Dimension d && Math.Abs(d.Measurement-59.04)<0.006) Log("DIM "+d.Handle+" ["+d.Layer+"] "+F(d.Measurement));
string txt=o is MText m?m.Contents:(o is DBText t?t.TextString:null);
if(txt!=null && txt.Contains("59.04")) Log("TEXT "+((Autodesk.AutoCAD.DatabaseServices.Entity)o).Handle+" ["+((Autodesk.AutoCAD.DatabaseServices.Entity)o).Layer+"] | "+txt);
}
Result
Notes
What worked, what didn't, job-specific gotchas — flagged notes feed the recipes.
No notes yet.