Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Close NX Part in VB ?

Status
Not open for further replies.

stytgat

Automotive
Mar 29, 2010
15
Hello,

I am novice in VB and I search to understand why my programm generate an error when i want to close a NX part.
See below a small programm test and the message information about the error.

My small prg test :

Try
Dim MYPart As Part = theSession.Parts.NewDisplay("G:\Temp\Test.prt", Part.Units.Millimeters)

MYPart.Close(BasePart.CloseWholeTree.True, BasePart.CloseModified.CloseModified, Nothing)

Catch ex As Exception

Dim MyWindows As NXOpen.ListingWindow = theSession.ListingWindow

MyWindows.Open()
MyWindows.WriteLine(ex.ToString)

End Try

The error information :


Close part System.NotImplementedException: The method or operation is not implemented.
at Repertoire_STD.Module1.Main() in C:\1_DELPHI\Programmation\VB\Repertoires\Repertoire_STD\Module1.vb:line 425


thanks for your help and best regards,

S. TYTGAT
 
Replies continue below

Recommended for you

S. TYTGAT,

Your code executes without error when pasted into a new journal in the NX journal editor and it is "run" - so the syntax is fine.

The boilerplate for an NX journal includes the directive
Code:
Imports System

which implements exception handling.

Is this missing, perhaps?

Regards, Joe
 
Hello,

Thanks for your answer but unfortunately, the CODE "Imports System" is already add.
If you have other information to support me, it would be appreciate.

Best regards,

S. TYTGAT
 
I'm not sure about the close function since I typically use the CloseAll function

C#:
MainSession.Parts.CloseAll(BasePart.CloseModified.CloseModified, null);


Are you sure that your error is being thrown by the close operation?
 

Line 425 :

MYPart.Close(BasePart.CloseWholeTree.True, BasePart.CloseModified.CloseModified, Nothing)

Thx and best regards,

S. TYTGAT
 
I made a quick test journal based on your code, run it and see if you get any errors.

Code:
Option Strict Off
Imports System
Imports NXOpen

Module Module1

    Sub Main()

        Dim theSession As Session = Session.GetSession()
        Dim lw As ListingWindow = theSession.ListingWindow
        lw.Open()
        Dim tempPart As String
        tempPart = IO.Path.GetTempPath
        tempPart = IO.Path.Combine(tempPart, "test.prt")

        Try
            Dim myPart As Part = theSession.Parts.NewDisplay(tempPart, Part.Units.Millimeters)
            MsgBox("part created")
            myPart.Close(BasePart.CloseWholeTree.True, BasePart.CloseModified.CloseModified, Nothing)
            MsgBox("part closed")
        Catch ex As Exception
            lw.WriteLine(ex.GetType.ToString & " : " & ex.Message)
        Finally
            lw.Close()
        End Try

    End Sub

End Module

www.nxjournaling.com
 
Hi,

Always the same error message :


System.NotImplementedException : The method or operation is not implemented.

Thanks,

S. TYTGAT
 
Are you sure you have you imported the NXOpen namespace?

Are you running any other NX functions in your script that execute just fine, or is the Close operation the only thing your script does?
 
NX 7.5.4.4 on Win XP64 bits.
I have imported the NXOpen.
I execute differents function without problem in my script. It's only the close operation which don't execute correctly.
But i found another mistake : my script execute correctly on my machine (except the Close function) but do not execute on other computer with error message in attached file.

I am completly lost!

Best regards,

 
 http://files.engineering.com/getfile.aspx?folder=202c5007-76fd-4790-b7ae-3bfc922000ef&file=error_msg.docx
Status
Not open for further replies.

Part and Inventory Search

Sponsor