Checking Cable Attributes

The cable attributes can be checked during their modifications or during cable creation.

You can check the cable attributes by defining the Attributes Valuation Check (PLMAttributesValuationCheck) opening ID. It is available trough the Attributes Valuation Check resource is stored in the Data Setup PLM Business Logic Implementation resource set.

Depending on your need, the fact type could be EleLogicalCable, EleLogicalOverShield, EleLogicalPowerCable, RFLVPMLogicalReference ...

Sample

/* Attributes initialization for Edit->Properties							*/
/* ------------------------------------------------------------------------ */
Let Errorlist(List)
Let ErrorMessagelist(List)
Let Warninglist(List)
Let WarningMessagelist(List)
Let ConductorsIdentifier(string)
Let GroupType(string)
Let ConductorsColor(string)
Let NbOfWire(Integer)
Let NbOfCable(Integer)
Let WireNb(Integer)
Let ColorNb(Integer)
Let ColorConductorNotEnough(string)
Let ColorConductorOrderCase(string)
Let NbOfConductorNotEnoughForTwisted(string)
Let GroupTypeNotSelected(string)
Let NbOfWiresTotal(Integer)

Let ListOfColors(List)
Let indiceSep(Integer)
Let indiceSepAfter(Integer)
Let SrippedString(String)
Validation=true

/*set Errorlist = Parameters->GetAttributeObject("ErrorAttributes")
set ErrorMessagelist = Parameters->GetAttributeObject("ErrorMessages")

set Warninglist = Parameters->GetAttributeObject("WarningAttributes")
set WarningMessagelist = Parameters->GetAttributeObject("WarningMessages")*/

ColorConductorNotEnough = BuildMessageNLS( "CATELEditorCreateAndRouteCableContentCmd", "ColorConductorNotEnough.Popup.Message" )
ColorConductorOrderCase = BuildMessageNLS( "CATELEditorCreateAndRouteCableContentCmd", "ColorConductorOrderCase.Popup.Message" )
NbOfConductorNotEnoughForTwisted = BuildMessageNLS( "CATELEditorCreateAndRouteCableContentCmd", "NbOfConductorNotEnoughForTwisted.Popup.Message" )
GroupTypeNotSelected = BuildMessageNLS( "CATELEditorCreateAndRouteCableContentCmd", "GroupTypeNotSelected.Popup.Message" )
NbOfWiresTotal = 0
 
if (ThisObject->IsASortOf ("EleLogicalCable") or ThisObject->IsASortOf ("EleLogicalPowerCable"))
{
	if (ThisObject->IsASortOf ("EleLogicalCable") )
	{
		NbOfCable=ThisObject.GetAttributeInteger ("V_Elec_NbGroups")
		NbOfWire=ThisObject.GetAttributeInteger ("V_Elec_NbConductorsByGroup")
		GroupType=""
		GroupType=ThisObject.GetAttributeString ("V_Elec_GroupsType")
		ConductorsIdentifier=ThisObject.GetAttributeString ("V_Elec_ConductorsIdentifier")
	}
	
  if (ThisObject->IsASortOf ("EleLogicalPowerCable"))
	{
		NbOfWire=ThisObject.GetAttributeInteger ("V_Elec_NbConductors")
		ConductorsIdentifier="Color"
	}
	NbOfWiresTotal = NbOfWire * NbOfCable	
  if(NbOfWire>0)
	{            
		  if(ConductorsIdentifier<>"Other")
		  {
			  ConductorsColor=""
			  ConductorsColor=ThisObject.GetAttributeString ("V_Elec_ConductorsColors")
                
			  if(ConductorsColor<>"")
			  {
				  indiceSep=0
				  indiceSepAfter=0                   
				  if (ConductorsColor.Extract(ConductorsColor.Length()- 1,1)<>",")
				  ConductorsColor=ConductorsColor+","
					
				  indiceSepAfter = ConductorsColor.Search (",", indiceSep)
				  for indiceSepAfter  while indiceSepAfter <> -1
				  {
					  SrippedString = ConductorsColor.Extract(indiceSep, indiceSepAfter-indiceSep)
					  ListOfColors.Append (SrippedString)
					  indiceSep = indiceSepAfter+1
					  indiceSepAfter = ConductorsColor.Search (",", indiceSep)
				  }          
			  }
	    
        if(ConductorsIdentifier=="Color")
		    {
			     if(ConductorsColor=="" or (ListOfColors.Size()<>NbOfWire and ListOfColors.Size()<>NbOfWiresTotal))
			     {
				    Validation=false
				    ErrorMessagelist->Append(ColorConductorNotEnough)
				    Errorlist->Append("V_Elec_ConductorsIdentifier")
			     }    
         }
         else if(ConductorsIdentifier=="Order")
		     {
			      if(ConductorsColor=="" or (ListOfColors.Size()<>NbOfWire and ListOfColors.Size()<>NbOfWiresTotal))
			      {
              Validation=false
              Warninglist->Append("V_Elec_ConductorsIdentifier")
              WarningMessagelist->Append(ColorConductorOrderCase)
			      }
         }
       }
		   if (ThisObject->IsASortOf ("EleLogicalCableTwisted") or ThisObject->IsASortOf ("EleLogicalCableTwistedShielded") )
		   {
			   if(NbOfWire<2)
			   {
				   Validation=false
				   ErrorMessagelist->Append(NbOfConductorNotEnoughForTwisted)
				   Errorlist->Append("V_Elec_NbConductorsByGroup")
			   }
		   }
	 }
	 if(NbOfCable>0)
	 {
		 if(GroupType=="")
		 {
			 Validation=false
			 ErrorMessagelist->Append(GroupTypeNotSelected)
			 Errorlist->Append("V_Elec_GroupsType")
		 }
	 }
 }

if (Validation == false) 
{
  /* Case of error : display messages with blocking execution */
	Parameters->SetAttributeObject("ErrorMessages",ErrorMessagelist)
	Parameters->SetAttributeObject("ErrorAttributes",Errorlist)

  /* Case of warning : display messages without blocking execution */
  Parameters->SetAttributeObject("WarningMessages",WarningMessagelist)
	Parameters->SetAttributeObject("WarningAttributes",Warninglist)
}