Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checkmate customization 1

Status
Not open for further replies.

Bonde78

Mechanical
Apr 3, 2019
20
Hello all

I cannot find a way to make two inputs so first_input finds every blend less than the number put in and the second_input finds the every blend greater than the number put in. Does anyone know how to do this?

The code looks like:
If ( ( first_input: < 0.0 ) )
Then
@{
$log_msg << "Invalid values given to the parameters.~n"+
"The blend feature cannot be under 0.";
ug_mqc_log( LOG_WARNING, {}, $log_msg );
}
Else
@{


$all_feats_tags << mqc_askFeatures( checked_type );
$all_feats_types << mqc_askFeatureTypes( features_tags, $all_feats_tags );
$count_feats << ( $all_feats_types );

$blend_obj <<

Loop
{
For $each_feat in $count_feats;
For $feat_ra is mqc_askBlendRadius( $each_feat );
If( ($feat_ra > first_input) & ($feat_ra < $second_input))
Append {$each_feat};
}

if ( Empty?($blend_obj) )
then
@{
$detail_msg << mqc_sprintf("Found %s blend",
Format("%d", Length($blend_obj)));
$usr_msg << If ( "" = log_msg: ) Then "" Else log_msg: + "~n";
ug_mqc_log( Nth(log_type:, log_type_option:), $blend_obj, $usr_msg + $detail_msg);
}
else
donothing;

};

Best regards

Christian
 
Replies continue below

Recommended for you

Thank you for you're answer! Helped with the problem at hand.

The mqc_askBlendRadius() but needs a integer, which integer can be used? becuase the one i used before does not work.

Regards
Christian
 
The mqc_askBlendRadius() needs the tag of the blend. Look at the snippet below.

Code:
$feats << mqc_askFeaturesByType( "BLEND" ); 

$blend_feats << 
Loop 
{ 
For $each_feat in $feats; 
For $cur_blend_value is mqc_askBlendRadius( $each_feat ); 
If( your conditional statement ) 
Append {$each_feat}; 
};

Suresh
 
Thank you for your answer!
I get the error message from the Log file in NX:

