If you are
looking for an API to change AutoCAD Civil 3D FeatureLine object's style you
can use FeatureLine.StyleName property which gets or sets the Featureline's
style name.
And using
Autodesk.Civil.DatabaseServices.GeneralSegmentLabel.Create() method we can add
Label to a FeatureLine.
In the
screenshot below we can see a Civil 3D FeatureLine before changing it's style –
And using the
following C# .NET code we can change the style and label it –
using (Transaction ts = AcadApp.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction())
{
FeatureLine featureLine = ts.GetObject(ftrLineID, OpenMode.ForWrite) as FeatureLine;
// Change the Style to "Flowline"
// Style name used abobe is specific to a DWG file
// FeatureLine.StyleName // Gets or sets the Featureline's style name.
featureLine.StyleName = "Flowline";
// Use Autodesk.Civil.DatabaseServices.GeneralSegmentLabel.Create to add label to a feature line
GeneralSegmentLabel.Create(featureLine.ObjectId, 0.5);
ts.Commit();
}
FeatureLine
style after change –
and
FeatureLine with label –




Leave a Reply to Area51VisitorCancel reply