Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Journal to select_components. do not select all components ?

Status
Not open for further replies.

Ehaviv

Computer
Jul 2, 2003
1,012
Hi

The following journal with class selection select all.
see image. do not select all components.
To select all I must expand all components in assembly nav and control select each one manualy.

Do someone can help to change journal to select all.

Thank you.

Capture_fa3g8g.png



Code:
Option Strict Off
Imports System
Imports System.Collections.Generic
Imports NXOpen
Imports NXOpen.UF
 
Module Module69
 
    Dim theSession As Session = Session.GetSession()
    Dim lw As ListingWindow = theSession.ListingWindow
 
 
    Sub Main()
 
        lw.Open()
 
        Dim theComponents As New List(Of Assemblies.Component)
        Dim tObjects() As TaggedObject = Nothing
 
        If SelectComponents("Select Components", tObjects) = Selection.Response.Cancel Then
            Return
        End If

        For i As Integer = 0 To tObjects.Length - 1 
          theComponents.Add(CType(tObjects(i), NXOpen.Assemblies.Component))
        Next

        For i As Integer = 0 To tObjects.Length - 1 
          lw.WriteLine("")
          lw.WriteLine("theComponents(" & (i+1).ToString & ").DisplayName: " & theComponents(i).DisplayName)
          lw.WriteLine("theComponents(" & (i+1).ToString & ").Prototype.OwningPart.FullPath: " & _
                                                             theComponents(i).Prototype.OwningPart.FullPath)
        Next
 
        lw.Close()
    End Sub
 
Function SelectComponents(ByVal prompt As String, ByRef selObj() As TaggedObject) As Selection.Response
 
	Dim theUI as UI = UI.GetUI
	Dim title As String = "Select components"
	Dim includeFeatures As Boolean = False
	Dim keepHighlighted As Boolean = False
	Dim selAction As Selection.SelectionAction = Selection.SelectionAction.ClearAndEnableSpecific
	Dim scope As Selection.SelectionScope = Selection.SelectionScope.AnyInAssembly
	Dim selectionMask_array(0) As Selection.MaskTriple
 
	With selectionMask_array(0)
		.Type = UFConstants.UF_component_type
		.Subtype = UFConstants.UF_all_subtype
	End With
 
	Dim resp as Selection.Response = theUI.SelectionManager.SelectTaggedObjects(prompt, _
		title, scope, selAction, _
		includeFeatures, keepHighlighted, selectionMask_array, _
		selobj)
	If resp = Selection.Response.Ok Then
		Return Selection.Response.Ok
	Else
		Return Selection.Response.Cancel
	End If
 
End Function
 
End Module
 
Replies continue below

Recommended for you

Status
Not open for further replies.

Part and Inventory Search

Sponsor