<HTML><HEAD><link type="text/css" href="../css/main_styles.css" rel="stylesheet"></HEAD>
<BODY><TITLE>%mqc_check_multi_entity_color</TITLE><H1>%mqc_check_multi_entity_color </H1><P CLASS="Paragraph">Classname: <B>%mqc_check_multi_entity_color </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 the entity color
Parameters:
    (List)   entity_color_map:       -  List of description strings of the
                                       'Entity Type | Entity Color' mapping relations.
                                       For example:
                                        {
                                            "VIEW_DEPENDENT_GEOMETRY  |  Aquamarine",
                                            "DIMENSION                |  Magenta"
                                        };
                                        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 specified type entities' color settings are correct
   FAILED  -- if any specified type entitiy's color is not correct

<B>See Also:</B>
    %mqc_check_single_entity_color
=============================================================================================
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 entity type / entity color mapping strings for interactive selections.
       ( List )  entity_color_map_init:
                  List of strings of entity type(s) and entity color mapping descriptions.
                  It must have the format like:
                     {
                         "entity_type_1  |  color_name_1",
                         "entity_type_2  |  color_name_2",
                         ...
                         "entity_type_n  |  color_name_n"
                     };
                  The entity_type and the color_name must be separated by '|'.
                          e.g. "SOLID   |   Magenta".
                  Mutiple entity types in the description strings must be
                  separated by commas.
                          e.g. "SOLID,SOLID_BODY" means SOLID entity type and
                                SOLID BODY entity type.
                  Every entity type in the entity types strings must included in
                  the following list.
                  {    VIEW_DEPENDENT_GEOMETRY,  DIMENSION, _CURVE, LINE, ARC, CONIC,
                       SPLINE, SKETCH, SOLID, SOLID_BODY, SHEET_BODY, FACETED_BODY,
                       COMPONENT, DATUM, DATUM_PLANE, DATUM_AXIS, _POINT, CSYS,
                       DRAFTING_ENTITY, _GROUP, PLANE, PATTERN, PATTERN_POINTS,
                       FOREIGN_ENTITY
                  };
                  Color name in the description strings must included in
                  the following list.
                  { Blue, Green, Cyan, Red, Magenta,
                    Yellow, White, Olive, Pink, Brown,
                    Orange, Purple, Dark_red, Aquamarine, Gray }.
                  For example:
                  {
                      "VIEW_DEPENDENT_GEOMETRY  |  Aquamarine",
                      "DIMENSION                |  Magenta"
                   };
  4. (Optinal) change the default log type
      (integer) log_type:  1;
=============================================================================================
</PRE><PRE><FONT COLOR= blue>DefClass: %mqc_check_multi_entity_color( %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 Entity / Color 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 parameters</PRE><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( List Parameter )                 entity_color_map: entity_color_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>   ( List )                           entity_color_map_init:
                                      {
                                      };
   ( String )                         entity_color_map_label: "Entity Type / Entity Color";


</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";


   ( List )                 valid_type_name: {  VIEW_DEPENDENT_GEOMETRY,  DIMENSION, _CURVE, LINE,
                                                 ARC, CONIC,SPLINE, SKETCH, SOLID, SOLID_BODY,
                                                 SHEET_BODY, FACETED_BODY,COMPONENT, DATUM,
                                                 DATUM_PLANE, DATUM_AXIS, _POINT, CSYS,
                                                 DRAFTING_ENTITY,_GROUP, PLANE, PATTERN,
                                                 PATTERN_POINTS, FOREIGN_ENTITY
                                               };

   ( List )                 valid_color_name:
                                      {
                                          Blue      ,
                                          Green     ,
                                          Cyan      ,
                                          Red       ,
                                          Magenta   ,
                                          Yellow    ,
                                          White     ,
                                          Olive     ,
                                          Pink      ,
                                          Brown     ,
                                          Orange    ,
                                          Purple    ,
                                          Dark_red  ,
                                          Aquamarine,
                                          Gray
                                      };

</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( List ) rules_to_check:

            If  -empty?(entity_color_map:)

            Then  Loop
            {
                For  $each_sel  In  entity_color_map:;

                For  $sel_list  Is  Splitstring( $each_sel, "|" );
                For  $moveblank Is  mqc_removePreSufBlank($sel_list);

                For  $ent_type  Is  First ( $moveblank );
                For  $color_str  Is  Second( $moveblank );
                For  $color_name Is MakeName($color_str);

                For  $valid_map Is ( -( $ent_type = "" ) ) & ( -( $ent_type = noValue ) ) & ( -( $color_str = "" ) ) & ( -( $color_str = noValue ) );
                For  $valid_color_string  Is   ( member( $color_name,valid_color_name:) );

                For  $type_list Is
                @{
                     If ($valid_map)
                     Then Loop
                     {
                         For  $a from 0 to 0;
                         For  $ent_list  Is  Splitstring( $ent_type,",");
                         For  $entmoveblank Is  mqc_removePreSufBlank( $ent_list );
                         For  $type_name_list Is
                         Loop
                         {
                             For $each_type In $entmoveblank;
                             For $type_name Is MakeName( $each_type );
                             For $valid_type Is member( $type_name,valid_type_name: );
                             Do  If ( $valid_type )
                                 Then donothing
                                 Else  ug_mqc_log( LOG_WARNING, {},
                                 "   Entity type " + $type_name + " with invalid string." );
                             If ( $valid_type )  Append { $type_name };
                          };
                          Do If ( - ( Empty?( $type_name_list )  ) )
                             Then $type_name_list
                             Else {};
                     }
                     Else {};
                   };

                  Do If ( $valid_map ) & ( - ( Empty?( $type_list )  ) )
                      Then  If ( $valid_color_string )
                            Then donothing
                            Else ug_mqc_log( LOG_WARNING, {}, " Invalid color name " + $color_str + ".")
                      Else  ug_mqc_log( LOG_WARNING, {}, " Invalid mapping " + $each_sel + ".");

                  If ( $valid_map ) & ( - ( Empty?( $type_list )  ) ) & ( $valid_color_string )
                   Append { { $type_list , position( $color_name, valid_color_name: ) } };

            }
            Else
            {};
</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 $i from 1 to length(rules_to_check:);
                       for $each_rule in rules_to_check:;

                       do ug_mqc_checkEntityColor( second($each_rule),
                                                first($each_rule),
                                                Nth( log_type:, log_type_option: ),
                                                log_msg: );
                    };

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