Showing results for 
Search instead for 
Do you mean 
Reply

Receive email when simulation crashes or finishes NX10

[ Edited ]

Hi everyone,

 

lately I'm dealing with large simulation files in NX Flow which run for 12 hours upwards. Since I'm not able to access remotely to my workdesk, I was wondering if there is a way to receive an email to know if a simulation has abborted due to errors or has finished correctly.

 

Thanks a lot in advance

 

Eiko

2 REPLIES

Betreff: Receive email when simulation crashes or finishes NX10

[ Edited ]

Eiko,

 

because you did not get an answer from nx developer or siemens partners I think there is no way in nx itself for transerfing solving state informations by using E-Mail-activities.

 

But if you would use the command line abilities of nx for solving you also can combine it with command line e-mail programs like blat (see http://www.blat.net)

 

If you run your NX solution process as Batch-Script you can add a command for sending an E-Mail as last action:

 

>>>>>>>>>>>>>>>>>>>>>>>>> run_nx_solve.bat

ECHO OF
setlocal enabledelayedexpansion

 

REM NX-COMMAND LINE section ================================================

call ... +++ I do not know the corret command line for NX flow +++

 

REM E-MAIL-COMMAND LINE Section =============================================

set MAIL_PROGRAM=+++ C:\Program files\blat300\full\blat.exe or something like that +++

set MAIL_SERVER_STRING=+++ EMAIL SERVER like mail.arcor-ip.de +++
set MAIL_FROM_STRING=+++ EMAIL adress of sender +++

set MAIL_TO_STRING=+++ EMAIL adress of recipient +++

set MAIL_SUBJECT_STRING=+++ SUITABLE HEADLINE FOR EMAIL like "NXSolution process..." +++

 

set MAIL_BOBY_FILE=mail_body.txt

ECHO " " > mail_body.txt

ECHO "INSERT a suitable desription in body file" >> mail_body.txt

ECHO "Additional line" >> mail_body.txt

 

set MAIL_SIG_FILE=mail_signature.txt
ECHO _________________________________________> !MAIL_SIG_FILE!

ECHO automatially reated by ... >> !MAIL_SIG_FILE!

 

call !MAIL_PROGRAM! -to "!MAIL_TO_STRING!" -subject "!MAIL_SUBJECT_STRING!" -bodyF !MAIL_BODY_FILE! -server !MAIL_SERVER_STRING! -f !MAIL_FROM_STRING! -sig !MAIL_SIGNATURE_FILE!

 

IF EXIST !MAIL_SIG_FILE! del !MAIL_SIG_FILE!
IF EXIST !MAIL_BODY_FILE! del !MAIL_BODY_FILE!

 

REM END section ===========================================================

pause

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< run_nx_solve.bat

 

Try to enhance NX with your own E-MAIL notification! With a littly practice and knowledge in batch scripting you also can improve your message with informations out of nx log-files or protocol files. Additional date and time information or something like that are also good extensions.

 

Good luck, Michael

 

Edit: It only works with Windows.

Betreff: Receive email when simulation crashes or finishes NX10

[ Edited ]

Hey MiDi,

 

thank you very much for your help. I suspected there would not be a simple way to set it up but wanted to get sure first before getting into programming batch-files or vba scripts.

 

Nevertheless, thanks again!

 

----------------------------------------------------------------------------------------------------------------

PS: I've just written a Powershell Script file which works without problems.

 

# START MONITORING MODE for opened NX SOLUTION MONITOR
$SolverActive = Get-Process xcsmon_viewer -ErrorAction SilentlyContinue
$SolverActive.waitforexit()

 

# FILL-IN EMAIL
$SMTPServer = " " # SMTP Server adress
$SMTPPort = " " # SMTP Sending Port
$Username = " " # Your Email account with @...
$Password = " " # Your Email Password

$to = " " # Receivers Email adress
$subject = " " # Email Subject
$body = " " # Email Text
$attachment = "C:\test.txt" # If desired to add an attached file

 

# SEND EMAIL
Send-MailMessage -SmtpServer $SMTPServer -From $Username -To $to -Subject $subject -Body $body

 

write-host "Mail Sent" # Output message. Email has been sent

 

Remove-Variable SolverActive # Delete variable from memory

----------------------------------------------------------------------------------------------------------------

 

  1. Save the file filling in your data as a text-file. Afterwards change its ending to *.ps1
  2. Execute Windows Powershell 2.0
  3. Run the Powershell script as follows:
    PowerShell.exe –ExecutionPolicy Unrestricted –NoProfile –File “C:\test.ps1"
  4. As long as the Powershell window ist running, it will remain in monitoring mode. When the simulation in NX Flow finishes or crashes, the Solution Monitor will close and an email will be sent to given email adress
  5. INFO: McAfee causes problems because of blocking some ports. Adjustments may be necessary

 

 

Regards

Eiko