Submitted by mmiscool on Fri, 10/17/2014 - 11:53
Forums:
Hello,
My company requires all wave linked objects (solids, faces, curves, ect) to be placed on a specific layer. This is a tedious task and I was hoping that there might be a way to automate this.
In nx the selection filters don't seem to have wave linked features so I am not sure how to approach this.
Any help would be appreciated.
re: move wave linked geometry to a specified layer
[code]
'NXJournaling.com
'October 22, 2014
'
'Move linked bodies, faces, and curves to a specified layer.
'http://nxjournaling.com/content/move-wave-linked-features-layer-journal
Option Strict Off
Imports System
Imports System.Collections.Generic
Imports NXOpen
Imports NXOpen.UF
Module Module1
Sub Main()
Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession()
If IsNothing(theSession.Parts.Work) 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 layer: linked bodies, faces, and curves"
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, undoMarkName)
'$$$$ target layer for extracted geometry
Const waveGeoLayer As Integer = 12
Dim geomToMove As New List(Of DisplayableObject)
'gather the linked bodies and curves
For Each tempFeat As Features.Feature In workPart.Features
If tempFeat.FeatureType.ToUpper.Contains("LINKED") Then
'linked bodies and faces
If TypeOf (tempFeat) Is Features.ExtractFace Then
Dim tempBody As Features.ExtractFace = tempFeat
For Each myDispObj As DisplayableObject In tempBody.GetBodies
geomToMove.Add(myDispObj)
Next
End If
'linked curves
If TypeOf (tempFeat) Is Features.CompositeCurve Then
For Each myDispObj As DisplayableObject In tempFeat.GetEntities
geomToMove.Add(myDispObj)
Next
End If
End If
Next
'move the linked bodies and curves to a new layer
Dim displayModification1 As DisplayModification
displayModification1 = theSession.DisplayManager.NewDisplayModification()
displayModification1.ApplyToAllFaces = False
displayModification1.NewLayer = waveGeoLayer
displayModification1.Apply(geomToMove.ToArray)
displayModification1.Dispose()
lw.Close()
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
'Unloads the image when the NX session terminates
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination
'----Other unload options-------
'Unloads the image immediately after execution within NX
'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
'Unloads the image explicitly, via an unload dialog
'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly
'-------------------------------
End Function
End Module
[/code]
Reorder wavelink features
-