<HTML><HEAD><link type="text/css" href="../css/main_styles.css" rel="stylesheet"></HEAD>
<BODY><TITLE>%mqc_check_sheet_offsetable</TITLE><H1>%mqc_check_sheet_offsetable </H1><P CLASS="Paragraph">Classname: <B>%mqc_check_sheet_offsetable </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 all sheet bodies found in the part can be offset with
    the user specified positive or negative offset distance.
Parameters:
    (Number)  Offset_Value  - A non-zero offset value.
                                               Default is 0.1.
    (Name)    Offset_Unit      - Unit of offset value. Can be:
                                               mm
                                               inch
                                               Default is mm.
    (Number)  Tol_Value      - Offset tolerance.
                                               This value must be greater than 0.00001.
                                               Default is 0.0254 mm.
    (Name)    Tol_Unit          - Unit of offset tolerance. Can be:
                                              mm
                                              inch
                                              Default is mm.
    (Name)    offset_direction  - Direction to offset the sheet body.
                                  Can be:
                                    Positive
                                    Negative
                                    Both
    (List)    sheet_body         - Filter options for sheet body.
    (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:
    FAILED -  If any sheet body can not be offset with the user
              specified offset value.
    PASS   -  All sheet bodies can be offset with the user specified
              offset value.
</PRE><PRE><FONT COLOR= blue>DefClass: %mqc_check_sheet_offsetable( %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 Offset";
</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 )                Offset_Value_label:"Offset";

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

</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( String )                Tol_Value_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>   ( List )                  offset_direction_option: { Positive, Negative, Both };
   ( String )                offset_direction_label: "Offset Direction";

</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   ( String )                sheet_body_label: "Sheet Body Filters";
</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 )      Offset_Value:0.1;
   ( Name Parameter )        Offset_Unit:mm;
   ( Number Parameter )      Tol_Value:0.0254;
   ( Name Parameter )        Tol_Unit:mm;
   ( Name Parameter )        offset_direction: Positive;
   ( 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: "Additional 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_ << unit_translator:( Offset_Value:, Offset_Unit:, $part_unit );
           $tol_ << unit_translator:( Tol_Value:, Tol_Unit:, $part_unit );
           
           If ( $tol_ < 0.00001 )
           Then
               ug_mqc_log ( log_type:, {}, $usr_msg + "Tolerance must be larger than 0.00001.~n" )
           Else If ( Offset_Value: = 0 )
           Then 
               ug_mqc_log ( log_type:, {}, $usr_msg + "the offset value can not be zero.~n" )
           Else
           @{
               $faces_not_offset <<
               Loop
               {
                   For $each_sheet in $all_sheet_bodies;
                   Append { ask_non_offsetable_faces:( $each_sheet, $offset_, $tol_, offset_direction: ) };
               };
               
               $result_faces << ug_removeDuplicates(Flatten($faces_not_offset));

               $num_not_offset << length ( $result_faces );

               If ( $num_not_offset > 0 )
               Then
               @{
                   $detail_msg <<           
                       If( $num_not_offset = 1 ) 
                       Then           
                           "One face can not be offset with the input value.~n"
                       Else           
                           stringvalue ( $num_not_offset )
                           + " faces can not be offset with the input value.~n";

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

   #ask faces which can not be offset in the input sheet body using the offset value in the specified direction
</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>   (Method List) ask_non_offsetable_faces:( Integer $single_sew, Number $offset_value, Number $tol_value, Name $offset_direction)
   @{
       $faces_of_sew <<
       Loop
       {
           For $each_hp in ug_body_askFaces ( %mqc_askHostpointerOfTag ( $single_sew ) );
           Append {%mqc_askTagOfHostpointer ( $each_hp )};
       };
       
       $faces1 << If (($offset_direction = Positive) | ($offset_direction = Both))
                  Then mqc_askNonOffsetableFace ( $faces_of_sew, offset_value,  $offset_value, tol, $tol_value )
                  Else {};

       $faces2 << If (($offset_direction = Negative) | ($offset_direction = Both))
                  Then mqc_askNonOffsetableFace ( $faces_of_sew, offset_value, -$offset_value, tol, $tol_value )
                  Else {};
       
       ug_removeDuplicates(Flatten({$faces1, $faces2}));
   };
   
   #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>