About Business Logic

Below is some information about the use of Business Logic.

This page discusses:

About Valuation of Attributes

Below is some information about a Business Logic (PLMImportExportAttributesValuation) to value some attributes at import or export.

For more information, in particular full description of the parameters, see Import/Export Attributes Valuation (PLMImportExportAttributesValuation).

Add the Name of Imported File

Below is some information on how to add the name of the imported file to the PLM Object currently imported in 3DEXPERIENCE.

Note: You cannot add a default attributes to all PLM entities into 3DEXPERIENCE.

PLM Leader creates a new rule (.CATRule) for STEP import where the source filename ExternalFileName is accessible and usable to customize the currently processed PLM object (ThisObject).

PLM Designer applies this Business Logic rule when importing STEP files.

The imported data now have an atttribute containing the concatenated name of the source STEP file associated to each entity, with the value built and set in the Business Logic. The attribute may be a new one or an existing or default one.

Example of rule:

Let filename(string)

if (ThisObject->HasAttribute(“V_fromExternalID”) == true)
{
	If (Parameters->HasAttribute(“ExternalFileName”) == true)
	{
		filename = Parameters->GetAttributeObject(“ExternalFileName”)
		ThisObject->SetAttributeString(“V_fromExternalID”, filename)
	}
}

Manage the Enterprise Item Number

Below is some information on how to manage the Enterprise Item Number at import and export.

The Enterprise Item Number (EIN) is the primary identifier of an object.

Note: You must enable the User Defined Attributes option. If you do not, the executed Business Logic managing the EIN will not be taken into account.

At Import

You can modify the EIN associated to the current PLM Object imported in 3DEXPERIENCE.

Note: You cannot add a default attributes to all PLM entities into 3DEXPERIENCE.

