Space Coloring

An opening ID is an entry point used to customize business logic. Space Coloring assigns colors to space references according to their extensions and attributes.

Note: For more information about customization by business rules, see Installation and Setup: Customize: Behavior: Data Setup: Customization by Business Rules.

This page discusses:

General Information

This opening ID is invoked when you click the Space Coloring command.

This opening ID is used to customize the colors of the space references according to their extensions and attributes.

Definition Description
PLM Opening ID SpaceColoring
Customization intent Computation
Execution context Client

Input Objects

Input objects must be of the following types:

  • ThisObject: VPMReference
  • Parameters corresponds to the context object: RuleContext

Samples

The following samples explain the business rules for coloring of space references.

Sample 1: This business rule assigns colors to space references depending on their customer extensions.

/*
ThisObject Type = VPMReference
Parameters Type = RuleContext
*/

let RValue(Integer)
let GValue(Integer)
let BValue(Integer)

let CustomerExtensionName(String)

set CustomerExtensionName= Parameters.GetAttributeString("CustomerExtensionName")

/* Set RGB color */
if("NAVCabin" == CustomerExtensionName)
{
	RValue = 0
	GValue = 0
	BValue = 255
}
else if("NAVPool" == CustomerExtensionName)
{
	RValue = 255
	GValue = 0
	BValue = 0
}
else if("NAVRestaurant" == CustomerExtensionName)
{
	RValue = 128
	GValue = 0
	BValue = 255
}
else if("NAVLobby" == CustomerExtensionName)
{
	RValue = 255
	GValue = 255
	BValue = 0
}
else if("NAVGymnasium" == CustomerExtensionName)
{
	RValue = 255
	GValue = 128
	BValue = 0
}
else if("NAVInternalVol" == CustomerExtensionName)
{
	RValue = 0
	GValue = 0
	BValue = 0
}
else if("Default" == CustomerExtensionName)
{
	RValue = 128
	GValue = 128
	BValue = 128
}

Parameters.SetAttributeInteger("RValue", RValue)
Parameters.SetAttributeInteger("GValue", GValue)
Parameters.SetAttributeInteger("BValue", BValue) 

Sample 2: This business rule assigns colors to space references depending on their attributes.

/*
ThisObject Type = VPMReference
Parameters Type = RuleContext
*/

/*
## Explanation of the sample script ##
Test Data Model has two space references.
1. Title: Design Space Reference 01 / Floor Area: 0.009m2
2. Title: Design Space Reference 02 / Floor Area: 0.008m2 
3. Title: Manufacturing Space Reference 03 / No Floor Area

This example code changes color of space reference depending on conditions.
1. If space reference name includes "Design Space Reference" and floor area is 0.009m2, then its color would be Red.
2. If space reference name includes "Design Space Reference" and floor area is 0.008m2, then its color would be Blue.
*/

let RValue(Integer)
let GValue(Integer)
let BValue(Integer)

let attrTitle(String)
let attrFloorArea(Area)
let attrFloorAreaStr(String)

if(ThisObject <> NULL)
{
	attrTitle=ThisObject.GetAttributeString("V_Name")
	if attrTitle like "Design Space Reference*"
	{
		attrFloorArea=ThisObject.GetAttributeReal("V_FloorArea")*1m2
		attrFloorAreaStr = DimToString(attrFloorArea, "m2")
		if("0.009m2" == attrFloorAreaStr)
		{
			RValue = 255
			GValue = 0
			BValue = 0
		}
		else if("0.008m2" == attrFloorAreaStr)
		{
			RValue = 0
			GValue = 0
			BValue = 255
		}
	}
}

Parameters.SetAttributeInteger("RValue", RValue)
Parameters.SetAttributeInteger("GValue", GValue)
Parameters.SetAttributeInteger("BValue", BValue)