×
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

linking ugopen to visual studio

linking ugopen to visual studio

linking ugopen to visual studio

(OP)
Hi all
Is there a documentation about how to configure visual studio when it tries to link with ugopen? I am currently using visual studio 2012.
when I try to build a simple program using uf functions (only had two functions been called from uf.h, i.e., UF_initialize and UF_terminate), it gives me such errors:

1>------ Build started: Project: NXTest1, Configuration: Debug Win32 ------
1>NXTest1.obj : error LNK2019: unresolved external symbol __imp__UF_initialize referenced in function _main
1>NXTest1.obj : error LNK2019: unresolved external symbol __imp__UF_terminate referenced in function _main
1>D:\Gan_Software\VisualStudio\projects\NXTest1\Debug\NXTest1.exe : fatal error LNK1120: 2 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

If I use the variables defined by nx, such as, "uf_list_p_t", it works ok. The compiler only gives error msg when it calls the functions from ugopen. I guess the solution could be very simple, maybe it because that it cannot find the source code for the functions and just need to include some library paths. But I tried to include all lib directories in the visual studio, and still doesn't work.

Someone please help!

Many thanks!

RE: linking ugopen to visual studio

The programmer's guide in the NX help files will guide you through setting up VS to work with NX.

www.nxjournaling.com

RE: linking ugopen to visual studio

Do You think of this:

NX Open Visual Basic (VB) wizard
Creating a Visual Basic project using the NX Open VB wizard
The following topic describes how to develop an NX Open Visual Basic application using Microsoft Visual Studio. It is recommended that all NX Open Visual Basic program development on Windows be done from a Visual Basic project

Starting Visual Studio
You can start Visual Studio by typing "devenv.exe" from an NX command prompt window. Studio will pick up the required NX environment variables necessary to compile and link a project.

Creating a Visual Basic project
Use the Visual Basic wizard whenever you need to create a new NX Open automation program in Visual Studio with the Visual Basic language. The wizard automatically adds the required references to NX Open libraries in the new project.

Using the NX Open VB wizard
To use the NX Open VB wizard:

Step 1. Select the File→New→Project menu item to activate the New dialog box.

Step 2. Under Project Types, expand Other languages and select Visual Basic.

Step 3. Select NX#_VB from the list of Templates (where # is the NX version).

Step 4. Enter a project name into the "Project name:" dynamic input box. By default this becomes the name portion of the program being built. For instance, a project named "MyNXOpenApp" produces either a "MyNXOpenApp.dll" or "MyNXOpenApp.exe". You can override this later, if necessary.

Step 5. Click OK and follow the on-screen instructions to create your Visual Basic project.
?

I have installed both NX and VS2010express, but I have no devenv.exe at all..
What is the problem? What is devenv.exe?

----
kukelyk

RE: linking ugopen to visual studio

(OP)
Hello, the problem has been solved. It due to the environment setting and 64/32 bit version issue.

Many thanks for your help!
Gan

RE: linking ugopen to visual studio

Could You write me the steps needed?

----
kukelyk

RE: linking ugopen to visual studio

(OP)
Sorry, I only used VS C++ to implement my program, and I don't use vb.

RE: linking ugopen to visual studio

(OP)
If you want, I can post the vs c++ project files online.

RE: linking ugopen to visual studio

I am also facing the same problem kindly post the procedure.

RE: linking ugopen to visual studio

Hello.
I have similar issues in attempting to link UG (NX7.5) to Visual Studio Professional 2012 (Version 11.0.60610.1 Q11REL). I've copied all network NX files to the VB folders as described below:
• 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 8\VC\VCWizards\
and
%UGII_BASE_DIR%\UGOPEN\vs_files\VC\vcprojects\
to
C:/program Files\Microsoft Visual Studio 8\VC\vcprojects\


But when I use the NX Command prompt, then change the path to the location of the devenv.exe, then type devenv.exe <return>, it starts Visual Studio as normal and without the NX Wizard. Any suggestions on how to get the NX Wizard within Visual Studio operational?

Thank you for your help.

RE: linking ugopen to visual studio

I have successfully used the NX wizards with VB.net 2010 express. I downloaded VB.net 2012 express a while back, but was never able to get the wizards to work. NX 7.5 came out well before VS 2012, my best guess is that MS changed something that broke the NX wizards.

