Cancel
Showing results for 
Search instead for 
Did you mean: 

Wait for available SE license

Valued Contributor
Valued Contributor

Hi,

I'm creating a batch program that uses an available SE-license for creating STP- and PDF-files. The program is running on a server, and is started when an XML file (containing SE-file paths) is placed in a specific folder. When starting the process, it opens a new instance of Solid Edge, but when there's no license available, it shows the 'license exceeded' message.

 

I would like to catch when the licenses are unavailable, show none of the errors and let the program sleep for 30 seconds after trying again.

 

This is my Function that starts an instance of SE

 

public Application seApplication;
public Documents openDocuments;

public void startApplication() { seApplication = SolidEdgeUtils.Connect(true,false); seApplication.DoIdle(); if (seApplication != null) { seApplication.Visible = false; seApplication.DoIdle(); seApplication.ShowStartupScreen = false; seApplication.DisplayAlerts = false; seApplication.ScreenUpdating = false; seApplication.SetGlobalParameter(
ApplicationGlobalConstants.seApplicationGlobalDraftSaveAsPDFSheetOptions, 1);
// 0 - Active, 1 - All Sheets, 2 - Range seApplication.DoIdle(); } else { System.Threading.Thread.Sleep(30000); startApplication(); } }

 

________[Oo\____/oO]________

The truth is .... I am Dutch

C# - VS Ex 2015 - Solid Edge ST10 MP3 - TC11.4
Key-User, IT-student, no admin rights
11 REPLIES

Re: Wait for available SE license

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

@JanWillem,

 

you may spawn a process and running the "lmutil lmstat -a" command and then parse the output to check how many licenses are available, and how many are in use.

This will give you the information about the license availability and you run your batch or wait for another 30 seconds.

 

BTW: do not run your startApplication() method recursively, as it may fill up the memory stack on your server and cause it to stop responding. Use a loop which ends if the application could be started.

Re: Wait for available SE license

Valued Contributor
Valued Contributor

@MartinBernhard Thanks for your reply.

I've never done that, but would that be like a command prompt?

I tried it, but it doesn't return anything usefull.

 

public void checkLicense()
{
Process cmd = new Process();
cmd.StartInfo.FileName = "cmd.exe";
cmd.StartInfo.RedirectStandardInput = true;
cmd.StartInfo.RedirectStandardOutput = true;
cmd.StartInfo.CreateNoWindow = true;
cmd.StartInfo.UseShellExecute = false;
cmd.Start();

cmd.StandardInput.WriteLine("lmutil lmstat -a");
cmd.StandardInput.Flush();
cmd.StandardInput.Close();
cmd.WaitForExit();
Console.WriteLine(cmd.StandardOutput.ReadToEnd());
}

Running it directly in cmd also doesn't work (not recognized).

 

Also, you're totally right about the recursion mistake, thanks!

 

________[Oo\____/oO]________

The truth is .... I am Dutch

C# - VS Ex 2015 - Solid Edge ST10 MP3 - TC11.4
Key-User, IT-student, no admin rights

Re: Wait for available SE license

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

You may need to use the full path to the lmutil tool, which is normally distributed with the FlexLM license server.

Re: Wait for available SE license

Valued Contributor
Valued Contributor

I personally don't have access to the server, so I can't search for it myself.

The system administrator of our company can, but he can't find the tool.

Might it be called lmtool? Because that's what he found.

We have Solid Edge ST10 MP3.

 

I did find out that using License Borrowing only shows the info when you actually have a license in use. So when there's no license available, you can't use this tool to see who is currently using a license.

________[Oo\____/oO]________

The truth is .... I am Dutch

C# - VS Ex 2015 - Solid Edge ST10 MP3 - TC11.4
Key-User, IT-student, no admin rights

Re: Wait for available SE license

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

If you have installed the Siemens PLM License Server shipped with SE, then there should be directly a "lmstat.exe" file. It is mainly a copy (or hardlink) of the original lmutil.exe file and renamed to lmstat.

 

If you are using the license server from NX, then there is only the "lmutil.exe" tool, which you have to call with the lmstat parameter.

 

While the lmstat.exe and lmutil.exe tools are command line programs, the lmtools.exe is a front end to the lmutil program with some user interface!

Both executables are normally located in the same folder.

Re: Wait for available SE license

Valued Contributor
Valued Contributor

Thanks for the clarification.

We found the lmstat executable, but running it brings up the error attached.

We also found the lmPath executable, and figured this might allow us to change the search location.

Is this the case, and would it be wise the change this while my colleagues are using Solid Edge?

I don't want to cause any problems with the license server.

 

________[Oo\____/oO]________

The truth is .... I am Dutch

C# - VS Ex 2015 - Solid Edge ST10 MP3 - TC11.4
Key-User, IT-student, no admin rights

Re: Wait for available SE license

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

I don't have a license server installed, so I was just suggesting from help.

Use the command with the -c option:

lmstat -c <license_file> -a

 

In relation to the lmpath command, I don't have experience on that.

You may read here to look for the usage of the different FlexLM license utility commands. It's the documentation from another product, but the FlexLM is mainly the same.

Re: Wait for available SE license

Valued Contributor
Valued Contributor

I have been doing some other work, and last week I did some stuff with command prompt. Now that I know some of the basics, I was comfortable restarting to work on this issue. I have managed to get information from the license server, which, among other infor, contains the following line:

 

Users of solidedgeclassic: (Total of 6 licenses issued; Total of 6 licenses in use)


The 6 licenses issued may grow in the future. The 6 licenses in use changes when anyone opens or closes an application of solidedgeclassic. Does anyone know how to compare the two values, and create an IF-statement with that?

________[Oo\____/oO]________

The truth is .... I am Dutch

C# - VS Ex 2015 - Solid Edge ST10 MP3 - TC11.4
Key-User, IT-student, no admin rights

Re: Wait for available SE license

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

As the wording always seems to be the same, you may use regular expressions to find this line from the output and to retrieve the two values from it.

I have developed a SE Starter application for our customers, which use multiple licenses of different type, e.g. Premium and Classic, and my app allows them to easily switch between the license types on startup and to see which license is used by whom.

SE_Starter_UI.png