← Inbox

C3D-0655 · 261009 init: read IPFs, layouts, layers (read-only) [C3D-INIT1009] error

Read-only: list IPF points (northernmost first), layouts + contents, model-space layer counts, for 261009 setup.

Script file
C3D-0655.cs
Target
261009 - 510 Covington Cove.dwg · model space
Author
claude
Approved
yes · reviewer
Timeout
60s

C# payload

var pts=new List<Tuple<uint,double,double,double,string>>();
foreach(ObjectId id in CivilDoc.CogoPoints){ var p=(Autodesk.Civil.DatabaseServices.CogoPoint)Tx.GetObject(id,OpenMode.ForRead); pts.Add(Tuple.Create(p.PointNumber,p.Easting,p.Northing,p.Elevation,p.RawDescription??"")); }
Log("cogo points="+pts.Count);
var ipf=pts.Where(t=>t.Item5.ToUpper().Contains("IPF")).OrderByDescending(t=>t.Item3).ToList();
Log("IPF points="+ipf.Count);
foreach(var t in ipf) Log("  #"+t.Item1+" N "+t.Item3.ToString("F2")+" E "+t.Item2.ToString("F2")+" Z "+t.Item4.ToString("F2")+" '"+t.Item5+"'");
var descs=pts.GroupBy(t=>t.Item5.ToUpper().Split(' ')[0]).OrderByDescending(g=>g.Count()).Take(25);
Log("descriptions: "+string.Join(", ",descs.Select(g=>g.Key+"="+g.Count())));
var ld=(DBDictionary)Tx.GetObject(Db.LayoutDictionaryId,OpenMode.ForRead);
foreach(DBDictionaryEntry e in ld){ var lo=(Layout)Tx.GetObject(e.Value,OpenMode.ForRead); var btr=(BlockTableRecord)Tx.GetObject(lo.BlockTableRecordId,OpenMode.ForRead); int n=0; var kinds=new Dictionary<string,int>(); foreach(ObjectId oid in btr){ n++; var en=(Entity)Tx.GetObject(oid,OpenMode.ForRead); string k=en is BlockReference?"blk:"+((BlockReference)en).Name:en.GetType().Name; kinds[k]=kinds.ContainsKey(k)?kinds[k]+1:1; } Log("layout '"+lo.LayoutName+"' tab="+lo.TabOrder+" paper="+lo.CanonicalMediaName+" ents="+n+" : "+string.Join(", ",kinds.OrderByDescending(k=>k.Value).Take(12).Select(k=>k.Key+"="+k.Value))); }
var ms=(BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db),OpenMode.ForRead);
var bylay=new Dictionary<string,int>(); int tot=0;
foreach(ObjectId oid in ms){ var en=(Entity)Tx.GetObject(oid,OpenMode.ForRead); tot++; bylay[en.Layer]=bylay.ContainsKey(en.Layer)?bylay[en.Layer]+1:1; }
Log("model ents="+tot+" layers used="+bylay.Count);
foreach(var k in bylay.OrderByDescending(k=>k.Value).Take(40)) Log("  "+k.Key+"="+k.Value);
var lt=(LayerTable)Tx.GetObject(Db.LayerTableId,OpenMode.ForRead); int nl=0; foreach(ObjectId x in lt) nl++; Log("layers total="+nl);
Log("parcels sites="+CivilDoc.GetSiteIds().Count+" alignments="+CivilDoc.GetAlignmentIds().Count+" surfaces="+CivilDoc.GetSurfaceIds().Count);

Result

Status
error
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\261009 - 510 Covington Cove, Byron, GA 31008, USA\261009 - 510 Covington Cove.dwg
Message
Compile error: (10,264): error CS0104: 'Entity' is an ambiguous reference between 'Autodesk.AutoCAD.DatabaseServices.Entity' and 'Autodesk.Civil.DatabaseServices.Entity'; (13,38): error CS0104: 'Entity' is an ambiguous reference between 'Autodesk.AutoCAD.DatabaseServices.Entity' and 'Autodesk.Civil.DatabaseServices.Entity'
Entities
—
Duration
1693 ms
Civil 3D
25.0.0.0

Notes

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

No notes yet.