Updating PipeLabel Style using Civil 3D API

By Partha Sarkar

 

Label.StyleName API allows to get or set the Entity object's style name and we can use this to update PipeLabel Style.

Here is a C# .NET code snippet :

PipeLabel pipeLbl = ts.GetObject(pipeLblID, OpenMode.ForWrite) asPipeLabel;
 
// Label.StyleName Property -> Gets or sets the Entity object's style name.          
ed.WriteMessage("nStyle Name Before Change : " + pipeLbl.StyleName.ToString());
 
// Now update the Style
pipeLbl.StyleName = "2D Length - Total Span";
ed.WriteMessage("nStyle Name After Change : " + pipeLbl.StyleName.ToString());

 

In the following screenshot we can see a particular Label Style being used for Pipe Object in Civil 3D.

Pipe_Label_Before_Change
 

And here we see by updating the StyleName how the Label style is changed :

Pipe_Label_After_Change


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading