Compute Segment Color (EHI_ComputeSegmentColor)

An opening ID is an entry point used to customize business logic. The Compute Segment Color opening ID allows you to specify a color on segments according to their separation code or their subtype. This enables to easily segregate and identify segments in the 3D area.

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 used to customize the color of segments. It is invoked whenever you set or edit the separation code or the subtype of a segment.

The opening ID in not invoked in the following cases:

  • Import of a product with FBDI
  • Generation of a configured harness
  • Extract of your content in Electrical Manufacturing Preparation

Note: After the customization, you can edit the computed color manually.

DefinitionDescription
PLM Opening IDEHI_ComputeSegmentColor
Customization intent Computation
Execution contextClient

Input Objects

Input objects must be of the following types:

  • ThisObject: Segment
  • Parameters corresponds to the context object.

Context Object Parameters

Parameter NameTypeRead or WriteComments
FactTypeAny EKL typeType of ThisObject in the business rule body.
Red

(output)

Integer WriteDefines the intensity of the red color.

Valid integer value is between 0 and 255.

Green

(output)

Integer WriteDefines the intensity of the green color.

Valid integer value is between 0 and 255.

Blue

(output)

Integer WriteDefines the intensity of the blue color.

Valid integer value is between 0 and 255.

Tip: You can specify an invalid integer value to prevent the color of segments with a specific separation code or a specific subtype from being modified.

Sample

The following sample illustrates how to specify a color on segments depending on their separation code and subtype.

In this example, the color is specified in the segment's separation code and is computed according to the subtype. If the segment has a "Low Tension" subtype, its color is light. If the segment has a "High Tension" subtype, its color is dark.

Let SepCode(String)
Let SubType(String)
Let R(Integer)
Let G(Integer)
Let B(Integer)

Set SepCode = ThisSegment.Elec_Segreg
Set SubType = ThisSegment.Elec_SubType

if(SubType == "High Tension")
{
	if(SepCode == "Red")
	{
		Set R = 255
		Set G = 0
		Set B = 0
	}
	else if(SepCode == "Green")
	{
		Set R = 0
		Set G = 157
		Set B = 0
	}
	else if(SepCode == "Blue")
	{
		Set R = 0
		Set G = 0
		Set B = 255
	}
}
else if(SubType == "Low Tension")
{
	if(SepCode == "Red")
	{
		Set R = 255
		Set G = 100
		Set B = 100
	}
	else if(SepCode == "Green")
	{
		Set R = 0
		Set G = 255
		Set B = 0
	}
	else if(SepCode == "Blue")
	{
		Set R = 100
		Set G = 100
		Set B = 255
	}
}

Parameters.SetAttributeInteger("Red",R)
Parameters.SetAttributeInteger("Green",G)
Parameters.SetAttributeInteger("Blue",B)