Jump to content
KNL21

Exporting modified geometry after offline edits to Caeses batch script

Recommended Posts

Hello,

I'm working on a project where Caeses is used to modify geometry parameters easily, but an external optimization script will generate new parameter inputs and Caeses will be used to generate the new geometry (e.g., new .stl files). To accomplish this, I have setup a case, exported a *.fsc script from it, modified a design variable in that script, and then executed it with "CAESES_crt.exe" to save the geometry as .stl files.

Everything works perfectly and I am happy with this setup, but there is one thing I would like to improve upon. I would like to save the base filename for the modified .stl files generated after externally modifying the .fsc script. So for example, the scope from the project I am working in that I want to export has "mixerExported" as the base .stl file name (I am using "exportStlExtractColors" to extract a separate .stl file for each geometry partitioned into their respective colors), so the files generated are called "mixerExported_outletTopCyl.stl", etc. My question is: is it possible to change this base .stl file name in the .fsc script generated from the same project file? I do not need to generate separate project files, but rather I am looking to just modifying several design parameters and generate a new geometry for each of these modifications. Is it possible then to generate geometries from running the script and also changing the baseline filename they are saved from, just through modifying the .fsc file (and not the project file)? There are lines commented in the script file that specify a path, but it doesn't seem like they are being read:

// CAESES Executable  C:\Program Files (x86)\FRIENDSHIP-SYSTEMS\CAESES5\bin\win64\CAESES.exe
// CAESES Project     ~\CAESES\simple_test_geometry_export_demo\Simple_test_geometry_final_export.cdb
// Design Name        baseline
// Project Units      meters

The outputs are saved in a folder created called "/manual_results/baseline/input". It would be great if there could be a way to generate a new folder called "/manual_results/mod1/input" etc. I'm not sure if this is something to be done just with the script, or if the project file does need to be modified, but I thought I would post it here for some advice or inputs from the experts. Thanks very much for your time!

Best,

Katherine

 

base_filename.png

Share this post


Link to post
Share on other sites

Hi Katherine,

maybe it is easier if you just run the fsc script in a unique directory for each design you want to generate -- this way also any other files generated by CAESES are taken care of.

However, you can also adjust the name trough the fsc script. I'm guessing you set up your export by providing a scope (folder) in CAESES which contains the geometry you want to export and for which you have set a custom file name like this:

image.png.125bdd043fe4ff4f7122100dec7202c4.png

Inside your fsc script you should be able to just change that name if you add a line like this:

19_export.setExportFileName("changeThisNameAsYouLike")

You can also provide a fullName (incl. absolute path) if you want.

BR,
Heinrich

Share this post


Link to post
Share on other sites

Hi Heinrich,

Thanks very much for your response! Yes you are right, running the script in a separate directory is perhaps the best way to go about achieving what I want. I did try out adjusting the name through the script (I did export a scope as you mentioned) using the "setExportFileName" command and it works for me. Just a quick final question: I also had success with providing a fullName including an absolute path with something like:

19_export.setExportFileName("~\absolute_path\NewFileName")

but is there also a separate command that sets the path? Is there perhaps a way to learn what the commands are available in Caeses scripts too?

Thanks again for your help,

Katherine

Share this post


Link to post
Share on other sites

Hi Katherine,

I don't think there is a command to set just the path, not the name. In that case you would simply have to set the full name and path but keep using the same name. 

The commands available in fsc scripts are basically the same as in CAESES with the exception of things that require a GUI (e.g. screenshots are not available in batch mode). You can learn about most types and available commands through the Type documentation:

image.thumb.png.b6706e39543a876e4fe8cd0649111e65.png

Also, if you start typing a command (even if it is just a "." behin a certain object) you can always use ctrl + space in CAESES and see what the auto-completion has to offer:

image.png.f0f9dcf4e203015b56a09e3d063cbf59.png

A third option many newcomers like to use is, to set things up in the GUI and then select a certain object or a whole bunch and right-click > Create Feature Definition:

image.png.97fc80454666683055f67be28cd28d64.png

This will give you a new feature definition containing everything you had selected.

BR,
Heinrich

Share this post


Link to post
Share on other sites

Hi Heinrich,

Perfect, thank you so much for this information, it is very helpful for getting started. I will check it out and try out the feature definition tip as well. Thank you!

Best,

Katherine

Share this post


Link to post
Share on other sites

Hi again,

I have a bit of a follow-up to this topic: I would like to export STL's using the STL (Extract Colors) functionality. To export with Cases, there must be a name given for "file name", which serves as a prefix for all of the STL's I am exporting by color. Is there a way to get rid of this prefix, and to only have the names given by color used for the STL's? For example, in the attached screenshot when I use the file name ".stl", geometries are exported with names like "_leftInlet.stl", etc. - I would like to have the name be exported only as "leftInlet.stl" but the underscore that is attached to the prefix remains. Any help would be greatly appreciated. Thank you!

Best,

Katherine

name.png

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...