Share

CogoPoint.ClearLabelTextComponentOverrides Method

Clears the text component overrides on the specified text component in the CogoPoint label.



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

Syntax

C#

public void ClearLabelTextComponentOverrides(
	ObjectId labelComponentId
)

VB

Public Sub ClearLabelTextComponentOverrides ( 
	labelComponentId As ObjectId
)

C++

public:
void ClearLabelTextComponentOverrides(
	ObjectId labelComponentId
)

Parameters

labelComponentId  ObjectId
The ObjectId of the text component to clear.

Exceptions

ExceptionCondition
ArgumentException Thrown when labelComponentId is not the objectId of the object that composes the text on the sub-entity label.

Example

C#

 1// Create a COGO Point to demonstrate its methods.
 2// 
 3ObjectId pointId = _civildoc.CogoPoints.Add(new Point3d(100, 100, 100), false);
 4CogoPoint cogoPoint = pointId.GetObject(OpenMode.ForWrite) as CogoPoint;
 5cogoPoint.RawDescription = "Example Point";
 6cogoPoint.LabelStyleId = _civildoc.Styles.LabelStyles.PointLabelStyles.LabelStyles["Elevation and Description"];
 7
 8
 9// Get text components
10ObjectIdCollection textCompIds = cogoPoint.GetLabelTextComponentIds();
11_editor.WriteMessage("\n # components: {0}", textCompIds.Count);
12foreach (ObjectId textCompId in textCompIds)
13{
14    // Set overrides:
15    cogoPoint.SetLabelTextComponentJustificationOverride(textCompId, TextJustificationType.Center);
16    cogoPoint.SetLabelTextComponentOverride(textCompId, "<[Full Description(CP)]>");
17
18    LabelStyleTextComponent lstc = textCompId.GetObject(OpenMode.ForWrite) as LabelStyleTextComponent;
19    _editor.WriteMessage("\n Text Component:{0}", lstc.Name);
20    _editor.WriteMessage("\n Justification type: {0}", cogoPoint.GetLabelTextComponentJustificationOverride(textCompId));
21    _editor.WriteMessage("\n Is label text component overriden? {0}", cogoPoint.IsLabelTextComponentOverriden(textCompId));
22    _editor.WriteMessage("\n Justification override type: {0}", cogoPoint.GetLabelTextComponentJustificationOverride(textCompId));
23    _editor.WriteMessage("\n Text Contents: {0}", lstc.Text.Contents.Value);
24
25    // clear overrides for this ID
26    cogoPoint.ClearLabelTextComponentOverrides(textCompId);
27}
28
29// You can clear all the overrides without having to iterate the collection like this:
30cogoPoint.ClearAllLabelTextComponentOverrides();
31
32// Reset the label location, rotation, contents:
33cogoPoint.ResetLabelLocation();
34cogoPoint.ResetLabelRotation();
35cogoPoint.ResetLabel();

VB

 1' Create a COGO Point to demonstrate its methods.
 2'
 3Dim pointId As ObjectId = _civildoc.CogoPoints.Add(New Point3d(100, 100, 100), False)
 4Dim cogoPoint As CogoPoint = TryCast(pointId.GetObject(OpenMode.ForWrite), CogoPoint)
 5cogoPoint.RawDescription = "Example Point"
 6cogoPoint.LabelStyleId = _civildoc.Styles.LabelStyles.PointLabelStyles.LabelStyles("Elevation and Description")
 7
 8
 9' Get text components
10Dim textCompIds As ObjectIdCollection = cogoPoint.GetLabelTextComponentIds()
11_editor.WriteMessage(vbLf & " # components: {0}", textCompIds.Count)
12For Each textCompId As ObjectId In textCompIds
13  ' Set overrides:
14  cogoPoint.SetLabelTextComponentJustificationOverride(textCompId, TextJustificationType.Center)
15  cogoPoint.SetLabelTextComponentOverride(textCompId, "<[Full Description(CP)]>")
16
17  Dim lstc As LabelStyleTextComponent = TryCast(textCompId.GetObject(OpenMode.ForWrite), LabelStyleTextComponent)
18  _editor.WriteMessage(vbLf & " Text Component:{0}", lstc.Name)
19  _editor.WriteMessage(vbLf & " Justification type: {0}", cogoPoint.GetLabelTextComponentJustificationOverride(textCompId))
20  _editor.WriteMessage(vbLf & " Is label text component overriden? {0}", cogoPoint.IsLabelTextComponentOverriden(textCompId))
21  _editor.WriteMessage(vbLf & " Justification override type: {0}", cogoPoint.GetLabelTextComponentJustificationOverride(textCompId))
22  _editor.WriteMessage(vbLf & " Text Contents: {0}", lstc.Text.Contents.Value)
23
24  ' clear overrides for this ID
25  cogoPoint.ClearLabelTextComponentOverrides(textCompId)
26Next
27
28' You can clear all the overrides without having to iterate the collection like this:
29cogoPoint.ClearAllLabelTextComponentOverrides()
30
31' Reset the label location, rotation, contents:
32cogoPoint.ResetLabelLocation()
33cogoPoint.ResetLabelRotation()
34cogoPoint.ResetLabel()

See Also

Reference

Was this information helpful?