Compute Shape Properties (Sys3D_ComputeShapeDimensions)

An opening ID is an entry point used to customize business logic. The Sys3D_ComputeShapeDimensions opening ID is used to customize the computation of the dimention for the new shape feature.

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 the basic shape feature type is modified to another Parameter-driven shape (pad, cylinder, cone, sphere).

This opening ID is used to customize the computation of the dimension for the parameter-driven shape.

Definition Description
PLM Opening ID parameter-driven shape
Customization intent Execution
Execution context Client

Input Objects

Input objects must be of the following types:

  • ThisObject: Sys3D_AbstractVolumeReference
  • Parameters corresponds to the context object.
  • Validation: If business rule provides values of these parameters, the new shape is created with these dimension and color.
    Notes:
    • If any of the parameter value is not valid, the shapeis created with computed dimensions (as in Target3DShape).
    • If the color output list is not valid, new shape feature will be created with same as the current feature.

Context Object Parameters

Parameter Name Type Read or Write Comments
Current3DShape String Read Name of current shape type (pad, cylinder, cone, sphere).
CurrentBaseLength Length Read Length for the pad shape.
CurrentBaseWidth Length Read Width for the pad shape.
CurrentHeight Length Read Height for pad shapes.
CurrentBaseDiameter Length Read Diameter for cone and cylinder shapes.
CurrentHeight Length Read Height for cone and cylinder shapes.
CurrentDiameter Length Read Diameter for sphere shape.
Target3DShape String Write Name of the new shape
BaseLength Length Write Length for the new pad shape.
BaseWidth Length Write Width for the new pad shape.
Height Length Write Height for the new pad shape.
BaseDiameter Length Write Diameter for the new cone and cylinder shapes.
Height Length Write Height for the new cone and cylinder shapes.
Diameter Length Write Diameter for the new sphere shape.
Color List Write List of integers containing three values of color (R, G and B) for the new shape.

Sample

The following sample

/* CATRule signature (do not edit) : (ThisObject : #In Sys3D_AbstractVolume, Parameters : #In RuleContext) : VoidType */
let currentShapeType (String)
let newShapeType (String)
let d1(Length)
let d2(Length)
let d3(Length)
let dH (Length)
let d2Valid (boolean)
let d3Valid (boolean)
let listColor(LIST)

let bIsSet (boolean)
let sMessage(String)

set d2Valid = false
set d3Valid = false
set bIsSet = false
set currentShapeType = Parameters.GetAttributeString("Current3DShape")
set newShapeType = Parameters.GetAttributeString("Target3DShape")
if(newShapeType <> currentShapeType)
{
	// Get the dimensions from current shape
	set d1 = 0.0mm
	set d2 = 0.0mm
	set d3 = 0.0mm
	set dH = 0.0mm
	if(currentShapeType == "Pad")
	{		
		set d1 = Parameters.GetAttributeReal("CurrentBaseLength")*1mm
		set d2 = Parameters.GetAttributeReal("CurrentBaseWidth")*1mm
		set d3 = Parameters.GetAttributeReal("CurrentHeight")*1mm
		set d2Valid = true
		set d3Valid = true
	}
	else if ( (currentShapeType == "Cone") or (currentShapeType == "Cylinder") )
	{
		set d1 = Parameters.GetAttributeReal("CurrentBaseDiameter")*1mm
		set d3 = Parameters.GetAttributeReal("CurrentHeight")*1mm
		set d3Valid = true
	}
	else if(currentShapeType == "Sphere")
	{
		set d1 = Parameters.GetAttributeReal("CurrentDiameter")*1mm
	}
	
	// Update the dimension of new shape based on valid dimensions
	// If current shepe has height, the height should be used as height (/ diame</Value><Value IDX="12">N11Nter for sphere)
	// All other dimension should be equal to D1
	set sMessage = sMessage + " (d1 = " + ToString(d1) + ", d2 = " + ToString(d2) + ", d3 = " + ToString(d2) + ")"
	set sMessage = sMessage + " To " + newShapeType
	set dH = d1
	if(true == d3Valid)
		dH = d3
	
	if( (newShapeType == "Cylinder") or (newShapeType == "Cone") )
	{
		Parameters.SetAttributeDimension("BaseDiameter", d1, "Length")
		Parameters.SetAttributeDimension("Height", dH, "Length")
		set sMessage = sMessage + " ( BaseDia = " + ToString(d1) + " Height = " + ToString(dH) + ")"
		set bIsSet = true
	}
	else if(newShapeType == "Pad")
	{
		Parameters.SetAttributeDimension("BaseLength", d1, "Length")
		Parameters.SetAttributeDimension("BaseWidth", d1, "Length")
		Parameters.SetAttributeDimension("Height", dH, "Length")
		set sMessage = sMessage + " ( BaseLength = BaseWidth = " + ToString(d1) + " Height = " + ToString(dH) + ")"
		set bIsSet = true
	}
	else if(newShapeType == "Sphere")
	{
		Parameters.SetAttributeDimension("Diameter", dH, "Length")
		set sMessage = sMessage + " ( Dia = " + ToString(dH) + ")"
		set bIsSet = true
	}
	
	// Decide the color based on type of volume
	if(true == ThisObject.IsSupporting("Sys3D_ComponentVolume"))
	{
		listColor.Append(175) //R
		listColor.Append(224) //G
		listColor.Append(183) //B
	}
	else if(true == ThisObject.IsSupporting("Sys3D_DerivationVolume"))
	{
		listColor.Append(145) //R
		listColor.Append(232) //G
		listColor.Append(250) //B
	}
	else if(true == ThisObject.IsSupporting("Sys3D_InterfaceVolume"))
	{
		listColor.Append(102) //R
		listColor.Append(161) //G
		listColor.Append(237) //B
	}
	else // default color
	{
		listColor.Append(218) //R
		listColor.Append(218) //G
		listColor.Append(218) //B
	}
}
if(bIsSet == false)
{
	Parameters.Message = "ERROR: Dimensions not computed"
	Parameters.Severity = 2
}
else
{
	Parameters.Message = sMessage
	Parameters.Severity = 0
}

Notify(sMessage)