<HTML><HEAD><link type="text/css" href="../css/main_styles.css" rel="stylesheet"></HEAD>
<BODY><TITLE>%mqc_check_drawing_attribute</TITLE><H1>%mqc_check_drawing_attribute </H1><P CLASS="Paragraph">Classname: <B>%mqc_check_drawing_attribute </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 drawing attributes.
 Parameters:
   (Integer) check_type              - Selection of check type
                                       This is a mandatory parameter for the checker.
      check type can be following option:
        1 -  CHECK_ATTRIBUTE_VALUE,         | check values of existing attributes.
        2 -  CHECK_REQUIRED_ATTRIBUTE,      | check titles and values of specified attributes
        3 -  CHECK_VALUE_OPTIONAL_ATTRIBUTE,| check titles of specified attributes. Check attribute values if they exist.
        4 -  CHECK_TITLE_OPTIONAL_ATTRIBUTE,| check values of specified attributes, if attribute titles exist.
        5 -  CHECK_DISALLOWED_ATTRIBUTE,    | check disallowed attributest.
   (List )  attr_titles_MatchMethod_MatchParam
                                   - List of description strings of the
                                     'Title  /  Match Method  /  Match Parameter'
                                     mapping  relations.
                                     For example:
                                      {
                                         "D_DWGNUM    |  REGULAR_EXPRESSION  |   [A-Za-z0-9]{3}[0-9]{3,5}" ,
                                         "D_DWGSIZE   |  REGULAR_EXPRESSION  |   .*                      " ,
                                         "D_RELLVL    |  REGULAR_EXPRESSION  |   .+                      "
                                       }
                                     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 an empty string.
Results:
    PASS    -- if all specified drawing attributes meet specified requirement.
    FAILED  -- if any specified drawing attribute does not meet specified requirement.

<B>See Also:</B>
    %mqc_check_single_drawing_attr
=============================================================================================
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 check type option
                specify the 'Title  /  Match Method  /  Match Parameter' mapping strings
                for interactive selections.
       ( Integer ) check_type:1;
       ( List )    attr_titles_MatchMethod_MatchParam_init:
                      List of strings of 'Title  /  Match Method  /  Match Parameter'
                      mapping descriptions.
                      It must have the format like:
                        {
                            "attribute_title_1  |  match_method_1 | match_parameter_string_1",
                            "attribute_title_2  |  match_method_2 | match_parameter_string_2",
                            ...
                            "attribute_title_n  |  match_method_n | match_parameter_string_n"
                        };
                      The attribute_title, match_method_option and the layer_range
                      must be separated by '|'.
                     match_method in the description strings must be included in the following
                      string list:
                      { NONE,REGULAR_EXPRESSION,MATCH_ONE_IN_SET,MATCH_ANOTHER_ATTRIBUTE}
                        NONE,                        |    no requirement on the attribute value
                        REGULAR_EXPRESSION,          |    the value must match the pattern of regular expression
                        MATCH_ONE_IN_SET,            |    the value must be one of specified value set
                        MATCH_ANOTHER_ATTRIBUTE      |    the value must match another attribute's value
                      match_parameter_string has the different format according to match method:
                                     match_method         |       parameter format             |       example
                           NONE,                          |    empty string                    |   ""
                           REGULAR_EXPRESSION,            |    regular expression string       |   "[A-Za-z0-9]{3}[0-9]{3,5}"
                           MATCH_ONE_IN_SET,              |    a list of string                |   {"MLDES","MLASM","LYTFMT"}
                           MATCH_ANOTHER_ATTRIBUTE        |    attribute title string          |   "F_CLASS"
                      For example:
                      {
                          "D_DWGNUM    |  REGULAR_EXPRESSION  |   [A-Za-z0-9]{3}[0-9]{3,5}" ,
                          "D_DWGSIZE   |  REGULAR_EXPRESSION  |   .*                      " ,
                          "D_RELLVL    |  REGULAR_EXPRESSION  |   .+                      "
                      }
  4. (Optinal) change the default log type
      (integer) log_type:  1;
