JensHorstmann
Computer
- Jul 31, 2014
- 3
Hi,
we are trying to analyze a loaded assembly and provide all contained parts and subassemblies to an external tool via NXOpen.
Currently we are using NX9.
Normally this works perfectly using the GetChildren() method from the RootComponent of a given part.
Something like:
[pre]
...
Dim dispPart As Part = theSession.Parts.Display
Dim c As ComponentAssembly = dispPart.ComponentAssembly
if not IsNothing(c.RootComponent) then
For Each child As Component In comp.GetChildren()
'Do something with child
Next
end if
...
[/pre]
In my understanding accessing RootComponent should either be Nothing for piece parts or the component of the given part.
Apparently this is not always the case especially when using the "load partially"-Option.
In some assemblies (but not in all!) I get the following Exception (in german ...) when trying to access the RootComponent:
[pre]NXOpen.NXException: Teil ist nur teilweise geladen
bei NXOpen.Assemblies.ComponentAssembly.get_RootComponent()
bei NXJournal.Main(String[] args) in C:\Users\horstm\AppData\Local\Temp\NXJournals6424\journal.vb:Zeile 15.
[/pre]
Should translate to: Part is only loaded partially.
Question 1: Does anybody have any experience with this behaviour?
Question 2: Is there another way to get the children of a partially loaded part (i.e. without accessing the RootComponent)?
Many thanks
JH
we are trying to analyze a loaded assembly and provide all contained parts and subassemblies to an external tool via NXOpen.
Currently we are using NX9.
Normally this works perfectly using the GetChildren() method from the RootComponent of a given part.
Something like:
[pre]
...
Dim dispPart As Part = theSession.Parts.Display
Dim c As ComponentAssembly = dispPart.ComponentAssembly
if not IsNothing(c.RootComponent) then
For Each child As Component In comp.GetChildren()
'Do something with child
Next
end if
...
[/pre]
In my understanding accessing RootComponent should either be Nothing for piece parts or the component of the given part.
Apparently this is not always the case especially when using the "load partially"-Option.
In some assemblies (but not in all!) I get the following Exception (in german ...) when trying to access the RootComponent:
[pre]NXOpen.NXException: Teil ist nur teilweise geladen
bei NXOpen.Assemblies.ComponentAssembly.get_RootComponent()
bei NXJournal.Main(String[] args) in C:\Users\horstm\AppData\Local\Temp\NXJournals6424\journal.vb:Zeile 15.
[/pre]
Should translate to: Part is only loaded partially.
Question 1: Does anybody have any experience with this behaviour?
Question 2: Is there another way to get the children of a partially loaded part (i.e. without accessing the RootComponent)?
Many thanks
JH