How do I change the default styles of Points in AutoCAD Civil 3D using .NET API?

By Partha Sarkar

In AutoCAD
Civil 3D ‘Create Points’ dialog, under Parameter if you expand the ‘Default
Styles’ collection, you will see the default ‘Point Style’ and ‘Point Label
Style’ field and their corresponding values in the ‘Value’ column as shown in
the screenshot below –

Civil3D_Point_Default_Style

If you want to change these default style values using
Civil 3D .NET API, you need to get the SettingsPoint object first and then
update the Style and Label styles value as shown in the C# .NET code snippet
below –

using (Transaction trans = db.TransactionManager.StartTransaction())
{
 
  // get the SettingsPoint object
  SettingsPoint pointSettings = civilDoc.Settings.GetSettings() as SettingsPoint;
 
  // now set the value for default Style and Label Style
  // make sure the values exists in DWG file before you try to set them
  pointSettings.Styles.Point.Value = "Benchmark";
  pointSettings.Styles.PointLabel.Value = "Elevation Only";
 
  trans.Commit();
}

 

Once you run your custom application the default style
and labels style value for Point object will be changed –

Civil3D_Point_Default_Style_afterChange

Hope this is useful to you!


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

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

Continue reading