Business Rule: CATRule to Define the Format and the Text of Choreography Text Events

Using a CATRule, you can customize the parameters of text events using Generate Choreography Text Events from the Programming section of the action bar.

This page discusses:

General Information

The DELNCChoreographyGeneration_BL_ID.CATRule is located in ..\resources\knowledge\scripts and can be invoked when creating a choreography text event using Generate Choreography Text Events from the Programming section of the action bar.

Input Objects

You can use the attributes of a machining operation. Input objects must be of the following types:

  • MachiningOperation

Parameter Name Comments
Output_text List of text lines to be displayed.
Output_format Define the format of the text event.

Additional Information

Use the following names to set the corresponding default text events attributes:

Name Attribute
FontName Text font
FontSize Text size
TextColor Text color expressed in RGB
BackGroundColor Panel color expressed in RGB
BackGroundTransparency Panel transparency
WindowPosition Panel position in the work area (ex. TOP_CENTER, BOTTOM_CENTER, TOP_LEFT, BOTTOM_LEFT, TOP_RIGHT, BOTTOM_RIGHT)

Example of usage

/* COMPUTATION RULE DELNCChoreographyGeneration_BL_ID
   GOAL: To define content and format of text choreography generated by 'Generate Choreography Event' command
   
   INPUT parameters:
     MachiningOperation: Selected machining operation.
   
   OUTPUT parameters:
     Output_text: List of text lines to be displayed in the text choreography event
	 Output_format: List of lists defining the format of text choreography event.
	        Each list contains two strings, one for the format attribute name and one for the format attribute value:
			* FontName: text font (ex: "Arial")
			* FontSize: text size
			* TextColor: text color expressed in RGB (ex: "0, 0, 0" for black)
			* BackGroundColor: panel color expressed in RGB
			* BackGroundTransparency: panel transparency [0 - 255]
			* WindowPosition: TOP_CENTER, MIDDLE_CENTER, BOTTOM_CENTER, TOP_LEFT, MIDDLE_LEFT, BOTTOM_LEFT, TOP_RIGHT, MIDDLE_RIGHT, BOTTOM_RIGHT 
			* WindowWidth: panel width size (default is 375) 
			* WindowHeight: panel height size
			* Duration : duration of the event (default is tool path machining time)

   EXAMPLE of usage:
		Let OutputTextList(List)
		Let OutputFormatList(List)
		Let Activity(ManufacturingOperation) 
		Let TextLine(String)

		// INPUT
		Set Activity = Parameters->GetAttributeObject("MachiningOperation")
		
		// Text
		TextLine = "Tool: " + Activity.GetToolName()
		OutputTextList.Append(TextLine)

		// Format  
		OutputFormatList.Append(List("BackGroundColor", "0, 255, 0"))
		OutputFormatList.Append(List("BackGroundTransparency", "115"))
		OutputFormatList.Append(List("WindowPosition", "TOP_CENTER"))
		OutputFormatList.Append(List("FontName", "Arial"))
		OutputFormatList.Append(List("FontSize", "20"))
		OutputFormatList.Append(List("TextColor", "0, 0, 255"))

		// OUPUTS 
		Parameters->SetAttributeObject("Output_text", OutputTextList)
		Parameters->SetAttributeObject("Output_format", OutputFormatList)
*/

Let OutputTextList(List)
Let OutputFormatList(List)
Let Activity(ManufacturingOperation) 
Let MchOpe(MachiningOperation) 
Let TextLine(String)
Let LinFeedRate(LINEARFEEDRATE)
Let AngFeedRate(ANGULARFEEDRATE)
Let LinSpeed(LINEARSPINDLESPEED)
Let AngSpeed(ANGULARSPINDLESPEED)

/* INPUT */
Set Activity = Parameters->GetAttributeObject("MachiningOperation")

/* Business Rule Logic*/
if (true == Activity.IsSupporting("MachiningOperation"))
{
	// Tool number
	TextLine = "Tool Number: " + ToString(Activity.GetToolNumber())
	OutputTextList.Append(TextLine)

	// Tool Name
	TextLine = "Tool Name: " + Activity.GetToolName()
	OutputTextList.Append(TextLine)
	
	Set MchOpe = Activity

	// Machining Feedrate
	if (MchOpe.MfgGlobalFeedrateMagnitude == "LINEARFEEDRATE")
	{
		LinFeedRate = MchOpe.MFG_FEED_MACH_VALUE
		TextLine = "Feedrate: " + ToString(LinFeedRate)
	}
	else
	{
		AngFeedRate = MchOpe.MFG_FEED_MACH_VALUE
		TextLine = "Feedrate: " + ToString(AngFeedRate)
	}
	OutputTextList.Append(TextLine)
	
	// Spindle speed
	if (MchOpe.MfgGlobalSpindleMagnitude == "LINEARSPINDLESPEED")
	{
		LinSpeed = MchOpe.MFG_SPINDLE_MACH_VALUE
		TextLine = "Spindle: " + ToString(LinSpeed)
	}
	else
	{
		AngSpeed = MchOpe.MFG_SPINDLE_MACH_VALUE
		TextLine = "Spindle: " + ToString(AngSpeed)
	}
	OutputTextList.Append(TextLine)
}

OutputFormatList.Append(List("WindowPosition", "TOP_CENTER"))
OutputFormatList.Append(List("FontName", "Arial"))
OutputFormatList.Append(List("FontSize", "20"))

	
/* OUPUTS */
Parameters->SetAttributeObject("Output_text", OutputTextList)
Parameters->SetAttributeObject("Output_format", OutputFormatList)