Package: Auto Annotate

Author: HCA Central
Version: 3
Added to Library: 11-Nov-23
HCAVersion needed: 17
Keywords: Utility

Requirements: See notes file for more information
Extra Info Link: Here

Package Description:
Depending upon your needs, this package could be as easy as just adding it to your design and adding the Annotate tag to a device. Of course, more complex operation is possible.

Program: Assemble Annotation Line

Program Description:
Takes a line containing placeholders and replaces the placeholders with current value text.

The line is of the form <text>%<placeholder>%<text>%<placeholder>%...

Placeholders are enclosed in %s. Two %s with nothing between them creates a single % in the output.

A newline character replaces any / in the text

Return value: The resultant line with placeholders evaluated

Parameters:

Name Type Description Default
Target Value Device whose icon is to be annotated  
Spec Value Annotation Spec.  

Program: Assemble Annotation Part

Program Description:
Generates the value for a placeholder. These placeholders are supported:

1. The name of a tag on the target object

2. "time"

3. "percent"

4. "state"

State can be supplied as "state" in which case the result is either "on" or "off". State can also be supplied as "state:text1:text2". Text1 is used in the object is off, otherwise text2 is used. For example:

"state:inactive:active" generates either "active" or "inactive"

Return value: The result of evaluating the placeholder

Parameters:

Name Type Description Default
Target Value Device whose icon is being annotated  
PartSpec Value Annotation placeholder  

Program: AssembleRGB

Program Description:
Has one parameter which is a text string of the form R,G,B. For example, "57,122,181". Uses the _RGB function to create the color code.

Return value: The color code

Parameters:

Name Type Description Default
ThreeParts Value RGB as three numbers separated by commas 255,255,255

Program: CreateAnnotateSpec

Program Description:
Based upon the kind of object and various state tags, creates a reasonable annotation specification.

Return value: The annotation spec string

Parameters:

Name Type Description Default
Target Value The device whose icon is to be annotated  

Program: Do Annotate

Program Description:
If the target device has the Annotate tag, its device is annotated using the annotation specification in the tag value, or one is created based upon the device state and properties

Parameters:

Name Type Description Default
Target Value Device whose icon is being annotated  

Program: State Change Responder

Program Description:
Responds to any state change on a device by passing the device name on to the DoAnnotate program.

Parameters:

Name Type Description Default
Target Object Device whose icon is being annotated  

Program: Tag Change Responder

Program Description:
Responds to any tag change on a device by passing the device name on to the DoAnnotate program.

Parameters:

Name Type Description Default
Target Object Device whose icon is being annotated  
TagName Value Changed tag name  
TagValue Value Changed tag value