Code:
&MACRO CUSTOM HEADER 25 "UGTL_macro" 0
&MACRO CUSTOM 25 MCT * TL_EXPAND * (4) * 1 ! Modeling
&MACRO CUSTOM 25 MCT * TL_EXPAND * (4 1) * 1 ! Features
&MACRO CUSTOM 25 MCT * TL_PICKED_ITEM * (4 1 1) * 0 ! Blend
&MACRO CUSTOM 25 MCT * TL_SELECT * (4 1 1) * 0 * 1 ! Blend
&MACRO CUSTOM 25 MCT * TL_DEFAULT_ACTION * (4 1 1) * 0 ! Blend
&MACRO EVENT ACTIVATE 0 0, 52, 0, 0, 0! Execute Check-Mate Tests
&MACRO ASK_ITEM 11 (1 OPTM 0) = 0  ! ##495None
&MACRO ASK_ITEM 26 (1 BOOL 0) = 0  ! Stop on an Error
&MACRO ASK_ITEM 27 (1 BOOL 0) = 0  ! Stop on a Warning
&MACRO ASK_ITEM 39 (1 BOOL 0) = 0  ! Generate an External Log File
&MACRO ASK_ITEM 40 (1 OPTM 0) = 0  ! One log per session
&MACRO ASK_ITEM 42 (1 STRN 0) = "C:\Siemens\NX11\UGII"  ! Directory
&MACRO ASK_ITEM 29 (1 OPTM 0) = 0  ! Do Not Save
&MACRO ASK_ITEM 30 (1 OPTM 0) = 0  ! Do Not Save
&MACRO ASK_ITEM 32 (0 BOOL 0) = 0  ! Generate Check Flag
&MACRO ASK_ITEM 33 (0 BOOL 0) = 1  ! Treat Warning as Pass
&MACRO ASK_ITEM 34 (1 BOOL 0) = 0  ! Skip Checking if Check Flag is Up-to-date
&MACRO ASK_ITEM 36 (0 BOOL 0) = 0  ! Read Flag without Part Loading
&MACRO ASK_ITEM 35 (1 BOOL 0) = 0  ! Skip Checking if Part has Overridden Results
&MACRO ASK_ITEM 11 (1 OPTM 0) = 0  ! ##495None
Symbol not found in dynamic module onFusionLoad
Bad eval return code 3270018 in checker '%mqc_check_blend'.&MACRO FOCUS CHANGE IN 1
&MACRO ASK_ITEM 4849664 (1 OPTM 8400) = 1  ! Saved in Part
&MACRO ASK_ITEM 4849664 (1 OPTM 8400) = 0  ! Most Recently Run
&MACRO ASK_ITEM 8847360 (1 BOOL 8400) = 0  !  
&MACRO ASK_ITEM 9175040 (1 BOOL 8400) = 0  !  
&MACRO ASK_ITEM 2621440 (1 OPTM 8400) = 0  !      
&MACRO CUSTOM HEADER 29 "HD3D_Node" 0
&MACRO CUSTOM 29 NX_VALIDATION_GADGET * TREE_TYPE * NODE_EXPAND * 1 * (0) ! model1.prt
&MACRO CUSTOM 29 NX_VALIDATION_GADGET * TREE_TYPE * NODE_SELECT * 2 * (0 0) ! Blend
&MACRO ASK_ITEM 2621440 (1 OPTM 8400) = 0  ! model1.prt
&MACRO CUSTOM 29 NX_VALIDATION_GADGET * TREE_TYPE * NODE_MENUPOPUP * 2 * (0 0) ! Blend
What does this mean? Tried with different feature finders, but ended up with almost the same error code.
 
Here is the DFA code:
Code:
#! NX/KF 3.0
#
 
DefClass: %mqc_check_blend1 ( %ug_base_checker );
   ( String )    %test_category: "Modeling.Features";
   ( String )    %displayed_name: "Blend1";
   ( Boolean Parameter )    Disabled?: False;
   ( Boolean  )    save_log_in_part: True;
 
#  Attributes for this class
   ( Number Parameter )   first_input: 2;
   ( String )   first_input_label: "First Number";
   ( Integer Parameter )   log_type: 1;
   ( List )   log_type_option: { LOG_ERROR, LOG_WARNING, LOG_INFO };
   ( String )   log_type_label: "Log Option";
   ( String Parameter )   log_msg: "";
   ( String )   log_msg_label: "Log Additional Message";
   ( List )   checked_type: { "BLEND" };
 
#  Checker function
   (Any Uncached)   do_check: 
   If ( ( first_input: < 0.0 ) )
   Then
   @{
           $log_msg << "Invalid values given to the parameters.~n"+
                       "The blend feature cannot be under 0.";
           ug_mqc_log( LOG_WARNING, {}, $log_msg );
     }
   Else
   @{
   	   $feats << mqc_askFeaturbyType( checked_type ); 

   	   $blend_obj << 
	   Loop { 
	       For $each_feat in $feats; 
	       For $blend_ra is mqc_askBlendRadius( $each_feat ); 
	       If( $blend_ra < first_input) 
	           Append {$each_feat}; 
                };

     if ( Empty?($blend_obj) )
          then
          @{
              $detail_msg << mqc_sprintf("Found %s blend",
                               Format("%d", Length($blend_obj)));

              $usr_msg << If ( "" = log_msg: ) Then "" Else log_msg: + "~n"; 
              ug_mqc_log( Nth(log_type:, log_type_option:), $blend_obj, $usr_msg + $detail_msg);
            }
          else
              donothing;
    };
 
Had a typo and syntax error. mqc_askFeaturbyType should be mqc_askFeaturesByType. Below is the code.

