OpenVSPAPI  3.21.0
Functions
Geom Functions

This group of functions is available for adding, deleting, and modifying OpenVSP Geoms through the API.

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

Functions

string [] GetGeomTypes ()
 
string AddGeom (const string &in type, const string &in parent=string())
 
void UpdateGeom (const string &in geom_id)
 
void DeleteGeom (const string &in geom_id)
 
void DeleteGeomVec (string[]@ del_arr)
 
void CutGeomToClipboard (const string &in geom_id)
 
void CopyGeomToClipboard (const string &in geom_id)
 
string [] PasteGeomClipboard (const string &in parent_id="")
 
string [] FindGeoms ()
 
string [] FindGeomsWithName (const string &in name)
 
string FindGeom (const string &in name, int index)
 
void SetGeomName (const string &in geom_id, const string &in name)
 
string GetGeomName (const string &in geom_id)
 
string [] GetGeomParmIDs (const string &in geom_id)
 
int GetGeomVSPSurfCfdType (const string &in geom_id, int main_surf_ind=0)
 
int GetGeomVSPSurfType (const string &in geom_id, int main_surf_ind=0)
 
string GetGeomTypeName (const string &in geom_id)
 
int GetNumMainSurfs (const string &in geom_id)
 
int GetTotalNumSurfs (const string &in geom_id)
 
vec3d GetGeomBBoxMax (const string &in geom_id, int main_surf_ind=0, bool ref_frame_is_absolute=true)
 
vec3d GetGeomBBoxMin (const string &in geom_id, int main_surf_ind=0, bool ref_frame_is_absolute=true)
 
string GetGeomParent (const string &in geom_id)
 
string [] GetGeomChildren (const string &in geom_id)
 

Detailed Description

Function Documentation

◆ AddGeom()

string AddGeom ( const string &in  type,
const string &in  parent = string() 
)

Add a new Geom of given type as a child of the specified parent. If no parent or an invalid parent is given, the Geom is placed at the top level

//==== Add Wing Geometry ====//
string wing_id = AddGeom( "WING" );
Parameters
[in]typeGeom type (i.e FUSELAGE, POD, etc.)
[in]parentParent Geom ID
Returns
Geom ID

◆ CopyGeomToClipboard()

void CopyGeomToClipboard ( const string &in  geom_id)

Copy Geom from current location and store on clipboard

//==== Add Pod Geometries ====//
string pid1 = AddGeom( "POD", "" );
string pid2 = AddGeom( "POD", "" );
PasteGeomClipboard( pid2 ); // Paste Pod 1 as child of Pod 2
geom_ids = FindGeoms();
if ( geom_ids.size() != 3 ) { Print( "---> Error: API Copy/Paste Geom " ); }
See also
PasteGeomClipboard
Parameters
[in]geom_idGeom ID

◆ CutGeomToClipboard()

void CutGeomToClipboard ( const string &in  geom_id)

Cut Geom from current location and store on clipboad

//==== Add Pod Geometries ====//
string pid1 = AddGeom( "POD", "" );
string pid2 = AddGeom( "POD", "" );
PasteGeomClipboard( pid2 ); // Paste Pod 1 as child of Pod 2
geom_ids = FindGeoms();
if ( geom_ids.size() != 2 ) { Print( "---> Error: API Cut/Paste Geom " ); }
See also
PasteGeomClipboard
Parameters
[in]geom_idGeom ID

◆ DeleteGeom()

void DeleteGeom ( const string &in  geom_id)

Delete a particular Geom

//==== Add Wing Geometry ====//
string wing_id = AddGeom( "WING" );
//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
DeleteGeom( wing_id );
Parameters
[in]geom_idGeom ID

◆ DeleteGeomVec()

void DeleteGeomVec ( string@ []  del_arr)

Delete multiple Geoms

//==== Add Pod Geometry ====//
string pid = AddGeom( "POD", "" );
string rid = ExecAnalysis( "CompGeom" );
array<string>@ mesh_id_vec = GetStringResults( rid, "Mesh_GeomID" );
DeleteGeomVec( mesh_id_vec );
Parameters
[in]del_arrArray of Geom IDs

◆ FindGeom()

string FindGeom ( const string &in  name,
int  index 
)

Find and return the Geom ID with the specified name at given index. Equivalent to FindGeomsWithName( name )[index].

//==== Add Pod Geometry ====//
string pid = AddGeom( "POD", "" );
SetGeomName( pid, "ExamplePodName" );
geom_id = FindGeom( "ExamplePodName", 0 );
geom_ids = FindGeomsWithName( "ExamplePodName" );
if ( geom_ids[0] != geom_id )
{
Print( "---> Error: API FindGeom & FindGeomsWithName" );
}
See also
FindGeomsWithName
Parameters
[in]nameGeom name
[in]index
Returns
Geom ID with name at specified index

◆ FindGeoms()

string [] FindGeoms ( )

Find and return all Geom IDs in the model

