×
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

Move one feture to especific layer

Move one feture to especific layer

Move one feture to especific layer

(OP)
Hi I am new in this assignment and I need your help in one journal I don´t know how to send a feature tube to one leyer specific, this tube is the representation of weld in my assembly.

Can someone help me please.

RE: Move one feture to especific layer

Do you have a reference to the tube feature? If so, you can get the resulting body from the {feature}.GetBodies method. Once you have a reference to the body object (features cannot be moved to layers, only displayable objects can) you can move it to a different layer.

If you need an example of how to change an object's layer, the journal recorder is good for that.

www.nxjournaling.com

RE: Move one feture to especific layer

The following journal (NX 9) will look for tube features in the work part and move the tube bodies to layer 3. Modify all or part of it to suit your needs.

CODE

Option Strict Off
Imports System
Imports System.Collections.Generic
Imports NXOpen

Module Module1

    Sub Main()

        Dim theSession As Session = Session.GetSession()
        If IsNothing(theSession.Parts.BaseWork) Then
            'active part required
            Return
        End If

        Dim workPart As Part = theSession.Parts.Work
        Dim lw As ListingWindow = theSession.ListingWindow
        lw.Open()

        Const undoMarkName As String = "move tube bodies to layer"
        Dim markId1 As Session.UndoMarkId
        markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, undoMarkName)

        Dim tubeBodies As New List(Of Body)

        For Each temp As Features.Feature In workPart.Features
            If TypeOf (temp) Is Features.Tube Then
                Dim tempTube As Features.Tube = temp
                tubeBodies.Add(tempTube.GetBodies(0))
            End If
        Next

        Dim displayModification1 As DisplayModification
        displayModification1 = theSession.DisplayManager.NewDisplayModification()

        displayModification1.NewLayer = 3

        displayModification1.Apply(tubeBodies.ToArray)

        displayModification1.Dispose()

        lw.Close()

    End Sub

End Module 

www.nxjournaling.com

RE: Move one feture to especific layer

(OP)
Cowski you are the best, the journal is incredible, thanks for all.

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