DefaultValue Property

Gets or sets the default value for the AttributeTypeInfo.

Gets or sets the default value for the AttributeTypeInfo.

Gets or sets the default value for the AttributeTypeInfo.

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

Syntax

C#

public Object DefaultValue { get; set; }

Visual Basic

Public Property DefaultValue As Object
	Get
	Set

Visual C++

public:
property Object^ DefaultValue {
	Object^ get ();
	void set (Object^ value);
}

Examples

CopyC#
 1// Check if classification already exists. If not, create it.
 2// 
 3const string sampleClassificationName = "SampleClassification";
 4UDPClassification sampleClassification = null;
 5if (_civildoc.PointUDPClassifications.Contains(sampleClassificationName))
 6{
 7    sampleClassification = _civildoc.PointUDPClassifications[sampleClassificationName];
 8    // sampleClassification = _civildoc.PointUDPClassifications["Inexistent"];  // Throws exception.
 9}
10else
11{
12    sampleClassification = _civildoc.PointUDPClassifications.Add(sampleClassificationName);
13    // sampleClassification = _civildoc.PointUDPClassifications.Add("Existent"); // Throws exception.
14}
15
16// Create new UDP.
17// 
18AttributeTypeInfoInt typeInfoInt = new AttributeTypeInfoInt("Sample_Int_UDP");
19typeInfoInt.Description = "Sample integer User Defined Property";
20typeInfoInt.DefaultValue = 15;
21typeInfoInt.LowerBoundValue = 0;
22typeInfoInt.UpperBoundValue = 100;
23typeInfoInt.LowerBoundInclusive = true;
24typeInfoInt.UpperBoundInclusive = false;
25UDPInteger integerUDP = sampleClassification.CreateUDP(typeInfoInt);
26
27using (Transaction tr = startTransaction())
28{
29    // Assign classification to Point Group. In this case, we use
30    // the "_AllPoints" point group so we can use it with all points.
31    // 
32    ObjectId allPointsId = _civildoc.PointGroups.AllPointsPointGroupId;
33    PointGroup allPoints = allPointsId.GetObject(OpenMode.ForRead) as PointGroup;
34    allPoints.UseCustomClassification(sampleClassificationName);
35
36    ObjectId pointId = _civildoc.CogoPoints.GetPointByPointNumber(1);
37    CogoPoint point = pointId.GetObject(OpenMode.ForWrite) as CogoPoint;
38    int val = point.GetUDPValue(integerUDP);
39    // val should be default (15)
40    write(String.Format("Point {0} Sample_Int_UDP={1}", point.PointNumber, val));
41
42    point.SetUDPValue(integerUDP, 0); // Works! Lower bound included.
43    // point.SetUDPValue(integerUDP, 100); // Throws! Upper bout not included.
44
45    tr.Commit();
46}
CopyVB.NET
1!ERROR: See log file!

Examples

CopyC#
 1// Check if classification already exists. If not, create it.
 2// 
 3const string sampleClassificationName = "SampleClassification";
 4UDPClassification sampleClassification = null;
 5if (_civildoc.PointUDPClassifications.Contains(sampleClassificationName))
 6{
 7    sampleClassification = _civildoc.PointUDPClassifications[sampleClassificationName];
 8    // sampleClassification = _civildoc.PointUDPClassifications["Inexistent"];  // Throws exception.
 9}
