<HTML><HEAD><link type="text/css" href="../css/main_styles.css" rel="stylesheet"></HEAD>
<BODY><TITLE>%mqc_fam_check_member_attrs</TITLE><H1>%mqc_fam_check_member_attrs </H1><P CLASS="Paragraph">Classname: <B>%mqc_fam_check_member_attrs </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\">
<B>Description:</B>
    Check for an identical solid body pair that deviates less than the constraint
    value of identical distance tolerance or for one body that is completely inside
    another body.
Parameters:
    (Name)    unit     - Part unit for the distance tolerance
    (Number)  identical_tol - identical distance tolerance.
                              default is 0.01.
    (Boolean) no_embed_check - Check embedded faces.
                              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.
    (Name)    log           - log Error,
                              log Warning,
                              log Info,
                              None.
                              default is log error.
    (String)  message       - message to be logged
Results:
    Passed -- No identical or embedded solids.
    Error  -- Found identical/embedded solids.
UG Objects logged:
    All identical/embedded solid pairs.
 #
                                  %vda_solid_lookup_mixin );
( String )  %test_category: "Template.Modeling.Advanced Geometry Check - Solid";
( String )  %displayed_name: "Identical Solid";
   ( Boolean Parameter )    Disabled?: False;
   ( Boolean Parameter )    save_log_in_part: True;
#  Attributes for this class
   ( Name Parameter )      unit: part_unit: ;
   ( List )                unit_option:{grams_and_millimeters, pounds_and_inches};
   ( String )              unit_label: "Part unit";
   ( Number Parameter )   identical_tol: 0.01;
   ( String )             identical_tol_label: "Identical Distance Tolerance";
   ( Boolean Parameter )   no_embed_check: false;
   ( String )              no_embed_check_label: "No Embed Check";
   ( Name Parameter )     log: LOG_ERROR;
   ( List )               log_option: {LOG_ERROR, LOG_WARNING, LOG_INFO, LOG_NONE};
   ( String Parameter )   message: "Found identical/embedded solids.";
   ( String )             message_label: "Additional Message";
#  Checker function
   (Any Uncached)   do_check:
   @{
       $identical_tol << mqc_convert_unit_for_tolerance(identical_tol:, unit:);
       $topo_tol << {mqc_convert_unit_for_tolerance(nth(1, topo_tolerances:), unit:),
                     nth(2,topo_tolerances:),
                     mqc_convert_unit_for_tolerance(nth(3, topo_tolerances:), unit:)};
        mqc_vda_identical_solid_objects(geometry_set:, $topo_tol,
                             solid_checking_criteria:, sel_filters:,
                                        identical_tol:, log:, message:,
                                        no_embed_check:);
    };
#! UG/KF 18.0
#
 
