×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

NXOpen VB.net programs

NXOpen VB.net programs

NXOpen VB.net programs

(OP)
Hi,

I made some GRIP prgms but now I would like to
switch to VB.NET . . .

To start learning I would like to create 1 point on the screen at x=10, y=20, z=30

In GRIP I write it in this way :
ENTITY/PT1
PT1=POINT/10,20,30

My question : How is it write in NXOpen VB.NET

remark : I have VB.NET Express 2010 Framework 4
Thanks very much for your help



 

RE: NXOpen VB.net programs

A great way to start is to begin the journal recorder, create your point, close the journal recorder, and check out the code it generated.

RE: NXOpen VB.net programs

Following is a VB code snippet for one method of creating a point object in NX.

Dim ufs As UFSession = UFSession.GetUFSession()
Dim pointTag As NXOpen.Tag = Tag.Null
Dim point1() As Double = {10.0, 20.0, 0.0}

ufs.Curve.CreatePoint(point1, pointTag)

FrankSwinks

RE: NXOpen VB.net programs

(OP)
Thanks cowski and FrankSwinks,
I am very novice with VB.NET . . .

Another question:

I tried to put this code into the journal

' NX 6.0.5.3

Option Strict Off
Imports System
Imports NXOpen

Module NXJournal
    Sub Main()

        Dim theSession As Session = Session.GetSession()
        Dim workPart As Part = theSession.Parts.Work

        Dim displayPart As Part = theSession.Parts.Display

        Dim coordinates1 As Point3d = New Point3d(10, 20, 30)
        Dim point2 As Point
        point2 = workPart.Points.CreatePoint(coordinates1)

        point2.SetVisibility(SmartObject.VisibilityOption.Visible)

        point2.RedisplayObject()

    End Sub
End Module

And it works . . . I am happy

But when I put the same code into VB.NET Express 2010 IDE
At the debugging, I have this error !!!

Unable to load DLL 'libpart': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

The error is on this line : Dim theSession As Session = Session.GetSession()

What's wrong ???

Is there a special configuration to set into the IDE to use it with NX ?

Thank a lot in advance
 

RE: NXOpen VB.net programs

To debug an NXOpen program you need to do the following:

1. Start NX
2. Start VS with the project you want to debug
3. Create one or more break points in the project
4. In VS choose Debug->Attach to Process...
5. Choose ugraf.exe from the list of processes.  
6. In NX start running your project in whatever way you want (eg File->Execute->NX Open)
7. When one of the breakpoints gets reached NX will hang  while you step through the code.
8. When you want to stop debugging, in VS choose Debug->Detach All

I find this rather painfull so that when developing programs I typically list out values (using the NX listing window and create points to see how things are going.

By the way the reason I used the wrapper function for creating the point object was to demonstrate it with the minimum number of lines of code.

FrankSwinks
 

RE: NXOpen VB.net programs

I have the same problem when I try to run any thing...even the code generated by the nx7 wizard...am really stuck...can anyone help me please?

  

RE: NXOpen VB.net programs

hi!
    I have a problem accessing any kind of info from a session.

I always get a null ref exception whenever I try to access anything (part etc) from a session....

does anyone have any clue....???????

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources