Assemblies
Alle Parts
eines Assemblies auflisten
|
Imports System
Imports NXOpen
Imports
NXOpen.Assemblies
public
CompArray() as
Component
public
CompCount as
Integer = -1
Sub Main()
dim theSession
as
NXOpen.Session = NXOpen.Session.GetSession()
dim workPart
as NXOpen.Part
= theSession.Parts.Work
dim MyDispPart
as Part =
theSession.Parts.Display
dim comp
as
ComponentAssembly = Nothing
comp = MyDispPart.ComponentAssembly
dim i
dim lw As
ListingWindow = theSession.ListingWindow
lw.Open()
GetAllComp(comp.RootComponent,
1)
for i =
0
to CompCount -1
lw.WriteLine(CompArray(i).DisplayName)
next
end Sub
Sub GetAllComp(ByVal
comp as
Component, ByVal indent
as Integer)
for
each child
as Component
in
comp.GetChildren()
CompCount = CompCount +1
ReDim Preserve CompArray(CompCount)
CompArray(CompCount) = child
GetAllComp(child, indent +1)
next
end Sub
End Module |
|