Compute Feature Name (Compute_Elec_Feature_Name)

An opening ID is an entry point used to customize business logic. The Compute Feature Name opening ID enables to automatically name or rename branches, segments, conductors, conductor groups, and cable routes according to an industrial criteria. This allows you to ensure the uniqueness of names in your product.

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 can be invoked in two cases:

  • When the following electrical features are instantiated: branch, segment, conductor, conductor group, and ElecRoute.

    In this case, the opening ID is used to customize the name of the features according to one the following industrial criteria:

    • The hierarchy of your product structure
    • Your customized attributes

  • When electrical features are renamed after their instantiation using the knowledge method ComputeAndUpdateName().

    In this case, the opening ID is used to customize the name of the features according to one the following industrial criteria:

    • The hierarchy of your product structure
    • Your customized attributes
    • Your product spaces
      Note: Using spaces as criteria is only possible after the instantiation of features because features need a geometry to allow the business rule to compute their associated space.

    For more information about the ComputeAndUpdateName() method, see Enterprise Knowledge Language Reference Guide: Knowledge Packages: 3D Modeling Apps: Electrical Types: Electrical Methods.

Important: In Me > Preferences > Infrastructure > 3D Shape Infrastructure > Display > Checking Operation When Renaming, three options are available to define the rule for renaming elements. When a name computed by the business rule is already used in your product, the naming logic takes into account the specified option to ensure the uniqueness of features name:
Option Naming behavior after the computation
No name check The computed name is specify on the feature.

Therefore, two features can have the same name.

Under the same tree node For features aggregated under the same node, the uniqueness is ensured by adding the suffix ".Renamed". If the suffix is already used, a unique number is generated and appended.

In the main object For features belonging to the same main node (electrical branch geometry or electrical physical system), the behavior is the same as for the Under the same tree node option and uniqueness is ensured for all electrical features within the node.

These options are not taken into account when the method ComputeAndUpdateName() is invoked.

For more information about these options, see Native Apps Preferences Guide: Infrastructure: 3D Shape Infrastructure: Display: Checking Operation When Renaming.

Tips:
  • The name computed by the business rule is not a fixed name. It can be edited manually.
  • You can create separate rules for each feature.
  • You can use the IsFeatureBeingInstantiated parameter to customize two logics: one for the features instantiation and one for the features renaming. See the Context Objects Parameters section below.
Definition Description
PLM Opening ID Compute_Elec_Feature_Name
Customization intent Computation
Execution context Client

Input Objects

Input objects must be of the following types:

  • ThisObject: the electrical feature (Branch, Segment, Conductor, ConductorGroup, or ElecRoute).
  • Parameters corresponds to the context object.

Context Object Parameters

Parameter Name Type Read or Write Comments
FactType Any EKL type Type of ThisObject in the business rule.

Can be Branch, Segment, Conductor, ConductorGroup, or ElecRoute.

IsFeatureBeingInstantiated Boolean Read Input argument that indicates if the business rule is called during the instantiation or the renaming of the feature.
  • If TRUE, the business rule is called during instantiation.
  • If FALSE, the business rule is called during renaming.
oFeatureName String Write Output name of the feature computed by the business rule.

Sample 1

The following sample illustrates how to automatically prefix conductors with their parent's name when they are instantiated.

Let BranchOldName(String)
Let EBG(Feature)
Let EBGName(String)
Let BranchNewName(String)
Let ListBranches(List)
Let itr(Integer)
Let Sz(Integer)
Let SameName(Integer)
Let Branch(Feature)
let bIsInstantiation(Boolean)

Set BranchOldName = ThisObject.Name
Set EBG = ThisObject.Owner
Set EBGName = EBG.Name
Set BranchNewName = EBGName + "\\" + BranchOldName
set bIsInstantiation = Parameters.GetAttributeBoolean("IsFeatureBeingInstantiated")

Notify("Branch old name = " + BranchOldName)
Notify("EBG name             = " + EBGName)
Notify("Branch new name = " + BranchNewName)