Using the 2012 version, I started a new project, copied & pasted the boiler plate code from the NX wizards, added references to the NX .dll files, and saved it as a template. Not quite as handy as the code wizards, but it is a workable solution.

www.nxjournaling.com

RE: linking ugopen to visual studio

Thank you cowski for your directions.

Since I have not been able to get the NX wizards to run ever, could you please let me know what boiler plate code you used (or which files I might search to locate this initial code) as well as what references used to the NX .dll driver files so I can build my template too?

Thank you once again for your tremendous help.

RE: linking ugopen to visual studio

If you open a windows explorer and browse to [NX install directory]\UGOPEN\vs_files\VB\VBWizards\NX7_VB\Templates\1033\vbfile.vb, you will see all the code that the wizards reference. This file contains several if/end if statements that will build up the starting code based on inputs to the wizard.

I most often use the "explicit activation" and "import NXOpen.UF" options; the resulting code looks something like this:

CODE

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF

Module Module1

    Sub Main()

        Dim theSession As Session = Session.GetSession()
        Dim theUfSession As UFSession = UFSession.GetUFSession

        'TO DO: add your code here

    End Sub


    Public Function GetUnloadOption(ByVal dummy As String) As Integer

        'Unloads the image when the NX session terminates
        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination

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

        'Unloads the image explicitly, via an unload dialog
        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly
        '-------------------------------

    End Function

End Module 

From the [NX install directory]\UGII\managed directory, the referenced .dll's are:
  • NXOpen.dll
  • NXOpen.UF.dll
  • NXOpen.Utilities.dll
  • NXOpenUI.dll
From the .net framework folder, the referenced .dll's are:
  • System.dll
  • System.Data.dll
  • System.Deployment.dll
  • System.Xml.dll

www.nxjournaling.com

RE: linking ugopen to visual studio

Quote (Cowski)

I have successfully used the NX wizards with VB.net 2010 express. I downloaded VB.net 2012 express a while back, but was never able to get the wizards to work. NX 7.5 came out well before VS 2012, my best guess is that MS changed something that broke the NX wizards.

Using the 2012 version, I started a new project, copied & pasted the boiler plate code from the NX wizards, added references to the NX .dll files, and saved it as a template. Not quite as handy as the code wizards, but it is a workable solution.

Here is my work around for this issue since Microsoft killed the wizards after 2010:
I downloaded VS2013(Visual Studio), I created a project using the wizard in 2010 Express(Free), imported it into 2013, and exported it as a template. This allows me to run all the code analysis and use full capabilities of projects in VS, I do not have an Author license so I can't sign any of the products of compilation but the .vb file generated from it is exactly what I need for journaling.

This should be able to work for 2012 as well, but I do not have a seed to confirm.

DHuskic
Data Prep NX7.5
Kettering University Class of '17

RE: linking ugopen to visual studio

Thank you very much cowski for your boiler plate code, driver files, and locations of them. Over the next few days at work, I'll have to see if I can get my template created to work along with having VB forms linked to the code, which is where I'm always stumped. Afterwards, I'll let you know if I am successful.
Thank you again for your awesome help!

Also, thank you DHuskic for your excellent input as well. But for my position at work, we are not allowed to load software (even freeware) onto our workstations. But if worse comes worse, I might see if one of the IT guys can load it with proper approvals and attempt making the modifications as you've suggested. Thank you.

RE: linking ugopen to visual studio

I am running NX 8.0.3.4 and have Visual Express 2010.
I copied all the Wizard files from UG to Microsoft Visual Studio 10.0.

1) Can someone give me detailed instructions on how to set the MSVCDir environment variable?

When I run NX tools --> comand prompt I get that message MSVCDir environment variable not defined.
It states that i must modify the ufvars.bat file.
I tried modifying but it doesnt work.

Can the MSVCDir be created in regedit ? If yes then where exactly ?

2) Also the devenv.exe is not recognized as a command? How do you fix this?

RE: linking ugopen to visual studio

Install the Visual Studio Professional.

devenv.exe should be found. If not the installation is incorrect.

Regards,
Mukundh

RE: linking ugopen to visual studio

I found out that express doesnt have the devenv.exe

Express has vbexpress.exe
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\vbexpress.exe

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