In Civil 3D UI when we use the Change Label Style command (LabelStyleEdit) on Alignment Curve Label, we get the option of selecting a Label Style from Alignment -> Label Styles -> Curve -> Label Styles collection as well as General Curve Label Styles (Styles listed under General -> Multipurpose Styles -> Curve). And we can change the label style to one from the General Curve Label Styles.
Screenshot below explains the situation described above:
Here is a C# code snippet which demonstrates how to achieve the same using Civil 3D .NET API:
try
{
AlignmentCurveLabel alignCurveLbl = (AlignmentCurveLabel)tr.GetObject(pres.ObjectId, OpenMode.ForWrite);
ed.WriteMessage("\nAlignment Curve Label Style Name (before Change) : " + alignCurveLbl.StyleName.ToString());
CivilDocument curDoc = CivilApplication.ActiveDocument;
LabelStyleCollection lStyles = curDoc.Styles.LabelStyles.GeneralCurveLabelStyles;
// The following Style Name is specific to Tutorial DWG file - "Labels-6a.dwg"
string stylesFound = "Distance-Radius and Delta";
foreach (ObjectId stId in lStyles)
{
LabelStyle generalCurveLblStyl = tr.GetObject(stId, OpenMode.ForRead) as LabelStyle;
if (generalCurveLblStyl.Name.ToString() == stylesFound)
{
alignCurveLbl.StyleId = generalCurveLblStyl.Id;
break;
}
}
ed.WriteMessage("\nAlignment Curve Label Style Name (after Change) : " + alignCurveLbl.StyleName.ToString());
}
Hope this is useful to you!