×
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

Journal function don't do what documentation say.

Journal function don't do what documentation say.

Journal function don't do what documentation say.

(OP)
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 

RE: Journal function don't do what documentation say.

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

RE: Journal function don't do what documentation say.

(OP)
Are you mean that adding
lw.open() and the flush command
to my journal will amended the journal.

RE: Journal function don't do what documentation say.

(OP)
Are you mean that adding
lw.open() and the flush command
to my journal will repairs the journal.

RE: Journal function don't do what documentation say.

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:

https://community.plm.automation.siemens.com/t5/NX...

https://community.plm.automation.siemens.com/t5/NX...

www.nxjournaling.com

RE: Journal function don't do what documentation say.

(OP)
Hi Cowski I'm very thank you for that helpful information.

Maybe I need to live with those pop up cloning reports.

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