Top  Previous  Next


Creates an attribute associated with the specified element.

 CreateElementAttribute(const char* feature, const char* element, const char* elemValue, const char* attr, const char* value);


[in] const char* feature  
Name of the feature to which the element belongs.  
[in] const char* element  
Name of the element for which the attribute will be created.  
[in] const char* elemValue  
String representing the value of the element.  
[in] const char* attr  
Name of the attribute to be created.  
[in] const char* value  
String representing the value of the attribute.  

Return Values

Feature or element does not exist  


CreateCustomFeature("SwissKnife", "MaxFrameRate", "");  
SetFeatureElement("MaxFrameRate", "pVariable", "regPayloadSize", true);  
SetFeatureElement("MaxFrameRate", "pVariable", "regExposureTime", true);  
SetFeatureElement("MaxFrameRate", "pVariable", "regMultiplierFPS", true);  
SetFeatureElement("MaxFrameRate", "Formula", "( (1000000000 / 8 / PS < 1000000 / ET) ? (1000000000 / 8 / PS) * MUL : (1000000 / ET) * MUL)", true);  
CreateElementAttribute("MaxFrameRate", "pVariable", "regPayloadSize", "Name", "PS");  
CreateElementAttribute("MaxFrameRate", "pVariable", "regExposureTime", "Name", "ET");  
CreateElementAttribute("MaxFrameRate", "pVariable", "regMultiplierFPS", "Name", "MUL");  

As a result, the following feature description will appear in the camera XML file::

<SwissKnife Name="MaxFrameRate" NameSpace="Custom">
<pVariable Name="PS">regPayloadSize</pVariable>
<pVariable Name="ET">regExposureTime</pVariable>
<pVariable Name="MUL">regMultiplierFPS</pVariable>
<Formula>( (1000000000 / 8 / PS &lt; 1000000 / ET) ? (1000000000 / 8 / PS) * MUL : (1000000 / ET) * MUL)</Formula>


This method allows you to directly program an XML-file linked to the virtual camera object. An element is part of the XML-file encapsulated between a starting and ending tag. The element can contain multiple unique attributes which give more information about the element. The above sample code creates an advanced SwissKnife-type feature named MaxFrameRate with several elements, including a formula for calculating the value of the feature and three elements of the pVariable type pointing to certain registers (regPayloadSize, regExposureTime, regMultiplierFPS). Then the code uses SetFeatureElement to add a Name attribute to pVariable elements thus associating them with PS, ET and MUL variables used in the formula.

The use of this method requires an advanced knowledge of the GenICam standard and XML syntax. For more information please refer to the description of the GenICam standard available at

Note that the camera must be in the disconnected state in order for this method to work.