Programming Pure VB 2012 with forms and dialog boxes together with NX 7.5
Programming Pure VB 2012 with forms and dialog boxes together with NX 7.5
(OP)
Hello all,
Can anyone please help me? I am working with NX 7.5 - mostly the drafting side as well as some modeling. And I just had the full Visual Studio with Visual Basic (VB) 2012 loaded.
I've been able to generate simple VB code to run inside of NX 7.5. But I would like to write code as well as developing forms with buttons, scroll bars, etc. that allows the user to have multiple options to run the programs.
Subsequently, can you please provide me with sample code(s) including how to set the entire code to speak to NX and/or direct me to websites containing examples of the full VB package with example codes containing connections to NX?
Thank you very much for your response(s) ahead of time!
Can anyone please help me? I am working with NX 7.5 - mostly the drafting side as well as some modeling. And I just had the full Visual Studio with Visual Basic (VB) 2012 loaded.
I've been able to generate simple VB code to run inside of NX 7.5. But I would like to write code as well as developing forms with buttons, scroll bars, etc. that allows the user to have multiple options to run the programs.
Subsequently, can you please provide me with sample code(s) including how to set the entire code to speak to NX and/or direct me to websites containing examples of the full VB package with example codes containing connections to NX?
Thank you very much for your response(s) ahead of time!





RE: Programming Pure VB 2012 with forms and dialog boxes together with NX 7.5
www.nxjournaling.com
RE: Programming Pure VB 2012 with forms and dialog boxes together with NX 7.5
Currently, the following softwares and installations are on my machine:
Teamcenter (TC) -> NX7.5 – not loaded on individual machines, but running off of a server
Native NX7.5 (rarely used, less than 0.1%) – also not loaded on individual machines, but running off of a server
Visual Studio 2012 – installed last week directly on my machine
I located both the “NX Open Visual Basic (VB) Wizard” and the “Visual Studio (VS) Application Wizard Setup,” in which I copied the directions in the attached file (NX Open VB & VS App Wizards.docx). Which wizard should I run first once I locate them?
From the NX Open Visual Basic (VB) Wizard, it reads “You can start Visual Studio by typing ‘devenv.exe’ from an NX command prompt window.” Do you know where the “NX command prompt window” is located? I’ve searched all over NX as well as going through numerous Help files and still cannot find it.
Also, as indicated in this same directions file (NX Open Visual Basic (VB) Wizard) under the “Using the NX Open VB wizard” section, Step 1 says “Select the File→New→Project menu item to activate the New dialog box.” I found this to be within VS according to directions from another web page (http://share.pdfonline.com/1843125f096349ccb6b1c02...). But I’m having difficulties getting to Step 2 – “Under Project Types, expand Other languages and select Visual Basic.” Is this because NX 7.5 is not loaded directly on my machine, but instead is running off a server and running through TC?
Within the “Visual Studio Application Wizard Setup,” how can you determine if the “appropriate version Microsoft Visual Studio has been installed”? Also, with my license of TC→NX7.5 running off a server, should the “%UGII_BASE_DIR%\UGOPEN\vs_files\VB\VBWizards\” and “%UGII_BASE_DIR%\UGOPEN\vs_files\VB\vbprojects\” folders have the same folder structure as licenses loaded in individual machines? (I only ask this because our Helpdesk IT support staff will want to know once I put in a Helpdesk ticket).
Thank you again for your help, which I greatly appreciate!
NXProf
RE: Programming Pure VB 2012 with forms and dialog boxes together with NX 7.5
The NX command prompt window can be started from Start -> NX 7.5 -> NX Tools -> Command Prompt.
But I never start VS this way. Once the wizards are setup you can just start VS the normal way, start a new project and select the NX template.
I imagine the folder structure will be the same, but you will have to look on the server to find the %UGII_BASE_DIR%.
www.nxjournaling.com
RE: Programming Pure VB 2012 with forms and dialog boxes together with NX 7.5
I have been able to do the following 4 steps with no issues:
1) Copied all NX files/folders from the network drive … \vs_files\VB\VBWizards\
to D:\Microsoft Visual Studio 11.0\VB\VBWizards\
and copied all NX files/folders from the network drive
…\vs_files\VB\VBprojects\
to D:\Microsoft Visual Studio 11.0\VB\VBprojects\
2) Within the D:\Microsoft Visual Studio 11.0\VB\VBprojects\NX7_VB.vsz file, I changed the 2nd line from “Wizard=VsWizard.VsWizardEngine.9.0” to “…VsWizardEngine.11.0” since my VS version is 11.0.
3) I found the NX command prompt via Start -> All Programs -> Technical Applications -> Teamcenter -> NX command prompt and changed the current folder as D:\Microsoft Visual Studio 11.0\Common7\IDE\, then typed devenv.exe, which started Visual Studio 2012, but appeared to be a normal startup session without establishing any Wizard settings. But I can’t tell.
4) I followed the directions to “Creating a Visual Basic project using the NX Open VB wizard” up to the point where is says “Step 1 Select the File→New→Project menu item to activate the New dialog box.”
When I get to VS, the actual starting of a project is File→NewProject (and not File→New→Project), which I start. Then when expanding the “Installed” tree for a New Project to go to Step 2 “Under Project Types, expand Other languages and select Visual Basic,” Visual Basic is listed under the Templates tree limb, but not under Other Languages. (Please see attached, which shows all expanded). Then Step 3 says “Select NX#_VB from the list of Templates (where # is the NX version).”
But at this point, I do not see “NX#_VB from the list of Templates.” Is there something I might be missing to properly get the NX Open VB wizard started?
Thank you again for your help!
RE: Programming Pure VB 2012 with forms and dialog boxes together with NX 7.5
www.nxjournaling.com
RE: Programming Pure VB 2012 with forms and dialog boxes together with NX 7.5
I'll see if I can get VS2010. Do you know what version of NX works with VS2010? Currently I'm running NX 7.5.
Thank you again for your outstanding help!
RE: Programming Pure VB 2012 with forms and dialog boxes together with NX 7.5
www.nxjournaling.com
RE: Programming Pure VB 2012 with forms and dialog boxes together with NX 7.5
www.nxjournaling.com
RE: Programming Pure VB 2012 with forms and dialog boxes together with NX 7.5
I'll have to see if I can downgrade my VS from 2012 to 2010 and then see if the wizard will work. But before downgrading, I might attempt to "add the references." Do you know how I can get started?
Best regards.
RE: Programming Pure VB 2012 with forms and dialog boxes together with NX 7.5
Now replace the existing code in the .vb file with this:
CODE
Option Strict Off Imports System Imports NXOpen Imports NXOpen.UF Module Module1 ' Explicit Activation ' This entry point is used to activate the application explicitly Sub Main() Dim theSession As Session = Session.GetSession() Dim theUfSession As UFSession = UFSession.GetUFSession() ' TODO: Add your application code here End Sub Public Function GetUnloadOption(ByVal dummy As String) As Integer 'Unloads the image immediately after execution within NX GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately '----Other unload options------- 'Unloads the image when the NX session terminates 'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination 'Unloads the image explicitly, via an unload dialog 'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly '------------------------------- End Function End Modulewww.nxjournaling.com