Gets or sets the point label style for the point.

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

Syntax

C#
public ObjectId LabelStyleId { get; set; }
Visual Basic
Public Property LabelStyleId As ObjectId
	Get
	Set
Visual C++
public:
property ObjectId LabelStyleId {
	ObjectId get ();
	void set (ObjectId value);
}

Remarks

ObjectId.Null is an valid value.

Examples

CopyC#
 1// Setup: create a COGO Point:
 2ObjectId pointId = _civildoc.CogoPoints.Add(new Point3d(100, 100, 100));
 3CogoPoint cogoPoint = pointId.GetObject(OpenMode.ForWrite) as CogoPoint;
 4
 5_editor.WriteMessage("\nLabel properties for point number {0}:", cogoPoint.PointNumber);
 6_editor.WriteMessage("\n- Is pinned? {0}", cogoPoint.IsLabelPinned.ToString());
 7// A label can only be pinned if is dragged.
 8// 
 9if (cogoPoint.IsLabelDragged && !cogoPoint.IsLabelPinned)
10{
11    cogoPoint.IsLabelPinned = true;
12}
13_editor.WriteMessage("\n- Is visible? {0}", cogoPoint.IsLabelVisible.ToString());
14// Toggle visibility.
15// 
16cogoPoint.IsLabelVisible = !cogoPoint.IsLabelVisible;
17
18_editor.WriteMessage("\n- Location: {0}", cogoPoint.LabelLocation.ToString());
19Vector3d vec = new Vector3d(1, 1, 0);
20cogoPoint.LabelLocation = cogoPoint.LabelLocation + vec;
21_editor.WriteMessage("\n- New location: {0}", cogoPoint.LabelLocation.ToString());
22
23_editor.WriteMessage("\n- Rotation: {0}", cogoPoint.LabelRotation);
24cogoPoint.LabelRotation += 0.785398163; // radians, add 45 degrees
25_editor.WriteMessage("\n- New rotation: {0}", cogoPoint.LabelRotation);
26
27// Label Style properties
28// 
29ObjectId labelStyleId = cogoPoint.LabelStyleId;
30if (labelStyleId != ObjectId.Null)
31{
32    LabelStyle labelStyle = labelStyleId.GetObject(OpenMode.ForWrite) as LabelStyle;
33    _editor.WriteMessage("\n Label style: {0}", labelStyle.Name);
34}
35ObjectId newStyle;
36if (_civildoc.Styles.LabelStyles.PointLabelStyles.LabelStyles.Contains("Northing and Easting"))
37    newStyle = _civildoc.Styles.LabelStyles.PointLabelStyles.LabelStyles["Northing and Easting"];
38else
39    newStyle = _civildoc.Styles.LabelStyles.PointLabelStyles.LabelStyles[0];
40
41cogoPoint.LabelStyleId = newStyle;
CopyVB.NET
 1' Setup: create a COGO Point:
 2Dim pointId As ObjectId = _civildoc.CogoPoints.Add(New Point3d(100, 100, 100))
 3Dim cogoPoint As CogoPoint = TryCast(pointId.GetObject(OpenMode.ForWrite), CogoPoint)
 4
 5_editor.WriteMessage(vbLf & "Label properties for point number {0}:", cogoPoint.PointNumber)
 6_editor.WriteMessage(vbLf & "- Is pinned? {0}", cogoPoint.IsLabelPinned.ToString())
 7' A label can only be pinned if is dragged.
 8'
 9If cogoPoint.IsLabelDragged AndAlso Not cogoPoint.IsLabelPinned Then
10  cogoPoint.IsLabelPinned = True
11End If
12_editor.WriteMessage(vbLf & "- Is visible? {0}", cogoPoint.IsLabelVisible.ToString())
13' Toggle visibility.
14'
15cogoPoint.IsLabelVisible = Not cogoPoint.IsLabelVisible
16
17_editor.WriteMessage(vbLf & "- Location: {0}", cogoPoint.LabelLocation.ToString())
18Dim vec As New Vector3d(1, 1, 0)
19cogoPoint.LabelLocation = cogoPoint.LabelLocation + vec
20_editor.WriteMessage(vbLf & "- New location: {0}", cogoPoint.LabelLocation.ToString())
21
22_editor.WriteMessage(vbLf & "- Rotation: {0}", cogoPoint.LabelRotation)
23cogoPoint.LabelRotation += 0.785398163
24' radians, add 45 degrees
25_editor.WriteMessage(vbLf & "- New rotation: {0}", cogoPoint.LabelRotation)
26
27' Label Style properties
28'
29Dim labelStyleId As ObjectId = cogoPoint.LabelStyleId
30If labelStyleId <> ObjectId.Null Then
31  Dim labelStyle As LabelStyle = TryCast(labelStyleId.GetObject(OpenMode.ForWrite), LabelStyle)
32  _editor.WriteMessage(vbLf & " Label style: {0}", labelStyle.Name)
33End If
34Dim newStyle As ObjectId
35If _civildoc.Styles.LabelStyles.PointLabelStyles.LabelStyles.Contains("Northing and Easting") Then
36  newStyle = _civildoc.Styles.LabelStyles.PointLabelStyles.LabelStyles("Northing and Easting")
37Else
38  newStyle = _civildoc.Styles.LabelStyles.PointLabelStyles.LabelStyles(0)
39End If
40
41cogoPoint.LabelStyleId = newStyle

Exceptions

ExceptionCondition
System..::..ArgumentException Thrown when the ObjectId is not a valid ObjectId for a LabelStyle object.

See Also