×
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

Select group by them name in a journal

Select group by them name in a journal

Select group by them name in a journal

(OP)
Hi,

Is it possible in a journal to select some groups by them names?

I want to select groups whom the name begin by "post_" in a .sim file.

Thanks

Bastien
NX7.5.4.4

RE: Select group by them name in a journal

Bastien,

I work for Siemens PLM and know a couple guys familiar with NX Open. I'm ghost writing for them. Without knowing the intent of the group query, here are a couple suggestions from them (i.e. not me):

loop through the groups to find the desired name, i.e.:

        ' Get the base part
        Dim basePart As BasePart = theSession.Parts.BaseWork

        ' Test to ensure it is a SIM part
        If (basePart Is Nothing Or Not TypeOf basePart Is CAE.SimPart) Then
            theNXMessageBox.Show(MessageBoxTitle, NXMessageBox.DialogType.Error, "SIM Part must be loaded")
            Return
        End If

        Dim simPart As CAE.SimPart = CType(basePart, CAE.SimPart)

        For Each caeGroup As CAE.CaeGroup In simPart.CaeGroups.ToArray
            If Left(caeGroup.Name, 5) = "post_" Then
                ' Insert your code here
            End If

            'Alternative
            If InStr(caeGroup.Name, "post_") = 1 Then
                ' Insert your code here
            End If
        Next caeGroup

A similar approach is shown next. The point of emphasis is identifying the groups by looping through them similar to what is above:

        Dim groups As CAE.CaeGroup() = part.CaeGroups().ToArray()

        For Each group As CAE.CaeGroup In groups

            If group.Name.StartsWith("post_") Then

            End If
        Next ' For Each group

The VB program below (and attached as a file) will cycle through all groups in a SIM file and output data to the information window. This was written with NX 7.5.4. I successfully tested it with NX 7.5.4 but didn't try other versions. The check for the group name is case sensitive. I tried groups named "Post_*" and "post_*". It listed out the "post_*" groups only.

' NX 7.5.4.0
' Journal created by golfisd on Tue Apr 12 13:26:24 2011 Eastern Daylight Time
'
Option Strict Off
Imports System
Imports NXOpen

Module NXJournal88
    Dim theSession As Session = Session.GetSession()
    Dim theResultManager As CAE.ResultManager = theSession.ResultManager
    Dim theLW As ListingWindow = theSession.ListingWindow

    Sub Main()
        Dim detailLevel As Integer = 0
        Dim basePart As BasePart = theSession.Parts.BaseWork

        Dim caePart As CAE.CaePart = Nothing

        If TypeOf basePart Is CAE.CaePart Then
            caePart = CType(basePart, CAE.CaePart)
        End If

        processCaePart(caePart, detailLevel)

    End Sub
    Sub processCaePart(ByVal part As CAE.CaePart, ByVal detailLevel As Integer)


        If part Is Nothing Then
            WriteLine(" CaePart:: nothing input ")
            Return
        End If



        Dim groups As CAE.CaeGroup() = part.CaeGroups().ToArray()

        WriteLine("CaePart named [" + part.FullPath + "]  has nCaeGroups = [" + groups.Length.ToString + "] tag = " + part.Tag.ToString)

        For Each group As CAE.CaeGroup In groups

            If group.Name.StartsWith("post_") Then

                Dim taggedObjs As TaggedObject() = group.GetEntities()

                WriteLine("  CaeGroup named [" + group.Name + "] nMembers = " + taggedObjs.Length.ToString + " tag = " + group.Tag.ToString + " type = " + group.GetType.ToString)


                If detailLevel > 0 Then

                    For Each taggedObj As TaggedObject In taggedObjs
                        WriteLine("    Member Tag =" + taggedObj.Tag.ToString + " Obj Type = " + taggedObj.GetType.ToString)

                    Next 'For Each taggedObj

                End If ' if detailLevel > 0
            End If
        Next ' For Each group

    End Sub
    Sub WriteLine(ByRef line As String)
        Dim theLW As ListingWindow = theSession.ListingWindow

        If (theLW.IsOpen = False) Then theLW.Open()

        theLW.WriteLine(line)

    End Sub
End Module

Regards,
Mark

Mark Lamping
CAE Technical Consultant
Siemens PLM Software
(513) 576-2073
mark.lamping@siemens.com
 

RE: Select group by them name in a journal

(OP)
Mark,

thanks you, it's work.

I work on journals in .sim files. I'm a beginner.

Have you some samples of journals to execute in .sim files?

Thanks.
Bastien.

RE: Select group by them name in a journal

Bastien,

There are a few CAE oriented NX Open examples here:

http://www.plmworld.org

Go to the Communities SIGs and Focus Groups

http://www.plmworld.org/p/cm/ld/fid=67

Then sign up for the NX Simulation SIG (Special Interest Group). That group contains a File Library called NX Open Routines. So far there are 5 routines located there, but internally we've developed many more for users.

Note that you have to be a member of PLM World first before you can request access to the SIGs. Let me know here if you need further assistance.

Regards,
Mark

CAE Technical Consultant
Siemens PLM Software
 

RE: Select group by them name in a journal

(OP)
Mark,

I have others questions.

Is it possible to include a WindowsForm or equivalent in a journal ? I have find UI block styler but we have not the licence.

I want to create a graphical user interface. Is it possible?

Thank you very much.

Bastien.

RE: Select group by them name in a journal

Bastien,

I'm told that it is possible. You need to add:

Imports System.Windows.Forms

to the journal. The attached example copies an assembly to a selected directory via standard Windows UI. It runs fine for me using NX 7.5.4.

Should you convince your management to purchase a license of the block styler product, make sure it includes the Block UI Styler application as opposed to the User Interface Styler application. The Block UI Styler application builds dialogs that are consistent with the NX UI from NX 6 onwards. I can't comment on the proper products/licenses, but I do know the preferred application is Block UI Styler.

Regards,
Mark

Mark Lamping
CAE Technical Consultant
Siemens PLM Software

RE: Select group by them name in a journal

(OP)
Mark,

The program you sent me is working properly. I'm leaving tonight on vacation for two weeks.

Can you give me your email address to contact you when I return?

Thank you.

Bastien.

RE: Select group by them name in a journal

(OP)
Mark,

I'm back from vacation. I have another question about the journals. Is it possible with a function to retrieve the name of the .sim file and the solution in which we work?

Regards,
Bastien.

RE: Select group by them name in a journal

Bastien,

Unfortunately I'm ghost writing here with respect to NX Open questions. My programming skills are dismal at best. Perhaps the NX online help has the answer to this buried in the NX Open for .NET Reference Guide. To get to that launch the online help. Then expand the Automation topic. Go to NX Open and then Open for .NET. There you will find the .NET reference guide.

Another option would be to open a call with GTAC. I'll ping my sources too and post an answer here assuming I get one.

Regards,
Mark

Mark Lamping
CAE Technical Consultant
Siemens PLM Software

RE: Select group by them name in a journal

(OP)
Mark,

I find too in the online help and in the .NET Reference Guide.
Thank you for your answers.

Bastien.

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