SPS working directory

I have made a batch file to run some teddy files through sps.exe, see excerpt below:

@echo off
set no_waves=100
set shift=0
"C:\Program Files\SOFiSTiK\2020\SOFiSTiK 2020\sps.exe" ".\01_Model\AQUA\Materials.dat"
"C:\Program Files\SOFiSTiK\2020\SOFiSTiK 2020\sps.exe" ".\01_Model\SOFIMSHC\Geometry.dat"

As my project is quite large, I have created a folder structure for each SOFiSTiK module with relevant teddy files in them (\AQUA,\SOFIMSHC,\SOFILOAD,\TALPA etc.)

When running sps.exe it places all the output files within the active subfolder, which means the next teddy file it runs can’t find the previous output files.

Is there any way to set a working directory for sps to save all output in the \01_Model folder instead of in the active subfolder?

I could of course write a piece of code in the batch file that moves all files except .dat into the \01_Model folder after the run, but it just seems cumbersome, so hopefully there’s a smarter way?

Exists as an environment variable (SOFISTIK_PRODIR), see basic manual chapter 10.

Windows has a tendency to muck things up if you are in different folders.
I prefer to organize by filename, e.g.:

  • _001_Aqua.dat
  • _002_Sofimshc.dat
  • _003_Sofiload.dat

The first underscore keeps the files together in case numbers are used for something else.
Makes #includes easier if you are reusing some files

1 Like

If I read the manual correctly I should be able to put SOFISTIK_PRODIR into my batch file and set the directory from there, but the files turn up in the same location, so I’m obviously misreading something.

@echo off
set no_waves=100
set shift=0
set SOFISTIK_PRODIR="C:\Users\myuser\mymodel\01_Model"
"C:\Program Files\SOFiSTiK\2020\SOFiSTiK 2020\sps.exe" ".\01_Model\AQUA\Materials.dat"
"C:\Program Files\SOFiSTiK\2020\SOFiSTiK 2020\sps.exe" ".\01_Model\SOFIMSHC\Geometry.dat"

Try adding \ at the end of the path

I did a quick try and I was only able to move the location of the cdb
The result files (plb/etc) however seem to stay in the dat folder.

An alternative is to create a “main.dat” in the project folder
Then you include the subfiles in your main dat with #include ".\01_Model\AQUA\Materials.dat"

1 Like

I ended up making a main.dat in a parent directory and then running everything from there.

My next issue now is with printing report files, because when I run the teddy code from a main.dat, everything is thrown into “main.plb”.

I’m trying to print my load setup using +sys ursula "Load_plots.plb" -printto:"pdf", but seeing as everything is crammed into main.plb the reports are way too large.

I’ve tried splitting the processes into two separate files in the same parent directory, but I arrive at the same issue as before where they don’t share the same working files and prompt errors:

"C:\Program Files\SOFiSTiK\2020\SOFiSTiK 2020\sps.exe" ".\01_Model\Main.dat"
"C:\Program Files\SOFiSTiK\2020\SOFiSTiK 2020\sps.exe" ".\01_Model\Load_plots.dat"

Any idea of a workaround for this?

At each break you can use the sys command, e.g.:

+sys copy myproject.plb myproject_001.plb
+sys del myproject.plb

Copies the report to seperate file and then deletes the “original” so the next one starts empty.

You can also join reports after if you call ursula via command line (check chapter 12.1.9 of the basics manual)

1 Like

That is clever!

Works perfectly, thank you very much :slight_smile: