Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.Assemblies
Module ArrangementUpdateNew
Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim lw As ListingWindow = theSession.ListingWindow
Sub Main()
lw.Open()
'ArrangementOptions.IndividuallyPositioned
Dim Mycomponent As Assemblies.Component = Nothing
For Each Mycomponent In workPart.ComponentAssembly.RootComponent.GetChildren()
lw.WriteLine(Mycomponent.Name)
Try
Dim MyObj(0) As NXObject
MyObj(0) = Mycomponent
Dim assembliesParameterPropertiesBuilder1 As AssembliesParameterPropertiesBuilder = workPart.PropertiesManager.CreateAssembliesParameterPropertiesBuilder(MyObj)
assembliesParameterPropertiesBuilder1.Arrangements = Assemblies.AssembliesParameterPropertiesBuilder.ArrangementOptions.IndividuallyPositioned
Dim NxObject1 As NXObject
NxObject1 = assembliesParameterPropertiesBuilder1.Commit()
assembliesParameterPropertiesBuilder1.Destroy()
Catch ex As NXException
lw.WriteLine("Failed")
End Try
Next
End Sub
End Module
re: process all components
The following article shows how to use recursion to process all the components of an assembly (all components at all levels).
http://nxjournaling.com/content/creating-subroutine-process-all-componen...