<HTML><HEAD><link type="text/css" href="../css/main_styles.css" rel="stylesheet"></HEAD>
<BODY><TITLE>%mqc_check_sheet_thickenable</TITLE><H1>%mqc_check_sheet_thickenable </H1><P CLASS="Paragraph">Classname: <B>%mqc_check_sheet_thickenable </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 sheet bodies in the part can be thickened
    with the specified thickening parameters.
Parameters:
    (Number)  first_offset        - First offset of the thickness.
                                    Default is 0.5.
    (Name)    first_offset_unit   - Unit of the first offset. Can be:
                                      mm
                                      inch
                                    Default is mm.
    (Number)  second_offset       - Second offset the thickness.
                                    Default is 0.0.
    (Name)    second_offset_unit  - Unit of the second offset. Can be:
                                      mm
                                      inch
                                    Default is mm.
    (Number)  tol                 - Tolerance for creating thickened body.
                                    This value must be greater than 0.00001
                                    and less than 10% of the difference between
                                    the first offset and the second offset.
                                    Default is 0.0254.
    (Name)    tol_unit            - Unit of tolerance. can be:
                                      mm
                                      inch
                                    Default is mm.
    (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.
    (Name)    log_type            - Indicate which logging type to use to report the violation.
                                      Can be:
                                      LOG_ERROR
                                      LOG_WARNING
                                      LOG_INFO
                                    Default is LOG_ERROR.
    (String)  log_msg             - User specified error/warining/info message.
                                    The default is an empty string.
Results:
    INFO   - This part has no SHEET BODY to be thickened.
    FAILED - Some sheet bodies can not be thickened with the
             specified thicken value.
    PASS   - All sheet bodies can be thickened with the
             specified thicken value.
</PRE><PRE><FONT COLOR= blue>DefClass: %mqc_check_sheet_thickenable( %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 Sheet Body Thickening";
</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 )                first_offset_label:"First Offset";

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

</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( String )                second_offset_label:"Second Offset";

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

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

</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 )                sheet_body_label: "Sheet Body Entity Filter";
</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 )      first_offset:0.5;
   ( Name Parameter )        first_offset_unit:mm;
   ( Number Parameter )      second_offset:0.0;
   ( Name Parameter )        second_offset_unit:mm;
   ( Number Parameter )      tol:0.0254;
   ( Name Parameter )        tol_unit:mm;
   ( List Parameter )        sheet_body: {};
   ( Name Parameter )        sheet_body_layer_mode: Include;
   ( List Parameter )        sheet_body_layer_filter: {all};
   ( Name Parameter )        sheet_body_color_mode: Include;
   ( List Parameter )        sheet_body_color_filter: {all};
   ( Name Parameter )        log_type: LOG_ERROR;
   ( 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:;

       #Get all sheet bodies in the part file.
       $all_sheet_bodies << mqc_collectEntitiesWithFilterOptions( Include, {sheet_body},
                                                                  sheet_body_layer_mode:, sheet_body_layer_filter:,
                                                                  sheet_body_color_mode:, sheet_body_color_filter:);

       If ( Empty? ( $all_sheet_bodies ) )
       Then
           ug_mqc_log ( LOG_INFO, {}, $usr_msg + "Can not find any sheet body in specified layers and colors." )
       Else
       @{
           #Unit translation from input unit to part unit
           $part_unit << ug_askPartUnits ( "" );
           $offset_1 << unit_translator:( first_offset:, first_offset_unit:, $part_unit );
           $offset_2 << unit_translator:( second_offset:, second_offset_unit:, $part_unit );
           $tol_ << unit_translator:( tol:, tol_unit:, $part_unit );

           #Tolerance is not valid for the thicken operation function
           If ( $tol_ < 0.00001 )
           Then

               ug_mqc_log ( log_type:, {}, 
                   $usr_msg + "Tolerance must be larger than 0.00001.~n" )

           Else If ( ( $tol_ * 10.0 ) >= abs ( $offset_1 - $offset_2 ) )
           Then

               ug_mqc_log ( log_type:, {}, 
                   $usr_msg + "Tolerance should be less than 1/10 of total thickness.~n" )

           Else
           @{
               #Test all sheet bodies in this part file
               $sheets_not_thicken <<
               Loop
               {
                   with $tags is {};
                   For $each_sheet in $all_sheet_bodies;
                   For $error_num is mqc_isSheetThickenable($each_sheet,
                                                            first_offset,$offset_1,
                                                            second_offset,$offset_2,
                                                            tol,$tol_);
                   If( $error_num != 0 ) Append {$each_sheet};
               };

               $num_not_thicken << Length($sheets_not_thicken);

               If ( $num_not_thicken > 0 )
               Then
               @{
                   $detail_msg <<

                       If( $num_not_thicken = 1)
                       Then " One sheet body can not be thickened with the input value.~n"
                       Else stringvalue($num_not_thicken)
                            + " sheet bodies can not be thickened with the input value.~n";

                   ug_mqc_log( log_type:, 
                       $sheets_not_thicken, $usr_msg + $detail_msg );
               }
               Else Donothing;
           };
       };
   };

   #translated Number value $inValue from unit $from_unit to unit $to_unit
</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   (Method Number) unit_translator:(Number $inValue, Name $from_unit, Name $to_unit)
   @{
       If ( ($from_unit = mm) & ($to_unit = pounds_and_inches) )
       Then $inValue/25.4
       Else If ( ($from_unit = inch) & ($to_unit = grams_and_millimeters) )
       Then $inValue*25.4
       Else $inValue;
   };

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