Share

StyleCollectionBase.Add Method

Creates a new style object, adds it to the collection, and returns an ObjectId for the object.



Namespace: Autodesk.Civil.DatabaseServices.Styles
Assembly: AeccDbMgd (in AeccDbMgd.dll) Version: 13.8.0.280

Syntax

C#

public abstract ObjectId Add(
	string name
)

VB

Public MustOverride Function Add ( 
	name As String
) As ObjectId

C++

public:
virtual ObjectId Add(
	String^ name
) abstract override

Parameters

name  String
The name of the new style. If this string is empty or null, a dynamically generated name is created.

Return Value

ObjectId

Exceptions

ExceptionCondition
ArgumentException Thrown when the name already exists.

Example

 1// Select a surface style to use.
 2// If the desired style doesn't exist, create it.
 3ObjectId surfaceStyleId = ObjectId.Null;
 4try
 5{
 6    surfaceStyleId = doc.Styles.SurfaceStyles["Slope Banding (2D)"];
 7}
 8catch (System.ArgumentException e)
 9{
10    surfaceStyleId = doc.Styles.SurfaceStyles.Add("Slope Banding (2D)");
11}

See Also

Reference

Was this information helpful?