<HTML><HEAD><link type="text/css" href="../css/main_styles.css" rel="stylesheet"></HEAD>
<BODY><TITLE>%mqc_check_multi_cat_layer</TITLE><H1>%mqc_check_multi_cat_layer </H1><P CLASS="Paragraph">Classname: <B>%mqc_check_multi_cat_layer </B></P><P CLASS="Paragraph">Inherits from: <B><A href=..\checkmate\xug_base_checker.html>%ug_base_checker </A></B></P><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"> </PRE><PRE STYLE=\"text-align : left;\" CLASS=\"Code\">
<B>Description:</B>
    Validate that the specified categories contain the given ranges of layers
Parameters:
   (List)   category_layer_map: - List of description strings of
                                  the 'Category | Layer' mapping relations.
                                  For example:
                                  {
                                       "SOLID           |    1-20",
                                       "WIREFRAME       |    21-40",
                                       "CENTERLINE      |    60",
                                       "PART            |    1-40"
                                   };
                                   This is the mandatory parameter for the checker.
    (Boolean)  disabled?        -  If it is true, the checker is disabled.
                                     Default is False.
    (Boolean)  save_log_in_part -  The flag indicates whether the checking results can
                                     be saved to the part file
                                     Default is True.
   (Integer) log_type:           - Indicate which logging type to use to report
                                   the violation
                                   1 - log error
                                   2 - log warning
                                   3 - log information
                                   The default value is 1 which is to log error.
   (String)  log_msg:            - User defined message to be added when the system
                                   reports the violation.
                                   The default is no additional message.
Results:
   PASS    -- If all of the layers in the specified categories are in the allowed ranges .
   FAILED  -- If any layer in specified category is outside of the ranges of the layers.
   The system will generate a warning if the given categories do not exist.

<B>See Also:</B>
    %mqc_check_single_cat_layer
=============================================================================================
Create a new checker from this template by specifying the values of the mandatory parameters:
  1. (Must)     change the class name, and the category name
  2. (Optional) change the display name. (optional)
  3. (Must)     specify the category layer mapping strings for interactive selections.
       ( List )   category_layer_map_init:
                      List of strings of category and layer(s) mapping descriptions.
                      It must have the format like:
                        {
                            "category_name_1  |  layer_range_1",
                            "category_name_2  |  layer_range_2",
                            ...
                            "category_name_n  |  layer_range_n"
                        };
                      The category_name and the layer_range must be separated by '|'.
                             e.g. "SOLID   |   1,5-10 "
                      Mutiple layer ranges in the description strings
                      must be separated by commas,
                             e.g. "1,3-5,7,9" means layer 1, layers 3 to 5
                                  plus layer 7, and layer 9.
                      For example:
                           {
                               "SOLID           |    1-20",
                               "WIREFRAME       |    21-40",
                               "CENTERLINE      |    60",
                               "PART            |    1-40"
                           };
  4. (Optinal) change the default log type
      (integer) log_type:  1;
=============================================================================================
</PRE><PRE><FONT COLOR= blue>DefClass: %mqc_check_multi_cat_layer( %ug_base_checker ); 
</FONT></PRE><PRE STYLE=\"text-align : left;\" CLASS=\"Code\">  Check-Mate attributes and parameters</PRE><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>( String )    %test_category: "Template.File Structure";
( String )    %displayed_name: "Check Category / Layer mappings";   
</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>( Boolean Parameter )    disabled?: false;
( Boolean Parameter )    save_log_in_part: true;
</SPAN></FONT></PRE></DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\">  Checker specific parameters and attributes</PRE><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>( List Parameter )     category_layer_map: category_layer_map_init:;
</SPAN></FONT></PRE></DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\">  parameter for log_option                                       </PRE><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>( String )             category_layer_map_label: "Category    |    Layers";
( List )               category_layer_map_init:{};

  

</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>( Integer Parameter )    log_type: 1;
</SPAN></FONT></PRE></DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\">  parameter for log_message     </PRE><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>( List )                 log_type_option: { LOG_ERROR, LOG_WARNING, LOG_INFO, LOG_ANY };
( String )               log_type_label: "Log Option";
   
</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>( String Parameter )     log_msg: "";
</SPAN></FONT></PRE></DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\">  Attribute for check rules:</PRE><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>( String )               log_msg_label: "Log Message";



</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>( List ) rules_to_check:
  @{
      If Empty?(category_layer_map:)
      Then
          {}
      Else
      @{
      
          Loop
          {
              For  $each_sel  In  category_layer_map:;
              For  $sel_list  Is  Splitstring( $each_sel, "|" );
              For  $moveblank Is  mqc_removePreSufBlank($sel_list);
             
              For  $category  Is  First ( $moveblank );
              For  $layer_str Is  Second( $moveblank );
              
              For  $valid_map Is  ( -( $category = "" ) ) & ( -( $category = noValue ) ) & ( -( $layer_str = "" ) ) & ( -( $layer_str = noValue ) ) ;
              
              For  $valid_layer  Is  ( -( $layer_str = "" ) ) & ( -( $layer_str = noValue ) ) &( ug_rexp_match( $layer_str, "[0-9][0-9,\-]{0,}" ) );
             
              Do  If ( $valid_map )
                  Then  If ( $valid_layer )
                        Then donothing
                        Else  ug_mqc_log( LOG_WARNING, {}, "Category "+$category+" with invalid layer string." )
                  Else  ug_mqc_log( LOG_WARNING, {}, "Invalid mapping: " + $each_sel +" ." );
              If  ( $valid_layer ) & ( $valid_map )
                  Append { $moveblank };
            
          };
      };
  };


</SPAN></FONT></PRE></DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\">  Checking...</PRE><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>( Any Uncached ) do_check: 

                    If ( Empty?( rules_to_check: ) )

                    Then  ug_mqc_empty_param_warning()

                    Else  Loop
                    {
                        For  $each_rule  In  rules_to_check:;
                        For  $category  Is  First( $each_rule );
                        For  $layer_str  Is  Second( $each_rule );

                        Do
                          If ( 0 = ug_mqc_checkRequiredCategory( { $category }, LOG_WARNING, "" ) )

                          Then
                              ug_mqc_checkCategoryLayer( $category, $layer_str, Nth( log_type:, log_type_option: ), log_msg: )

                          Else
                              donothing;
                              
                    };

</SPAN></FONT></PRE></DIV></TABLE><p class=EndLine>&nbsp;</p><p class=blank>&nbsp;</p></BODY></HTML>