OpenVSPAPI  3.20.0
Functions
File Input and Output Functions

This group of funtions provides file input and output interfacing through the API.

Click here to return to the main page. More...

Functions

void ReadVSPFile (const string &in file_name)
 
void WriteVSPFile (const string &in file_name, int set)
 
void SetVSP3FileName (const string &in file_name)
 
void InsertVSPFile (const string &in file_name, const string &in parent)
 
void ExportFile (const string &in file_name, int write_set_index, int file_type)
 
string ImportFile (const string &in file_name, int file_type, const string &in parent)
 

Detailed Description

Function Documentation

◆ ExportFile()

void ExportFile ( const string &in  file_name,
int  write_set_index,
int  file_type 
)

Export a file from OpenVSP. Many formats are available, such as STL, IGES, and SVG.

string wid = AddGeom( "WING" ); // Add Wing
ExportFile( "Airfoil_Metadata.csv", SET_ALL, EXPORT_SELIG_AIRFOIL );
See also
EXPORT_TYPE
Parameters
[in]file_nameExport file name
[in]write_set_indexSet index to export (i.e. SET_ALL)
[in]file_typeFile type enum (i.e. EXPORT_IGES)

◆ ImportFile()

string ImportFile ( const string &in  file_name,
int  file_type,
const string &in  parent 
)

Import a file into OpenVSP. Many formats are available, such as NASCART, V2, and BEM). The imported Geom, mesh, or other object is inserted as a child of the specified parent. If no parent or an invalid parent is given, the import will be done at the top level.

See also
IMPORT_TYPE
Parameters
[in]file_nameImport file name
[in]file_typeFile type enum (i.e. IMPORT_PTS)
[in]parentParent Geom ID (ignored with empty string)

◆ InsertVSPFile()

void InsertVSPFile ( const string &in  file_name,
const string &in  parent 
)

Insert an external OpenVSP project into the current project. All Geoms in the external project are placed as children of the specified parent. If no parent or an invalid parent is given, the Geoms are inserted at the top level.

Parameters
[in]file_name*.vsp3 filename
[in]parentParent geom ID (ignored with empty string)

◆ ReadVSPFile()

void ReadVSPFile ( const string &in  file_name)

Load an OpenVSP project from a VSP3 file

string fid = AddGeom( "FUSELAGE", "" ); // Add Fuselage
string fname = "example_fuse.vsp3";
SetVSP3FileName( fname );
//==== Save Vehicle to File ====//
Print( "\tSaving vehicle file to: ", false );
Print( fname );
//==== Reset Geometry ====//
Print( string( "--->Resetting VSP model to blank slate\n" ) );
ReadVSPFile( fname );
Parameters
[in]file_name*.vsp3 file name

◆ SetVSP3FileName()

void SetVSP3FileName ( const string &in  file_name)

Set the file name of a OpenVSP project

string fid = AddGeom( "FUSELAGE", "" ); // Add Fuselage
string fname = "example_fuse.vsp3";
SetVSP3FileName( fname );
//==== Save Vehicle to File ====//
Print( "\tSaving vehicle file to: ", false );
Print( fname );
//==== Reset Geometry ====//
Print( string( "--->Resetting VSP model to blank slate\n" ) );
ReadVSPFile( fname );
Parameters
[in]file_nameFile name

◆ WriteVSPFile()

void WriteVSPFile ( const string &in  file_name,
int  set 
)

Save the current OpenVSP project to a VSP3 file

string fid = AddGeom( "FUSELAGE", "" ); // Add Fuselage
string fname = "example_fuse.vsp3";
SetVSP3FileName( fname );
//==== Save Vehicle to File ====//
Print( "\tSaving vehicle file to: ", false );
Print( fname );
//==== Reset Geometry ====//
Print( string( "--->Resetting VSP model to blank slate\n" ) );
ReadVSPFile( fname );
Parameters
[in]file_name*.vsp3 file name
[in]setSet index to write (i.e. SET_ALL)
EXPORT_SELIG_AIRFOIL
Definition: openvsp_as.h:1401
SetVSP3FileName
void SetVSP3FileName(const string &in file_name)
WriteVSPFile
void WriteVSPFile(const string &in file_name, int set)
SET_ALL
Definition: openvsp_as.h:1840
Update
void Update()
ClearVSPModel
void ClearVSPModel()
ReadVSPFile
void ReadVSPFile(const string &in file_name)
AddGeom
string AddGeom(const string &in type, const string &in parent=string())
ExportFile
void ExportFile(const string &in file_name, int write_set_index, int file_type)
Print
void Print(const string &in data, bool new_line=true)
GetVSPFileName
string GetVSPFileName()