Create Parent of 3D Physical under the Grand Parent (L2P_Create3DParent)

An opening ID is an entry point used to customize business logic. The Create 3D Parent opening ID is available in the Logical to Physical Assistant Resources resource set.

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 to create a physical aggregating product where the 3D physical object should be instantiated.

Definition Description
PLM Opening ID L2P_Create3DParent
Customization intent Execution
Execution context Client

Input Objects

Input objects must be of the following types:

  • ThisObject: an L2PItem object and the name of the parent obtained in a previous analysis by calling Business Rule L2P_ComputeParent
  • Parameters corresponds to the context object.

Context Object Parameters

Parameter Name Type Read or Write Comments
PhysicalContext ProductOccurrence Read Physical context in which the parent is to be searched or created newly created 3D product instance
PhysicalParentName String Read Name of the expected 3D parent, which can be used for object creation.
ListOfPhysicalParentType List Read List of names of the types allowed as parent of the item. The business rule should create or search an object with one of these types.
PhysicalGrandParentName String Write Name of the grand-parent instance. Instance with the same name as this output will be searched. If found, it will be considered as grand-parent for manual creation of parent.
PhysicalGrandParentProduct ProductOccurrence Write The grand-parent occurrence in which parent is expected. The usage of this output is explained below:
  • If this output is valuated along with the PhysicalParent output,the right occurrence of the output parent will be searched inside PhysicalGrandParentProduct
  • If this output is valuated without the PhysicalParent output, this output will be considered as grand-parent for manual creation of parent.
PhysicalParent VPMInstance Write Computed or created 3D product instance. This output will be used to set as “Expected 3D Parent”.

Sample

let ProductOcc(ProductOccurrence)
let ChildProductOccurrence(ProductOccurrence)
let listChild(LIST)
let nbChild(INTEGER)
let index(INTEGER)
let sMessage(STRING)
let Child(Feature)

let ListParentProductTypeNameValue(List)

let bParentcreated(BOOLEAN)
let ReferenceNameValue(String)
let ownerRef(VPMReference)
let CurrentReference(VPMReference)
let newInst(VPMInstance)
let ParentReferenceNameValue(String)
let GrandParentReferenceNameValue(String)
let ParentProductTypeNameValue(String)


set bParentcreated=false

ProductOcc=Parameters.GetAttributeObject("PhysicalContext") 

listChild=ProductOcc.Children
set nbChild=listChild->Size()

set index =1

for index while index <= nbChild
{
	
	set Child=listChild->GetItem(index)
	if ((Child <> NULL) and (bParentcreated == false))
	{
		set ChildProductOccurrence= Child
		set CurrentReference = ChildProductOccurrence.Reference
		
		if (ChildProductOccurrence <> NULL and  "Cabin_1" == CurrentReference.Name)
		{
			
			ParentReferenceNameValue = Parameters.GetAttributeString("PhysicalParentName")
			
			ListParentProductTypeNameValue = Parameters.GetAttributeObject("ListOfPhysicalParentType")
			ParentProductTypeNameValue = ListParentProductTypeNameValue->GetItem(1)			
			newInst=new("VPMInstance",ParentReferenceNameValue +DateFormat("%H%M%S",BuildDate()), ChildProductOccurrence.Reference,new(ParentProductTypeNameValue, ParentReferenceNameValue, NULL))
			Parameters.SetAttributeObject("PhysicalGrandParentProduct", ChildProductOccurrence)										
			Parameters.SetAttributeObject("PhysicalParent", newInst)			
			bParentcreated = true
		}
	}
	
	
}

if (NULL == newInst)
{
	set GrandParentReferenceNameValue="Physical Root"
	Parameters.SetAttributeString("PhysicalGrandParentName", GrandParentReferenceNameValue)
}


if (bParentcreated == false)
{
	sMessage =  "Enitity parent not created"
	Parameters.SetAttributeInteger("Severity", 2)
	
	Parameters.SetAttributeString("Message", sMessage)
}