Code:
#! NX/KF 3.0
#
 
DefClass: check_blend1 ( %ug_base_checker );
   ( String )    %test_category: "TEST.My";
   ( String )    %displayed_name: "Blend1";
   ( Boolean Parameter )    Disabled?: False;
   ( Boolean  )    save_log_in_part: True;
 
#  Attributes for this class
   ( Number Parameter )   first_input: 2;
   ( String )   first_input_label: "First Number";
   ( Integer Parameter )   log_type: 1;
   ( List )   log_type_option: { LOG_ERROR, LOG_WARNING, LOG_INFO };
   ( String )   log_type_label: "Log Option";
   ( String Parameter )   log_msg: "";
   ( String )   log_msg_label: "Log Additional Message";

#  Checker function
   (Any Uncached)   do_check: 
   If ( ( first_input: < 0.0 ) )
   Then
   @{
           $log_msg << "Invalid values given to the parameters.~n"+
                       "The blend feature cannot be under 0.";
           ug_mqc_log( LOG_WARNING, {}, $log_msg );
     }
   Else
   @{
   	   $feats << mqc_askFeaturesByType( "BLEND" ); 

   	   $blend_obj << 
	   Loop { 
	       For $each_feat in $feats; 
	       For $blend_ra is mqc_askBlendRadius( $each_feat ); 
	       If( $blend_ra < first_input:) 
	           Append {$each_feat}; 
                };

     if ( Empty?($blend_obj) )
          then
          @{
              $detail_msg << mqc_sprintf("Found %s blend",
                               Format("%d", Length($blend_obj)));

              $usr_msg << If ( "" = log_msg: ) Then "" Else log_msg: + "~n"; 
              ug_mqc_log( Nth(log_type:, log_type_option:), $blend_obj, $usr_msg + $detail_msg);
            }
          else
              donothing;
    };

Suresh
 
The code now passes the test as long as there is one blend radius under the first_input, but I want to know what blend radiuses that do not pass the test (which ones that is over the first_input if there is any). How do you do this? I know you can use != to find everthing that is not equal to the first_input, but thats does not inclued the numbers that are under or the number I choose.
 
The answer that is found to anyothers who wants to know is:

Code:
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_ble << 
           If ( ( ble_unit: = mm ) & ( $part_unit = pounds_and_inches ) )
           Then ble:/25.4
           Else If ( ( ble_unit: = inch ) & ( $part_unit = grams_and_millimeters ) )
           Then ble:*25.4
           Else ble:;
        
        $feats << mqc_askFeaturesByType( "BLEND" );

        $ble_feats <<
        Loop 
        {
            For $each_feat in $feats;
            For $feat_ble is mqc_askBlendRadius( $each_feat );
            If( ($feat_ble >= $check_ble) & ($feat_ble != $check_ble) )
                Append {$each_feat};
        };

        If ( Empty?($ble_feats) )
        Then
           ug_mqc_log( LOG_INFO, {}, $usr_msg + "This part has no edge blends with greater radius than specified." )
        Else
        @{
               $detail_msg << Loop
                        {
                              With $msg  Is  "";
                              For  $ble_feat  In  $ble_feats;
                              For  $ble Is mqc_askBlendRadius( $ble_feat );
                              For  $feat_name  Is  First( mqc_askFeatureNameAndType($ble_feat) );
                              For  $msg  Is  $msg+"~n"+$feat_name+"  ["+StringValue($ble)+"]";
                              Return Is $msg;
                        }; 
           
           $u_msg << mqc_sprintf("%s blend(s) with [radius] greater than specified:~n",
                                 StringValue( Length( $ble_feats ) ) );
           
           $usr_msg << (If ( "" = log_msg: ) Then "" Else log_msg:) + "~n" + $u_msg;

               ug_mqc_log( Nth(log_type:, log_type_option:), $ble_feats, $usr_msg + $detail_msg );
        };
   };
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor