Do you want to change the Label style of an Alignment curve element using Civil 3D .NET AP ? Here is the C# code snippet which demonstrates how to do this :
public void ChangeAlignmentCurveLblStyle()
{
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
PromptEntityOptions pops = new PromptEntityOptions("Select Alignment Curve Label : ");
pops.AllowNone = true;
PromptEntityResult pres = ed.GetEntity(pops);
if (pres.Status != PromptStatus.OK)
return;
using (Transaction tr = HostApplicationServices.WorkingDatabase.TransactionManager.StartTransaction())
{
try
{
AlignmentCurveLabel alignCurveLbl = (AlignmentCurveLabel)tr.GetObject(pres.ObjectId, OpenMode.ForWrite);
ed.WriteMessage("\nAlignment Curve Label Style Name (before Change) : " + alignCurveLbl.StyleName.ToString());
// The following Style Name is specific to Tutorial DWG file - "Labels-6a.dwg"
alignCurveLbl.StyleName = "Design Data";
ed.WriteMessage("\nAlignment Curve Label Style Name (after Change) : " + alignCurveLbl.StyleName.ToString());
tr.Commit();
}
catch (System.Exception e)
{
System.Windows.Forms.MessageBox.Show(e.Message);
}
}
}
After executing the command in AutoCAD Civil 3D you will see a result similar to the screenshot below –