Share

PartDataRecord Class

A single data record for a Part object.

Inheritance Hierarchy

SystemObject
  Autodesk.Civil.DatabaseServicesPartDataRecord


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

Syntax

C#

public sealed class PartDataRecord : IDisposable

VB

Public NotInheritable Class PartDataRecord
	Implements IDisposable

C++

public ref class PartDataRecord sealed : IDisposable

The PartDataRecord type exposes the following members.

Methods

 NameDescription
Public methodDisposeReleases all resources used by the PartDataRecord
Public methodCode exampleGetAllDataFields Gets all data fields.
Public methodGetDataFieldBy(PartContextType) Gets the object of DataField by Context.
Public methodGetDataFieldBy(String) Gets the object of DataField by Name.
Public methodCode exampleGetDataFieldBy(PartContextType, Int32) Gets the object of DataField by Context and index.
Public methodGetMaxIndex Gets the maximum index of one context type.
Public methodGetSupportedContexts Gets the collection of supported ContextType.

Remarks

To edit the value of a PartDataField, you must open the Part (Pipe or Structure) for write, get a reference to the Part object's PartData property (type PartDataRecord), modify the PartDatafield value, and then re-set the Part's PartData. See the example code. A similar procedure is required for editing a PartSize. See the example code for PartSize for a sample.

Example

 1[CommandMethod("pipemann")]
 2public void getPipeManning () {
 3    Autodesk.AutoCAD.EditorInput.Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
 4    PromptEntityOptions opt = new PromptEntityOptions("\nSelect a Pipe");
 5    opt.SetRejectMessage("\nObject must be a pipe.");
 6    opt.AddAllowedClass(typeof(Pipe), false);
 7    ObjectId pipeID = ed.GetEntity(opt).ObjectId;
 8
 9    CivilDocument doc = CivilApplication.ActiveDocument;
10
11    using ( Transaction ts = Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction() ) {
12        Pipe PipeEle = ts.GetObject(pipeID, OpenMode.ForWrite) as Pipe;
13        // Save a reference to the PartData to restore later:
14        PartDataRecord record = PipeEle.PartData;
15        // Get a copy of the data:
16        PartDataField PartDataFld = record.GetDataFieldBy(PartContextType.FlowAnalysisManning);
17        // Change the inner data of the copy:
18        PartDataFld.Value = 0.44;
19        // Re-set the PartData property.  The data will not be updated without this step.
20        PipeEle.PartData = record;
21        ed.WriteMessage("Manning value is now: {0}", PartDataFld.Value);
22        ts.Commit();
23    }
24}

See Also

Reference

Was this information helpful?