=============================================================================================
</PRE><PRE><FONT COLOR= blue>DefClass: %mqc_check_drawing_attribute( %ug_base_checker );
</FONT></PRE><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( String )       %test_category: "Template.Drafting";
   ( String )       %displayed_name: "Check Multiple Drawing Attributes";

</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>  ( String )             check_type_label: "Select Check Type ";
  ( List  )              check_type_option: {
                                       CHECK_ATTRIBUTE_VALUE,       
                                       CHECK_REQUIRED_ATTRIBUTE,   
                                       CHECK_VALUE_OPTIONAL_ATTRIBUTE,
                                       CHECK_TITLE_OPTIONAL_ATTRIBUTE,
                                       CHECK_DISALLOWED_ATTRIBUTE 
                                       };
  
</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;
  ( Integer Parameter )  check_type:  1;
   ( List Parameter )    attr_titles_MatchMethod_MatchParam: attr_titles_MatchMethod_MatchParam_init:;
   ( String )            attr_titles_MatchMethod_MatchParam_label: 
   ( List )              attr_titles_MatchMethod_MatchParam_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>   ( 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 };
   ( 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\">   Checker function</PRE><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( String )                   log_msg_label: "Log Message";
   
   
   ( List )  val_match_method_list: {
                                            "NONE", 
                                            "REGULAR_EXPRESSION", 
                                            "MATCH_ONE_IN_SET", 
                                            "MATCH_ANOTHER_ATTRIBUTE" 
                                    };

 
 ( List ) rules_to_check:
    
             If   -Empty?( attr_titles_MatchMethod_MatchParam: )
             Then  Loop
             {
                For  $each_sel  In  attr_titles_MatchMethod_MatchParam:;
 
                For  $sel_list  Is  Splitstring( $each_sel, "|" );
                For  $moveblank Is  mqc_removePreSufBlank($sel_list);
                             
                For  $attr_title  Is  First ( $moveblank );
                For  $match_method_string Is  Second( $moveblank );
                For  $match_method Is Position( $match_method_string, val_match_method_list: );
                For  $match_param  Is  Third( $moveblank );
                
                For  $valid_map Is ( ( -( $attr_title = "" ) ) & ( -( $attr_title = noValue ) ) &  ( -( $match_method_string = "" ) ) & ( -( $match_method_string = noValue ) ) );  
                              
                For  $valid_method  Is  member($match_method_string, val_match_method_list:);
                             
                Do  If ( $valid_map )
                    Then  If ( $valid_method )
                          Then donothing
                          Else  ug_mqc_log( LOG_WARNING, {}, "Match method " + $match_method_string + " with invalid string." )
                    Else  ug_mqc_log( LOG_WARNING, {}, "Invalid mapping: " + $each_sel +" ." );
                If  ( $valid_method ) & ( $valid_map )
                  Append { { $attr_title,$match_method,$match_param } };
               }
             
             Else
                {};
 
 
</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   (Any Uncached)   do_check: 
   @{ 
        if -( empty?(rules_to_check:)) then
        loop
           {
             for $i from 1 to length(rules_to_check:);

             for $attr_title is first( nth($i, rules_to_check:) );
             for $val_match_method is second( nth($i, rules_to_check: ) ); 
             for $val_match_parameter is third( nth($i, rules_to_check: ) ); 
        
        # convert value match param into list
             for $val_match_param_list is
             if $val_match_method = 1  # NONE
             then
                {} # no requirement
             else if $val_match_method = 2 # REGULAR_EXPRESSION
             then
                {$val_match_parameter}
             else if $val_match_method = 3 # MATCH_ONE_IN_SET
             then
               mqc_removePreSufBlank( SplitString($val_match_parameter, ";") )
             else if $val_match_method = 4  #MATCH_ANOTHER_ATTRIBUTE
             then
               {$val_match_parameter}
             else 
               {};

             do ug_mqc_checkDrawingAttribute( check_type:-1, 
                                         $attr_title, 
                                         $val_match_method-1, 
                                         $val_match_param_list,
                                         nth( log_type:, log_type_option: ), 
                                         log_msg:);

           }
       else 
          ug_mqc_empty_param_warning();    
   };
   
</SPAN></FONT></PRE></DIV></TABLE><p class=EndLine>&nbsp;</p><p class=blank>&nbsp;</p></BODY></HTML>