Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

NXOpen: Exception when accessing RootComponent of a partially loaded Assembly

Status
Not open for further replies.

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
 
Replies continue below

Recommended for you

Dim root As Component = theSession.Parts.Display.ComponentAssembly.RootComponent
If Not root Is Nothing Then ...
 
daluigi said:
Dim root As Component = theSession.Parts.Display.ComponentAssembly.RootComponent
If Not root Is Nothing Then ...

The problem is that I get an exception on some partially loaded assemblies when accessing RootComponent in that way.
So i need to have an alternative (if any exists that is).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor