<HTML><HEAD><link type="text/css" href="../css/main_styles.css" rel="stylesheet"></HEAD>
<BODY><TITLE>%mqc_report_entity_layer_color</TITLE><H1>%mqc_report_entity_layer_color </H1><P CLASS="Paragraph">Classname: <B>%mqc_report_entity_layer_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>
    Report entities of the specified type which do not reside on the specified
    layers and which are not in the specified color.
Parameters:
    ( List )  entities           - This parameter is used to display filter
                                   option button in checker customization dialog.
    ( Name )  entities_type_mode - This parameter is used to set entity type
                                   filter mode which can be Include or Exclude.
                                   Include - Collect entities with the specified
                                             types in the list filter_type_filter.
                                   Exclude - Collect entities without the specified
                                             types in the list filter_type_filter.
                                   Default is Include.
    ( List ) entities_type_filter - This parameter is used to collect the entity
                                   types for entity type filter.
                                   It can be a list of any entity types available
                                   in the class selection dialog.
                                   Default is
                                   {All_Curves,Spline,Arc,Line,Conic,
                                    Ellipse,Hyperbola,Parabola};
    ( List )  rule_of_entity     - This parameter is used to display filter
                                   option button in checker customization dialog.
    ( Name )  rule_of_entity_layer_mode
                                 - This parameter is used to set layer filter mode
                                   which can be Include or Exclude.
                                   See rule_of_entity_type_mode.
                                   Default is Include.
    ( List )  rule_of_entity_layer_filter
                                 - This Parameter is used to collect the layers
                                   for layer filter.
                                   It can be a list of layers string or category
                                   name string, For example: {"8,10-12", "SOLID"}
                                   Default is {ALL}.
    ( Name )  rule_of_entity_color_mode
                                 - This parameter is used to set color filter mode
                                   which can be Include or Exclude.
                                   See rule_of_entity_type_mode.
                                   Default is Include.
    ( List )  rule_of_entity_color_filter
                                 - This parameter is used to collect the colors
                                   for color filter.
                                   It can be a list of color RGB,
                                   such as {{255,0,0},{102,102,102}},
                                   or color index, such as {1,2,3}
                                   Default is {ALL}.
    (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.
    (String)   log_msg          -  User defined message to be added when the system
                                   reports the violation.
                                   Default is an empty string.
Results:
    Info -  Report number of entities with the specified type which do not
            reside on the specified layers or in the specified color.
</PRE><PRE><FONT COLOR= blue>DefClass: %mqc_report_entity_layer_color( %ug_base_checker );
</FONT></PRE><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( String )    %test_category: "Get Information.Modeling";
   ( String )    %displayed_name: "Report Entity Layer and Color";
</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\">   Attributes for this class</PRE><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( String )            entities_label: "Entity Type";
</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( String )            rule_of_entity_label: "Entity Criteria";
</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( List Parameter )    entities: {};
   ( Name Parameter )    entities_type_mode: Include;
   ( List Parameter )    entities_type_filter: {all};
   ( List Parameter )    rule_of_entity: {};
   ( Name Parameter )    rule_of_entity_layer_mode: Include;
   ( List Parameter )    rule_of_entity_layer_filter: {all};
   ( Name Parameter )    rule_of_entity_color_mode: Include;
   ( List Parameter )    rule_of_entity_color_filter: {all};
   ( String Parameter )  log_msg: "";
</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( String )            log_msg_label: "Log Message";

   (Any Uncached)   do_check:
   @{
       $usr_msg << If ( "" = log_msg: ) Then "" Else "~n"+log_msg:;
       
       #Build filter condition string
       $type_str  << If ( (entities_type_mode: = Include) & Member(All,entities_type_filter:))
                     Then ""
                     Else If ( entities_type_mode: = Include )
                     Then "    specified entity type: "+mqc_list_to_string(entities_type_filter:,",")+"~n"
                     Else "    specified entity type exclude: "+mqc_list_to_string(entities_type_filter:,",")+"~n";
                            
       $layer_str << If ( (rule_of_entity_layer_mode: = Include) & Member(All,rule_of_entity_layer_filter:) )
                     Then ""
                     Else If ( rule_of_entity_layer_mode: = Include )
                     Then "    should be on layer/category: "+mqc_list_to_string(rule_of_entity_layer_filter:,",")+"~n"
                     Else "    should not be on layer/category: "+mqc_list_to_string(rule_of_entity_layer_filter:,",")+"~n";

       $color_str << If ( (rule_of_entity_color_mode: = Include) & Member(All,rule_of_entity_color_filter:) )
                     Then ""
                     Else If ( rule_of_entity_color_mode: = Include )
                     Then "    should be in color: "+mqc_list_to_string(rule_of_entity_color_filter:,",")+"~n"
                     Else "    should not be in color: "+mqc_list_to_string(rule_of_entity_color_filter:,",")+"~n";

       If ( ($layer_str = "") & ($color_str = "") )
       Then
       @{
            ug_mqc_log( LOG_INFO, {}, $usr_msg + "No specific entity layer and color.~n"  );
       }
       Else
       @{
            #Get all entities with specified type.
            $specified_entities  << mqc_collectEntitiesWithFilterOptions( 
                                      entities_type_mode:, entities_type_filter:,
                                      Include,  {All},
                                      Include,  {All});
                                      
            If ( Empty?($specified_entities) )
            Then
            @{
                 ug_mqc_log( LOG_INFO, {},  $usr_msg + "No specified entity in part.~n");
            }
            Else
            @{
                 $filter_str<< If ( ($layer_str != "") & ($color_str  = "") )
                               Then " on improper layers.~n"
                               Else If ( ($layer_str  = "") & ($color_str != "") )
                               Then " in improper colors.~n"
                               Else " on improper layers or in improper colors.~n";

                 #Get all entities with specified type and reside on specified layer and in specified color.
                 $proper_entities     << mqc_collectEntitiesWithFilterOptions( 
                                           entities_type_mode:,         entities_type_filter:,
                                           rule_of_entity_layer_mode:,  rule_of_entity_layer_filter:,
                                           rule_of_entity_color_mode:,  rule_of_entity_color_filter:);

                 #Get entities with specified type but outside of specified layer and/or specified color.
                 $questioned_entities  << Setdifference( $specified_entities, $proper_entities );
                 
                 $questioned_entities_num << Length( $questioned_entities );

                 $questioned_entities_num_str << If ( $questioned_entities_num = 0 )
                                                 Then "No specified entity"
                                                 Else If ( $questioned_entities_num = 1 )
                                                 Then "Found one specified entity"
                                                 Else "Found "+stringvalue($questioned_entities_num)+" entities";

                 $detail_msg  << $questioned_entities_num_str
                                 +$filter_str
                                 +$type_str
                                 +$layer_str
                                 +$color_str;
                            
                 #Log these questioned entities.
                 ug_mqc_log( LOG_INFO, $questioned_entities, $usr_msg + $detail_msg );
            };
       };
   };

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