admin 发表于 2018-6-5 16:10:49

202. NX命令行相关详细配置讲解

When starting the Visual Studio to build and/or debug NX applications, as well as when using NX utilities such as the signing tools or when running NX journals or applications, it is important that the command shell is set up correctly.This is especially important when you are working with multiple NX versions.


If you are only working with one version of NX, the easiest thing to do is:

    1) Use Control Panel-> System-> Advanced system settings-> Environment
      Variables set a user environment variable named MSVCDir to point to the VC
      folder under the main folder of your Visual Studio install, e.g.


            NX12.0:
                MSVCDir=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC
            NX11.0:
                MSVCDir=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC
            NX10.0:
                MSVCDir=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC
            NX9.0:
                MSVCDir=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC
            NX8.5:
                MSVCDir=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC
            NX7.5:
                MSVCDir=C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC
            NX6.0:
                MSVCDir=C:\Program Files (x86)\Microsoft Visual Studio 8\VC


    NOTE:These are typical install folder paths and may not match your set up!




    2) Start and NX Command Prompt window
      Start-> All Programs-> NX#-> NX Tools-> Command Prompt


      The new window should show that it is setting the environment for using the
      Microsoft Visual Studio.


Step 1) only needs to be done once.


Another way to get a shell environment which is exactly the same as NX's is to start a shell from within interactive NX using a custom button added to the toolbar using these steps:
    - in the Toolbar <RMB>Customize
    - on the Commands tab of the Customize dialog select Categories -> New Item
    - from Items, drag/drop New User Command onto the toolbar
    - on the new User Command button <RMB>Edit Action
    - on the Button Action dialog
      Type -> System Commands
      Enter an Action or Browse
            start "NX" cmd /k
      Enter Button Message Text
            NX Command Prompt
      OK
    - Close (Customize)




If you are working with multiple NX and their corresponding Visual Studio versions, then you might want to make a .bat file to start the NX Command Prompt for each one.The contents would look like this:


    set UGII_BASE_DIR=<as appropriate (see Help-> Log File)>
    set MSVCDir=<as appropriate (see above)>
    call "%UGII_BASE_DIR%\UGII\ugiicmd.bat" "%UGII_BASE_DIR%" AUTO
    for /F "usebackq delims==" %%i in (`env_print -n`) do set n=%%i
    for /F "usebackq delims=," %%i in (`env_print -m`) do set m=%%i
    if "%m%"=="" ( title %n% Command Prompt ) else ( title %m% Command Prompt )
    cmd


The 3 lines starting for/for/if put the NX version in the title bar of the command window.They can be omitted.


Put the .bat file or a shortcut to it on your desktop.<Double-click> to run it.


Once the shell is set up correctly, you should be able to start NX from the Command Prompt window using the command "ugii".


To start the Visual Studio to build or debug NXOpen applications, enter the command "devenv".


To run a journal in batch (background) mode:
run_journal <path to journal> -args <any journal args here>


页: [1]
查看完整版本: 202. NX命令行相关详细配置讲解