Sets the LabelStyleId for a single CogoPoint.

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

Syntax

C#
public ObjectId SetLabelStyleId(
	ObjectId pointId,
	ObjectId styleId
)
Visual Basic
Public Function SetLabelStyleId ( _
	pointId As ObjectId, _
	styleId As ObjectId _
) As ObjectId
Visual C++
public:
ObjectId SetLabelStyleId(
	ObjectId pointId, 
	ObjectId styleId
)

Parameters

pointId
Type: ObjectId
The ObjectId of the point you want to set the LabelStyleId property for.
styleId
Type: ObjectId
The ObjectId of the style you want to set LabelStyleId to (object type LabelStyle).

Return Value

If the method succeeds, it returns the same ObjectId pointId passed in. If the method fails, it returns ObjectId.Null.

Examples

CopyC#
 1// _civildoc is the active CivilDocument instance.
 2// 
 3CogoPointCollection cogoPoints = _civildoc.CogoPoints;
 4ObjectId pointId = cogoPoints.Add(new Point3d(100, 100, 50));
 5ObjectId labelStyleId = _civildoc.Styles.LabelStyles.PointLabelStyles.LabelStyles.Add("Example Style");
 6
 7// set value for single point
 8if (cogoPoints.SetLabelStyleId(pointId, labelStyleId) == ObjectId.Null)
 9    write("SetLabelRotation failed.\n");
10
11Point3dCollection points = new Point3dCollection();
12points.Add(new Point3d(50, 50, 25));
13points.Add(new Point3d(200, 200, 15));
14ObjectIdCollection pointIds = cogoPoints.Add(points);
15List<ObjectId> pointIdList = GetListFromCollection(pointIds);
16
17// set multiple points to a single value
18ObjectIdCollection success = cogoPoints.SetLabelStyleId(pointIdList, labelStyleId);
19write(String.Format("SetLabelStyleId success for {0} of {1} points\n",
20  success.Count, pointIdList.Count));
21
22List<ObjectId> labelStyles = new List<ObjectId>();
23for (int i = 0; i < pointIdList.Count; i++)
24    labelStyles.Add(labelStyleId);
25
26// set multiple points to multiple values
27success = cogoPoints.SetLabelStyleId(pointIdList, labelStyles);
28write(String.Format("SetLabelStyleId success for {0} of {1} points\n",
29  success.Count, pointIdList.Count));
CopyVB.NET
 1' _civildoc is the active CivilDocument instance.
 2'
 3Dim cogoPoints As CogoPointCollection = _civildoc.CogoPoints
 4Dim pointId As ObjectId = cogoPoints.Add(New Point3d(100, 100, 50))
 5Dim labelStyleId As ObjectId = _civildoc.Styles.LabelStyles.PointLabelStyles.LabelStyles.Add("Example Style")
 6
 7' set value for single point
 8If cogoPoints.SetLabelStyleId(pointId, labelStyleId) = ObjectId.Null Then
 9    write("SetLabelRotation failed." & vbLf)
10End If
11
12Dim points As New Point3dCollection()
13points.Add(New Point3d(50, 50, 25))
14points.Add(New Point3d(200, 200, 15))
15Dim pointIds As ObjectIdCollection = cogoPoints.Add(points)
16Dim pointIdList As List(Of ObjectId) = GetListFromCollection(pointIds)
17
18' set multiple points to a single value
19Dim success As ObjectIdCollection = cogoPoints.SetLabelStyleId(pointIdList, labelStyleId)
20write([String].Format("SetLabelStyleId success for {0} of {1} points", success.Count, pointIdList.Count))
21
22Dim labelStyles As New List(Of ObjectId)()
23For i As Integer = 0 To pointIdList.Count - 1
24    labelStyles.Add(labelStyleId)
25Next
26
27' set multiple points to multiple values
28success = cogoPoints.SetLabelStyleId(pointIdList, labelStyles)
29write([String].Format("SetLabelStyleId success for {0} of {1} points", success.Count, pointIdList.Count))

See Also