10else
11{
12    sampleClassification = _civildoc.PointUDPClassifications.Add(sampleClassificationName);
13    // sampleClassification = _civildoc.PointUDPClassifications.Add("Existent"); // Throws exception.
14}
15
16// Create new UDP.
17// 
18AttributeTypeInfoInt typeInfoInt = new AttributeTypeInfoInt("Sample_Int_UDP");
19typeInfoInt.Description = "Sample integer User Defined Property";
20typeInfoInt.DefaultValue = 15;
21typeInfoInt.LowerBoundValue = 0;
22typeInfoInt.UpperBoundValue = 100;
23typeInfoInt.LowerBoundInclusive = true;
24typeInfoInt.UpperBoundInclusive = false;
25UDPInteger integerUDP = sampleClassification.CreateUDP(typeInfoInt);
26
27using (Transaction tr = startTransaction())
28{
29    // Assign classification to Point Group. In this case, we use
30    // the "_AllPoints" point group so we can use it with all points.
31    // 
32    ObjectId allPointsId = _civildoc.PointGroups.AllPointsPointGroupId;
33    PointGroup allPoints = allPointsId.GetObject(OpenMode.ForRead) as PointGroup;
34    allPoints.UseCustomClassification(sampleClassificationName);
35
36    ObjectId pointId = _civildoc.CogoPoints.GetPointByPointNumber(1);
37    CogoPoint point = pointId.GetObject(OpenMode.ForWrite) as CogoPoint;
38    int val = point.GetUDPValue(integerUDP);
39    // val should be default (15)
40    write(String.Format("Point {0} Sample_Int_UDP={1}", point.PointNumber, val));
41
42    point.SetUDPValue(integerUDP, 0); // Works! Lower bound included.
43    // point.SetUDPValue(integerUDP, 100); // Throws! Upper bout not included.
44
45    tr.Commit();
46}
CopyVB.NET
1!ERROR: See log file!

Examples

CopyC#
 1// Check if classification already exists. If not, create it.
 2// 
 3const string sampleClassificationName = "SampleClassification";
 4UDPClassification sampleClassification = null;
 5if (_civildoc.PointUDPClassifications.Contains(sampleClassificationName))
 6{
 7    sampleClassification = _civildoc.PointUDPClassifications[sampleClassificationName];
 8    // sampleClassification = _civildoc.PointUDPClassifications["Inexistent"];  // Throws exception.
 9}
10else
11{
12    sampleClassification = _civildoc.PointUDPClassifications.Add(sampleClassificationName);
13    // sampleClassification = _civildoc.PointUDPClassifications.Add("Existent"); // Throws exception.
14}
15
16// Create new UDP.
17// 
18AttributeTypeInfoInt typeInfoInt = new AttributeTypeInfoInt("Sample_Int_UDP");
19typeInfoInt.Description = "Sample integer User Defined Property";
20typeInfoInt.DefaultValue = 15;
21typeInfoInt.LowerBoundValue = 0;
22typeInfoInt.UpperBoundValue = 100;
23typeInfoInt.LowerBoundInclusive = true;
24typeInfoInt.UpperBoundInclusive = false;
25UDPInteger integerUDP = sampleClassification.CreateUDP(typeInfoInt);
26
27using (Transaction tr = startTransaction())
28{
29    // Assign classification to Point Group. In this case, we use
30    // the "_AllPoints" point group so we can use it with all points.
31    // 
32    ObjectId allPointsId = _civildoc.PointGroups.AllPointsPointGroupId;
33    PointGroup allPoints = allPointsId.GetObject(OpenMode.ForRead) as PointGroup;
34    allPoints.UseCustomClassification(sampleClassificationName);
35
36    ObjectId pointId = _civildoc.CogoPoints.GetPointByPointNumber(1);
37    CogoPoint point = pointId.GetObject(OpenMode.ForWrite) as CogoPoint;
38    int val = point.GetUDPValue(integerUDP);
39    // val should be default (15)
40    write(String.Format("Point {0} Sample_Int_UDP={1}", point.PointNumber, val));
41
42    point.SetUDPValue(integerUDP, 0); // Works! Lower bound included.
43    // point.SetUDPValue(integerUDP, 100); // Throws! Upper bout not included.
44
45    tr.Commit();
46}
CopyVB.NET
1!ERROR: See log file!

Exceptions

ExceptionCondition
System.FormatException Thrown when the format of an argument does not meet the parameter specifications of the invoked method.
System.FormatException Thrown when the format of an argument does not meet the parameter specifications of the invoked method.
System.FormatException Thrown when the format of an argument does not meet the parameter specifications of the invoked method.

See Also