Read Non-Geometric components to component type array

Hi,

I have a requirement where in I have to read all the children in an assembly.Using the below line of code I am getting the child components to an array of component type..

components = workPart.ComponentAssembly.RootComponent.GetChildren();

The problem is that this line of code gets me only the child components added as geometric model,the components added as Non-geometric models are left unread.Please advise.

Regards,
Aditya

NXOpen will, by default, ignore non-geometric components. To change this behavior, create an environment variable: "UGII_ALLOW_NGC_IN_UGOPEN" and set the value to "YES".

Thank you very much..it worked out..

Is there any way it can be done by the program?

I tried "Environment.SetEnvironmentVariable(strEnvVar, strEnvVVal, EnvironmentVariableTarget.User);"

but its not working.Thanks.

I believe that NX has to be restarted for the environment variable to take effect. If this is the case, I don't see any way that it could be done by the journal itself. Perhaps an independent program (one not running inside NX) could be made that would check for the variable, set the value and restart NX if necessary.