OpenVSPAPI  3.20.0
Functions
General Computation Functions

The following group of API functions are available for general computations. In general, it is best practice to perform computations through the the Analysis group instead of calling these functions directly.

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

Functions

string ComputeMassProps (int set, int num_slices)
 
string ComputeCompGeom (int set, bool half_mesh, int file_export_types)
 
string ComputePlaneSlice (int set, int num_slices, const vec3d &in norm, bool auto_bnd, double start_bnd=0, double end_bnd=0)
 
void ComputeDegenGeom (int set, int file_type)
 

Detailed Description

Function Documentation

◆ ComputeCompGeom()

string ComputeCompGeom ( int  set,
bool  half_mesh,
int  file_export_types 
)

Mesh, intersect, and trim components in the set. Alternatively can be run through the Analysis Manager with 'CompGeom'.

//==== Add Pod Geom ====//
pid = AddGeom( "POD", "" );
//==== Run CompGeom And Get Results ====//
string mesh_id = ComputeCompGeom( SET_ALL, false, 0 ); // Half Mesh false and no file export
string comp_res_id = FindLatestResultsID( "Comp_Geom" ); // Find Results ID
array<double> @double_arr = GetDoubleResults( comp_res_id, "Wet_Area" ); // Extract Results
See also
SetAnalysisInputDefaults, PrintAnalysisInputs, ExecAnalysis, COMPUTATION_FILE_TYPE
Parameters
[in]setSet index (i.e. SET_ALL)
[in]half_meshFlag to ignore surfaces on the negative side of the XZ plane (e.g. symmetry)
[in]file_export_typesCompGeom file type to export (supports XOR i.e. COMP_GEOM_CSV_TYPE & DRAG_BUILD_TSV_TYPE )
Returns
MeshGeom ID

◆ ComputeDegenGeom()

void ComputeDegenGeom ( int  set,
int  file_type 
)

Compute the degenerate geometry representation for the components in the set. Alternatively can be run through the Analysis Manager with 'DegenGeom' or 'VSPAERODegenGeom'.

//==== Set File Name ====//
SetComputationFileName( DEGEN_GEOM_CSV_TYPE, "TestDegenScript.csv" );
//==== Run Degen Geom ====//
See also
SetAnalysisInputDefaults, PrintAnalysisInputs, ExecAnalysis, COMPUTATION_FILE_TYPE
Parameters
[in]setSet index (i.e. SET_ALL)
[in]file_typeDegenGeom file type to export (supports XOR i.e DEGEN_GEOM_M_TYPE & DEGEN_GEOM_CSV_TYPE)

◆ ComputeMassProps()

string ComputeMassProps ( int  set,
int  num_slices 
)

Compute mass properties for the components in the set. Alternatively can be run through the Analysis Manager with 'MassProp'.

//==== Test Mass Props ====//
pid = AddGeom( "POD", "" );
string mesh_id = ComputeMassProps( SET_ALL, 20 );
string mass_res_id = FindLatestResultsID( "Mass_Properties" );
double_arr = GetDoubleResults( mass_res_id, "Total_Mass" );
if ( double_arr.size() != 1 ) { Print( "---> Error: API ComputeMassProps" ); }
See also
SetAnalysisInputDefaults, PrintAnalysisInputs, ExecAnalysis
Parameters
[in]setSet index (i.e. SET_ALL)
[in]num_slicesNumber of slices
Returns
MeshGeom ID

◆ ComputePlaneSlice()

string ComputePlaneSlice ( int  set,
int  num_slices,
const vec3d &in  norm,
bool  auto_bnd,
double  start_bnd = 0,
double  end_bnd = 0 
)

Slice and mesh the components in the set. Alternatively can be run through the Analysis Manager with 'PlanarSlice'.

//==== Add Pod Geom ====//
pid = AddGeom( "POD", "" );
//==== Test Plane Slice ====//
string slice_mesh_id = ComputePlaneSlice( 0, 6, vec3d( 0.0, 0.0, 1.0 ), true );
string pslice_results = FindLatestResultsID( "Slice" );
double_arr = GetDoubleResults( pslice_results, "Slice_Area" );
if ( double_arr.size() != 6 ) { Print( "---> Error: API ComputePlaneSlice" ); }
See also
SetAnalysisInputDefaults, PrintAnalysisInputs, ExecAnalysis
Parameters
[in]setSet index (i.e. SET_ALL)
[in]num_slicesNumber of slices
[in]normNormal axis for all slices
[in]auto_bndFlag to automatically set the start and end bound locations
[in]start_bndLocation of the first slice along the normal axis (default: 0.0)
[in]end_bndLocation of the last slice along the normal axis (default: 0.0)
Returns
MeshGeom ID
ComputePlaneSlice
string ComputePlaneSlice(int set, int num_slices, const vec3d &in norm, bool auto_bnd, double start_bnd=0, double end_bnd=0)
DEGEN_GEOM_CSV_TYPE
Definition: openvsp_as.h:1253
SET_ALL
Definition: openvsp_as.h:1840
ComputeDegenGeom
void ComputeDegenGeom(int set, int file_type)
GetDoubleResults
double[] GetDoubleResults(const string &in id, const string &in name, int index=0)
FindLatestResultsID
string FindLatestResultsID(const string &in name)
vec3d
A class for representing 3D vectors.
Definition: openvsp_as.h:341
SetComputationFileName
void SetComputationFileName(int file_type, const string &in file_name)
array
AngelScript ScriptExtension for representing the C++ std::vector.
Definition: openvsp_as.h:244
AddGeom
string AddGeom(const string &in type, const string &in parent=string())
ComputeCompGeom
string ComputeCompGeom(int set, bool half_mesh, int file_export_types)
Print
void Print(const string &in data, bool new_line=true)
ComputeMassProps
string ComputeMassProps(int set, int num_slices)