Customizing the User Interface with Business Rules

An Electrical Design product enables to define 3D Electrical Physical System in the physical product definition. Through Business Rules (BR), you can use Knowledgeware language to specify the way a given command should behave in its own design environment. You can have your own proprietary design rules to apply for the Electrical Design and use BR features to customize electrical applications more easily.

There are two types of Business Rules:

  • Business Rules for validation: to validate the behavior of an electrical command through a user Rule.
  • Business Rules for computation: to delegate the user to run a specific algorithm to find a compatible part number or to compute the diameter for example.

With Knowledge customization, you can modify the User Interface with a specific error or warning message in CATIA, i.e. the Business Rule generates a message when the Part Number is compatible or not.

A validation message, displayed from the BR's context, tells you if an electrical command is valid or not, with a severity number from 0 to 2. A severity message is a standard information from context (not specific to electrical) but used by the electrical command. A severity is also computed in case of validation: by default, it is equal to 1.

There is a set of electrical commands (described below) which are candidates to Business Rule customization. You will find below the Business Rules for Electrical Assembly Design commands. For Electrical Library and Electrical 3D Installation Business Rules, please refer to the corresponding user guides.

This task shows you how to customize a :


Before you begin: You should be familiar with the key processes of electrical product definition:
  • Electrical part catalog definition and usage including instantiation and connection.
  • Electrical branch geometry and routing.
  • Conductor creation and routing inside the 3D electrical geometry.

and with the customization of PLM using Expert Rules, please refer to PLM Customization by Rules in the Knowledge Expert User Guide.

Business Rule to validate Conductor Routing

You can declare a BR to check the compatibility of the conductor to be routed and the set of segments to be routed through. This Business Rule will be triggered when the user confirms the conductor route definition in the Automatic Routing and Manual Routing commands.

  1. Use the BR to check if the conductor and the list of segments to be routed.

    • validate the routing of conductor to segment (severity=0)
    • validate the routing of conductor to segment with a warning computed from the rules context (severity=1). All messages will be gathered in a single dialog box.
    • forbid the routing of conductor to segment with a warning computed from the rules context (severity=2). All messages will be gathered in a single dialog box.

  2. Use the Opening ID:EWRRouting_ValidateWireRoute. This validation rule will be triggered when a conductor is routed.

  3. Use the following parameters:

    ThisObject: Conductor to route

    Parameters: the standard context and message attribute will be displayed in a warning if the validation fails.

    • ListOfBundleSegments (input): List of proposed segments for the conductor route
    • Severity messages:
      • Severity= 0 the treatment is to be continued (no message)
      • Severity= 1 the treatment is to be continued and only a warning raised)
      • Severity= 2 the treatment is supposed to be undone

    Note that this notion is not mandatory and it is used by the electrical command.

    Validation: Variable to know if the validation succeeded of failed.

    Here is an example of Business Rule syntax:

    /* CATRule signature (do not edit) : (ThisObject :
     #In Wire, Parameters : #In RuleContext, Validation : 
     #Out Boolean) : #Void */
    
    let ListOfSeg(LIST)
    let NbElem(INTEGER)
    let Name(STRING)
    let iSearch(INTEGER)
    let iSearch2(INTEGER)
    let SepCode(String)
    
    set Name = ThisObject.Name
    set SepCode = ThisObject.Elec_Sep_Code
    
    if(SepCode == "Error")
    {
       Validation = false
       Parameters.Severity = 2
       Parameters.Message = "Routing not allowed by 
        business rule"
    }
    else if(SepCode == "DefaultError")
    {
       Validation = false
       Parameters.Severity = 2
    }
    else if(SepCode == "Warning")
    {
       Validation = true
       Parameters.Severity = 1
       Parameters.Message = "Routing allowed with warning"
    }
    else if(SepCode == "DefaultWarn")
    {
       Validation = true
       Parameters.Severity = 1
    }
    else
    {
    	  Validation = true
       Parameters.Severity = 0
       Parameters.Message = "Routing Allowed"
    }

Business Rule to validate Segment Selection for Manual Conductor Routing

You can declare a BR to validate the selection of the segment(s) to define conductor route. This Business Rule is used for the Manual Routing command.

  1. Use the BR to check if the segment can be selected.

    • the treatment is to be continued (severity=0)
    • the treatment is to be continued and only a warning is displayed (severity=1).
    • the treatment is not done and an error message appears (severity=2). Routing will not be performed.

      All messages will be gathered in a single dialog box.

  2. Use the Opening ID:EWRRouting_ValidateSegmentSelectionForWireRoute. This validation rule will be triggered when a segment is selected.

  3. Use the following parameters:

    ThisObject: Instance of segment to add to the conductor route.

    Parameters: the standard context and message attribute will be displayed in a warning if the validation fails.

    • ModifiedWire (input): Instance of the conductor, the route of which is modified.
    • ListOfLinkedWires (input): List of all the other conductors passing through this segment.
    • Message: Standard information to allow specifying a special message corresponding to severity (useful only if severity is not null).
    • Severity messages:
      • Severity= 0 the treatment is to be continued (no message)
      • Severity= 1 the treatment is to be continued and only a warning raised)
      • Severity= 2 the treatment is supposed to be undone

    Note that this notion is not mandatory and it is used by the electrical command.

    Validation: Variable to know if the validation succeeded of failed. If TRUE, the segment will be added to the conductor route.

Business Rule to validate Routing of all the Conductors inside a Segment