//==== Add Pod Geometries ====//
string pod1 = AddGeom( "POD", "" );
string pod2 = AddGeom( "POD", "" );
//==== There Should Be Two Geoms =====//
array< string > @geom_ids = FindGeoms();
if ( geom_ids.size() != 2 ) { Print( "---> Error: API FindGeoms " ); }
Returns
Array of all Geom IDs

◆ FindGeomsWithName()

string [] FindGeomsWithName ( const string &in  name)

Find and return all Geom IDs with the specified name

//==== Add Pod Geometry ====//
string pid = AddGeom( "POD", "" );
SetGeomName( pid, "ExamplePodName" );
geom_ids = FindGeomsWithName( "ExamplePodName" );
if ( geom_ids.size() != 1 )
{
Print( "---> Error: API FindGeomsWithName " );
}
See also
FindGeom
Parameters
[in]nameGeom name
Returns
Array of Geom IDs

◆ GetGeomBBoxMax()

vec3d GetGeomBBoxMax ( const string &in  geom_id,
int  main_surf_ind = 0,
bool  ref_frame_is_absolute = true 
)

Get the the maximum coordinate of the bounding box of a Geom with given main surface index. The Geom bounding box may be specified in absolute or body reference frame.

//==== Add Pod Geometry ====//
string pid = AddGeom( "Pod" );
SetParmVal( FindParm( pid, "Y_Rotation", "XForm" ), 45 );
SetParmVal( FindParm( pid, "Z_Rotation", "XForm" ), 25 );
vec3d max_pnt = GetGeomBBoxMax( pid, 0, false );
See also
GetGeomBBoxMin
Parameters
[in]geom_idGeom ID
[in]main_surf_indMain surface index
[in]ref_frame_is_absoluteFlag to specify absolute or body reference frame
Returns
Maximum coordinate of the bounding box

◆ GetGeomBBoxMin()

vec3d GetGeomBBoxMin ( const string &in  geom_id,
int  main_surf_ind = 0,
bool  ref_frame_is_absolute = true 
)

Get the the minimum coordinate of the bounding box of a Geom with given main surface index. The Geom bounding box may be specified in absolute or body reference frame.

//==== Add Pod Geometry ====//
string pid = AddGeom( "Pod" );
SetParmVal( FindParm( pid, "Y_Rotation", "XForm" ), 45 );
SetParmVal( FindParm( pid, "Z_Rotation", "XForm" ), 25 );
vec3d min_pnt = GetGeomBBoxMin( pid, 0, false );
See also
GetGeomBBoxMax
Parameters
[in]geom_idGeom ID
[in]main_surf_indMain surface index
[in]ref_frame_is_absoluteFlag to specify absolute or body reference frame
Returns
Minimum coordinate of the bounding box

◆ GetGeomChildren()

string [] GetGeomChildren ( const string &in  geom_id)

Get the IDs for each child of the input parent Geom.

//==== Add Parent and Child Geometry ====//
string pod1 = AddGeom( "POD" );
string pod2 = AddGeom( "POD", pod1 );
string pod3 = AddGeom( "POD", pod2 );
Print( "Children of Pod #1: " );
array<string> @children = GetGeomChildren( pod1 );
for ( int 1 = 0; i < children.size(); i++ )
{
Print( "\t", false );
Print( children[i] );
}
Parameters
[in]geom_idGeom ID
Returns
Array of child Geom IDs

◆ GetGeomName()

string GetGeomName ( const string &in  geom_id)

Get the name of a specific Geom

//==== Add Pod Geometry ====//
string pid = AddGeom( "POD", "" );
SetGeomName( pid, "ExamplePodName" );
string name_str = "Geom Name: " + GetGeomName( pid );
Print( name_str );
Parameters
[in]geom_idGeom ID
Returns
Geom name

◆ GetGeomParent()

string GetGeomParent ( const string &in  geom_id)

Get the parent Geom ID for the input child Geom. "NONE" is returned if the Geom has no parent.

//==== Add Parent and Child Geometry ====//
string pod1 = AddGeom( "POD" );
string pod2 = AddGeom( "POD", pod1 );
Print( "Parent ID of Pod #2: ", false );
Print( GetGeomParent( pod2 ) );
Parameters
[in]geom_idGeom ID
Returns
Parent Geom ID

◆ GetGeomParmIDs()

string [] GetGeomParmIDs ( const string &in  geom_id)

Get all Parm IDs associated with this Geom Parm container

//==== Add Pod Geometry ====//
string pid = AddGeom( "POD", "" );
Print( string( "---> Test Get Parm Arrays" ) );
array< string > @parm_array = GetGeomParmIDs( pid );
if ( parm_array.size() < 1 ) { Print( "---> Error: API GetGeomParmIDs " ); }
Parameters
[in]geom_idGeom ID
Returns
Array of Parm IDs

◆ GetGeomTypeName()

string GetGeomTypeName ( const string &in  geom_id)

