EKL - BL for instantiate/duplicate option

Introduction

Usage : when using Manipulate command, with option Business Rule to copy a portion of the schema. 

You will define in the Rules if you want to duplicate the objects or instantiate them according there type and subPartype

Datasetup Resource Set : 

  • Diagram Resource

Datasetup Resource : Rule for instantiate/duplicate option

 

Rule Example1

Description 

Only Equipment object will be duplicated, all others (pipes, branches, valves, ...) will be instantiated

rule

/*/* CATRule signature: (ThisObject : #In LogicalOccurrence, Parameters : #In RuleContext) : #Void */

/* Sample rule*/
/* Input parameter is List of PLM Occurrences*/
/* Output parameter is List of integers, which is one to one mapping with List Of PLM Occurrences*/
/* In this sample rule, we fill 2 in output list for Equipments and 1 for all other objects*/
/* all objects are reinstantiated into the targeted system */

/*
Object manipulation:
1: The object is instantiated.
2: The object is duplicated.
3: The object is placed in view.

Context for new instances:
0: The context for new instance is the same as the existing instance.
1: The context for new instance is different from the existing object. It will be the logical father of the sheet containing the duplicated view.
*/

/* Input parameters read */

let This2DObject (LogicalOccurrence)
let ListPLMOccurrences(LIST)

set ListPLMOccurrences = Parameters.GetAttributeObject ("List_PLM_Occurrences")

let OutputInsDupOptionsList(List)
let OutputContextChangeOptionsList(List)

Let ReferenceObject(RFLVPMLogicalReference)
let OccurrenceObject (LogicalOccurrence)
let sDiscipline (String)

Let j = 1
for j while j<=ListPLMOccurrences->Size()
	{
	set OccurrenceObject = ListPLMOccurrences->GetItem(j)
	set ReferenceObject = OccurrenceObject.Reference
 	sDiscipline = ReferenceObject.V_discipline
 	 if(sDiscipline == "EnsLogicalEquipment")
		{ 		
		OutputInsDupOptionsList.Append(2)
		OutputContextChangeOptionsList.Append(1)
		}
	else
		{
		OutputInsDupOptionsList.Append(1)
		OutputContextChangeOptionsList.Append(1)
		}
	j = j+1
	}

Parameters.SetAttributeObject("List_Instantiate_Duplicate_Options", OutputInsDupOptionsList)
Parameters.SetAttributeObject("List_Context_Change_Options", OutputContextChangeOptionsList)