New Scripting and .des Files

354 views
Skip to first unread message

David Stevens

unread,
Jan 9, 2015, 8:54:23 AM1/9/15
to ope...@googlegroups.com
Hi All,

I was looking at the documentation for v3 and could not find a reference to how one would load a .des file via the new scripting language. I have been using OpenVSP for design studies and my old methodology used a MATLAB script to modify a .des file, load the .des file, modify a baseline VSP model, and output a .tri file. Is there a better way to modify a baseline geometry using the new scripting interface that I am unaware of? Any help would be greatly appreciated!

-David

Rob McDonald

unread,
Jan 9, 2015, 9:25:30 AM1/9/15
to ope...@googlegroups.com
David,

There are a couple of answers for you. First, the API documentation
has sometimes lagged our features, so I suspect we just left this out.

You can work with design files through the API....

void ReadApplyDESFile( const string & in file_name )
void WriteDESFile( const string & in file_name )
void ReadApplyXDDMFile( const string & in file_name )
void WriteXDDMFile( const string & in file_name )
int GetNumDesignVars()
void AddDesignVar( const string & in parm_id, int type )
void DeleteAllDesignVars()
string GetDesignVar( int index )
int GetDesignVarType( int index )

However, I actually suspect that you don't want to do that.

We've moved most batch mode commands from the command line prompt into
the scripting. The command line options were becoming increasingly
complex, and scripting can be so much more flexible.

To make life easy, we also made certain really commonly changed things
available through the command line.

So, if you want to read in a VSP file, or a DES file, you can pass
those on the command line -- and then run a particular script. That
way, if you are frequently changing your VSP or DES file, you don't
need to keep modifying your script to change a filename.

You probably want:

vsp baseline.vsp3 -des changes.des -script myscript.vspscript

Rob
> --
> You received this message because you are subscribed to the Google Groups
> "OpenVSP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to openvsp+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

David Stevens

unread,
Jan 25, 2015, 4:01:14 PM1/25/15
to ope...@googlegroups.com
Hi Rob,

I was wondering what is the easiest way to pass command line arguments to a VSP Script? I have the simple script:

void main(string in_filename)
{
string filename ='ONERA_M6_Baseline.vsp3';
 ReadVSPFile(filename);
 //==== Run Mass Properties ====//
 string sliced_mesh_id = ComputeCompGeom( SET_ALL, false, 0 );
 
 //==== Export STL File ====//
 ExportFile( in_filename, SET_ALL, EXPORT_STL );
}

I suspect there is a gross conceptual error on my part given my inexperience with C++ style languages.

I would expect to be able to pass arguments via the command line via something like:  .\vsp vspfile.vsp3 -des designfile.des -script MyScript.vspscript Test1.stl

 My goal is to generate numerous .stl files that are named sequentially e.g. Test1.stl, Test2.stl, Test3.stl, .... but I have yet to find a simple way to do this without modifying the script. Any help would be greatly appreciated.

-David

Rob McDonald

unread,
Jan 25, 2015, 5:07:20 PM1/25/15
to ope...@googlegroups.com
David,

I don't think we currently support passing command line arguments on
to the script.

Do you want the file names to be sequentially generated during a
single execution of a script (say varying a parameter and writing
multiple files), or do you want separate executions to use sequential
file names?

If the former, you should be able to accomplish that within the
scripting language.

If the latter, I suggest you have VSP write out a single file name,
and then use your batch environment (batch file on Windows, or
whatever shell you're using on Mac/Linux) to take that standard name
file and rename it to the sequential number you desire.

Rob
Reply all
Reply to author
Forward
0 new messages