×
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 to move components visible to the user to layer

Journal to move components visible to the user to layer

Journal to move components visible to the user to layer

(OP)
Hello,

I'm trying to create a journal to move the components in an assembly that are currently visible to the user, to a layer. I pulled together the following code using .AskVisibleObjects, but this has the effect of moving everything on screen to the layer.

CODE -->

Option Strict Off
Imports System
Imports NXOpen

Module NXJournal
Sub Main (ByVal args() As String) 

        Dim theSession As Session = Session.GetSession()
        Dim lw As ListingWindow = theSession.ListingWindow
        Dim workpart As Part = theSession.Parts.Work
        Dim visibleObjects() As DisplayableObject

        VisibleObjects = workPart.Views.WorkView.AskVisibleObjects

        Const VisLayer As Integer = 150

        Dim displayModification1 As DisplayModification
        displayModification1 = theSession.DisplayManager.NewDisplayModification()
        displayModification1.NewLayer = VisLayer
        displayModification1.Apply(VisibleObjects)
        displayModification1.Dispose()

End Sub
End Module 

If possible I wanted it to only select the outermost components of an assembly and move them to the designated layer, so that all inner components can be switched on and off in layer settings without affecting what the user will usually see.

Is there an alternative to .AskVisibleObjects that will do this? The only other place I have noticed where this type of selection behavior occurs is when using the 'hide components in view' function in drafting mode - where you can drag a selection box over the whole assembly, and only components visible from that camera angle are selected, leaving everything else behind and not visible un-selected.

Hope this makes sense, and thanks in advance.

RE: Journal to move components visible to the user to layer

There are functions called IdentifyExteriorUsingHl and IdentifyExteriorUsingRays that might be handy for your situation.

www.nxjournaling.com

RE: Journal to move components visible to the user to layer

(OP)
Thanks Cowski, I found some information on 'IdentifyExteriorUsingHl' which has mostly worked for what I'm doing. Ill play around with it and see what I get.

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