Hallo Hoschi,
ein vorschlag den ich mal auf die Schnelle aus schnipseln zusammenkopiert habe...
Also nicht sauber Programmiert aber es geht:-)
Los gehts:
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.UI
Imports NXOpen.Utilities
Module NXJournal
Sub Main
Dim theSession As Session = Session.GetSession()
Dim ufs As UFSession = UFSession.GetUFSession()
Dim workPart As Part = theSession.Parts.Work
Dim workView As NXOpen.Tag = NXOpen.Tag.Null
Dim displayPart As Part = theSession.Parts.Display
If theSession.Parts.Work Is Nothing Then
Windows.Forms.MessageBox.Show("Kein Teil geladen! - No Part Loaded!")
Exit Sub
End If
theSession.SetUndoMark( Session.MarkVisibility.Visible, "Layer Verschieben")
' Definition für Layer
Dim Layern as Integer = 5
' SelectBody
Dim objects1() As NXObject
SelectFaces(objects1)
' Copy NXObject array to DisplayableObject array
Dim objects2(objects1.Length-1) As DisplayableObject
Dim ii as Integer = 0
For Each obj as NXObject in objects1
objects2(ii) = objects1(ii)
ii = ii+1
Next
workPart.Layers.MoveDisplayableObjects(Layern, objects2)
End Sub
' ----------------------------------------------
' sub to select faces
' ----------------------------------------------
Sub SelectFaces(ByRef selectedObjects As NXObject())
Dim ui As UI = NXOpen.UI.GetUI
Dim message As String = "Select Body"
Dim title As String = "Selection"
Dim scope As Selection.SelectionScope = Selection.SelectionScope.WorkPart
Dim keepHighlighted As Boolean = False
Dim includeFeatures As Boolean = False
Dim response As Selection.Response
Dim selectionAction As Selection.SelectionAction = _
Selection.SelectionAction.ClearAndEnableSpecific
Dim selectionMask_array(1) As Selection.MaskTriple
With selectionMask_array(0)
.Type = UFConstants.UF_solid_type
'.Subtype = 0
'.SolidBodySubtype = UFConstants.UF_UI_SEL_FEATURE_ANY_FACE
End With
response = ui.SelectionManager.SelectObjects(message, title, scope, _
selectionAction, includeFeatures, _
keepHighlighted, selectionMask_array, _
selectedObjects)
If response = Selection.Response.Cancel Or response = _
Selection.Response.Back Then
Return
End If
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
Return Session.LibraryUnloadOption.Immediately
End Function
End Module
Hier Kannst du deinen Ziellayer definieren:
Dim Layern as Integer = 5
------------------
Gruß
Michael
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP