cancel
Showing results for 
Search instead for 
Did you mean: 

Reference the current directory in Advanced Simulation

Valued Contributor
Valued Contributor

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

Siemens Legend Siemens Legend
Siemens Legend
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

Valued Contributor
Valued Contributor

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.

Re: Reference the current directory in Advanced Simulation

Siemens Phenom Siemens Phenom
Siemens Phenom

"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

Valued Contributor
Valued Contributor

Thanks Jim. That works beautifully!