CogoPointIsLabelPinned Property

Gets or sets the pinned state of the CogoPoint label.

Namespace: Autodesk.Civil.DatabaseServices
Assembly: AeccDbMgd (in AeccDbMgd.dll) Version: 13.8.0.292
Syntax
public bool IsLabelPinned { get; set; }

Property Value

Boolean
Exceptions
ExceptionCondition
InvalidOperationException Thrown when the label object is not dragged.
Example
 1// Setup: create a COGO Point:
 2ObjectId pointId = _civildoc.CogoPoints.Add(new Point3d(100, 100, 100), false);
 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;
See Also