Introduction
Usage : during part placement, Part list from the Spec is filtered according additionnal criteria to get the filtered list of available part
Datasetup Resource Set :
- Piping/Tubing Specification Resources
- HVAC Specification Resources
- Raceway Specification Resources
Datasetup Resource : Compute list of additional specification to be used depending of the context
Rule Example1:
Rule Code :
this exemple is doing :
during part placement, Part list from the Spec is trigger the list of available Parts according additionnal criteria from the LineID :
- Based on LineID FluidName we filter a specific MaterialName
- Based on LineID Pressure we filter a specific Rating Value
/* CATRule signature (do not edit) : (ThisObject : #In KweTrigger_BL_AddedSpecsAndResourceFilteringParams, Parameters : #In RuleContext) : #Void */
/*Spec is trigger the list of availableParts according additionnal criteria from the LineID : */
/* Based on LineID FluidName we filter a specific MaterialName */
/* Based on LineID Pressure we filter a specific Rating Value*/
/* Inputs */
let FeatureCurrentApplicativeInformation (Feature)
/* Declarations for current applicative entities */
let ListCurrentApplicativeEntitiesKeys (List)
let sCurrentApplicativeEntityKey (String)
let ListCurrentApplicativeEntities (List)
let NbCurrentApplicativeEntities (Integer)
let pCurrentApplicativeEntity (PLMEntity)
let sCurrentApplicativeEntityName (String)
let StrApplicativeOperationName(String)
let StrSearchedType(String)
/* Declarations for current ens specifications & content */
let ListCurrentEnsSpecifications (List)
let NbCurrentEnsSpecifications (Integer)
/* Declarations for additional customer ens specifications */
let ListAuthorizedAdditionalEnsSpecifications (List)
let NbAuthorizedAdditionalEnsSpecifications (Integer)
let ListIndexesOfRequestedAdditionalEnsSpecifications(List)
let NbIndexesOfRequestedAdditionalEnsSpecifications(Integer)
let pAuthorizedAdditionalEnsSpecification (PLMEntity)
let sAuthorizedAdditionalEnsSpecificationName1 (String)
let sAuthorizedAdditionalEnsSpecificationName2 (String)
let pAdditionalSpec (PLMEntity)
let ObjectOccurence(ProductOccurrence)
let pipingLine(Piping_Line)
let pip_line_inst(Piping_Line_Inst)
let attr_pipingLineName(String)
let attr_pipingLineFluid(String)
let attr_pipingLinePressure(PRESSURE)
let attr_Material(String)
let attr_Rating(String)
let FeatureAddedPLMAttributesFilteringSearchedPLMParts (Feature)
/* Declarations for BL Outputs : additional PLM attributes to filter searched resource AND/OR indexes of customer additional ens specifications to filter searched resource */
let FeatureAddedPLMAttributesFilteringSearchedResource (Feature)
let ListIndexesOfAddedEnsSpecifications (List)
let i (Integer)
let posX(Real)
let posY(Real)
let posZ(Real)
let pos(Real)
let NbSize(Integer)
let Index(Integer)
set posX =0.0
set posY =0.0
set posZ =0.0
Trace(1, "============== Location Spec activated W38 ========================")
StrApplicativeOperationName = Parameters->GetAttributeString("ApplicativeOperationName")
Trace(1,"Application Operation Name = ", StrApplicativeOperationName)
StrSearchedType = Parameters->GetAttributeString("SearchedType")
Trace(1,"Searched Type = ", StrSearchedType)
set FeatureCurrentApplicativeInformation = Parameters->GetAttributeObject("FeatureCurrentApplicativeInformation")
if ((NULL<> FeatureCurrentApplicativeInformation) and (true == FeatureCurrentApplicativeInformation.HasAttribute("Location_PosX")))
{
posX = FeatureCurrentApplicativeInformation->GetAttributeReal("Location_PosX")
Trace(1, "Location X = ", posX)
posY = FeatureCurrentApplicativeInformation->GetAttributeReal("Location_PosY")
Trace(1, "Location Y = ", posX)
posZ = FeatureCurrentApplicativeInformation->GetAttributeReal("Location_PosZ")
Trace(1, "Location Z = ", posZ)
}
// Get input parameters : ListCurrentApplicativeEntities and retrieve piping line among them ****************/
ListCurrentApplicativeEntitiesKeys = Parameters->GetAttributeObject("ListCurrentApplicativeEntitiesKeys")
ListCurrentApplicativeEntities = Parameters->GetAttributeObject("ListCurrentApplicativeEntities")
NbCurrentApplicativeEntities = ListCurrentApplicativeEntities.Size()
Trace(1,"NbCurrentApplicativeEntities = ", NbCurrentApplicativeEntities)
i = 1
if (0 < NbCurrentApplicativeEntities)
{
for i while i <= NbCurrentApplicativeEntities
{
set sCurrentApplicativeEntityKey = ListCurrentApplicativeEntitiesKeys.GetItem(i)
set pCurrentApplicativeEntity = ListCurrentApplicativeEntities.GetItem(i)
if (NULL <> pCurrentApplicativeEntity)
{
sCurrentApplicativeEntityName = pCurrentApplicativeEntity.V_Name /* Title */
}
if(sCurrentApplicativeEntityKey == "Logical_Line")
{
Trace(1, "Line ID OK")
set pip_line_inst = ListCurrentApplicativeEntities.GetItem(i)
}
if(sCurrentApplicativeEntityKey == "Object_Occurrence")
{
Trace(1, "Object_Occurence OK")
set ObjectOccurence = ListCurrentApplicativeEntities.GetItem(i)
}
}
}
if (NULL <>pip_line_inst)
{
set pipingLine = pip_line_inst.Reference
if( NULL <> pipingLine )
{
set attr_pipingLineName = pipingLine.V_Name
Trace(1, "Line ID Name = ", attr_pipingLineName)
set attr_pipingLineFluid = pipingLine.V_Fluid
Trace(1, "Line ID Fluid = ", attr_pipingLineFluid)
set attr_pipingLinePressure = pipingLine.V_OperatingPressure
Trace(1, "Line ID Pressure = ", attr_pipingLinePressure)
if ( "acetic acid"== attr_pipingLineFluid)
{
attr_Material = "Steel_172"
}
else if ( "Fuel oil" == attr_pipingLineFluid)
{
attr_Material = "Iron_13"
}
if (30bara > attr_pipingLinePressure)
{
attr_Rating = "SCHEDULE 40"
}
else if ((30bara < attr_pipingLinePressure) and (50bara > attr_pipingLinePressure))
{
attr_Rating = "SCHEDULE 80"
}
else if (50bara < attr_pipingLinePressure)
{
attr_Rating = "SCHEDULE 160"
}
if ((NULL <> attr_Material) and ("Piping Line ID_001" == attr_pipingLineName))
{
Trace(1, "Line ID and Fluid is retrieve so Add additional criteria")
// Retrieve the feature carrying N attributes to filter PLM parts
set FeatureAddedPLMAttributesFilteringSearchedPLMParts = Parameters->GetAttributeObject("FeatureAddedPLMAttributesFilteringSearchedPLMParts")
// Valuate extra conditions on the feature based on PLM attributes of the searched PLM part type
FeatureAddedPLMAttributesFilteringSearchedPLMParts->SetAttributeString("V_MaterialName",attr_Material)
}
if ((NULL <> attr_Rating) and ("Piping Line ID_001" == attr_pipingLineName))
{
Trace(1, "Line ID and Rating is retrieve so Add additional criteria")
// Retrieve the feature carrying N attributes to filter PLM parts
set FeatureAddedPLMAttributesFilteringSearchedPLMParts = Parameters->GetAttributeObject("FeatureAddedPLMAttributesFilteringSearchedPLMParts")
// Valuate extra conditions on the feature based on PLM attributes of the searched PLM part type
FeatureAddedPLMAttributesFilteringSearchedPLMParts->SetAttributeString("V_Rating",attr_Rating)
}
}
}
// List of CurrentApplicativeEntitiesKeys
ListCurrentApplicativeEntitiesKeys = Parameters->GetAttributeObject("ListCurrentApplicativeEntitiesKeys")
NbCurrentApplicativeEntities = ListCurrentApplicativeEntitiesKeys.Size()
Trace(1, "NbCurrentApplicativeEntities = ", NbCurrentApplicativeEntities)
// List of ListCurrentApplicativeEntities
ListCurrentApplicativeEntities = Parameters->GetAttributeObject("ListCurrentApplicativeEntities")
NbCurrentApplicativeEntities = ListCurrentApplicativeEntities.Size()
// list of Authorized Additional EnsSpecifications
ListAuthorizedAdditionalEnsSpecifications = Parameters->GetAttributeObject("ListAuthorizedAdditionalEnsSpecifications")
NbAuthorizedAdditionalEnsSpecifications = ListAuthorizedAdditionalEnsSpecifications.Size()
Trace(1, "ListAuthorizedAdditionalEnsSpecifications = ", ListAuthorizedAdditionalEnsSpecifications)
// list of index of requested Authorized Additional EnsSpecifications
ListIndexesOfRequestedAdditionalEnsSpecifications = Parameters->GetAttributeObject("ListIndexesOfRequestedAdditionalEnsSpecifications")
NbIndexesOfRequestedAdditionalEnsSpecifications = ListIndexesOfRequestedAdditionalEnsSpecifications.Size()
Trace(1, "NbIndexesOfRequestedAdditionalEnsSpecifications = ", NbIndexesOfRequestedAdditionalEnsSpecifications)
if (0 < NbIndexesOfRequestedAdditionalEnsSpecifications)
{
Index = ListIndexesOfRequestedAdditionalEnsSpecifications.GetItem(1)
Trace(1, "Index Value = ", Index)
// Fill OUTPUT
set ListIndexesOfAddedEnsSpecifications = Parameters->GetAttributeObject("ListIndexesOfAddedEnsSpecifications")
ListIndexesOfAddedEnsSpecifications = Copy(ListIndexesOfRequestedAdditionalEnsSpecifications)
Parameters->SetAttributeObject("ListIndexesOfAddedEnsSpecifications", ListIndexesOfRequestedAdditionalEnsSpecifications)
}
else
{
Trace(1, "No Additional Spec selected by user")
}
Trace(1, "============== Location Spec END ========================")
