# Element

The Element object provides a short-hand method of accessing network elements (nodes and pipes) and their properties. Note: You must use the Network.GetElement routine to get an Element object from the network.
Function/Property | Description
Get(PropertyNameOrId: Variant; [FromUnitId: Integer; ToUnitId: Integer]): Variant | Get the value of a property, given a PropertyName or PropertyId. For result properties, you can optionally specify to convert the result value. If both the FromUnitId and ToUnitIds are specified the result will be converted between them. If only one is specified, this will be assumed to be the ToUnitId and the FromUnitId will be determined from how the result is stored internally.
GetKindName([UseShortVersion: Boolean = False]): String | Returns the name of the Kind associated with this Element, and any additional component-specific naming, if UseShortVersion is False.
Id: Integer | Returns the Element's Id.
Property[PropertyNameOrId: Variant]: Variant | Gets/Sets the value of an element property given a PropertyName or PropertyId.
PropertyExists(Name: String): Boolean | Returns True if a property with the specified name exists in the Element; False, otherwise.
Set(PropertyNameOrId: Variant; Value: Variant) | Set the value of a property, given a PropertyName or PropertyId.
Status: Integer | Get/Set the Status property for this Element.
Example: This example will go through the network 5 times, increasing the value of the first node's pressure by 1.5 each iteration. It calls a procedure to check each node's Flow result value – if it is less than 100 it will change the background color of the node to RED. uses Graphics; procedure UpdateNodeBackgroundColors; var NodeIds; begin NodeCount := Network.GetNodes(NodeIds); if NodeCount > 0 then begin // NOTE: NodeIds is a 0-based array so all indexing starts at 0. for NodeIndex := 0 to NodeCount – 1 do begin e := Network.GetElement(NodeIds[NodeIndex]); // If the current element's flow is less than 100 then set // it's Background color to red. if e.Property[46] < 100 then begin e.Property['BackgroundColor'] := clRed; Output.Add('Changed Node: ' + IntToStr(e.Id)); end; end; end; end; begin Output.Clear; Node1 := Network.GetElement(1); for i := 1 to 5 do begin ePressure := Node1.Get(66); // Could use Node1.Property['BoundaryPressure']; Node1.Set(66, ePressure + 1.5); Network.Calculate; UpdateNodeBackgroundColors; Network.Refresh; end; end; See Property Constants for a full list of all available properties for each type of element.