← Inbox

C3D-0560 · Contour labels: no decimals 260711 R2 done

Set Surface Elevation precision P2 -> P0 in Existing Major Labels and Existing Minor Labels contour label styles.

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

C# payload


var cs=CivilDoc.Styles.LabelStyles.SurfaceLabelStyles.ContourLabelStyles;
foreach(string nm in new[]{"Existing Major Labels","Existing Minor Labels"}){
  var st=(Autodesk.Civil.DatabaseServices.Styles.LabelStyle)Tx.GetObject(cs[nm],OpenMode.ForWrite);
  foreach(ObjectId cid in st.GetComponents(Autodesk.Civil.DatabaseServices.Styles.LabelStyleComponentType.Text)){
    var c=(Autodesk.Civil.DatabaseServices.Styles.LabelStyleTextComponent)Tx.GetObject(cid,OpenMode.ForWrite);
    string old=c.Text.Contents.Value; string neu=old.Replace("Surface Elevation(Uft|P2|","Surface Elevation(Uft|P0|");
    c.Text.Contents.Value=neu; Log(nm+": "+old+"  ->  "+c.Text.Contents.Value);
  }
}
Ed.Regen();

Result

Status
success
Drawing file
C:\Users\sanja\OneDrive\_SurveyDisco\260711 - 281 Maranatha Trail, Lawrenceville, GA 30045, USA\260711 - 281 Maranatha Trail R2.dwg
Message
Executed C3D-0560 (0 entities touched).
Entities
—
Duration
663 ms
Civil 3D
25.0.0.0

Log

Existing Major Labels: <[Surface Elevation(Uft|P2|RN|AP|Sn|OF)]>  ->  <[Surface Elevation(Uft|P0|RN|AP|Sn|OF)]>
Existing Minor Labels: <[Surface Elevation(Uft|P2|RN|AP|Sn|OF)]>  ->  <[Surface Elevation(Uft|P0|RN|AP|Sn|OF)]>

Notes

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

No notes yet.