×
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!

*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

NX Journal Selection Priority

NX Journal Selection Priority

NX Journal Selection Priority

(OP)
I'm creating a journal using basic selection, and using this as a guide. I'm running into a sort of strange issue.

Using normal selection in NX, with no selection filters, the priority starts with components. I click on a body in an assembly, and the component is what's selected. But when I run the journal using the same selection technique from the tutorial, the selection priority starts with the solid body within the desired component. Now I may or may not have write access to that, and even if I did, I wouldn't want to dig into every component in the selection So is there a way of changing the selection priority within a journal to grab components as a whole and not trying to grab the child body?

RE: NX Journal Selection Priority

The selection priority you have set will influence the selection in that journal. Also, the user can select a filter to refine the selection while that journal is running.

If you want to set the selection to automatically filter for components, you should use the version of the select object function that allows you to set up a "mask triple".
http://nxjournaling.com/?q=content/using-mask-trip...
For a component the mask triple values are:

CODE

Dim selectionMask_array(0) As Selection.MaskTriple

With selectionMask_array(0)
  .Type = UFConstants.UF_component_type
  .Subtype = UFConstants.UF_all_subtype
  .SolidBodySubtype = 0
End With 

www.nxjournaling.com

RE: NX Journal Selection Priority

(OP)
That works great, thanks. But what if I still want to be able to select solid bodies, if I'm in a part file for example. I tried adding another array item with UF_solid_type and tried it in both the 0 and 1 position and it always seemed to override the UF_component_type.

RE: NX Journal Selection Priority

You can add more mask triples values to widen your selection filter. The following will allow the user to select a component or a solid body:

CODE

Dim selectionMask_array(1) As Selection.MaskTriple

With selectionMask_array(0)
	.Type = UFConstants.UF_component_type
	.Subtype = UFConstants.UF_component_subtype
        .SolidBodySubtype = 0
End With
With selectionMask_array(1)
	.Type = UFConstants.UF_solid_type
        .Subtype = 0
	.SolidBodySubtype = UFConstants.UF_UI_SEL_FEATURE_BODY
End With 

However, when run in an assembly, selection priority will kick in and it is up to the user to make sure they are selecting a component instead of a body (or vice versa).

www.nxjournaling.com

RE: NX Journal Selection Priority

(OP)
Right, that's pretty much what I did. The default selection priority outside of the journal is components first. If I only use one mask, it gets components. If I add the solid mask it then prioritizes that, even though the default outside of the journal is component.

Is there a standard NX default that has to be set, or does the SelectObject method in NXOpen not inherit selection priority from the current session?

RE: NX Journal Selection Priority

(OP)
I'm revisiting this some today. I guess what I really want to do is filter out any solid body that's part of a component. That way I can either select entire components, or solid bodies within that part file.

RE: NX Journal Selection Priority

(OP)
Just found THIS from Baker that uses keyboard shortcuts to set the top selection priority in the session. Any ideas what that's doing behind the scenes?

RE: NX Journal Selection Priority

The selection priority ranks the objects available for selection and gives preferential treatment to whatever type you have prioritized. The selection filter limits your selection choices; the selection priority ranks the available options.

For example: if your selection filter is set to none and the selection priority is set to edges, as you move the cursor over the model edges within the selection ball will highlight. If there are no edges within the selection ball, some other object type will highlight. If you pull up the selection list, any available edges will be at the top of the list; other object types will be lower in the list.

www.nxjournaling.com

RE: NX Journal Selection Priority

(OP)
Right. I should have been more specific. I tried recording a test journal to see what's going on with NXOpen and it doesn't give anything. I wasn't sure if there was a method in the Options class or something. The goal is to set the selection priority within the journal instead of making the user set it, because the default is not ideal.

RE: NX Journal Selection Priority

Selection priority is a newer concept than the available selection functions. I don't know of a way to set selection priority through NXOpen (but of course that doesn't mean it isn't possible).

You may be able to do some custom filtering of your own...
The code below filters the selection for solid bodies. If the chosen body is an occurrence, the owning component is returned rather than the body itself.

CODE

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF

Module Module1

    Sub Main()

        Dim theSession As Session = Session.GetSession()
        Dim workPart As Part = theSession.Parts.Work

        Dim mySelection As TaggedObject
        If SelectObject("select a solid", mySelection) = Selection.Response.Cancel Then
            Exit Sub
        End If

        MsgBox("selection is a: " & mySelection.GetType.ToString)

    End Sub

    Function SelectObject(ByVal prompt As String, ByRef selObj As TaggedObject) As Selection.Response

        Dim theUI As UI = UI.GetUI
        Dim title As String = "Select an object"
        Dim includeFeatures As Boolean = False
        Dim keepHighlighted As Boolean = False
        Dim selAction As Selection.SelectionAction = Selection.SelectionAction.ClearAndEnableSpecific
        Dim cursor As Point3d
        Dim scope As Selection.SelectionScope = Selection.SelectionScope.AnyInAssembly
        Dim selectionMask_array(0) As Selection.MaskTriple

        With selectionMask_array(0)
            .Type = UFConstants.UF_solid_type
            .SolidBodySubtype = UFConstants.UF_UI_SEL_FEATURE_BODY
        End With

        Dim resp As Selection.Response = theUI.SelectionManager.SelectTaggedObject(prompt, _
         title, scope, selAction, _
         includeFeatures, keepHighlighted, selectionMask_array, _
         selobj, cursor)
        If resp = Selection.Response.ObjectSelected OrElse resp = Selection.Response.ObjectSelectedByName Then
            Dim selBody As Body = selObj
            If selBody.IsOccurrence Then
                selObj = selBody.OwningComponent
            End If
            Return Selection.Response.Ok
        Else
            Return Selection.Response.Cancel
        End If

    End Function

    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 

www.nxjournaling.com

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! Already a Member? Login


Resources

eBook - Functional Prototyping Using Metal 3D Printing
Functional prototypes are a key step in product development – they give engineers a chance to test new ideas and designs while also revealing how the product will stand up to real-world use. And when it comes to functional prototypes, 3D printing is rewriting the rules of what’s possible. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close