Cancel
Showing results for 
Search instead for 
Did you mean: 

List of users and relative NX version+build

Phenom
Phenom

Hi,

actually, we update NX manually. I send an e-mail to our colleagues where reside the NX update and how to update, but not all my colleague are updated NX. I would like a report, so I can call them and oblige to update NX.

Thank you...

Using NX1876
RuleDesigner PDM

12 REPLIES 12

Re: List of users and relative NX version+build

Valued Contributor
Valued Contributor

Hey there,

 

not sure if this is the best way but you could make an application that gets triggered on NX Startup.

 

This may help as a start:

using System;
using NXOpen;
using System.IO;

public class Program
{
    private static Session theSession;
    private static UI theUI;
    public static Program theProgram;
    public static bool isDisposeCalled;

    public Program()
    {
        try
        {
            theSession = Session.GetSession();
            theUI = UI.GetUI();
            isDisposeCalled = false;
        }
        catch (NXOpen.NXException ex)
        {
            theUI.NXMessageBox.Show("Error", NXMessageBox.DialogType.Error, $"{ex.Message}\n\n{ex.StackTrace}");
        }
    }

    public static int Startup()
    {
        int retValue = 0;
        try
        {
            theProgram = new Program();

            using (StreamWriter w = File.AppendText(@"C:\Temp\NXUsers.log"))
            {
                w.Write($"{Environment.UserName} - {theSession.GetEnvironmentVariableValue("UGII_FULL_VERSION")}" + Environment.NewLine);
            }

        }
        catch (NXOpen.NXException ex)
        {
            theUI.NXMessageBox.Show("Error", NXMessageBox.DialogType.Error, $"{ex.Message}\n\n{ex.StackTrace}");
        }
        return retValue;
    }

    public void Dispose()
    {
        try
        {
            if (isDisposeCalled == false)
            {
            }
            isDisposeCalled = true;
        }
        catch (NXOpen.NXException ex)
        {
            theUI.NXMessageBox.Show("Error", NXMessageBox.DialogType.Error, $"{ex.Message}\n\n{ex.StackTrace}");
        }
    }

    public static int GetUnloadOption(string arg)
    {
        return System.Convert.ToInt32(Session.LibraryUnloadOption.Immediately);
    }

}

 

This one will write a file called "NXUsers.log" in C:\Temp and will write Username + NX Version like this:

USERNAME - v12.0.2.9

 

To execute the DLL at NX-start you have to copy the DLL to the "startup" folder instead of the "application" folder.

Just change the path to a serverlocation where all NX-Users have access to.

 

 

Sorry for the long code, I used the NXWizard in Visual Studio for this Smiley Very Happy

Highlighted

Re: List of users and relative NX version+build

Legend
Legend

You don't need a DLL for this.

just add following line to startup script

 

%username%;%UGII_ROOT_DIR%\env_print -n >> \\NetworkShare\NxVersions.csv

Csv-file you can open in Excel and use autofilter 

 

2019-06-25 09_35_05-Window.jpg

Frederik Verscheure
Evolve Consulting bvba
Freelance NX & Teamcenter consultant
frederik@evolve-consulting.be

Re: List of users and relative NX version+build

Phenom
Phenom

Hi @evolve ,

can you describe an example of what do you mean on startup script?

Thank you...

Using NX1876
RuleDesigner PDM

Re: List of users and relative NX version+build

Legend
Legend

@cubalibre00 

 

I assume that you have a startup script since you have multiple users. It's used to set variables to point a custom environment on the server and not to the local install of NX.

The script is a batch file. You can edit it in notepad.

 

Right click on the NX shortcut on your desktop and choose "open file location". There a 2 posibilities

1.  If it points to and EXE-file in the NX install folder then you don't have startup script.

2. Otherwise it will point to the startup script you need to edit.

Frederik Verscheure
Evolve Consulting bvba
Freelance NX & Teamcenter consultant
frederik@evolve-consulting.be

Re: List of users and relative NX version+build

Phenom
Phenom

Hi @evolve ,

We don't have a startup script. Each user starts NX from Win and NX read a shared ugii_env_file.dat. This is our customization.

Thank you...

Using NX1876
RuleDesigner PDM

Re: List of users and relative NX version+build

Legend
Legend

How do you share this ugii_env.dat file? do you copy it to each computer and overwrite it in the NX folder?

 

You should create a simple startup script and put this ugii_env.dat file on the network together with other site/custom configurations?

How do you manage the site settings from the customer defaults?

Frederik Verscheure
Evolve Consulting bvba
Freelance NX & Teamcenter consultant
frederik@evolve-consulting.be

Re: List of users and relative NX version+build

Phenom
Phenom

@evolve ,

we have set one environment variable on each computer called UGII_ENV_FILE=\\server\...\ugii_env_file.dat

And all customizations are shared on the server and the ugii_env_file.dat contain the information where the customization is located. That all.

Thank you...

Using NX1876
RuleDesigner PDM

Re: List of users and relative NX version+build

Legend
Legend

Ok, now i understand how your environment is configured.

 

below is a sample of a startup script the you can use. Paste this in a text file called "StartScript_NX.bat" and run it

Offcourse you need to edit the text to match your environment.

 

@echo off

set UGII_ENV_FILE=\\server\..\ugii_env_file.dat
%username%;%UGII_ROOT_DIR%\env_print -n >> \\NetworkShare\NxVersions.csv "%UGII_BASE_DIR%\NXBIN\ugraf.exe"

 

Frederik Verscheure
Evolve Consulting bvba
Freelance NX & Teamcenter consultant
frederik@evolve-consulting.be

Re: List of users and relative NX version+build

Legend
Legend

I just thought of something. The most extensive startup script is managed by Gerrit Koelewijn. He makes a template for each new NX-version.

 

https://community.plm.automation.siemens.com/t5/NX-Programming-Customization-Forum/NXcustom-Utilitie...

 

Frederik Verscheure
Evolve Consulting bvba
Freelance NX & Teamcenter consultant
frederik@evolve-consulting.be