<B>Description:</B>
    Validate the values of the given part family attributes.
 Parameters:
    ( String )  checking_attribute    - the attribute name
                                         for example: "PART_NAME";
    ( String )  attribute_value_rule  - regular expression for the attribute value
                                        for example: "[A-Za-z0-9.]{0,}";
    (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              -  1 - log error
                                         2 - log warning
                                         3 - log information
                                         Default is 1 to log error
    ( string )  log_msg:              - user message,
                                         for example:
                                        "The value of attribute PART_NAME must be composed of
                                         alphanumeric letters and/or decimal point '.'";
  ============================================================================================
    How to customize the parameters:
    - Change checking_attribute: with the title of the attributes to be checked
    - Change attribute_value_rule: with the name matching regular expression
    - Change log_type: to 1 if report as error
                          2 if report as warning
                          3 if report as information
    - Change log_msg: with message in addition to the system generated message
============================================================================================
</PRE><PRE><FONT COLOR= blue>DefClass: %mqc_fam_check_member_attrs( %ug_base_checker );
</FONT></PRE><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>( String )             %test_category:   "Template.Part Family";
( String )             %displayed_name:  "Validate Family part attribute";

</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>( string )            log_msg_label:   "Log Message";

</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>( String )            checking_attribute_label:   "Attribute to be checked";

</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;
( Integer Parameter )  log_type: 1;
( string parameter )  log_msg:         "";
( String Parameter )  checking_attribute:         "";
( String Parameter )  attribute_value_rule:       "";
</SPAN></FONT></PRE></DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\">  checking ...</PRE><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue>( String )            attribute_value_rule_label: "Attribute Value (in Regular Expression)";


</SPAN></FONT></PRE></DIV><DIV><PRE STYLE=\"text-align : left;\" CLASS=\"Code\"><FONT COLOR=blue> ( any Uncached ) do_check:
 
       If ( ( checking_attribute: = Novalue ) | ( checking_attribute: = "" ) )
       
       Then   ug_mqc_log( LOG_WARNING, {}, "The parameter 'Attribute to be checked' is empty." )
       
       Else If ( ( attribute_value_rule: = Novalue ) | ( attribute_value_rule: = "" ) )
       
       Then   ug_mqc_log( LOG_WARNING, {}, "The parameter 'Attribute Value' is empty." )
       
       else If ( ug_rexp_is_valid( attribute_value_rule: ) = false )
       
       then   ug_mqc_log( LOG_WARNING, {},"Invalid regular expression.~n" )
       
       Else
       @{
           $usr_msg << If ( "" = log_msg: ) Then "" Else log_msg: + "~n";

           If ( mqc_fam_is_template?( "" ) )
           Then
           @{
               $familydata << ug_askFamilyData( ug_askCurrentWorkPart(), true );
               $familyattr << First( $familydata );
               $attr_index << Loop
               {
                  For  $i  From  1  To  Length( $familyattr );
                  For  $attr_list   Is  Nth( $i, $familyattr );
                  If   ( checking_attribute: = Second( $attr_list ) )
                      Return $i;
                  Return Is 0;
               };

               If ( $attr_index = 0 )
               Then ug_mqc_log( LOG_INFO, {}, "Attribute to be checked '" + checking_attribute: +
                                              "' does not exist." )
               Else
               @{
                   $memberattr << Second( $familydata );
                   $err_member << If ( Empty?( $memberattr ) )
                                  Then 
                                  @{
                                       ug_mqc_lprintf( {"MQC debug: This template is empty."} );
                                       $memberattr;
                                  }
                                  Else Loop
                                  {
                                      For  $member_index  From  1  To  Length( $memberattr );
                                      For  $member_attr_list    Is Nth( $member_index, $memberattr );
                                      For  $member_name         Is First( $member_attr_list );
                                      For  $query_attr_value    Is Nth( $attr_index, $member_attr_list );
                                      For  $query_value_str     Is If ( Typename( $query_attr_value ) = STRING )
                                                                   Then $query_attr_value
                                                                   Else Stringvalue( $query_attr_value );

                                      If ( -ug_rexp_match( $query_value_str, attribute_value_rule: ) )
                                      Append { { $member_name, $query_value_str } };
                                  };

                   If ( Empty?( $err_member ) )
                   Then 
                   @{
                       if ( -Empty?( $memberattr ) )
                       then
                           ug_mqc_lprintf( {"MQC debug: All member attributes value match the rexp rule."} )
                       else 
                           donothing;
                   }
                   Else
                   @{
                       $err_memb_num << Length( $err_member );

                       $err_memb_str << Loop
                       {
                          With $mem_str       Is  "~n    Member name   Attribute("+checking_attribute:+")"+
                                                  "~n-----------------------------------"+
                                                  "~n    ";
                          For  $ii  From  1   To  Length( $err_member );
                          For  $each_err_memb Is  Nth( $ii, $err_member );
                          For  $memb_name     Is  First( $each_err_memb );
                          For  $attr_value    Is  Second( $each_err_memb );
                          For  $mem_str       Is  $mem_str+$memb_name+"  --  "+$attr_value+"~n    ";
                          Return Is  $mem_str;
                       };

                       ug_mqc_log( Nth( log_type:, log_type_option: ), {}, 
                                   $usr_msg +
                                   "Attribute value rule is:" +
                                   attribute_value_rule: +
                                   "~nFound "+Stringvalue( $err_memb_num ) +
                                   " member(s) whose attribute ("+checking_attribute:+")" +
                                   " value do match the regular expression rule."+
                                   "~nThe members and attribute value" +
                                   $err_memb_str );
                   };
               };
           }
           Else  ug_mqc_log( LOG_INFO, {}, "This is not a template part." );
       };

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