Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Journal function don't do what documentation say.

Status
Not open for further replies.

Ehaviv

Computer
Jul 2, 2003
1,012
Hi

This is a revised journal (journal from this forum)
I added these 2 lines

Dim File,Window As ListingWindow.DeviceType
lw.SelectDevice(File, "C:\vita_vme_std\Export\cloning_log.txt")


but the cloning log don't go to the file
instead it still go to the information window.

Can someone give a clue, what wrong.

Thanks in advanced.

Code:
 'Here is a basic code snippet that will add the current displayed assembly to
 'the clone process, apply a naming rule (in this case adding "-"
 'to the end of every component), and define the output folder:

Option Strict Off
Imports System
Imports System.Windows.Forms
Imports NXOpen
Imports NXOpen.Assemblies
Imports NXOpenUI
Imports NXOpenUI.FormUtilities
Imports NXOpen.UF

Module Module1
 Public Sub Main()

        Dim theSession As Session = Session.GetSession()
        Dim theUISession As UI = UI.GetUI
        Dim workPart As Part = theSession.Parts.Work
        Dim displayPart As Part = theSession.Parts.Display
        Dim theUFS As NXOpen.UF.UFSession = NXOpen.UF.UFSession.GetUFSession()
        Dim lw As ListingWindow = theSession.ListingWindow
        Dim Current_Assembly As String = displayPart.FullPath

   Dim File,Window As ListingWindow.DeviceType
   lw.SelectDevice(File, "C:\vita_vme_std\Export\cloning_log.txt") 

   Dim cloner As NXOpen.UF.UFClone = theUFS.Clone
        cloner.Terminate()
        cloner.Initialise(NXOpen.UF.UFClone.OperationClass.CloneOperation)
        cloner.SetDefNaming(UFClone.NamingTechnique.NamingRule)
        cloner.SetDefDirectory("C:\vita_vme_std\Export\\Export")
        cloner.AddAssembly(Current_Assembly, Nothing)

        Dim opt As NXOpen.UF.UFClone.ExLogOpts
        opt.allow_missing_components = False

        Dim namerule1 As NXOpen.UF.UFClone.NameRuleDef
        namerule1.type = UFClone.NameRuleType.AppendString
        namerule1.new_string = "-"

        cloner.SetNameRule(namerule1, Nothing)
        cloner.SetDryrun(False)
        cloner.PerformClone(Nothing)
        cloner.Terminate()
 End Sub

 Public Function GetUnloadOption(ByVal dummy As String) As Integer
        'Unloads the image when the NX session terminates
        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination
 End Function

End Module
 
Replies continue below

Recommended for you

Some example code is below:

Code:
'use listing window to write to file and window
lw.SelectDevice(ListingWindow.DeviceType.FileAndWindow, outputFile)
lw.Open()
 
'write information to listing window
lw.WriteLine("full path: " & workPart.FullPath)
lw.WriteLine(New String("-", ("full path: " & workPart.FullPath).Length))
lw.WriteLine("file name: " & fileName)
lw.WriteLine("file name w/o extension: " & fileNameNoExt)
lw.WriteLine("parent folder: " & parentFolder)
lw.WriteLine("root folder: " & root)
lw.WriteLine("")
 
lw.Close()
'flush file buffer by changing listing window device
lw.SelectDevice(ListingWindow.DeviceType.Window, "")

You can find the above code and some more explanation in the article here.

www.nxjournaling.com
 
Are you mean that adding
lw.open() and the flush command
to my journal will amended the journal.
 
Are you mean that adding
lw.open() and the flush command
to my journal will repairs the journal.
 
Double check the .SelectDevice method. The way you are doing it looks odd to me; I'm not sure why you are declaring a variable as a DeviceType. You should specify the device type from the NXOpen API's enumeration. And, yes, you should change the device type to flush the buffer (which will write the info to the file).

Also note that some operations (such as cloning) may ignore your settings and do what they want. Below are a couple of threads from the Siemens programming forum:



www.nxjournaling.com
 
Hi Cowski I'm very thank you for that helpful information.

Maybe I need to live with those pop up cloning reports.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor