cancel
Showing results for 
Search instead for 
Did you mean: 

Sorting the meshes in postview

Experimenter
Experimenter

Is it possible to sort the meshes in postview by names, but not by physical properties?Thanks in advance!

3 REPLIES

Re: Sorting the meshes in postview

Siemens Legend Siemens Legend
Siemens Legend

In post view, the meshes are organized using each single mesh definition. The meshes get an automatic name with a counter (3d_mesh(X), 2d_mesh(X)) - so they are somehow difficult to identify if you have a large number of meshes in your analysis.

You have to ways to deal with that:

 

1) Rename the meshes in FEM

You can modify these names in the FEM file after the mesh is generated. Just right click the mesh and rename it. If you have multiple meshes in one container, you would have to rename all the meshes (this is something that could be scripted with NX Open, to automatically specify the name of the container the mesh is located in).

 

2) Use Groups

 Another option is to use groups. If you define groups in the sim, they are automatically available in the post view.

 

I hope that helps.

Boris

Re: Sorting the meshes in postview

Siemens Legend Siemens Legend
Siemens Legend

Please find below a .NET NX Open Skript that is automatically modifying all names of all meshes in the FEM and setting it to the name of the mesh container. So you can realize solution 1) of my previous post for all meshes in the .fem file.
If you select an appropriate name for the mesh container, you can find these names in post view.

 

This VB.Net program is provided "as is" without any warranty of any kind.

 

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.Annotations

Module Module1

    Sub Main()

        Dim theSession As Session = Session.GetSession()

        Dim MCols() As CAE.IMeshCollector
        Dim MCol As CAE.IMeshCollector

        Dim meshes() As CAE.Mesh
        Dim mesh As CAE.Mesh

        Dim counter As Integer

        Dim basePart As BasePart = theSession.Parts.BaseWork

        'check if basepart is a FEMPart. otherwise the Skript will not work
        If TypeOf basePart Is CAE.FemPart Then

            Dim femPart As CAE.FemPart = CType(basePart, CAE.FemPart)
            Dim fEModel As CAE.FEModel = CType(femPart.BaseFEModel(), CAE.FEModel)
            Dim meshManager As CAE.MeshManager = CType(fEModel.Find("MeshManager"), CAE.MeshManager)

            ' Loop all mesh Collectors
            MCols = meshManager.GetMeshCollectors()
            For Each MCol In MCols
                'get all meshes in the collector
                meshes = MCol.GetMeshes()
                ' Loop all meshes in collector
                counter = 0
                For Each mesh In meshes
                    counter = counter + 1
                    mesh.SetName(MCol.Name & "(" & counter & ")")
                Next
            Next
        Else
            MsgBox("ERROR: The Work Part has to be a FEM Part")
        End If
 End Sub
End Module

 

 

 

 

Re: Sorting the meshes in postview

Experimenter
Experimenter

Hi BorisL,

 

Thanks a lot for such quick and important information.

Currently I always try to create groups and then work with them (as you mentioned in your "2)").

An idea with the modifying the mesh names is also great!!!

But if we started to talk about NX.Open, maybe you are able to provide an information about the code which connects  the mesh name (in FEM) and the group (as it mentioned in NX Help, an example of code is here below).

 

.......

Sub Main (ByVal args() As String)

Dim theSession As Session = Session.GetSession()
Dim workSimPart As CAE.SimPart = CType(theSession.Parts.BaseWork, CAE.SimPart)

Dim displaySimPart As CAE.SimPart = CType(theSession.Parts.BaseDisplay, CAE.SimPart)

theSession.Post.PostviewApplyGroupVisibility

(1,CAE.Result.GroupContainer.OneDimensional, 1, False)

End Sub

........

 

 

So as it is shown in "theSession.Post.PostviewApplyGroupVisibility" :

1) first value - postview iD;

2) the second one means appropriate container;

3) the third - group (index number of mesh name, starts from 0);

4) visibility (boolean).

 

Resume: How to connect group (index number) with the relevant mesh name in programming code.

 

Thank you very much in advance.

Best regards,

Stanislav