Showing results for 
Search instead for 
Do you mean 
Reply
Solved! Go to solution

Reference the current directory in Advanced Simulation

I have a model into which I import a number of companion results. These are contained with a results file in the main simulation directory.

I would like to be able to copy the whole folder containing all parts of the simulation and results to another location and have it reference the companion results at the new location.

Is there a way to reference the current directory or run file directory like:

%RUN_DIRECTORY%\myResult.unv

 

Thanks,

 

Peter

4 REPLIES

Re: Reference the current directory in Advanced Simulation

Hi Peter,
If you implement a script in NX Open you can use the environment variable %PWD% that points to the actual working directory.

In Python use os.environ.get('PWD')

Boris

Re: Reference the current directory in Advanced Simulation

Thanks for your reply, Boris.

Should this work in journals? I tried reccording the import of a companion result, then inserted the line  unvLoc = os.environ.get('PWD')

but instaed of returning a location, it returnes a null value.

Solution
Solution
Accepted by topic author Peter_C
‎10-28-2015 01:14 PM

Re: Reference the current directory in Advanced Simulation

"Current Directory" is not necessarily the directory where your .sim file is located.

 

If you have an instance of the CAE.SimPart, you can get it's directory from CAE.SimPart.FullPath()

Re: Reference the current directory in Advanced Simulation

Thanks Jim. That works beautifully!