Set ListBranches = EBG.Query("Branch","")
Set Sz = ListBranches.Size()
Set itr =1
Set SameName = 0

for itr while itr<= Sz
{
	Set Branch = ListBranches.GetItem(itr)
	if(NULL <> Branch)
	{
		if(BranchNewName == Branch.Name)
		SameName = SameName + 1
	}
}

if(0 < SameName)
{
	BranchNewName = BranchNewName + "." + SameName
}

if(bIsInstantiation == true)
	BranchNewName  = BranchNewName  + "_Instantiation"
else
	BranchNewName  = BranchNewName  + "_Update"

Parameters.SetAttributeString("oFeatureName",BranchNewName)

Sample 2

The following sample illustrates how to ensure name uniqueness. Branches are automatically prefix with their parent's name when they are instantiated. If a name already exists, a number is added to the branch name as postfix. For example, if EBG_10.1_Branch.2 already exists, the name of the new branch is EBG_10.1_Branch.2.1.

Let BranchOldName(String)
Let EBG(Feature)
Let EBGName(String)
Let BranchNewName(String)
Let ListBranches(List)
Let itr(Integer)
Let Sz(Integer)
Let SameName(Integer)
Let Branch(Feature)

Set BranchOldName = ThisObject.Name
Set EBG = ThisObject.Owner
Set EBGName = EBG.Name
Set BranchNewName = EBGName + "_" + BranchOldName

Notify("Branch old name = " + BranchOldName)
Notify("EBG name             = " + EBGName)
Notify("Branch new name = " + BranchNewName)

Set ListBranches = EBG.Query("Branch","")
Set Sz = ListBranches.Size()
Set itr =1
Set SameName = 0

for itr while itr<= Sz
{
	Set Branch = ListBranches.GetItem(itr)
	if(NULL <> Branch)
	{
		if(BranchNewName == Branch.Name)
		SameName = SameName + 1
	}
}if(0 < SameName)
{
	BranchNewName = BranchNewName + "." + SameName
}

Parameters.SetAttributeString("oFeatureName",BranchNewName)

Sample 3

The following sample illustrates how to modify the name of the route of a cable (ElecRoute feature).

Let CableRouteOldName(String)
Let CableRouteNewName(String)
Let CableRoute(ElecRoute)
Let ThisCableRoute(ElecRoute)
Let EPSRef(Electrical3DSystem)
Let EPSRefName(String)
Let Prefix(String)
Let bIsInstantiation(Boolean)
Let CableOcc(Elec3DCableOccurrence)
Let CableName(String)

Set ThisCableRoute = ThisObject
if (NULL == ThisCableRoute) Notify("Invalid ThisObject")

Set CableRouteOldName = ThisCableRoute.Name
ThisCableRoute.GetParentEPS(EPSRef)
if (NULL == EPSRef) Notify("EPSRef is NULL ")
	
ThisCableRoute.GetCable(CableOcc)
if (NULL == CableOcc) Notify("CableOcc is NULL ")
Set CableName = CableOcc.Name

if (NULL == CableName)
{
	CableName = ""
	Notify("Cable Name is NULL")
}
Notify("Cable Name : " + CableName)

Set EPSRefName = EPSRef.Name
Set Prefix = CableName + "\\" +  EPSRefName

Set CableRouteNewName = Prefix + "\\" + CableRouteOldName
set bIsInstantiation = Parameters.GetAttributeBoolean("IsFeatureBeingInstantiated")

Notify("Cable Route old name = " + CableRouteOldName)
Notify("EPS name             = " + EPSRefName)
Notify("Cable Route new name = " + CableRouteNewName)

if(bIsInstantiation == true)
	CableRouteNewName  = CableRouteNewName  + "_Instantiation"
else
	CableRouteNewName  = CableRouteNewName  + "_Update"

Parameters.SetAttributeString("oFeatureName",CableRouteNewName)