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!

Using ug_inspect to check if flat pattern entity exist in a part

Status
Not open for further replies.

PSI-CAD

Computer
Feb 13, 2009
997
Hi,

Is it possible to use ug_inspect to check if flat pattern entity exist in a part ?

If not:

Is it possible to use ug_inspect to check if a special layer is not empty ?

Thanks in advance


Regards
Didier Psaltopoulos
 
Replies continue below

Recommended for you

No and no. The ug_inspect utility has a specific use; it cannot be extended to check for flat patterns or the status of layers.

However, a journal could be made to do either (or both) of the tasks that you mentioned...

www.nxjournaling.com
 
Here's a quick journal that will tell you if the work part contains a flat pattern or not.

Code:
Option Strict Off
Imports System
Imports NXOpen

Module Module1

    Sub Main()

        Dim theSession As Session = Session.GetSession()
        If IsNothing(theSession.Parts.BaseWork) Then
            'active part required
            Return
        End If

        Dim workPart As Part = theSession.Parts.Work
        Dim lw As ListingWindow = theSession.ListingWindow
        lw.Open()

        Const undoMarkName As String = "check for flat pattern"
        Dim markId1 As Session.UndoMarkId
        markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, undoMarkName)

        Dim fpFound As Boolean = False

        For Each tempFeature As Features.Feature In workPart.Features

            If TypeOf (tempFeature) Is Features.FlatPattern Then
                fpFound = True
                lw.WriteLine("workpart contains flat pattern")

            End If

        Next

        If Not fpFound Then
            lw.WriteLine("workpart does NOT contain a flat pattern")
        End If

        lw.Close()

    End Sub


    Public Function GetUnloadOption(ByVal dummy As String) As Integer

        'Unloads the image immediately after execution within NX
        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately

    End Function

End Module

www.nxjournaling.com
 
A simple Check-Mate profile can be created. Below is an example which flags the presence of a flat pattern as information:-

Cheers,

NXJockey

#! NX/KF 3.0
#

DefClass: check_for_flat_pattern ( %ug_base_checker );
( String ) %test_category: "MyCustomChecks.Modelling";
( String ) %displayed_name: "Check For Flat Pattern";
( Boolean Parameter ) Disabled?: False;
( Boolean Parameter ) save_log_in_part: False;

# Attributes for this class
( List Modifiable ) flat_ptrn: mqc_askObjectOfType( True, 64, 7, "lib", "libufmqc", "Name", "mqc_ufkf_askObjectOfType" );

# Checker function
(Any Uncached) do_check:
If ( (-Empty?(flat_ptrn:)) )
Then (mqc_log( LOG_INFO, flat_ptrn:, "Part contains a flat pattern"))
Else (donothing);
 
Hi NXJockey,

Thanks for your help, but I have the following error message:

check_mate_obra2w.jpg


Regards
Didier Psaltopoulos
 
Hi, try just putting the dfa file in your checkmate directory

Cheers,

NXJockey
 
Hi NXJockey,

I have set up my own dfa directory, but where is my test ?

existing_flat_pattern_yyzcjr.jpg


Thanks in advance

Regards
Didier Psaltopoulos
 
Hi Cowski,

Could you change the journal to check all parts in the opening assembly ?

Thanks in advance

Regards
Didier Psaltopoulos
 
Hi,

The checkmate directory is listed in the ugii_env.dat. It's this dir which controls the checkmate profiles

Cheers

NXJockey
 
With regderence to the above, a simple way to set up the abouve checker is as follows.

1.) CREATE A FOLDER CALLED 'checkmate'
2.) CREATE A SUB FOLDER WITHIN THE CHECKMATE FOLDER CALLED 'DFA'
3.) STORE THE FILE IN THE DFA FOLDER
4.) CREATE A LOCAL ENVIROMENT VARIABLE:-
UGCHECKMATE_USER_DIR=**** YOUR PATH TO THE FOLDER ****\checkmate\DFA
5.) START NX

Cheers,

NXJockey
 
Hi NXJockey,

I was on another subject for few days and I come back to day to this one to thank you. I succeed.

Now I will start a new thread because the tittle of this one is not adapted.

Regards
Didier Psaltopoulos
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor