← Inbox

C3D-0558 · Read contour label styles 260711 R2 (read-only) error

Which contour label styles the surface contour labels use, and their text component contents (precision).

Script file
C3D-0558.cs
Target
260711 - 281 Maranatha Trail R2.dwg · model space
Author
claude
Approved
yes · auto-auth
Timeout
60s

C# payload


var ms=(BlockTableRecord)Tx.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Db),OpenMode.ForRead);
var styles=new System.Collections.Generic.Dictionary<ObjectId,int>();
foreach(ObjectId e in ms){ if(e.IsErased) continue; var o=Tx.GetObject(e,OpenMode.ForRead);
  if(o is Autodesk.Civil.DatabaseServices.SurfaceContourLabelGroup g){ var sid=g.StyleId; if(!styles.ContainsKey(sid)) styles[sid]=0; styles[sid]++; } }
foreach(var kv in styles){ var st=(Autodesk.Civil.DatabaseServices.Styles.LabelStyle)Tx.GetObject(kv.Key,OpenMode.ForRead); Log("STYLE '"+st.Name+"' used by "+kv.Value+" label groups");
  foreach(ObjectId cid in st.GetComponents(Autodesk.Civil.DatabaseServices.Styles.LabelStyleComponentType.Text)){ var c=(Autodesk.Civil.DatabaseServices.Styles.LabelStyleTextComponent)Tx.GetObject(cid,OpenMode.ForRead); Log("   text comp '"+c.Name+"' contents="+c.Text.Contents.Value); } }
// all surface contour label styles in the drawing
var cs=CivilDoc.Styles.LabelStyles.SurfaceLabelStyles.ContourLabelStyles;
foreach(ObjectId sid in cs){ var st=(Autodesk.Civil.DatabaseServices.Styles.LabelStyle)Tx.GetObject(sid,OpenMode.ForRead); Log("available contour label style: "+st.Name); }

Result

Status
error
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260711 - 281 Maranatha Trail, Lawrenceville, GA 30045, USA\260711 - 281 Maranatha Trail R2.dwg
Message
eNullObjectId
Entities
—
Duration
569 ms
Civil 3D
25.0.0.0

Notes

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

No notes yet.