Create a new rule (.CATRule) for STEP import, where the primary identifier (information coming from Parameters in the Business Logic) can be set to oEnterpriseItemNumber (attribute associated to the Parameters, not the output Proxy: ThisObject.

The rule is applied to the imported data, which now contains a field V_partNumber with the value built and set in the Business Logic.

Example of rule:

Let IEM(string)

if (Parameters->HasAttribute(“iFileId”) == true) {
	if (Parameters->HasAttribute(“oEnterpriseItemNumber”) == true) {
		IEM = Parameters->GetAttributeString(“iFileId”) 
		Parameters->SetAttributeString(“oEntepriseItemNumber”, IEM)
}
}

At Export

You can retrieve the Enterprise Item Number associated to the current PLM Object exported from the 3DEXPERIENCE.

Note: You cannot create random Enterprise Item Number on the fly.

Create a new rule (.CATRule) for STEP export where the EIN can be retrieved via the ThisObject (current object being processed) attribute V_PartNumber. V_PartNumber can be set to the Context Object Parameter called oReferenceId (or to another parameter depending on the final intent).

The rule is applied to the exported data. STEP Product name/Filename etc. (depending on the filled Context Parameters) now match EIN.

Example of rule:

Let EnterpriseItemNumber(string)

if (ThisObject->HasAttrbute(“V_PartNumber”) == true) {
	EnterpriseItemNumber = ThisObject->GetAttributeString(“V_PartNumber”)

if (Parameters->HasAttribute(“oReferenceId”) == true) {
		Parameters->SetAttribute(“oReferenceId”, EnterpriseItemNumber)	
	}
}

Apply a Mapping to Attributes

Below is some information on how to apply a mapping to objects-attributes at export. These attributes are exported following the STEP Recommended Practices as customized PDM properties.

The goal is to map a 3DEXPERIENCE property to a written STEP property. For example, map the Property P1 to the GENERAL_PROPERTY MyM3R.

An example of rule could be

// The output « PLMInputProperties » context object parameter.
// Its name is actually missleading, but it is a parameter used in our scenario as output.
// It is a `Feature`: understand a sub-context in which it is possible to add attributes.
Let custo_attributes(Feature)
if (true == Parameters->HasAttribute("PLMInputProperties")) {
    custo_attributes = Parameters->GetAttributeObject("PLMInputProperties")
    // Parameter mapping examples, retrieve from Proxy and write into Context:
    if (true == ThisObject->HasAttribute("V_Name")) {
        Let vname(String)
        vname = ThisObject->GetAttributeString("V_Name")
        // Map parameter with a new name + modified value (add suffix).
        custo_attributes->SetAttributeString("Custo_V_Name", vname + "_THL1")        
        if (true == ThisObject->HasAttribute("V_description")) {
            Let description(String)
            description = ThisObject->GetAttributeString("V_description")            
            // String sequence created from existing attributes:
            custo_attributes->SetAttributeString("explicit-description", description + vname)
        }
    }    
    // Create a new attribute from nothing:
    custo_attributes->SetAttributeBoolean("HasCustoAttributes", True)
}

with

  • ExternalFileName: Current file name
  • ExternalFileType: File extension
  • CurrentFilePath: File path
  • OriginalFilePath: Initial file path
  • IsInternalComponent: Indicates if the current objet is root or not.
  • PLMInputProperties: Contains any parameter of any type
  • FileDescription: Contains product information
  • oEnterpriseItemNumber: For DataExchangeImport only, creates the Enterprise Item Number

About Customized Types Mapping

Below is some information about types mapping.

The customized types for VPMReference and VPMRepReference specified by a Business Logic are taken into account at import.

  • The Business Logic defines the customized type for VPMReference and VPMRepReference for the operation DataExchangeImport.
  • The customized types are registered in the dictionary of valid types.
  • You cannot specify applicative types by a Business Logic

Example:

  • CATRuleExit
    <Scripts>
    	<Script OpeningID="PLMCustoTypeMapping" Type="VPMReference" ScriptName="Tst_TypesMapping_NT">
    		<Condition Attribute="OperationId" Value="DataExchangeImport"/>
    	</Script>
    	<Script OpeningID="PLMCustoTypeMapping" Type="VPMRepReference" ScriptName="Tst_TypesMapping_Part_NT">
    		<Condition Attribute="OperationId" Value="DataExchangeImport"/>
    	</Script>
    </Scripts>
  • TST_TypesMapping_NT
    Let SourceObject(PLMEntity)
    Let oCustoName(String)
    
    set SourceObject = Parameters->GetAttributeObject("SourceObject")
    
    if(Parameters->HasAttribute("TargetCustoName") == true)
    {
    	oCustoName = "custoRefType"
    	
    	Parameters->SetAttributeString("TargetCustoName", oCustoName)
    }
  • TST_TypesMapping_Part_NT
    Let SourceObject(PLMEntity)
    Let oCustoName(String)
    
    set SourceObject = Parameters->GetAttributeObject("SourceObject")
    
    if(Parameters->HasAttribute("TargetCustoName") == true)
    {
    	oCustoName = "custoRepRefType"
    	
    	Parameters->SetAttributeString("TargetCustoName", oCustoName)
    }

About V_Usage

Below is some information about V_Usage.

V_usage is exposed in the Business Logic proxy during DataExchangeImport operation on VPMReference objects. The value is “” for basic Product Reference and “3DPart” for 3DParts. You can find an example for the use of this value below.

Example

  • V_usage_example.CATRuleExit
    <Scripts>
    	<Script OpeningID="PLMCustoTypeMapping" Type="VPMReference"
    ScriptName="V_usage_example">
    		<Condition Attribute="OperationId" Value="DataExchangeImport"/>
    	</Script>
    </Sripts>
  • V_usage_exampleCATRule
    Let oCustoName(String)
    Let Usage(String)
    
    Usage = ""
    
    if(Parameters->HasAttribute("TargetCustoName") == true
    {
    	oCustoName = "DICTestReference"
    	
    	if ( ThisObject->HasAttribute("V_usage") == true
    	{
    		Usage = ThisObject.V_usage
    	}
    	if(Usage == "3DPart")
    	{
    	oCustoName = "DICTestReference2"
    	}
    	Parameters->SetAttributesString("TargetCustoName", oCustoName)
    	}