Context Object Parameters
Parameter Name | Type | Read/Write | Comments |
---|
ColorAttributeName | String |
Write | Gives the RGB color (cache usage, see sample). |
DisplayColor | String | Write | Gives the RGB color. |
UseCache | Boolean | Write | TRUE if usage of cache is required and FALSE if not. |
Sample
The following sample retrieves the color of a precedence constraint, with usage of the cache.
/* Setting the attribute UseCache to false will cause the execution of the rule always */
/* You should always UseCache to true, to improve performance. Unless you have to do */
/* a complex calcul to determine the color of the constraints. */
/* Warning: */
/* 1. The cache will be effective only if you set a valid ColorAttributeName */
/* attribute value */
/* 2. if you set the UseCache attribute to false then the rule will be executed */
/* always even if you dont set the attribute ColorAttributeName */
Parameters.SetAttributeBoolean ("UseCache" , true)
/* To use the cache you must also set a valid ColorAttributeName attribute value */
/* Ex: V_description */
/* This attribute will be searched and evaluated on the cache to minimize */
/* the rule executions. */
/* Please remark that this value will be read only once */
/* To deactivate the rule after the first execution you should use */
/* the cache and set the ColorAttributeName attribute to empty string */
Parameters.SetAttributeString ("ColorAttributeName" , "")
if(ThisObject->GetAttributeString("V_description") <> "")
{
/* use the DisplayColor return attribute to return the desired RGB color */
/* Please remark that if you dont set the attribute or you set this attribute to an empy string */
/* then the default constraint color will be used (set on properties using the user interface). */
/* This is only an Example, the display color for the constraint will be green on this case */
Parameters->SetAttributeString ("DisplayColor" , "0|255|0")
}