×
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

Connecting Visual Studio with NX

Connecting Visual Studio with NX

Connecting Visual Studio with NX

(OP)
Hello community!

My aim is to write VB code within Visual Studio and execute it directly in NX. I usually copied the source code from Studio and pasted it into the NX Journal Editor. Since the code is pretty easy there are no problems with this method. While working on complex projects with forms, images etc. it is not possible anymore to simply copy and paste. I know there exists some workarounds but it should be possible to launch a project directly from Studio in NX.

None of the information I researched for could finally solve the problem mentioned above.

Further information about the system:
Microsoft Visual Studio Professional 2013 (30 days trial)
NX 8.0.3.4
Windows 7 Professional, SP1, 64bit

The NX documentation gives a hint:

Quote (NX Open Programmer's Guide -> Wizard Setup)

For each wizard, copy any files and/or folders under each subdirectory from the kit to the Visual Studio installation. This example is for the C language so substitute VB or VC# and the appropriate subdirectory for the other languages. Copy:
%UGII_BASE_DIR%\UGOPEN\vs_files\VC\VCWizards\
to
C:/program Files\Microsoft Visual Studio *\VC\VCWizards\
and
%UGII_BASE_DIR%\UGOPEN\vs_files\VC\vcprojects\
to
C:/program Files\Microsoft Visual Studio *\VC\vcprojects\
Repeat for each language.
* represents the current version of the Studio software

After doing so and clicking in Studio on start -> new project there appears a new entry which is called “NX8 Open VB Wizard” under templates/Visual Basic. I select a save as path for the new project, hit OK and instantly get the error message: "creating project “NX8_Open_VB_Wizard1”... Project Creation Failed". The screen shows the old Studio welcome page again and nothing has happened at all.

Finally I have two questions:
1) What causes the error in Studio? Am I missing any point?
2) Do I still have to edit the “ufvars.bat“ file [%UGII_BASE_DIR%\UGOPEN] or is this step redundant in the latest Studio versions? Anyway I changed the MSVCDir variable several times, but without any success.
Latest try: set MSVCDir=C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE

Thanks in advance. winky smile

RE: Connecting Visual Studio with NX

(OP)
Is there any possibility to solve this problem?

RE: Connecting Visual Studio with NX

For me the wizard don't work too.

To correct this I create a blank Project, then:

Project>Properties>References>Add:
...\UII\managed\NXOpen.dll
...\UII\managed\NXOpen.UF.dll
...\UII\managed\NXOpen.Utilities.dll
...\UII\managed\NXOpenUI.dll

And

Project>Properties>Resources>Add Resource
...\UGOPEN\NXSigningResource.res

Regards,

Gelson Z. Nicoletto
Eng. Supervisor
Mould Desing
Brazil

RE: Connecting Visual Studio with NX

(OP)
Thanks for your help gelsonnicoletto!
I read your steps but still having some trouble with Studio.

What I did so far:
Studio 13: Visual Basic -> Windows -> blank project
After configuring the properties (as described):
Project map explorer: project -> right-click add windows forms (select Windows Form from list)
After doing so there appears some default Form1.vb inside the project map explorer.

I just placed a simple button on this form and wanted to start the program inside NX simply by pressing the F5 (start…) key in Studio.

CODE -->

Public Class Form1
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        MsgBox("Hello World")
	‘NX Code to edit parts and do stuff
    End Sub
End Class 

After pressing the F5 key I always get the following error message:
Project creation failed. Do you want to continue and execute the latest stable build?
YES -> Studio cannot start the debugging process due to the fact that some *MyProjectName.exe does not exist.

Additionally, I got an error in the error list:
“Sub main” wasn’t found in your project
Why do I need this? What’s the problem with the private sub?

Regards,
Polynom3000

RE: Connecting Visual Studio with NX

(OP)
Hi gelsonnicoletto,

Could you please provide me a full list of steps you followed in order to connect Studio with NX?
What is your Visual Studio Version (I am using a trial of Prof. 2013)?

Thanks a lot!

Regards,
Polynom3000

RE: Connecting Visual Studio with NX

You can follow the below steps.

Creation of Windows form Project in Visual Studio:
--------------------------------------------------

1) Launch Visual Studio
2) Go to Menu File->New->Project
3) Select Windows Form Application Project in window.( Specify Project Name and Location)
4) Click Ok
5) Now you a pre created structure in Solution Explorer with Form1.cs, References, Properties, Program.cs items.


Linking the NX Libraries with Windows Form Project:
--------------------------------------------------

1) Right click on the References folder in Solution Explorer and click "Add References"
2) Now Go to Browse tab and browse for below libraries.
<NX Installation Dir>\UII\managed\NXOpen.dll
<NX Installation Dir>\UII\managed\NXOpen.UF.dll
<NX Installation Dir>\UII\managed\NXOpen.Utilities.dll
<NX Installation Dir>\UII\managed\NXOpenUI.dll
3) Select the above mentioned libraries and Click ok.
4) Add resource file as mentioned by "gelsonnicoletto"
5) Now Add the NX library namespace in Form1.cs file. ( Like "using NXOpen;" "using NXOpen.UF;")
6) Add your customization code, Build and execute in NX.

Regards,
Mukundh


RE: Connecting Visual Studio with NX

(OP)
Now I am confused. After configuring as mentioned and clicking on debug -> start debugging (F5 key), I am still inside Visual Studio and the form1 window with my modifications (radiobuttons, labels etc.) appears on the screen (but inside Studio and not NX).

My aim is to write VB code only inside Visual Studio. I am developing inside Studio, so there still might be some errors while testing the results inside NX. Then I want to click on the start button inside Studio and my personally written program should automatically appear inside NX (therfore not in Studio). This means that all forms and other stuff is compiled “on the fly” and transferred to NX.

Is it possible to turn on a switch to “forward” or ”outsource” the debugging process to NX by only clicking the start button in Studio?
I don’t have a finished program yet, it is still growing, but I want to check the available results step by step and then extend it.
Sorry for all the confusion. winky smile

Regards,
Polynom3000

RE: Connecting Visual Studio with NX

Ok, as per my understanding that you want to debug the code written in Visual studio while running in NX.

1) Build the application. (Debug mode)
2) Execute the application in NX using Ctrl+U and browsing.
3) Now attach the visual studio program from Menu Tools->Attach to the process.
4) Browse for the ugraf.exe application and click attach.
5) Keep the beak point wherever required.


There is no direct process to launch NX and run your program to debug.

Regards,
Mukundh

RE: Connecting Visual Studio with NX

(OP)
All right, thanks!

Regards,
Polynom3000

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