Gets or sets the pinned state of the CogoPoint label.
Namespace: Autodesk.Civil.DatabaseServicesAssembly: AeccDbMgd (in AeccDbMgd.dll) Version: 13.4.2516.0
Syntax
C# |
---|
public bool IsLabelPinned { get; set; } |
Visual Basic |
---|
Public Property IsLabelPinned As Boolean
Get
Set |
Visual C++ |
---|
public:
property bool IsLabelPinned {
bool get ();
void set (bool value);
} |
Examples
CopyC#
1
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
8
9if (cogoPoint.IsLabelDragged && !cogoPoint.IsLabelPinned)
10{
11 cogoPoint.IsLabelPinned = true;
12}
13_editor.WriteMessage("\n- Is visible? {0}", cogoPoint.IsLabelVisible.ToString());
14
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;
25_editor.WriteMessage("\n- New rotation: {0}", cogoPoint.LabelRotation);
26
27
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
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
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
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
25_editor.WriteMessage(vbLf & "- New rotation: {0}", cogoPoint.LabelRotation)
26
27
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
Exception | Condition |
---|
System..::..InvalidOperationException |
Thrown when the label object is not dragged.
|
See Also