<HTML><HEAD><link type="text/css" href="../css/main_styles.css" rel="stylesheet"></HEAD>
<BODY><TITLE>%mqc_report_trim_edge_references</TITLE><H1>%mqc_report_trim_edge_references </H1><P CLASS="Paragraph">Classname: <B>%mqc_report_trim_edge_references </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>
    Find out edges used to trim any other sheet bodies.
    Log these edges and the sheet bodies trimmed by these edges.
Parameters:
    ( List )  entity              - This parameter is used to display filter
                                    option button in checker customization dialog.
    ( Name )  entity_layer_mode   - This parameter is used to set layer filter mode
                                    which can be Include or Exclude.
                                    See filter_type_mode.
                                    Default is Include.
    ( List )  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 )  entity_color_mode   - This parameter is used to set color filter mode
                                    which can be Include or Exclude.
                                    See filter_type_mode.
                                    Default is Include.
    ( List )  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 -  Edges used to trim any other sheet bodies
            and the sheet bodies trimmed by these edges.
</PRE><PRE><FONT COLOR= blue>DefClass: %mqc_report_trim_edge_references( %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 Edges Used to Trim Body";
</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( String )            entity_label: "Edge Entity Filter";
</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;
   ( List Parameter )    entity: {};
   ( Name Parameter )    entity_layer_mode: Include;
   ( List Parameter )    entity_layer_filter: {all};
   ( Name Parameter )    entity_color_mode: Include;
   ( List Parameter )    entity_color_filter: {all};
</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 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:

   @{

       $all_edges << mqc_collectEntitiesWithFilterOptions( Include, {edge},
                                                           entity_layer_mode:, entity_layer_filter:,
                                                           entity_color_mode:, entity_color_filter:);

       #Get all edges used by TRIMMED_SHEET and EXTRUDE feature.
       #Get all feature generated from those edges.
       #
       #For instance, 
       #  edge E_1 is used by feature F_1 and F_2,
       #  edge E_2 is used by feature F_3, F_4 and F_5,
       #  ...
       #Then return is { {E_1, { F_1, F_2 } }, 
       #                 { E_2, { F_3, F_4, F_5 } }, 
       #                 ... }
       $edges_and_references <<
       Loop
       {
           For $each_edge In $all_edges;

           #Get the edge references which do not own the edge
           For $edge_references Is
           Loop
           {
               For $each_reference in mqc_askFeatureOfEdgeReference($each_edge);
               For $body_of_each_reference is mqc_askBodyOfFeature($each_reference);
               For $all_edges_in_each_reference is 
                   If ($body_of_each_reference = 0)
                   Then {}
                   Else Loop
                   {
                       For $each_hp in
                           ug_body_askEdges(%mqc_askHostpointerOfTag($body_of_each_reference));
                       Append {%mqc_askTagOfHostpointer($each_hp)};
                   };
                   
               If( -member ( $each_edge, $all_edges_in_each_reference ) )
                   Append{$each_reference};
           };

           If ( -Empty?($edge_references ) )
               Append {{$each_edge, $edge_references}};
       };

       #Get edges which are used to trim and all TRIMMED_SHEET feature
       $edges_and_TRIMMED_SHEETs << ask_edge_references:( $edges_and_references, "TRIMMED_SH" );

       $edges_referenced << nth ( 1, $edges_and_TRIMMED_SHEETs );
       $edges_num << length ( $edges_referenced );
       $trims << removeDuplicates ( nth ( 2, $edges_and_TRIMMED_SHEETs ) );
       $trims_num << length($trims);

       $usr_msg << If ( "" = log_msg: ) Then "" Else "~n"+log_msg:;

       #Write log message, Log not only edge referenced objects, but also edges
       If( $edges_num > 0 )
       Then 
       @{
           $detail_msg1 << If ( $edges_num = 1 )
                           Then "Found one edge being used.~n"
                           Else "Found " + stringvalue($edges_num) + " edges being used.~n";

           $detail_msg2 << If ( $trims_num = 1 ) 
                           Then "Found one entity trimmed by edge.~n"
                           Else "Found " + stringvalue($trims_num) + " entities trimmed by edge.~n";

           ug_mqc_log ( LOG_INFO, $edges_referenced + $trims, $usr_msg + $detail_msg1 + $detail_msg2 );
       }
       Else
           ug_mqc_log ( LOG_INFO, {}, $usr_msg + "No edge is used to trim any other entity.~n" );
   };

   #Get all edges and specified feature
</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   (Method List) ask_edge_references:(List $edges_and_references, String $feature_name)
   @{
       Loop
       {
           With $all_edges is {};
           With $all_references is {};

           For $each_item in $edges_and_references;

           For $each_edge is nth(1, $each_item);
           For $each_edge_references is nth(2, $each_item);

           For $edge_references is
           Loop
           {
               For $each_reference in $each_edge_references;
               If((nth(2, mqc_askFeatureNameAndType($each_reference)))
                 = $feature_name)
                  Append {$each_reference};
           };

           Append If(-empty?($edge_references)) Then {$each_edge}  Else {}
           Into $all_edges;

           Append If(-empty?($edge_references)) Then $edge_references Else {}
           Into $all_references;

           Return is {$all_edges, $all_references};
       };
   };


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