You can declare a BR to validate the routing of all the selected conductors through the segment. This Business Rule will be triggered when the user confirms the conductor route definition in the Automatic Routing command.

  1. Use the BR to check if all the selected conductors to be routed for a segment. Based on separation of conductors inside the segment, you can accept or reject routing of the conductor.

    • validate routing of all selected conductors with success (severity=0)
    • validate routing of all selected conductors with a warning in case segment is heavily overloaded (severity=1)
    • reject routing of all conductors with an error, when routing selected conductors will require segment diameter more than present to accommodate the conductors (severity=2)

  2. Use the Opening ID:EWR_ValidateRoutingAllConductorsInSegment. This validation rule will be triggered when a conductor is routed.

  3. Use the following parameters:

    ThisObject: Instance of segment to add to the conductor route

    Parameters: the standard context and message attribute will be displayed in a warning if the validation fails.

    • ListOfConductors (input): List of all conductors routed through the segment
    • Severity messages:
      • Severity= 0 the treatment is to be continued (no message)
      • Severity= 1 the treatment is to be continued and only a warning raised)
      • Severity= 2 the treatment is supposed to be undone (i.e. the route will be lost, even if the conductors are already routed)

    Note that this notion is not mandatory and it is used by the electrical command.

    Validation: The output boolean variable to know if the validation succeeded or failed. If the output from is false, the conductors will not be routed.

    Note: While creating input parameter (ListOfConductors), the result of the BR EWRRouting_ValidateWireRoute will be taken into account.

    Here is an example of Business Rule syntax:

    /* CATRule signature (do not edit) : (ThisObject :
     #In Segment, Parameters : #In RuleContext, Validation : 
     #Out Boolean) : #Void */
    
    Let ListConductors(LIST)
    Let Conductor (Wire)
    Let sMessage (STRING)
    Let iSeverity (INTEGER)
    Let index (INTEGER)
    Let nbConductors (INTEGER)
    Let ConductorDia (LENGTH)
    Let TotalDia (LENGTH)
    Let SegDia (LENGTH)
    Let ratio (REAL)
    Let SegName(String)
    
    /* Initialize the parameters, by default success */
    set Validation = true
    set sMessage = ""
    set iSeverity = 0
    
    set index = 1
    set SegDia = ThisObject.Elec_Diameter
    SegName = ThisObject.Name
    set ListConductors = Parameters.GetAttributeObject("ListOfLinkedWires")
    if(NULL <> ListConductors)
    {
       nbConductors = ListConductors.Size()
    	  /* Initialize the output parameters as success, based on 
    computation result these parameters will be reset*/
       Validation = true
    	  iSeverity = 0
       sMessage = "All the wires could be accomodated in this segments"
       if(SegName == "A")
       {
          	if(2 < nbConductors)
             {
              Validation = false
              iSeverity = 2
              sMessage = "Error : Segment " + SegName + " is fatally 
      overloaded" 
             }
           else if(1 < nbConductors)
             {
              Validation = true
              iSeverity = 1
              sMessage = "Warning : Segment " + SegName + " is 
      overloaded"
              }
       }
    }
     
     else /* No conductor is to be routed from this segment, so return 
     true */
    {
      Validation = true 
      iSeverity = 0
      sMessage = "None of the conductors are to be routed from this 
    segment"
    }
         
    Parameters.Message = sMessage
    Parameters.Severity = iSeverity
     

Business Rule to compute Conductor Routing and Re-compute Segment Diameter

You can create a BR to compute the segment diameter & Branch Bend Radius (from the list of conductors and conductor groups contained in it) during Segment Update. This Business Rule is used for the About Routing command.

  1. Use the BR to compute the segment parameters for update. Bend Radius.

  2. Use the Opening ID: EWRUpdate_ComputeBundleSegment. This computation rule will be triggered when updating a segment from its wiring content.

  3. Use the following parameters:

    ThisObject: Segment

    Parameters: the standard context and message attribute will be displayed in a warning if the validation fails


    • ListOfWiresAndGroups (input): List of conductors & conductor groups routed into the segments. Conductors included in conductor groups are not listed here, only their respective conductor groups.
    • Diameter (output) : (length) diameter of segment
    • BendRadius (output): (length) bend radius of segment.

    Validation: a variable to know if the validation succeeded of failed.

    Here is the priority, if several methods for computed segment are used:

    1. CAA API
    2. Business Rule
    3. Standard EWR method (based on settings)
    Warning: In case of BR failure then the standard EWR method for segment computation should be used.

    Here is an example of Business Rule syntax:

    /* CATRule signature (do not edit) : (ThisObject :
     #In Segment, Parameters : #In RuleContext) : #Void */
    
    let ListOfElem(LIST)
    let Segment(Segment)
    let NbElem(INTEGER)
    let Diameter(LENGTH)
    let BendRadius(LENGTH)
    let Wire(Wire)
    let WireGroup(WireGroup)
    let idx(INTEGER)
    
    set Diameter = 0.0mm
    set BendRadius = 0.0mm
    Parameters.Severity 	= 0
    Parameters.Message 	= "Business Rule computed diameter and
     bend radius"
    
    set ListOfElem = Parameters->GetAttributeObject
    ("ListOfWiresAndGroups")
    set NbElem = ListOfElem->Size()
    Trace (1, "NUmber of Influencing elements = ", NbElem)
    
    idx = 1
    for idx while idx <= NbElem
    {
       set Wire = ListOfElem->GetItem(idx)
       set WireGroup = ListOfElem->GetItem(idx)
       if(NULL <> Wire)
       {
          set Diameter = Diameter + Wire.Elec_Diameter
          set BendRadius = BendRadius + Wire.Elec_Bend_Radius
       }
       else if (NULL <> WireGroup)
       {
          set Diameter = Diameter + WireGroup.Elec_Diameter
          set BendRadius = BendRadius + WireGroup.Elec_Bend_Radius
       }
    }
    
    Parameters.SetAttributeReal("Diameter", Diameter)
    Parameters.SetAttributeReal("BendRadius", BendRadius)