Get the type name of specified Geom (i.e. FUSELAGE)

//==== Add Wing Geometry ====//
string wing_id = AddGeom( "WING" );
Print( "Geom Type Name: ", false );
Print( GetGeomTypeName( wing_id ) );
Parameters
[in]geom_idGeom ID
Returns
Geom type name

◆ GetGeomTypes()

string [] GetGeomTypes ( )

Get an array of all Geom types (i.e FUSELAGE, POD, etc.)

//==== Add Pod Geometries ====//
string pod1 = AddGeom( "POD", "" );
string pod2 = AddGeom( "POD", "" );
array< string > @type_array = GetGeomTypes();
if ( type_array[0] != "POD" ) { Print( "---> Error: API GetGeomTypes " ); }
Returns
Array of Geom type names

◆ GetGeomVSPSurfCfdType()

int GetGeomVSPSurfCfdType ( const string &in  geom_id,
int  main_surf_ind = 0 
)

Get the VSP surface CFD type of the specified Geom

//==== Add Wing Geometry ====//
string wing_id = AddGeom( "WING" );
if ( GetGeomVSPSurfCfdType( wing_id ) != CFD_NORMAL )
{
Print( "---> Error: API GetGeomVSPSurfCfdType " );
}
See also
VSP_SURF_CFD_TYPE
Parameters
[in]geom_idGeom ID
[in]main_surf_indMain surface index
Returns
VSP surface CFD type enum (i.e. CFD_TRANSPARENT)

◆ GetGeomVSPSurfType()

int GetGeomVSPSurfType ( const string &in  geom_id,
int  main_surf_ind = 0 
)

Get the VSP surface type of the specified Geom

//==== Add Wing Geometry ====//
string wing_id = AddGeom( "WING" );
if ( GetGeomVSPSurfType( wing_id ) != WING_SURF )
{
Print( "---> Error: API GetGeomVSPSurfType " );
}
See also
VSP_SURF_TYPE
Parameters
[in]geom_idGeom ID
[in]main_surf_indMain surface index
Returns
VSP surface type enum (i.e. DISK_SURF)

◆ GetNumMainSurfs()

int GetNumMainSurfs ( const string &in  geom_id)

Get the number of main surfaces for the specified Geom. Multiple main surfaces may exist for CustoGeoms, propellors, etc., but does not include surfaces created due to symmetry.

//==== Add Prop Geometry ====//
string prop_id = AddGeom( "PROP" );
int num_surf = GetNumMainSurfs( prop_id ); // Should be the same as the number of blades
Print( "Number of Propeller Surfaces: ", false );
Print( num_surf );
Parameters
[in]geom_idGeom ID
Returns
Number of main surfaces

◆ GetTotalNumSurfs()

int GetTotalNumSurfs ( const string &in  geom_id)

Get the total number of surfaces for the specified Geom. This is equivalent to the number of main surface multiplied by the number of symmetric copies.

//==== Add Wing Geometry ====//
string wing_id = AddGeom( "WING" );
int num_surf = GetNumMaGetTotalNumSurfsinSurfs( wing_id ); // Wings default with XZ symmetry on -> 2 surfaces
Print( "Total Number of Wing Surfaces: ", false );
Print( num_surf );
Parameters
[in]geom_idGeom ID
Returns
Number of main surfaces

◆ PasteGeomClipboard()

string [] PasteGeomClipboard ( const string &in  parent_id = "")

Paste Geom from clipboard into the model. The Geom is pasted as a child of the specified parent, but will be placed at top level if no parent or an invalid one is provided.

//==== Add Pod Geometries ====//
string pid1 = AddGeom( "POD", "" );
string pid2 = AddGeom( "POD", "" );
PasteGeomClipboard( pid2 ); // Paste Pod 1 as child of Pod 2
geom_ids = FindGeoms();
if ( geom_ids.size() != 2 ) { Print( "---> Error: API Cut/Paste Geom " ); }
Parameters
[in]parent_idParent Geom ID
Returns
Array of pasted Geom IDs

◆ SetGeomName()

void SetGeomName ( const string &in  geom_id,
const string &in  name 
)

Set the name of the specified Geom

//==== Add Pod Geometry ====//
string pid = AddGeom( "POD", "" );
SetGeomName( pid, "ExamplePodName" );
geom_ids = FindGeomsWithName( "ExamplePodName" );
if ( geom_ids.size() != 1 )
{
Print( "---> Error: API FindGeomsWithName " );
}
Parameters
[in]geom_idGeom ID
[in]nameGeom name

◆ UpdateGeom()

void UpdateGeom ( const string &in  geom_id)

Perform an update for the specified Geom

//==== Add Wing Geometry ====//
string wing_id = AddGeom( "WING" );
//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
SetParmVal( pod_id, "X_Rel_Location", "XForm", 5.0 );
UpdateGeom( pod_id ); // Faster than updating the whole vehicle
See also
Update()
Parameters
[in]geom_idGeom ID