Context Object Parameters
Parameter Names | Types | Read/Write | Comments |
---|
ThisObject | PLMEntity | Read/Write | This is a PLM proxy object with the same top modeler type and custo type as the PLM entity to create on which attribute valuation is requested or this is a proxy object of the exported PLM entity from which data can be extracted. Reading this PLM entity, the BL can retrieve original attributes values. During 3DXML import, only custom attributes can be modified. They will be initialized to default value, and can be set to another value by the rule. In case of update, if the custom attribute is not explicitly valuated by the rule, then the original value in database will be kept.
|
OperationId | string | Read | Parameter used to identify the context of usage of the BL. Authorized values are:- "DataExchangeExport”for PLM Export File command
- "DataExchangeImport" for PLM Import File command
- "BriefcaseImport" for 3DXML Import command
- "BriefcaseExport" for 3DXML Export command
- "FBDIImport" for FBDI Import command
|
IdString | string | Read | Parameter used to pre-valuate the identifier attribute. This information comes from UI (Tools/Options). Can be interpreted as a prefix for instance. May be not used by the Business Logic . |
iFileId | string | Read | Parameter valuated when OperationId="DataExchangeImport". Parameter used to pre-valuate the identifier attribute. This is the name of product reference or representation reference stored in file. This is an optional parameter for the other operations. |
ExchangeInfo | feature | Read/Write | Parameter valuated when OperationId="BriefcaseImport" or "BriefcaseExport". This parameter is used to describe additional information associated with an exported PLM object. It contains a set of (key, value) couples. Key and values are strings, and they are freely-defined by the administrator creating the rules (usually based on an agreement between the emitter and the receiver). This parameter is meant to be filled at export (OperationId="BriefcaseExport) and read at import (OperationId="BriefcaseImport). |
FirstImport | boolean | Read | Parameter valuated when OperationId="BriefcaseImport" or "FBDIImport" This parameter specifies if the object is imported for the first time (meaning this is an initialization), or if it already exists in the database (meaning this is an update). This parameter can be used by rules that need to initialize custom attribute values at first import only. |
oReferenceId | string | Read/Write | Parameter valuated when OperationId="DataExchangeExport". Parameter used to pre-valuate identifier attribute of File. This is an optional parameter for the other operations. |
FileName | string | Read | Parameter valuated when OperationId="FBDIImport". This parameter is used to retrieve the name of the file being imported. Ex : If E:\tmp\Rotor.CATPart is imported FileName is worth Rotor. |
FileType | string | Read | Parameter valuated when OperationId="FBDIImport". This parameter is used to retrieve the type of the file, ( CATPart, CATproduct, CATDrawing …) being imported. |
ExternalFileName | string | Read | Parameter valuated when OperationId="DataExchangeImport". This parameter is used to valuate the input file name. |
NativeV5Properties | feature | Read | Parameter valuated when OperationId="FBDIImport". This parameter is used to retrieve the list of the CATIA V5 native properties. The content of this list depends on the modeller type to which the proxy (ThisObject) belongs . Each modeller exposes a given and frozen list of properties that will be transmitted to the script of the Business Logic. [2] |
UserV5Properties | feature | Read | Parameter valuated when OperationId="FBDIImport". This parameter is used to retrieve the list of the CATIA V5 user properties. The content of this list depends on the modeller type to which the proxy (ThisObject) belongs. Each modeller exposes or not this list that could be transmitted to the script of the Business Logic. [1] |
Policy | String | Read | Policy name. |
Sample
The following sample shows how to:
- Initialize the naming of a Representation Reference from the naming of a File containing only geometry (PLM_ExternalID attribute is suffixed by a time stamp).
- Initialize the naming of a File from the naming of a Representation Reference as PLM_ExternalID value.
- Initialize the value of a custom attribute from the PLM_ExternalID value, during a 3DXML Import.
- Add a freely-defined export information based on a custom attribute value, during a 3DXML Export.
- Use this freely-defined information to valuate another custom attribute, during a 3DXML Import.
<Scripts>
<Script OpeningID="PLMImportExportAttributesValuation"
Type="MyCustoType"
ScriptName="MyRepDataExchangeImportScript">
<Condition Attribute="OperationId" Value="DataExchangeImport" />
</Scripts>
<Script OpeningID="PLMImportExportAttributesValuation"
Type="MyCustoType"
ScriptName="MyRepDataExchangeExportScript">
<Condition Attribute="OperationId" Value="DataExchangeExport" />
</Scripts>
<Script OpeningID="PLMImportExportAttributesValuation"
Type="MyCustoType"
ScriptName="My3DXMLImportScript">
<Condition Attribute="OperationId" Value="BriefcaseImport" />
</Scripts>
</Scripts>
<Script OpeningID="PLMImportExportAttributesValuation"
Type="MyCustoType"
ScriptName="My3DXMLExportScript">
<Condition Attribute="OperationId" Value="BriefcaseExport" />
</Scripts>
</Scripts>
<Script OpeningID="PLMImportExportAttributesValuation"
Type="MyCustoType2"
ScriptName="My3DXMLImportScript2">
<Condition Attribute="OperationId" Value="BriefcaseImport" />
</Scripts>
This family references the script that contains the business logic implementation, which looks like the following CATRule file:
Sample 1 (MyRepDataExchangeImportScript.CATRule): The script is based on a user knowledge package which provides a function DateFormat to get a time stamp.
Let Name(string)
Name = ""
if (Parameters->HasAttribute("iFileId")== true)
{
Name = Parameters->GetAttributeString("iFileId")
}
if(Name <> "")
{
if ( ThisObject->HasAttribute("V_Name") == true )
{
ThisObject.V_Name = Name
}
ThisObject.PLM_ExternalID = Name + "_" + DateFormat("%Y-%m-%d_%Hh%M")
}
Sample 2 (MyRepDataExchangeExportScript.CATRule):
Let Name(string)
Name = ""
if (Parameters->HasAttribute("oReferenceId")== true)
{
if ( ThisObject->HasAttribute("PLM_ExternalID") == true )
{
Name = ThisObject.PLM_ExternalID
}
Parameters->SetAttributeString("oReferenceId",Name)
}
Sample 3 (My3DXMLImportScript.CATRule)
Let Name(string)
Name = ""
if (Parameters->HasAttribute("FirstImport")== true)
{
if ( Parameters->GetAttributeBoolean("FirstImport") == true )
{
if (ThisObject->HasAttribute("PLM_ExternalID")== true)
{
Name = ThisObject.PLM_ExternalID
}
ThisObject->SetAttributeString("MyCustomAttribute",Name)
}
}
Sample 4 (My3DXMLExportScript.CATRule)
Let Value(string)
Let ExInfo(feature)
Value = "sampleValue"
if (ThisObject->HasAttribute("MyCustomAttribute")== true)
{
Value = ThisObject.GetAttributeString( "MyCustomAttribute" )
}
if (Parameters->HasAttribute("ExchangeInfo") == true)
{
ExInfo = Parameters->GetAttributeObject("ExchangeInfo")
ExInfo->SetAttributeString( "sampleKey", Value )
}
Sample 5 (My3DXMImportScript2.CATRule)
Let Value(string)
Let ExInfo(feature)
Value = "sampleValue"
if (Parameters->HasAttribute("ExchangeInfo") == true)
{
ExInfo = Parameters->GetAttributeObject("ExchangeInfo")
if (ExInfo->HasAttribute("sampleKey") == true)
{
Value = ExInfo->GetAttributeString( "sampleKey" )
}
}
ThisObject.SetAttributeString( "MyOtherCustomAttribute", Value )
Sample 6 to map the neutral attribute V_fromExternalID with the ExternalFileName (To add in the ENONT_VPMReference_BLInitialization.CATRule file).
Let Name(String)
Let InputFileName(String)
Name = ""
InputFileName = ""
if(Parameters->HasAttribute("ExternalFileName") == true)
{
InputFileName = Parameters->GetAttributeString("ExternalFileName")
if ( ThisObject->HasAttribute("V_fromExternalID") == true )
{
ThisObject.V_fromExternalID = InputFileName
}
}
Recommendations
Before using an input parameter, you have to check its value. For instance, to check if the iFileId parameter is valuated or not, use the following code sequence:
...
if (Parameters->HasAttribute("iFileId")== true)
Name = Parameters->GetAttributeString("iFileId")
if(Name <> "")
{
...
A typical usage of the IdString parameter is to interpret it as a prefix.