ThoughtWorthSharing HowTo
As part of the serie of article about UDO, I am sharing now a detailed explanation and examples on how to use the Primitives.
A primitive is a javascript function that allows us to navigate the PPR Data Model.
It usually takes 1 input navigation set, some additional parameters and gives an output navigation set (result of the navigations)
Each primitives that can be used in a procedure will be explained in this page.
- Expand Primitives
Header: var ExpandPrimitives = java.type("com.dassault_systemes.completion.service.ExpandPrimitives");
- Expand Primitives from 3D Index
Header: var ExpandFrom3DIndexPrimitives = java.type("com.dassault_systemes.pprcompletion.primitives.DELPPRContext3DPrimitive");
- Navigation Primitives
Header: var NavigationPrimitives = java.type("com.dassault_systemes. pprcompletion.primitives.DELPPRScopePrimitive");
- Advanced Primitives
Header: var FilterPrimitives= java.type("com.dassault_systemes.pprcompletion.primitives.DELPPRFilterPrimitive");
var PrimitiveScope= java.type("com.dassault_systemes.completion.service.ExpandPrimitives");
- Navigation Set Management Primitives
Header: var FilterServices = java.type("com.dassault_systemes.completion.service.FilterServices");
Hereunder are the list of the primitives, their info and a document with some examples/illustrations:
Expand Primitives
expandEBOM
Expands each Product occurrence in a Navigation Set at the specified level, with a configuration filter if necessary.
Syntax | expandEBOM (CompletionContext ctx, NavigationSet prdInput, int iDepth) |
Input | ctx: A Completion Context that contains the configuration filter (declared in the beginning of the CompletionProcedure. |
prdInput: A Navigation Set that contains the Product occurrences | |
iDepth: An integer that defines the expansion depth, that is, the number of levels to expand Note: If set to 0, all levels are expanded. | |
Output | A Navigation Set that contains the expanded Product occurrences |
expandMBOM
Expands each MBOM occurrence in a Navigation Set at the specified level, with a configuration filter if necessary.
Syntax | expandMBOM (CompletionContext ctx, NavigationSet MBOMInput, int iDepth) |
Input | ctx: A Completion Context that contains the configuration filter (declared in the beginning of the CompletionProcedure. |
MBOMInput: A Navigation Set that contains the Product occurrences | |
iDepth: An integer that defines the expansion depth, that is, the number of levels to expand Note: If set to 0, all levels are expanded. | |
Output | A Navigation Set that contains the expanded MBOM occurrences |
expandSystem
Expands each Workplan or System occurrence in a Navigation Set at the specified level, with a configuration filter if necessary.
Syntax | expandSystem (CompletionContext ctx, NavigationSet systInput, int iDepth) |
Input | ctx: A Completion Context that contains the configuration filter (declared in the beginning of the CompletionProcedure. |
systInput: A Navigation Set that contains the Workplan or System occurrences | |
iDepth: An integer that defines the expansion depth, that is, the number of levels to expand Note: If set to 0, all levels are expanded. | |
Output | A Navigation Set that contains the expanded Workplan or System occurrences |
expandResource
Expands each Resource occurrence in a Navigation Set at the specified level, with a configuration filter if necessary.
Syntax | expandResource (CompletionContext ctx, NavigationSet resInput, int iDepth) |
Input | ctx: A Completion Context that contains the configuration filter (declared in the beginning of the CompletionProcedure. |
resInput: A Navigation Set that contains the Resource occurrences | |
iDepth: An integer that defines the expansion depth, that is, the number of levels to expand Note: If set to 0, all levels are expanded. | |
Output | A Navigation Set that contains the expanded Resource occurrences |
Expand Primitives from 3D Index
I3DexpandEBOM
Expands from 3D Index each EBOM occurrence in an input Navigation Set at the specified level with a configuration or/and volume filter if necessary.
Syntax | I3DexpandEBOM (CompletionContext ctx, NavigationSet EBOMInput, int iDepth) |
Input | ctx: A Completion Context that contains the configuration filter |
EBOMInput: A Navigation Set that contains the MBOM occurrences | |
iDepth: An integer that defines the expansion depth, that is, the number of levels to expand Note: If set to 0, all levels are expanded. | |
Output | A Navigation Set that contains the expanded Resource occurrences |
I3DexpandMBOM
Expands from 3D Index each MBOM occurrence in an input Navigation Set at the specified level with a configuration filter if necessary.
Syntax | I3DexpandMBOM (CompletionContext ctx, NavigationSet MBOMInput, int iDepth) |
Input | ctx: A Completion Context that contains the configuration filter (declared in the beginning of the CompletionProcedure. |
resInput: A Navigation Set that contains the MBOM occurrences | |
iDepth: An integer that defines the expansion depth, that is, the number of levels to expand Note: If set to 0, all levels are expanded. | |
Output | A Navigation Set that contains the expanded MBOM occurrences |
I3DRetrieveContext
Expands from 3D Index all levels, and intersects the EBOM and all the previous MBOM from the selected MBOM input with a configuration or/and volume filter if necessary.
Note: MBOM children from Manufactured Material or Manufactured Part are not retrieved.
Syntax | I3DRetrieveContext (CompletionContext ctx, NavigationSet EBOMInput, NavigationSet MBOMInput, NavigationSet MBOMInputSelected) |
Input | ctx: A Completion Context that contains the configuration filter (declared in the beginning of the CompletionProcedure. |
EBOMInput: A Navigation Set that contains the EBOM occurrences to expand | |
MBOMInput: A Navigation Set that contains the MBOM occurrences scoped with an EBOM (usually the root MBOM) | |
MBOMInputSelected: A Navigation Set that contains the selected MBOM (usually the install MBOM) | |
Output | A list of Navigation Sets that contains two elements:
|
Navigation Primitives
navigateFromMBOMtoEBOM
Navigates from a set of MBOM occurrences to a set of product occurrences through links, with a configuration filter if necessary.
Note: If there is a partial scope linked to the EBOM, then it is ignored.
Syntax | navigateFromMBOMToEBOM (CompletionContext ctx, NavigationSet MBOMInput, Boolean Array navMode) |
Input | ctx: A Completion Context that contains the configuration filter (declared in the beginning of the CompletionProcedure. |
MBOMInput: A Navigation Set that contains the MBOM occurrences | |
navMode: A Boolean array that specifies the three navigation modes:
| |
Output | A Navigation Set that contains the product occurrences |
Note:
Known bug: The 2 first parameters in navMode are both merged. This issue is corrected in 20x T15 – FP2203, 21x T12 – FD11 et 22x T1 – FD01
navigateFromEBOMToMBOM
Navigates from a set of product occurrences to a set of MBOM occurrences through links, with a configuration filter if necessary.
Note: If there is a partial scope linked to the EBOM, then it is ignored.
Syntax | navigateFromEBOMToMBOM (CompletionContext ctx, NavigationSet EBOMInput, Boolean Array navMode) |
Input | ctx: A Completion Context that contains the configuration filter (declared in the beginning of the CompletionProcedure. |
EBOMInput: A Navigation Set that contains the EBOM occurrences | |
navMode: A Boolean array that specifies the three navigation modes:
| |
Output | A Navigation Set that contains the MBOM occurrences |
fastenersAnalysisBothSides
Retrieves fasteners occurrences and fastened parts occurrences associated with a product occurrence set through fastener stacking navigation, with a configuration filter if necessary.
Syntax | fastenersAnalysisBothSides (CompletionContext ctx, NavigationSet prdInput) |
Input | ctx: A Completion Context that contains the configuration filter (declared in the beginning of the CompletionProcedure. |
prdInput: A Navigation Set that contains the product occurrences | |
Output | A Navigation Set that contains the fasteners occurrences and the fastened parts occurrences |
getEBOMThroughMBOMAssignmentFilter
Retrieves the products linked to a set of MBOM occurrences through Assignment Filters links, with a configuration filter if necessary.
Syntax | getEBOMThroughMBOMAssignmentFilter (CompletionContext ctx, NavigationSet MBOMInput, boolean withCandidateProductforRerouting) |
Input | ctx: A Completion Context that contains the configuration filter (declared in the beginning of the CompletionProcedure. |
MBOMInput: navigation set that contains the MBOM objects | |
withCandidateProductforRerouting: A Boolean that defines the navigation mode: If true, navigates through Logical IDs If false, navigates through Physical IDs | |
Output | A Navigation Set that contains the Product linked the MBOM occurrences |
getMBOMPredecessors
Retrieves the predecessors of a set of MBOM occurrences at a specified level, with a configuration filter if necessary
Syntax | getMBOMPredecessors (CompletionContext ctx, NavigationSet resInput, int iDepth) |
Input | ctx: A Completion Context that contains the configuration filter (declared in the beginning of the CompletionProcedure. |
MBOMInput: A Navigation Set that contains the MBOM occurrences | |
levelOfPredecessors: An integer that defines the number of levels of predecessors to retrieve Note: If set to 0, all levels are retrieved. | |
Output | A Navigation Set that contains the predecessors of the MBOM occurrences Note: Instance link in the MBOM are considered as Predecessor as well |
getResultingProductFromMBOM
Navigates from a set of MBOM occurrences to a set of Resulting Product references through data materialization links, with a configuration filter if necessary.
Syntax | getResultingProductFromMBOM (CompletionContext ctx, NavigationSet MBOMInput) |
Input | ctx: A Completion Context that contains the configuration filter (declared in the beginning of the CompletionProcedure. |
MBOMInput: A Navigation Set that contains the MBOM occurrences | |
Output | A Navigation Set that contains the product occurrences (containing references only) |
navigateFromWorkPlanToMBOM
Navigates from a set of workplan occurrences to a set of MBOM occurrences through implement links, with a configuration filter if necessary.
Note: this primitives works only for Workplans (and operation under it). It is advised to use navigateFromProcessToMBOM, which works for both Workplan and General System types.
Syntax | navigateFromWorkPlanToMBOM (CompletionContext ctx, NavigationSet wkplInput, Boolean Array navMode) |
Input | ctx: A Completion Context that contains the configuration filter (declared in the beginning of the CompletionProcedure. |
wkplInput: A Navigation Set that contains the workplan occurrences | |
navMode: A Boolean array that specifies the two navigation modes: iRef_Ref: If true, navigates on a reference-reference pattern iOcc_Occ: If true, navigates on an occurrence-occurence pattern | |
Output | A Navigation Set that contains the MBOM occurrences |
navigateFromMBOMToWorkPlan
Navigates from a set of MBOM occurrences to a set of workplan occurrences through implement links, with a configuration filter if necessary.
Syntax | navigateFromMBOMToWorkPlan (CompletionContext ctx, NavigationSet MBOMInput, Boolean Array navMode) |
Input | ctx: A Completion Context that contains the configuration filter (declared in the beginning of the CompletionProcedure. |
MBOMInput: A Navigation Set that contains the MBOM occurrences | |
navMode: A Boolean array that specifies the two navigation modes: iRef_Ref: If true, navigates on a reference-reference pattern iOcc_Occ: If true, navigates on an occurrence-occurence pattern | |
Output | A Navigation Set that contains the Workplan occurrences |
navigateFromProcessToMBOM
Navigates from a set of system or workplan occurrences to a set of MBOM occurrences through implement links, with a configuration filter if necessary.
Syntax | navigateFromProcessToMBOM (CompletionContext ctx, NavigationSet systInput, Boolean Array navMode) |
Input | ctx: A Completion Context that contains the configuration filter (declared in the beginning of the CompletionProcedure. |
systInput: A Navigation Set that contains the system occurrences | |
navMode: A Boolean array that specifies the two navigation modes: iRef_Ref: If true, navigates on a reference-reference pattern iOcc_Occ: If true, navigates on an occurrence-occurence pattern | |
Output | A Navigation Set that contains the MBOM occurrences |
navigateFromMBOMToSystem
Navigates from a set of MBOM occurrences to a set of system occurrences through implement links, with a configuration filter if necessary.
Syntax | navigateFromMBOMToSystem (CompletionContext ctx, NavigationSet MBOMInput, Boolean Array navMode) |
Input | ctx: A Completion Context that contains the configuration filter (declared in the beginning of the CompletionProcedure. |
MBOMInput: A Navigation Set that contains the MBOM occurrences | |
navMode: A Boolean array that specifies the two navigation modes: iRef_Ref: If true, navigates on a reference-reference pattern iOcc_Occ: If true, navigates on an occurrence-occurence pattern | |
Output | A Navigation Set that contains the System occurrences |
navigateFromSystemToWorkPlan
Navigates from a set of system occurrences to a set of workplan occurrences through implement links, with a configuration filter if necessary.
Syntax | navigateFromSystemToWorkPlan (CompletionContext ctx, NavigationSet systInput, Boolean Array navMode) |
Input | ctx: A Completion Context that contains the configuration filter (declared in the beginning of the CompletionProcedure. |
systInput: A Navigation Set that contains the system occurrences | |
navMode: A Boolean array that specifies the two navigation modes: iRef_Ref: If true, navigates on a reference-reference pattern iOcc_Occ: If true, navigates on an occurrence-occurence pattern | |
Output | A Navigation Set that contains the Workplan occurrences |
navigateFromWorkPlanToSystem
Navigates from a set of workplan occurrences to a set of system occurrences through implement links, with a configuration filter if necessary.
Syntax | navigateFromWorkPlanToSystem (CompletionContext ctx, NavigationSet wkplInput, Boolean Array navMode) |
Input | ctx: A Completion Context that contains the configuration filter (declared in the beginning of the CompletionProcedure. |
wkplInput: A Navigation Set that contains the Workplan occurrences | |
navMode: A Boolean array that specifies the two navigation modes: iRef_Ref: If true, navigates on a reference-reference pattern iOcc_Occ: If true, navigates on an occurrence-occurence pattern | |
Output | A Navigation Set that contains the System occurrences |
getAllProcessPredecessors
Retrieves all predecessors of a set of system, workplan, or operation occurrences, with a configuration filter if necessary.
Note: only leaf node of each occurrence or branch in the Navigation Set will be navigated
Syntax | getAllProcessPredecessors (CompletionContext ctx, NavigationSet systInput) |
Input | ctx: A Completion Context that contains the configuration filter (declared in the beginning of the CompletionProcedure. |
systInput: A Navigation Set that contains the system, workplan, or operation occurrences | |
Output | A Navigation Set that contains the Predecessors of the system, workplan, or operation occurrences |
getCapableRscLinkInContextFromProcess
Navigates from a set of process occurrences to a set of capable resources in context, with a configuration filter if necessary.
Syntax | getCapableRscLinkInContextFromProcess (CompletionContext ctx, NavigationSet processInput, Boolean Array navMode) |
Input | ctx: A Completion Context that contains the configuration filter (declared in the beginning of the CompletionProcedure. |
processInput: A Navigation Set that contains the Process occurrences | |
navMode: A Boolean array that specifies the two navigation modes: iContext: If true, navigates the scope link to retrieve the capable resource in context. iLink: If true, navigates the link to retrieve the capable resource in context. | |
Output | A Navigation Set that contains the capable resources in context occurrences Important: This navigation set can only be merged with a resource navigation set (RSC). |
getAssetRscLinkFromWorkplan
Navigates from a set of process to a set of resource asset reference occurrences, with a configuration filter if necessary.
Syntax | getAssetRscLinkFromWorkplan (CompletionContext ctx, NavigationSet processInput, Boolean Array navMode) |
Input | ctx: A Completion Context that contains the configuration filter (declared in the beginning of the CompletionProcedure. |
processInput: A Navigation Set that contains the Process occurrences | |
navMode: A Boolean array that specifies the two navigation modes: iContext: if true, navigates the context link to retrieve the asset structure. iLink: If true, navigates the link to retrieve the preassigned work center | |
Output | A Navigation Set that contains the resource asset reference occurrences Important: This navigation set can only be merged with a resource navigation set (RSC). |
getCapableRscLinkFromProcess
Navigates from a set of process occurrences to a set of capable resource references, with a configuration filter if necessary.
Syntax | getCapableRscLinkFromProcess (CompletionContext ctx, NavigationSet processInput, Boolean Array navMode) |
Input | ctx: A Completion Context that contains the configuration filter (declared in the beginning of the CompletionProcedure. |
processInput: A Navigation Set that contains the Process occurrences | |
navMode: A Boolean array that specifies the three navigation modes: iContext: if true, navigates the scope link to retrieve the capable resource structure.. iPrimLink: If true, navigates the link to retrieve the primary capable resource. iSecLink: If true, navigates the link to retrieve the secondary capable resource. | |
Output | A Navigation Set that contains the capable resource occurrences (containing references only) Important: This navigation set can only be merged with a capable resource navigation set (CPBL_RSC) |
navigateFromProcessToResource
Navigates from a set of process occurrences to a set of resource occurrences through implement links, with a configuration filter if necessary.
Syntax | navigateFromProcessToResource (CompletionContext ctx, NavigationSet processes, Boolean Array navMode) |
Input | ctx: A Completion Context that contains the configuration filter (declared in the beginning of the CompletionProcedure. |
processes: A Navigation Set that contains the process occurrences | |
navMode: A Boolean array that specifies the four navigation modes: iRef_Ref: If true, navigates on a reference-reference pattern for the scope iOcc_Occ_With: If true, navigates on an occurrence-occurence pattern for the "with" resources only iOcc_Occ_Where: If true, navigates on an occurrence-occurence pattern for the "where" resources only iOcc_Occ_Who: If true, navigates on an occurrence-port-occurence pattern for the "who" resources only | |
Output | A Navigation Set that contains the resource occurrences (containing instances and references) Important: This navigation set can only be merged with a Resource navigation set (RSC) |
navigateFromResourceToWorkplan
Navigates from a set of resources to a set of workplan occurrences through implement links, with a configuration filter if necessary.
Syntax | navigateFromResourceToWorkplan (CompletionContext ctx, NavigationSet resources, Boolean Array navMode) |
Input | ctx: A Completion Context that contains the configuration filter (declared in the beginning of the CompletionProcedure. |
resources: A Navigation Set that contains the resource occurrences | |
navMode: A Boolean array that specifies the four navigation modes: iRef_Ref: If true, navigates on a reference-reference pattern for the scope iOcc_Occ_With: If true, navigates on an occurrence-occurence pattern for the "with" resources only iOcc_Occ_Where: If true, navigates on an occurrence-occurence pattern for the "where" resources only iOcc_Occ_Who: If true, navigates on an occurrence-port-occurence pattern for the "who" resources only | |
Output | A Navigation Set that contains the workplan occurrences |
navigateFromResourceToSystem
Navigates from a set of resources to a set of system occurrences through implement links, with a configuration filter if necessary.
Syntax | navigateFromResourceToSystem (CompletionContext ctx, NavigationSet resources, Boolean Array navMode) |
Input | ctx: A Completion Context that contains the configuration filter (declared in the beginning of the CompletionProcedure. |
resources: A Navigation Set that contains the resource occurrences | |
navMode: A Boolean array that specifies the four navigation modes: iRef_Ref: If true, navigates on a reference-reference pattern for the scope iOcc_Occ_With: If true, navigates on an occurrence-occurence pattern for the "with" resources only iOcc_Occ_Where: If true, navigates on an occurrence-occurence pattern for the "where" resources only iOcc_Occ_Who: If true, navigates on an occurrence-port-occurence pattern for the "who" resources only | |
Output | A Navigation Set that contains the system occurrences |
Cf previous examples.
Advanced Primitives
ModifyContextWithProximityVolume
Defines a proximity filter volume inside the context for all the EBOM objects given in input by applying an offset defined in millimeters to these objects. This proximity filter can only be understood by the index-based I3DexpandEBOM expansion primitive.
Syntax | ModifyContextWithProximityVolume (CompletionContext ioCompCtx, Final NavigationSet iNavSetPrd, final double iOffsetInMM, final VolumeMode iVolumeMode) |
Input | ioCompCtx: A Completion Context to modify according to the volume proximity |
iNavSetPrd: A Navigation Set that contains the EBOM occurrences | |
iOffsetInMM: The offset in millimeters | |
iVolumeMode: eReplace is the only available value for this parameter and it replaces the context volume by the proximity volume. | |
Output | There is no output parameter. |
Example 1: Create a 500mm volume filter from selected products.
FilterPrimitives.ModifyContextWithProximityVolume(context, Installed_PRD, 500, FilterPrimitives.VolumeMode.eReplace); |
getFirstUpperScopeFromMBOMToEBOM
Navigates from an MBOM occurrence to retrieve the first upper MBOM entity scoped to an EBOM entity, then retrieves the EBOM occurrence.
Recommendation: Use this primitive when the EBOM root is not loaded in the session.
Syntax | getFirstUpperScopeFromMBOMToEBOM (CompletionContext iCompCtx, NavigationSet iNavSetMBOM) |
Input | iCompCtx: A Completion Context that contains the configuration filter (declared in the beginning of the CompletionProcedure. |
iNavSetMBOM: A Navigation Set that contains MBOM occurrence Important: This parameter must contain only one MBOM occurrence. | |
Output | A list of Navigation Sets that contains: A Navigation Set containing one EBOM occurrence A Navigation Set containing one MBOM occurrence scoped with the EBOM occurrence |
Notes:
- If several scope links exist, then the primitive stops and raises an exception.
- The primitive does not check if the MBOM occurrence given as input in iNavSetMBOM has a scope to the EBOM. Upper scope identification starts on the first MBOM parent of this occurrence.
Navigation Set Management Primitives
Compact
Filters a set of occurrences by removing occurrences already included in other ones
Syntax | compact (NavigationSet inputNavSet) |
Input | inputNavSet: A Navigation Set that contains the occurrences to filter |
Output | A Navigation Set that contains the filtered occurrences |
Merge
Inserts a set of occurrences into another.
Note: The type of NavigationSet should be the same to be merged together
(example: if you try to merge an MBOM set with a EBOM set, it will get an error)
Syntax | merge (NavigationSet input) |
Input | input: the Navigation Set to be inserted in the one output from the previous primitive |
Output | A Navigation Set that contains both Navigation Sets |
CutLeafOccurrences
Filters a set of occurrences by removing the final instances and references (leaves), with a configuration filter if necessary.
Syntax | cutLeafOccurrences (NavigationSet input) |
Input | inputNavSet: the Navigation Set to be inserted in the one output from the previous primitive |
Output | A Navigation Set that contains both Navigation Sets |
filterOnLeaves
Filters a set of occurrences by applying a WhereClause criteria to their final references (leaves), with a configuration filter if necessary.
Syntax | filterOnLeaves (CompletionContext ctx, NavigationSet inputNavSet, java.lang.String whereClause) |
Input | ctx: A Completion Context that contains the configuration filter |
inputNavSet: A Navigation Set that contains the occurrences to filter | |
whereClause: The WhereClause to apply to the final references (leaves) To see more example of whereClause, please refer to DSDoc. | |
Output | A Navigation Set that contains the filtered occurrences |
cutOccurrences
Filters a set of occurrences by removing occurrences that do not match a WhereClause criteria applied to their references, with a configuration filter if necessary.
Syntax | cutOccurrences (CompletionContext ctx, NavigationSet inputNavSet, java.lang.String whereClause) |
Input | ctx: A Completion Context that contains the configuration filter |
inputNavSet: A Navigation Set that contains the occurrences to filter | |
whereClause: The WhereClause to apply to the references To see more example of whereClause, please refer to DSDoc. | |
Output | A Navigation Set that contains the filtered occurrences Note: This output may contain: Occurrences included in other occurrences. To remove them, see the compact primitive. More occurrences than the input Navigation Set |
