×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Help in a Journal with Process.Start command

Help in a Journal with Process.Start command

Help in a Journal with Process.Start command

(OP)
Hi

In this journal I get a blank output:
Dim outfile As String = _
"C:\haviv\_00_vita_vme_std\_m3u_assy_002" & "\ugiiOutput.txt"

? can someone help to explain this.

CODE -->

'Start an invisible process.

 'You can start a process and get its output without a visible window.
 'This shows how to changes to the System folder,
 'run the DOS Dir "*.exe" command and send the output to the Output.txt file.
 'The Windows XP command shell interpreter recognizes "&&" as a command separator,
 'thus, you can put multiple commands on a single line.

 ' "&&" command separator,
 ' ">>" redirects output into a file, append to existing 
 ' ">"  redirects output into a file, clear the existing. 
 ' Chr(34) = "

Option Strict Off

Imports System
Imports System.Diagnostics
Imports System.Security
Imports System.Windows.Forms

Module NXJournal

 Sub Main (ByVal args() As String)
 
    Dim myProcess As Process = New Process()
    Dim s As String

    Dim outfile As String = _
      "C:\haviv\_00_vita_vme_std\_m3u_assy_002" & "\ugiiOutput.txt" 
    '
    ' Get the System path. 
    '
    'Dim sysFolder As String = 
       'System.Environment.GetFolderPath(Environment.SpecialFolder.System)
    '
    Dim ugiiFolder As String = "C:\Program Files\Siemens\NX 8.5\UGII"

    MsgBox(" Changed to folder = " & ugiiFolder) 
    '
    ' Createe the command line. 
    '
    myProcess.StartInfo.FileName = "cmd.exe" 
    myProcess.StartInfo.Arguments = "/C cd " & ugiiFolder & _
        " && ug_clone -pim=Yes -o=clone:Import -Part=C:\_m3u_002\comp1.prt" & _
                                            " > " & Chr(34) & outfile & Chr(34) & " && exit"
    '
    ' Start the process in a hidden window.
    ' 
    myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal  'Hidden 
    myProcess.StartInfo.CreateNoWindow = False  'True 
    myProcess.Start()
    '
    ' Kill the process if it doesn't finish in one minute.
    ' 
    myProcess.WaitForExit() 
    'myProcess.WaitForExit(1000) 
    'If Not myProcess.HasExited Then 
        'myProcess.Kill() 
    'End If
    '
    ' Show the results.
    '
    MessageBox.Show("The 'ug_clone ' command window was " & _
        "closed at: " & myProcess.ExitTime & "." & System.Environment.NewLine & _
        "Exit Code: " & myProcess.ExitCode) 
    
    myProcess.Close()

 End Sub
End Module 

Thank you in advanced

RE: Help in a Journal with Process.Start command

If your intention is to import files to teamcenter, try using the "ugmanager_clone.bat" found in the UGMANAGER folder.

www.nxjournaling.com

RE: Help in a Journal with Process.Start command

(OP)
Cowski thank you.

My intention is to write a journal that run in native mode.
and manipulate an Assembly as the following:
Save original components parts names in part attribute.
change parts names to comply nxmanager mode, shorten long names
Replace spaces and like so.
and then run ug_clone.exe to import the assembly to nxmanager.

Thank you again.

RE: Help in a Journal with Process.Start command

In that case, definitely run "ugmanager_clone.bat" instead of ug_clone.
I ran your code on a test file and got an error of "need to have TCROOT/IMANROOT defined..." (yes we have TC installed). The "ugmanager_clone.bat" will set those environment variables before handing control over to ug_clone. Alternatively, you can set these variables yourself, before calling ug_clone.

www.nxjournaling.com

RE: Help in a Journal with Process.Start command

(OP)
Ahh OK thank you very much.

meanwhile I opened a command prompte window changed directory
To ugii and run this
ug_clone -help > out.txt and this indeed
created a blank out.txt file. ? ?

I'll try it with ugmanager_clone.bat

Thank you again.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources