OpenVSPAPI  3.20.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)
 
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)
 
string GetGeomTypeName (const string &in geom_id)
 
int GetNumMainSurfs (const string &in geom_id)
 
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

◆ 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 " );
}
Parameters
[in]nameGeom name
Returns
Array of Geom IDs

◆ 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

◆ 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, when symmetry is actve, etc.

//==== 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

◆ 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
GetGeomParent
string GetGeomParent(const string &in geom_id)
FindGeoms
string[] FindGeoms()
GetGeomChildren
string[] GetGeomChildren(const string &in geom_id)
PasteGeomClipboard
string[] PasteGeomClipboard(const string &in parent_id="")
ExecAnalysis
string ExecAnalysis(const string &in analysis)
GetGeomTypeName
string GetGeomTypeName(const string &in geom_id)
CutGeomToClipboard
void CutGeomToClipboard(const string &in geom_id)
GetStringResults
string[] GetStringResults(const string &in id, const string &in name, int index=0)
SetParmVal
double SetParmVal(const string &in parm_id, double val)
DeleteGeom
void DeleteGeom(const string &in geom_id)
GetGeomTypes
string[] GetGeomTypes()
array
AngelScript ScriptExtension for representing the C++ std::vector.
Definition: openvsp_as.h:244
SetGeomName
void SetGeomName(const string &in geom_id, const string &in name)
DeleteGeomVec
void DeleteGeomVec(string[]@ del_arr)
AddGeom
string AddGeom(const string &in type, const string &in parent=string())
Print
void Print(const string &in data, bool new_line=true)
GetGeomParmIDs
string[] GetGeomParmIDs(const string &in geom_id)
FindGeomsWithName
string[] FindGeomsWithName(const string &in name)
GetGeomName
string GetGeomName(const string &in geom_id)
CopyGeomToClipboard
void CopyGeomToClipboard(const string &in geom_id)
GetNumMainSurfs
int GetNumMainSurfs(const string &in geom_id)
UpdateGeom
void UpdateGeom(const string &in geom_id)