Top  Previous  Next


Creates and/or sets an element associated with the feature.

 SetFeatureElement(const char* feature, const char* element, const char* value, bool forceNew = false);


[in] const char* feature  
Name of the feature to assign the element to.  
[in] const char* element  
Name of the element.  
[in] const char* value  
String representing the value of the element.  
[in] bool* forceNew  
This parameter should be used only if the element with the same name already exists. If TRUE, the new element will be created regardless. If FALSE, the method will not create a new element, but will only modify the value of the existing element.  

Return Values

Feature does not exist  


The following fragment of code creates a floating point feature and sets up several associated elements:  
m_pCamera->CreateFeature(FEATURE_TYPE_FLOAT, "ExposureTime", "Analog", REG_ACCESS_ALL);  
m_pCamera->SetFeatureRange("ExposureTime", 10., 100000000.);  
m_pCamera->SetFeatureDescription("ExposureTime""Exposure duration, in microseconds");  
m_pCamera->SetFeatureElement("ExposureTime", "ToolTip","Exposure time");  
m_pCamera->SetFeatureElement("ExposureTime", "Representation", "Logarithmic");  
m_pCamera->SetFeatureElement("regExposureTime", "Cachable", "NoCache");  

As a result, the following feature description will appear in the camera XML file:
<Float Name="ExposureTimeNameSpace="Standard">  
<ToolTip>Exposure time.</ToolTip>  
<Description>Exposure duration, in microseconds.</Description>  
   <FloatReg Name="regExposureTime" NameSpace="Standard">  


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. In the example above those elements are: ToolTip, Description, pValue, Min, Max, Representation. The Min and Max elements are assigned by using the SetFeatureRange method, while SetFeatureElement is used to assign the remaining elements. The Cachable element is assigned not to the feature itself, but to its register ("regExposureTime") as required by the GenICam standard.

Elements can contain one or several attributes. See CreateElementAttribute for more details.

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.