Compute Volume Position (Sys3D_ComputeVolumePosition)

An opening ID is an entry point used to customize business logic. The Sys3D_ComputeVolumePosition computes the position of a volume, and place the volume in the work area or update its position.

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

This page discusses:

General Information

This opening ID is invoked when:

  • Using Update Volume Position in the Allocation Assistant panel.
  • Using the Create Component Volume command, if a system component is selected beforehand.

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

Input Objects

Input objects must be of the following types:

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

This opening ID is used to customize the computation of a volume position based on allocation connection data.

Context Object Parameters

Parameter Name Type Read or Write Comments
ListAllocationData GetAllocationConnection Read Input list of allocation connections.

The Sys3D_Volume Sys3D_ListSystemComponents , and Sys3D_AssignedSpaces attributes can be used to access the volumes for which positions must be computed, the allocated logical components, and their assigned spaces respectively.

List3DPosition Matrix Write Output list of positions.

The size of output list must be the same as the input list of allocation connections.

Note: If position computation fails for some connection data, NULL should be added in the list. If the position is NULL for some connection data/s, the volume position will remain unchanged.

Sample

The following sample shows you to update the position of a volume.

let ListAllocationData(list)
let ListAssignedSpaces(list)
let ListUniqueAssignedSpaces(list)
let ListSystemComponents(list)
let ListSystemCompNames(list)
let allocatedVolume(Sys3D_AbstractVolumeOccurrence)
let ListPositions(list)
let feat (Feature)
let newPos (Matrix)
let AllocatonCnx(Sys3DAllocationConnection)
let index(integer)
let index2(integer)
let sMsg(string)
let sName(string)

set ListAllocationData = Parameters.GetAttributeObject("ListAllocationData")
if(NULL <> ListAllocationData)
{
	index = 1
	for index while index <= ListAllocationData.Size()
	{
	  // For each connection initialize the position with NULL
		set newPos = NULL
		set AllocatonCnx = ListAllocationData[index]
		if(NULL <> AllocatonCnx)
		{
		  set allocatedVolume = AllocatonCnx.Sys3D_Volume
			set ListAssignedSpaces = AllocatonCnx.Sys3D_AssignedSpaces
			set ListSystemComponents = AllocatonCnx.Sys3D_ListSystemComponents
			if( (NULL <> allocatedVolume) and (NULL <> ListAssignedSpaces) and (NULL <> ListSystemComponents) and (ListSystemComponents.Size() == ListAssignedSpaces.Size()) )
			{
				sMsg = sMsg + allocatedVolume.Name
				
			  // Check if same space is assigned to all the components
				set sName = "Unknown"
				ListUniqueAssignedSpaces.RemoveAll()
				ListUniqueAssignedSpaces.Append(ListAssignedSpaces)
				ListUniqueAssignedSpaces.RemoveDuplicates()
				if(1 == ListUniqueAssignedSpaces.Size())
				{
					// Return position based on space
					set feat = ListUniqueAssignedSpaces.GetItem(1)
					if(NULL <> feat)
					{
						set sName = feat.Name
					}
					
					if(sName == "Space1")
					{
					  set newPos = [1,0,0,1000;0,1,0,0;0,0,1,0]
					}
					else if(sName == "Space2")
					{
					  set newPos = [1,0,0,2000;0,1,0,0;0,0,1,0]
					}
					else if(sName == "Space3")
					{
					  set newPos = [1,0,0,3000;0,1,0,0;0,0,1,0]
					}
					else if(sName == "Space4")
					{
					  set newPos = [1,0,0,4000;0,1,0,0;0,0,1,0]
					}
					sMsg = sMsg + ": Position computed based on Space Name" + "|"
				}
				else // Multiple spaces are found
				{
					// Prepare list if component names
					set index2 = 1
					ListSystemCompNames.RemoveAll();
					for index2 while index2 <= ListSystemComponents.Size()
					{
						set sName = "Unknown"
						set feat = ListSystemComponents.GetItem(index2)
						if(NULL <> feat)
						{
							set sName = feat.Name
						}
						ListSystemCompNames.Append(sName)
					}
					
					// Return Space based on Names of System component/s
					if( (1 <= ListSystemCompNames.IndexOf("C1")) and (1 <= ListSystemCompNames.IndexOf("C2")) )
					{
						set newPos = [1,0,0,1500;0,1,0,0;0,0,1,0]
					}
					else if( (1 <= ListSystemCompNames.IndexOf("C3")) and (1 <= ListSystemCompNames.IndexOf("C4")) )
					{
						set newPos = [1,0,0,3500;0,1,0,0;0,0,1,0]
					}
					sMsg = sMsg + ": Position computed based on Component Names" + "|"
				}
			}
		}
		ListPositions.Append(newPos)
	}
}

if(ListPositions.Size() == ListAllocationData.Size())
{
	Parameters.SetAttributeObject("List3DPosition", ListPositions)
	Parameters.Message = sMsg
}
else
{
	Parameters.Message = "Position computation failed"
}