Business Rule: Insulation Color (Color ID)

An opening ID is an entry point used to customize business logic. Color ID defines a specific color to an insulation based on the type of a feature.

Note: For more information about customization by business rules, see Customization by Business Rules.

This page discusses:

General Information

This opening ID is used to customize the color of an insulation based on the type of a feature on which insulation is applied.

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

Input Objects

Input objects must be of the following types:

  • ThisObject: VPMReference
  • Parameters: RuleContext

Sample

The following sample assigns color to an insulation as per the type of the feature.

/*
ThisObject Type = VPMReference
Parameters Type = RuleContext
*/
/* Initialize Input featue*/

let INS_SurfaceInsulation(InsSurfaceInsulationFeature)
let INS_ProfileInsulation(InsProfileInsulationFeature)

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

set INS_SurfaceInsulation = Parameters.GetAttributeObject("INSFeatureType")
set INS_ProfileInsulation = Parameters.GetAttributeObject("INSFeatureType")

if(NULL <> INS_SurfaceInsulation)
{
	//Check the children first and go to top in hierarchy
	Let oIns(InsInsulation)
	Let oRepRef(VPMRepReference)
	
	Let sCategory(String)
	
	//Notify(INS_SurfaceInsulation.Name)
	oRepRef = GetPLMOwner(INS_SurfaceInsulation)
	
	Set oIns = oRepRef.AggregatingReference

	sCategory = oIns.V_Categories->GetItem(1)

	if(sCategory == "A-0")
	{
		RValue = 0
		GValue = 128
		BValue = 128
	}
        else
        {
		RValue = 0
		GValue = 250
		BValue = 200
        }
	// you can add more conditions by retrieving the attributes
}
if(NULL <> INS_ProfileInsulation)
{
    //Check the children first and go to top in hierarchy
	Let oIns(InsInsulation)
	Let oRepRef(VPMRepReference)
	
	Let sCategory(String)
	
	//Notify(INS_ProfileInsulation.Name)
	oRepRef = GetPLMOwner(INS_ProfileInsulation)
	
	Set oIns = oRepRef.AggregatingReference

	sCategory = oIns.V_Categories->GetItem(1)
    
	if(sCategory == "B-0")
	{
		RValue = 0
		GValue = 100
		BValue = 200
	}
 	else
        {
		RValue = 0
		GValue = 130
		BValue = 220
        }
	// you can add more conditions by retrieving the attributes
}
Parameters.SetAttributeInteger("oRValue", RValue)
Parameters.SetAttributeInteger("oGValue", GValue)
Parameters.SetAttributeInteger("oBValue", BValue)

Note: This rule is executed using the Publish Insulations command.