<HTML><HEAD><link type="text/css" href="../css/main_styles.css" rel="stylesheet"></HEAD>
<BODY><TITLE>%mqc_check_feature_tolerance</TITLE><H1>%mqc_check_feature_tolerance </H1><P CLASS="Paragraph">Classname: <B>%mqc_check_feature_tolerance </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>
    Check If any feature is created with a distance tolerance different than specified.
Parameters:
   (Number)   tol               - Feature tolerance.
                                  Default is 0.254.
   (Name)     tol_unit          - Unit of tol.
                                  Default is mm.
   (Boolean)ignore_suppressed   - if suppressed features to be ignored during check.
                                  Default is False.
   (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_INFO,
                                  Default is 1 to log error.
    (String)  log_msg           - User defined message to be added when the system reports the violation.
                                  Default is an empty string.
Results:
    FAILED: -  If any feature is found with a distance tolerance different than specified.
    PASS:     -  No feature in the part is found with a tolerance different than specified.
</PRE><PRE><FONT COLOR= blue>DefClass: %mqc_check_feature_tolerance( %ug_base_checker );
</FONT></PRE><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( String )               %test_category: "Modeling.Features";
   ( String )               %displayed_name: "Check Feature Tolerance";
</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 )            tol_label: "Tolerance to Check";

</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( String )            tol_unit_label: "Tolerance Unit";
   ( List )              tol_unit_option: {mm, inch};

</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( String )            ignore_suppressed_label: "Ignore suppressed features?";

</SPAN></FONT></PRE></DIV><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>   ( Number Parameter )  tol: 0.0254;
   ( Name Parameter )    tol_unit: mm;
   ( Boolean Parameter ) ignore_suppressed: False;
   ( Integer Parameter ) Log_Type: 1;
   ( String Parameter )  Log_Msg: "";
</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( String )            Log_Msg_Label: "Additional Log Message";

   (Any Uncached)   Do_Check: 

   If ( -Member( log_type:, { 1, 2, 3 } ) ) 
   Then 
       ug_mqc_empty_param_warning( )
   Else
   @{
       $usr_msg << If ( "" = log_msg: ) Then "" Else log_msg: + "~n" ;

       $part_unit << ug_askPartUnits( "" );
       $check_tol << 
           If ( ( tol_unit: = mm ) & ( $part_unit = pounds_and_inches ) )
           Then tol:/25.4
           Else If ( ( tol_unit: = inch ) & ( $part_unit = grams_and_millimeters ) )
           Then tol:*25.4
           Else tol:;

       # inquire tolerance for all features

        $all_feats << mqc_askFeatures( ignore_suppressed_feature?, ignore_suppressed: );
  
        $tol_feats <<
        Loop 
        {
            For $each_feat in $all_feats;
            For $feat_tol is mqc_askFeatureTolerance( $each_feat );
            If( ($feat_tol >= 0.0) & ($feat_tol != $check_tol))
                Append {$each_feat};
        };

        If ( Empty?($tol_feats) )
        Then
           ug_mqc_log( LOG_INFO, {}, $usr_msg + "
                                     This part has no feature with tolerance different than specified." )
        Else
        @{
               $detail_msg << Loop
                        {
                              With $msg  Is  "";
                              For  $tol_feat  In  $tol_feats;
                              For $tol Is mqc_askFeatureTolerance( $tol_feat );
                              For  $feat_name  Is  First( mqc_askFeatureNameAndType($tol_feat) );
                              For  $msg  Is  $msg+"~n"+$feat_name+"  ["+StringValue($tol)+"]";
                              Return Is $msg;
                        }; 
           
           $u_msg << StringValue( Length( $tol_feats ) )  + 
                                   " feature(s) with [tolerance] different than specified:~n";
           
           $usr_msg << (If ( "" = log_msg: ) Then "" Else log_msg:) + "~n" + $u_msg;

               ug_mqc_log( Nth(log_type:, log_type_option:), $tol_feats, $usr_msg + $detail_msg );
        };
   };


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