openvsp package

degen geom parse

openvsp.degen_geom_parse.parse_degen_geom(degen_geom_res_id, vsp_instance=None)

parasite drag

class openvsp.parasite_drag.ParasiteDragResults(results)

Bases: object

Class that contains all of the results from a parasite drag sweep in OpenVSP

build_interpolator()

Returns interpolator to interpolate results as a function of speed and altitude

plot(ax=None)

Creates plot of CD0 vs speed and altitude

openvsp.parasite_drag.parasitedrag_sweep(speeds, alts_ft, sref=None, length_unit=None, speed_unit=6, set=None, vsp_instance=None)

Runs a parasite drag sweep over a range of speeds and altitudes. For subsonic data only.

Parameters:
  • speeds – list of speeds to sweep over

  • alts_ft – list of altitudes to sweep over

  • speed_unit – units of speed array

  • set – vsp geometry set to use for build up

  • length_unit – length unit of the vsp model

  • sref – reference area

  • vsp_instance – optional instance of vsp if using the multifacade

Returns:

named tuple with results

surface patches

class openvsp.surface_patches.Surface(comp_id, surf_index, patches)

Bases: object

class openvsp.surface_patches.SurfaceComponent(name, id, surfaces)

Bases: object

class openvsp.surface_patches.SurfacePatch(comp_id, surf_index, patch_index, x, y, z, nx, ny, nz)

Bases: object

openvsp.surface_patches.export_surface_patches(export_set: int, remove_degenerate=True, vsp_instance=None)

Function that export surfaces patches of current set :param export_set: vsp set to export :param remove_degenerate: if true, degenerate surface patches are removed :param vsp_instance: optional instance of vsp if using the multifacade :return: list components with surface patches

openvsp.surface_patches.plot_surface_components(components: List[SurfaceComponent], plot_normals=True, quiver_len=0.2, vsp_instance=None)

Plots a list of surface components :param components: list of surface components to plot :param plot_normals: set to true to plot normal vectors, set to false to turn off normal vector plotting :param vsp_instance: optional instance of vsp if using the multifacade :return: handle to plotted figure

utilities

class openvsp.utilities.PropInfo(geom_id, thrust_vector, rotation_direction, hub_center, transmat, diameter)

Bases: object

property area
openvsp.utilities.convert_double_tuple_to_list_matrix(tuple_matrix)

Converts a double matrix of tuples into a maxtrix of lists :param tuple_matrix: matrix of tuples :return: matrix of lists

openvsp.utilities.convert_vec3d_array_to_list_matrix(vec3d_array)

Converts an array of vec3d objects into a list of x,y,z points :param vec3d_array: array of vec3d objects :return: list of x,y,z pairs

openvsp.utilities.export_airfoils(set=0, vsp_instance=None, **kwargs)
openvsp.utilities.genX3d(file=None, set=0, dims=[1000, 400], vsp_instance=None, **kwargs)
openvsp.utilities.get_propeller_thrust_vectors(prop_set, alternate_rotation_direction=False, vsp_instance=None)

Returns propeller thrust vector directions and rotation direction for all propellers in the input set :param prop_set: set containing all propellers (no other geometries should be included) :param vsp_instance: optional instance of vsp if using the multifacade :return: Named Tuple with (geom_id, thrust_vector, rotation_direction, hub_center)

openvsp.utilities.get_single_propeller_info(prop_dg, vsp_instance=None)

Gets propeller info for a single propeller degen geom object :param prop_dg: propeller degen geom object :param vsp_instance: optional instance of vsp if using the multifacade :return: propeller info named tuple

openvsp.utilities.get_wing_reference_quantities(wing_name=None, wing_id=None, vsp_instance=None)

Gets wing reference area, reference span, and reference chord (sref, bref, cref) from the TotalArea, TotalSpan, and TotalChord properties of Wing component

Parameters:
  • wing_name – Name of the wing (will find the first wing with this name)

  • wing_id – ID of the wing object, if None wing name will be used to find the wing id. Wing ID takes precedence over wing_name

  • vsp_instance – optional instance of vsp if using the multifacade

Returns:

sref, bref, and cref

openvsp.utilities.parse_results_object(res_id, vsp_instance=None)

Function to parse a generic results object from openvsp results manager :param res_id: id of the results object to parse :param vsp_instance: optional instance of vsp if using the multifacade :return: named tuple of results values

openvsp.utilities.plot_propeller_info(prop_infos, vector_scale=10.0, markersize=2.0, mutation_scale=20.0)

Plots an array of propeller info tuples to visually inspect thrust and rotation directions :param prop_infos: array of prop info tuples :param vector_scale: length of each thrust vector :param markersize: size of marker for hub location :param mutation_scale: mutation scale applied to arrow objects :return: figure handle

openvsp.utilities.run_degen_geom(set_index=None, set_name=None, vsp_instance=None)

Runs degen geom on input set :param set_index: set index, will take precedence if both set index and set name are specified :param set_name: name of set, will be used if set index is not specified :param vsp_instance: optional instance of vsp if using the multifacade :return: degen geom manager object

openvsp.utilities.set_3d_axis_equal(ax)

Sets axis aspect ratio to equal :param ax: 3d axis object :return:

vsp

openvsp.vsp.ABS = 0

Absolute position

openvsp.vsp.AERO_CENTER = 19

Calculate aero center of single lifting surface

openvsp.vsp.ALIGN_BOTTOM = 6

Align to bottom

openvsp.vsp.ALIGN_CENTER = 1

Align to center

openvsp.vsp.ALIGN_LEFT = 0

Align to left

openvsp.vsp.ALIGN_MIDDLE = 5

Align to middle

openvsp.vsp.ALIGN_PIXEL = 3

Align to specified pixel

openvsp.vsp.ALIGN_RIGHT = 2

Align to right

openvsp.vsp.ALIGN_TOP = 4

Align to top

openvsp.vsp.ALL_GDEV_TYPES = 32

Flag for all GDEV types

openvsp.vsp.ALL_GEOM_SCREENS = 22

All geom screens

openvsp.vsp.ALTERNATE_FRAGMENT = 2

Alternate rotor fragment model

openvsp.vsp.ANG_0 = 0

Zero deg

openvsp.vsp.ANG_180 = 2

180 deg

openvsp.vsp.ANG_270 = 3

270 deg

openvsp.vsp.ANG_90 = 1

90 deg

openvsp.vsp.ANG_DEG = 1

Degrees

openvsp.vsp.ANG_RAD = 0

Radians

openvsp.vsp.APPROX_CEDIT = 3

Approximate curve as Cubic Bezier

openvsp.vsp.AREA_WSECT_DRIVER = 2

Area driver

openvsp.vsp.AREA_XSEC_DRIVER = 1

Area driver

openvsp.vsp.AR_WSECT_DRIVER = 0

Aspect ratio driver

openvsp.vsp.ATMOS_TYPE_HERRINGTON_1966 = 1

USAF 1966

openvsp.vsp.ATMOS_TYPE_MANUAL_P_R = 2

Manual: pressure and density control

openvsp.vsp.ATMOS_TYPE_MANUAL_P_T = 3

Manual: pressure and temperature control

openvsp.vsp.ATMOS_TYPE_MANUAL_RE_L = 5

Manual: Reynolds number and length control

openvsp.vsp.ATMOS_TYPE_MANUAL_R_T = 4

Manual: density and temperature control

openvsp.vsp.ATMOS_TYPE_US_STANDARD_1976 = 0

US Standard Atmosphere 1976 (default)

openvsp.vsp.ATTACH_ROT_COMP = 1

Rotation relative to parent body axes

openvsp.vsp.ATTACH_ROT_EtaMN = 5

Rotation relative to wing parent eta volume coordinate frame

openvsp.vsp.ATTACH_ROT_LMN = 4

Rotation relative to parent uniform volume coordinate frame

openvsp.vsp.ATTACH_ROT_NONE = 0

No parent attachment for rotations

openvsp.vsp.ATTACH_ROT_NUM_TYPES = 6

Number of rotation attachment types

openvsp.vsp.ATTACH_ROT_RST = 3

Rotation relative to parent per-section volume coordinate frame

openvsp.vsp.ATTACH_ROT_UV = 2

Rotation relative to parent surface coordinate frame

openvsp.vsp.ATTACH_TRANS_COMP = 1

Translation relative to parent body axes

openvsp.vsp.ATTACH_TRANS_EtaMN = 5

Translation relative to wing parent uniform eta volume coordinate frame

openvsp.vsp.ATTACH_TRANS_LMN = 4

Translation relative to parent uniform volume coordinate frame

openvsp.vsp.ATTACH_TRANS_NONE = 0

No parent attachment for translations

openvsp.vsp.ATTACH_TRANS_NUM_TYPES = 6

Number of translation attachment types

openvsp.vsp.ATTACH_TRANS_RST = 3

Translation relative to parent per-section volume coordinate frame

openvsp.vsp.ATTACH_TRANS_UV = 2

Translation relative to parent surface coordinate frame

Adv Link

openvsp.vsp.ATTROBJ_ATTR = 7

Attribute

openvsp.vsp.ATTROBJ_COLLECTION = 8

Attribute Collection

openvsp.vsp.ATTROBJ_FREE = 15

Unattached attribute

openvsp.vsp.ATTROBJ_GEOM = 1

Geom

Link

openvsp.vsp.ATTROBJ_MEASURE = 4

Measure

openvsp.vsp.ATTROBJ_MODE = 11

Mode

openvsp.vsp.ATTROBJ_PARM = 0

Parm

openvsp.vsp.ATTROBJ_SEC = 10

Wing Section

openvsp.vsp.ATTROBJ_SET = 12

Geom Set

openvsp.vsp.ATTROBJ_SUBSURF = 3

SubSurf

openvsp.vsp.ATTROBJ_VARGROUP = 13

Var Preset Group

openvsp.vsp.ATTROBJ_VARSETTING = 14

Var Preset Setting

openvsp.vsp.ATTROBJ_VEH = 2

Vehicle

openvsp.vsp.ATTROBJ_XSEC = 9

Cross Section

openvsp.vsp.ATTR_COLLECTION_DATA = 8

Attribute collection data type

openvsp.vsp.ATTR_GROUP_NONE = -1

No event (user attributes)

openvsp.vsp.ATTR_GROUP_WATERMARK = 0

Watermark group

openvsp.vsp.AUXILIARY_GEOM_SCREEN = 18

Auxiliary geom screen

openvsp.vsp.AUX_GEOM_ONE_PT_GROUND = 4

One contact point ground plane

openvsp.vsp.AUX_GEOM_ROTOR_BURST = 1

Rotor burst zone

openvsp.vsp.AUX_GEOM_ROTOR_FRAGMENT = 8

AC 20-128 A rotor fragment

openvsp.vsp.AUX_GEOM_ROTOR_TIP_PATH = 0

Rotor tip path

openvsp.vsp.AUX_GEOM_SINGLE_GEAR = 7

Single (potentially) off nominal gear

openvsp.vsp.AUX_GEOM_SUPER_CONE = 6

Super cone (XSecCurve based profile)

openvsp.vsp.AUX_GEOM_THREE_PT_CCE = 5

Three contact point composite clearance envelope

openvsp.vsp.AUX_GEOM_THREE_PT_GROUND = 2

Three contact point ground plane

openvsp.vsp.AUX_GEOM_THROWN_BLADE = 9

AC 25.905-1 thrown blade

openvsp.vsp.AUX_GEOM_TIRE_SPRAY = 10

ESDU 83042a Tire spray pattern

openvsp.vsp.AUX_GEOM_TWO_PT_GROUND = 3

Two contact point ground plane

openvsp.vsp.AUX_GEOM_WHEEL_TIRE_FAILURE = 11

AMC 25.734 Wheel and tire failure models

openvsp.vsp.AVEC_WSECT_DRIVER = 4

Average chord driver

openvsp.vsp.AcceptGeomScale(geom_id)

Turn a MeshGeom into a Point Cloud Geom made of its mesh nodes. This is the Mesh screen’s Convert to Point Cloud button.

pid = AddGeom( "POD" )

mesh_id = ExportFile( "Example_Mesh.msh", SET_ALL, EXPORT_GMSH )

cloud_id = CreatePtCloudGeom( mesh_id )

assert len( cloud_id ) > 0, "CreatePtCloudGeom did not make a point cloud"
assert GetGeomTypeName( cloud_id ) == "PtCloud", "CreatePtCloudGeom did not make a point cloud"

# A Geom that is not a mesh has to be rejected.
err_mgr = ErrorMgrSingleton.getInstance()

CreatePtCloudGeom( pid )

assert err_mgr.GetNumTotalErrors() > 0, "CreatePtCloudGeom accepted a Geom that is not a mesh"

while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: CreateNGonMeshGeom, CreateConvexHull :param [in]: geom_id string MeshGeom ID :rtype: void :return: string Point Cloud Geom ID

Keep a Geom’s scaled size and reset the scale factor to one, folding the scaling into the Geom’s own dimensions. This is the Scale tab’s Accept button.

pid = AddGeom( "POD" )

Update()

before_max = GetGeomBBoxMax( pid, 0, False )

SetParmValUpdate( pid, "Scale", "XForm", 2.0 )

Update()

AcceptGeomScale( pid )

Update()

# The scale factor comes back to one but the size it produced is kept.
assert abs( GetParmVal( pid, "Scale", "XForm" ) - 1.0 ) < 1e-9, "AcceptGeomScale did not reset the scale factor"

after_max = GetGeomBBoxMax( pid, 0, False )

assert abs( after_max.x() - 2.0 * before_max.x() ) < 1e-6, "AcceptGeomScale did not keep the scaled size"

See also: ResetGeomScale :param [in]: geom_id string Geom ID

Add an advanced link

pod = AddGeom( "POD", "" )
length = FindParm( pod, "Length", "Design" )
x_pos = GetParm( pod, "X_Rel_Location", "XForm" )

AddAdvLink( "ExampleLink" )
indx = GetLinkIndex( "ExampleLink" )
AddAdvLinkInput( indx, length, "len" )
AddAdvLinkOutput( indx, x_pos, "x" )

SetAdvLinkCode( indx, "x = 10.0 - len;" )

BuildAdvLinkScript( indx )

# The link was named, so it has to be findable by that name and by that
# index, and it has to actually drive its output: x is 10 minus the Pod's
# length, so changing the length has to move the Pod.
assert indx >= 0, "the advanced link was not registered under its name"
assert len( GetAdvLinkNames() ) == 1, "the advanced link was not registered under its name"
assert GetAdvLinkNames()[0] == "ExampleLink", "the advanced link was not registered under its name"

SetParmValUpdate( length, 6.0 )

Update()

assert abs( GetParmVal( x_pos ) - 4.0 ) < 1e-6, "the advanced link did not drive its output"
Parameters:

[in] – name string Name for advanced link

openvsp.vsp.AddAdvLinkInput(index, parm_id, var_name)

Add an input variable to an advanced link

pod = AddGeom( "POD", "" )
length = FindParm( pod, "Length", "Design" )
x_pos = GetParm( pod, "X_Rel_Location", "XForm" )

AddAdvLink( "ExampleLink" )
indx = GetLinkIndex( "ExampleLink" )
AddAdvLinkInput( indx, length, "len" )
AddAdvLinkOutput( indx, x_pos, "x" )

SetAdvLinkCode( indx, "x = 10.0 - len;" )

BuildAdvLinkScript( indx )

# The link was named, so it has to be findable by that name and by that
# index, and it has to actually drive its output: x is 10 minus the Pod's
# length, so changing the length has to move the Pod.
assert indx >= 0, "the advanced link was not registered under its name"
assert len( GetAdvLinkNames() ) == 1, "the advanced link was not registered under its name"
assert GetAdvLinkNames()[0] == "ExampleLink", "the advanced link was not registered under its name"

SetParmValUpdate( length, 6.0 )

Update()

assert abs( GetParmVal( x_pos ) - 4.0 ) < 1e-6, "the advanced link did not drive its output"
Parameters:
  • [in] – index int Advanced link index

  • [in] – parm_id string Parameter ID for advanced link input variable

  • [in] – var_name string Name for advanced link input variable

openvsp.vsp.AddAdvLinkOutput(index, parm_id, var_name)

Add an output variable to an advanced link

pod = AddGeom( "POD", "" )
length = FindParm( pod, "Length", "Design" )
x_pos = GetParm( pod, "X_Rel_Location", "XForm" )

AddAdvLink( "ExampleLink" )
indx = GetLinkIndex( "ExampleLink" )
AddAdvLinkInput( indx, length, "len" )
AddAdvLinkOutput( indx, x_pos, "x" )

SetAdvLinkCode( indx, "x = 10.0 - len;" )

BuildAdvLinkScript( indx )

# The link was named, so it has to be findable by that name and by that
# index, and it has to actually drive its output: x is 10 minus the Pod's
# length, so changing the length has to move the Pod.
assert indx >= 0, "the advanced link was not registered under its name"
assert len( GetAdvLinkNames() ) == 1, "the advanced link was not registered under its name"
assert GetAdvLinkNames()[0] == "ExampleLink", "the advanced link was not registered under its name"

SetParmValUpdate( length, 6.0 )

Update()

assert abs( GetParmVal( x_pos ) - 4.0 ) < 1e-6, "the advanced link did not drive its output"
Parameters:
  • [in] – index int Advanced link index

  • [in] – parm_id string Parameter ID for advanced link output variable

  • [in] – var_name string Name for advanced link output variable

openvsp.vsp.AddAllToVSPAEROControlSurfaceGroup(CSGroupIndex)

Add all available control surfaces to the control surface group at the specified index

wid = AddGeom( "WING", "" )                             # Add Wing

aileron_id = AddSubSurf( wid, SS_CONTROL )                      # Add Control Surface Sub-Surface

group_index = CreateVSPAEROControlSurfaceGroup() # Empty control surface group

# The group starts empty and the wing offers one control surface, mirrored
# by the wing's own symmetry.
assert GetNumControlSurfaceGroups() >= 1, "CreateVSPAEROControlSurfaceGroup did not add a group"

num_avail = len( GetAvailableCSNameVec( group_index ) )

assert num_avail >= 1, "no control surfaces are available to add"
assert len( GetActiveCSNameVec( group_index ) ) == 0, "a new control surface group is not empty"

AddAllToVSPAEROControlSurfaceGroup( group_index )

# Everything that was available is now active, and nothing is left over.
assert len( GetActiveCSNameVec( group_index ) ) == num_avail, "AddAllToVSPAEROControlSurfaceGroup did not add them all"
assert len( GetAvailableCSNameVec( group_index ) ) == 0, "control surfaces are still available after adding them all"
Parameters:

[in] – CSGroupIndex int Index of the control surface group

openvsp.vsp.AddAttributeBool(collID, attributeName, value)

Add a boolean attribute by name to an attribute collection

##==== Attribute: AddAttributeBool  =====##

VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
InitVal = True
AttrID = AddAttributeBool( CollID, "TestBoolAttr", InitVal )

GetVal = GetAttributeBoolVal( AttrID )
if GetVal[0] == InitVal:
    print( "Added Bool Attribute" )
else:
    print( "AddAttributeBool error!" )
    assert False, "AddAttributeBool error!"
Parameters:
  • [in] – collID string ID of attribute collection

  • [in] – attributeName string name of new attribute

  • [in] – value bool boolean value of new attribute

openvsp.vsp.AddAttributeDouble(collID, attributeName, value)

Add a double attribute by name to an attribute collection

##==== Attribute: AddAttributeDouble  =====##

VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
AttrName = 'Example_Double_Attr'
DoubleValue = 3.14159
AttrID = AddAttributeDouble( CollID, AttrName, DoubleValue )

GetVal = GetAttributeDoubleVal( AttrID )
if GetVal[0] == DoubleValue:
    print( "Added Double Attribute" )
else:
    print( "AddAttributeDouble error!" )
    assert False, "AddAttributeDouble error!"
Parameters:
  • [in] – collID string ID of attribute collection

  • [in] – attributeName string name of new attribute

  • [in] – value double value of new attribute

openvsp.vsp.AddAttributeDoubleMatrix(collID, attributeName, value)

Add an Double Matrix attribute by name to an attribute collection use nested vectors/arrays of ints for matrix argument

##==== Attribute: AddAttributeDoubleMatrix  =====##

VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
AttrName = 'Example_DoubleMat_Attr'
DoubleMatrix = [[0.,1.5],[8.4,1.1566]]
AttrID = AddAttributeDoubleMatrix( CollID, AttrName, DoubleMatrix )

DoubleMatrixVal = GetAttributeDoubleMatrixVal( AttrID )
DoubleMatrixVal = [list(row) for row in DoubleMatrixVal]

if DoubleMatrixVal == DoubleMatrix:
    print( "Added DoubleMatrix Attribute" )
else:
    print( "AddAttributeDoubleMatrix error!" )
    assert False, "AddAttributeDoubleMatrix error!"
Parameters:
  • [in] – collID string ID of attribute collection

  • [in] – attributeName string name of new attribute

  • [in] – value vector <vector <double>> Double matrix value of new attribute

openvsp.vsp.AddAttributeGroup(collID, attributeName)

Add an empty Attribute Group-type attribute by name to an attribute collection

##==== Attribute: AddAttributeGroup  =====##

VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
AttrName = 'Example_Attr_Group'
AttrID = AddAttributeGroup( CollID, AttrName )
if GetAttributeType( AttrID ) == ATTR_COLLECTION_DATA:
    print( "Added Attribute Group" )
else:
    print( "AddAttributeGroup error!" )
    assert False, "AddAttributeGroup error!"
Parameters:
  • [in] – collID string ID of attribute collection

  • [in] – attributeName string name of new attribute group

openvsp.vsp.AddAttributeInt(collID, attributeName, value)

Add a integer attribute by name to an attribute collection

##==== Attribute: AddAttributeInt  =====##

VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
InitVal = 55
AttrID = AddAttributeInt( CollID, "TestIntAttr", InitVal )

GetVal = GetAttributeIntVal( AttrID )
if GetVal[0] == InitVal:
    print( "Added Int Attribute" )
else:
    print( "AddAttributeInt error!" )
    assert False, "AddAttributeInt error!"
Parameters:
  • [in] – collID string ID of attribute collection

  • [in] – attributeName string name of new attribute

  • [in] – value int integer value of new attribute

openvsp.vsp.AddAttributeIntMatrix(collID, attributeName, value)

Add an Int Matrix attribute by name to an attribute collection use nested vectors/arrays of ints for matrix argument

##==== Attribute: AddAttributeIntMatrix  =====##

VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
AttrName = 'Example_IntMatrix_Attr'
IntMatrix = [[1,5],[-8,0]]
AttrID = AddAttributeIntMatrix( CollID, AttrName, IntMatrix )

IntMatrixVal = GetAttributeIntMatrixVal( AttrID )
IntMatrixVal = [list(row) for row in IntMatrixVal]

if IntMatrixVal == IntMatrix:
    print( "Added IntMatrix Attribute" )
else:
    print( "AddAttributeIntMatrix error!" )
    assert False, "AddAttributeIntMatrix error!"
Parameters:
  • [in] – collID string ID of attribute collection

  • [in] – attributeName string name of new attribute

  • [in] – value int matrix value of new attribute

openvsp.vsp.AddAttributeParm(collID, attributeName, parmID)

Add a parm attribute by name to an attribute collection

##==== Attribute: AddAttributeParm  =====##

VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
pid = AddGeom( "POD", "" )
print( "---> Test Add Parm Attr" )
parm_array = GetGeomParmIDs( pid )
AttrName = 'Example_Parm_Attr'
ParmID = parm_array[0]
AttrID = AddAttributeParm( CollID, AttrName, ParmID )

GetVal = GetAttributeParmID( AttrID )
if GetVal[0] == ParmID:
    print( "Added Parm Attribute" )
else:
    print( "AddAttributeParm error!" )
    assert False, "AddAttributeParm error!"
Parameters:
  • [in] – collID string ID of attribute collection

  • [in] – attributeName string name of new attribute

  • [in] – parmID string Parm ID to add to attribute

openvsp.vsp.AddAttributeString(collID, attributeName, value)

Add a string attribute by name to an attribute collection

##==== Attribute: AddAttributeString  =====##

VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
AttrName = 'Example_String_Attr'
StringValue = 'Example_String_Attr_DataVal'
AttrID = AddAttributeString( CollID, AttrName, StringValue )

GetVal = GetAttributeStringVal( AttrID )
if GetVal[0] == StringValue:
    print( "Added String Attribute" )
else:
    print( "AddAttributeString error!" )
    assert False, "AddAttributeString error!"
Parameters:
  • [in] – collID string ID of attribute collection

  • [in] – attributeName string name of new attribute

  • [in] – value string value of new attribute

openvsp.vsp.AddAttributeVec3d(collID, attributeName, value)

Add a Vec3d attribute by name to an attribute collection use vec3d() to create a vec3d object to pass into the args!

##==== Attribute: AddAttributeVec3d  =====##

VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
AttrName = 'Example_Vec3D_Attr'
Vec3dVal = vec3d( 0.5, 0.75, -0.4 )
AttrID = AddAttributeVec3d( CollID, AttrName, [Vec3dVal] )

GetVal = GetAttributeVec3dVal( AttrID )
if ( GetVal[0].x() == Vec3dVal.x() ) and ( GetVal[0].y() == Vec3dVal.y() ) and ( GetVal[0].z() == Vec3dVal.z() ):
    print( "Added Vec3d Attribute" )
else:
    print( "AddAttributeVec3d error!" )
    assert False, "AddAttributeVec3d error!"
Parameters:
  • [in] – collID string ID of attribute collection

  • [in] – attributeName string name of new attribute

  • [in] – value vector <vec3d> Vec3d value of new attribute

openvsp.vsp.AddBackground3D()

Add a Background3D to model

nbg = GetNumBackground3Ds()

# Add Background3D
bg_id = AddBackground3D()

if GetNumBackground3Ds() != nbg + 1 :
    print( "ERROR: AddBackground3D" )
    assert False, "ERROR: AddBackground3D"

DelBackground3D( bg_id )
Return type:

string

Returns:

string ID for added Background3D

openvsp.vsp.AddCFDSource(type, geom_id, surf_index, l1, r1, u1, w1, l2=0, r2=0, u2=0, w2=0)

Add a CFD Mesh default source for the indicated Geom. Note, certain input params may not be used depending on the source type

#==== Add Pod Geom ====//
pid = AddGeom( "POD", "" )

AddCFDSource( POINT_SOURCE, pid, 0, 0.25, 2.0, 0.5, 0.5 )      # Add A Point Source

# The source lands on the Geom it was given, as the type it was given.
assert GetNumCFDSources( pid ) == 1, "AddCFDSource did not add a point source"
assert GetCFDSourceType( pid, 0 ) == POINT_SOURCE, "AddCFDSource did not add a point source"

# A source attached to a Geom that does not exist has to be rejected.  The
# error queue is reached through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

AddCFDSource( POINT_SOURCE, "NOSUCHGEOM", 0, 0.25, 2.0, 0.5, 0.5 )

assert err_mgr.GetNumTotalErrors() > 0, "AddCFDSource accepted a bad Geom ID"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: CFD_MESH_SOURCE_TYPE :param [in]: type int CFD Mesh source type( i.e.BOX_SOURCE ) :param [in]: geom_id string Geom ID :param [in]: surf_index int Main surface index :param [in]: l1 double Source first edge length :param [in]: r1 double Source first radius :param [in]: u1 double Source first U location :param [in]: w1 double Source first W location :param [in]: l2 double Source second edge length :param [in]: r2 double Source second radius :param [in]: u2 double Source second U location :param [in]: w2 double Source second W location

openvsp.vsp.AddCpSlice(cut_type, location)

Add a new VSPAERO control surface group using the default naming convention. The control surface group will not contain any control surfaces until they are added.

wid = AddGeom( "WING", "" )                             # Add Wing

aileron_id = AddSubSurf( wid, SS_CONTROL )                      # Add Control Surface Sub-Surface

group_index = CreateVSPAEROControlSurfaceGroup() # Empty control surface group

num_group = GetNumControlSurfaceGroups()

if  num_group != 1 :
    print( "Error: CreateVSPAEROControlSurfaceGroup" )
    assert False, "Error: CreateVSPAEROControlSurfaceGroup"

See also: AddSelectedToCSGroup :rtype: string :return: int Index of the new VSPAERO control surface group

Delete a VSPAERO control surface group. The control surfaces it held go back to being available, and the groups above it slide down to fill the gap.

wid = AddGeom( "WING", "" )                             # Add Wing

aileron_id = AddSubSurf( wid, SS_CONTROL )                      # Add Control Surface Sub-Surface

group_index = CreateVSPAEROControlSurfaceGroup() # Empty control surface group

SetVSPAEROControlGroupName( "Doomed_Group", group_index )

AddAllToVSPAEROControlSurfaceGroup( group_index )

num_active = len( GetActiveCSNameVec( group_index ) )

DeleteVSPAEROControlSurfaceGroup( group_index )

assert GetNumControlSurfaceGroups() == 0, "DeleteVSPAEROControlSurfaceGroup did not remove the group"

# The surfaces it held are available again in a fresh group.
new_index = CreateVSPAEROControlSurfaceGroup()

assert len( GetAvailableCSNameVec( new_index ) ) == num_active, "the deleted group did not release its control surfaces"

# An index past the end has to be rejected.  The error queue is reached
# through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

DeleteVSPAEROControlSurfaceGroup( GetNumControlSurfaceGroups() )

assert err_mgr.GetNumTotalErrors() > 0, "DeleteVSPAEROControlSurfaceGroup accepted an index past the end"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: CreateVSPAEROControlSurfaceGroup, GetNumControlSurfaceGroups :param [in]: CSGroupIndex int Index of the control surface group

Add a Cp slice to the VSPAERO Cp Slicer. The CpSlicer analysis has nothing to slice until at least one has been added.

# A fresh model already carries a default slice, so count from there.
num_before = GetNumCpSlices()

slice_id = AddCpSlice( X_DIR, 0.5 )

assert len( slice_id ) > 0, "AddCpSlice did not add a slice"
assert GetNumCpSlices() == num_before + 1, "AddCpSlice did not add a slice"

# The slice is its own Parm Container, so its cut can be read back.
assert abs( GetParmVal( FindParm( slice_id, "CutPosition", "CpSlice" ) ) - 0.5 ) < 1e-9, "AddCpSlice did not place the cut"
assert GetCpSliceID( num_before ) == slice_id, "GetCpSliceID does not agree with AddCpSlice"

See also: GetNumCpSlices, GetCpSliceID, DelCpSlice, DeleteAllCpSlices :param [in]: cut_type int Slice direction enum (X_DIR, Y_DIR or Z_DIR) :param [in]: location double Location of the cut along that axis :rtype: string :return: string Cp slice ID

openvsp.vsp.AddDefaultSources()

Add default CFD Mesh sources for all Geoms

#==== Add Pod Geom ====//
pid = AddGeom( "POD", "" )

AddDefaultSources() # 3 Sources: Def_Fwd_PS, Def_Aft_PS, Def_Fwd_Aft_LS

# The three default sources arrive under the names in the comment.
assert GetNumCFDSources( pid ) == 3, "AddDefaultSources did not add three sources"
assert GetCFDSourceName( pid, 0 ) == "Def_Fwd_PS", "AddDefaultSources did not add the expected sources"
assert GetCFDSourceName( pid, 1 ) == "Def_Aft_PS", "AddDefaultSources did not add the expected sources"
assert GetCFDSourceName( pid, 2 ) == "Def_Fwd_Aft_LS", "AddDefaultSources did not add the expected sources"

# The first two are point sources and the third joins them with a line.
assert GetCFDSourceType( pid, 0 ) == POINT_SOURCE, "AddDefaultSources did not add the expected source types"
assert GetCFDSourceType( pid, 1 ) == POINT_SOURCE, "AddDefaultSources did not add the expected source types"
assert GetCFDSourceType( pid, 2 ) == LINE_SOURCE, "AddDefaultSources did not add the expected source types"
openvsp.vsp.AddDesignVar(parm_id, type)

Add a design variable See also: XDDM_QUANTITY_TYPE :param [in]: parm_id string Parm ID :param [in]: type int XDDM type enum (XDDM_VAR or XDDM_CONST)

openvsp.vsp.AddExcrescence(excresName, excresType, excresVal)

Add an Excresence to the Parasite Drag Tool

AddExcrescence( "Miscellaneous", EXCRESCENCE_COUNT, 8.5 )

AddExcrescence( "Cowl Boattail", EXCRESCENCE_CD, 0.0003 )

# Each excrescence gets its own row, so deleting them one at a time has to
# empty the table and then start being rejected.  The error queue is reached
# through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

DeleteExcrescence( 1 )
DeleteExcrescence( 0 )

assert err_mgr.GetNumTotalErrors() == 0, "the two excrescences were not both added"

DeleteExcrescence( 0 )

assert err_mgr.GetNumTotalErrors() > 0, "more excrescences were added than asked for"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: EXCRES_TYPE :param [in]: excresName string Name of the Excressence :param [in]: excresType int Excressence type enum (i.e. EXCRESCENCE_PERCENT_GEOM) :param [in]: excresVal double Excressence value

openvsp.vsp.AddFeaAssembly() std::string
openvsp.vsp.AddFeaAssemblyConnection(assembly_id, start_fix_pt_id, start_struct_id, start_index, end_fix_pt_id, end_struct_id, end_index)

Connect two FEA Fixed Points, each belonging to a Structure in the assembly, so the Structures are tied together where they meet.

pod_id = AddGeom( "POD" )

struct_ind_1 = AddFeaStruct( pod_id )
struct_ind_2 = AddFeaStruct( pod_id )

struct_id_1 = GetFeaStructID( pod_id, struct_ind_1 )
struct_id_2 = GetFeaStructID( pod_id, struct_ind_2 )

#==== Each Structure needs a Fixed Point to connect ====//
fix_pt_1 = AddFeaPart( pod_id, struct_ind_1, FEA_FIX_POINT )
fix_pt_2 = AddFeaPart( pod_id, struct_ind_2, FEA_FIX_POINT )

assembly_id = AddFeaAssembly()

AddFeaStructureToAssembly( assembly_id, struct_id_1 )
AddFeaStructureToAssembly( assembly_id, struct_id_2 )

assert NumFeaAssemblyConnections( assembly_id ) == 0, "a new assembly already holds connections"

AddFeaAssemblyConnection( assembly_id, fix_pt_1, struct_id_1, 0, fix_pt_2, struct_id_2, 0 )

assert NumFeaAssemblyConnections( assembly_id ) == 1, "AddFeaAssemblyConnection did not add a connection"

DeleteFeaAssemblyConnection( assembly_id, 0 )

assert NumFeaAssemblyConnections( assembly_id ) == 0, "DeleteFeaAssemblyConnection did not remove the connection"

# An index past the end has to be rejected.
err_mgr = ErrorMgrSingleton.getInstance()

DeleteFeaAssemblyConnection( assembly_id, 0 )

assert err_mgr.GetNumTotalErrors() > 0, "DeleteFeaAssemblyConnection accepted an index past the end"

while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: AddFeaAssembly, DeleteFeaAssemblyConnection, NumFeaAssemblyConnections :param [in]: assembly_id string FEA Assembly ID :param [in]: start_fix_pt_id string FEA Fixed Point ID at the start of the connection :param [in]: start_struct_id string FEA Structure ID the start Fixed Point belongs to :param [in]: start_index int Surface index of the start Fixed Point :param [in]: end_fix_pt_id string FEA Fixed Point ID at the end of the connection :param [in]: end_struct_id string FEA Structure ID the end Fixed Point belongs to :param [in]: end_index int Surface index of the end Fixed Point

openvsp.vsp.AddFeaBC(fea_struct_id, type=-1)

Add an FEA BC to a Structure

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

#==== Add FeaStructure to Pod ====//
struct_ind = AddFeaStruct( pod_id )

struct_id = GetFeaStructID( pod_id, struct_ind );

#==== Add BC ====//
bc_id = AddFeaBC( struct_id, FEA_BC_STRUCTURE )

See also: FEA_BC_TYPE :param [in]: fea_struct_id string FEA Structure ID :param [in]: type int FEA BC type enum ( i.e. FEA_BC_STRUCTURE ) :rtype: string :return: string FEA BC ID

openvsp.vsp.AddFeaLayer(material_id)

Add an FEA Material the FEA Mesh material library. Materials are available across all Geoms and Structures.

#==== Create FeaMaterial ====//
mat_id = AddFeaMaterial()

SetParmVal( FindParm( mat_id, "MassDensity", "FeaMaterial" ), 0.016 )
Return type:

string

Returns:

string FEA Material ID

Get the IDs of every FEA Material in the FEA Mesh material library, including the built in materials as well as any added through AddFeaMaterial.

#==== The library starts out holding the built in materials ====//
num_builtin = len( GetFeaMaterialIDVec() )

assert num_builtin >= 1, "the FEA material library is empty"

#==== Create FeaMaterial ====//
mat_id = AddFeaMaterial()

mat_ids = GetFeaMaterialIDVec()

assert len( mat_ids ) == num_builtin + 1, "GetFeaMaterialIDVec did not follow AddFeaMaterial"
assert mat_id in mat_ids, "the material that was added is not in the list"

See also: AddFeaMaterial, DeleteFeaMaterial :rtype: string :return: vector<string> Array of FEA Material IDs

Add a layer to an FEA laminate material. Only a material of type FEA_LAMINATE carries layers.

#==== Create a laminate material ====//
mat_id = AddFeaMaterial()

SetParmVal( FindParm( mat_id, "FeaMaterialType", "FeaMaterial" ), FEA_LAMINATE )

Update()

# Becoming a laminate gives the material a first layer, so count from there.
num_before = NumFeaLayers( mat_id )

assert num_before >= 1, "a laminate starts with no layers"

layer_id = AddFeaLayer( mat_id )

assert len( layer_id ) > 0, "AddFeaLayer did not add a layer"
assert NumFeaLayers( mat_id ) == num_before + 1, "AddFeaLayer did not add a layer"

layer_ids = GetFeaLayerIDVec( mat_id )

assert len( layer_ids ) == num_before + 1, "the layer is not in the layer list"
assert layer_ids[num_before] == layer_id, "the layer is not in the layer list"

DeleteFeaLayer( mat_id, layer_id )

assert NumFeaLayers( mat_id ) == num_before, "DeleteFeaLayer did not remove the layer"

# A material that is not a laminate has to be rejected.
err_mgr = ErrorMgrSingleton.getInstance()

plain_id = AddFeaMaterial()

AddFeaLayer( plain_id )

assert err_mgr.GetNumTotalErrors() > 0, "AddFeaLayer accepted a material that is not a laminate"

while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: DeleteFeaLayer, NumFeaLayers, GetFeaLayerIDVec, AddFeaMaterial :param [in]: material_id string FEA Material ID of a laminate :rtype: string :return: string FEA Layer ID

openvsp.vsp.AddFeaMaterial() std::string
openvsp.vsp.AddFeaPart(geom_id, fea_struct_ind, type)

Add an FEA Part to a Structure

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

#==== Add FeaStructure to Pod ====//
struct_ind = AddFeaStruct( pod_id )

#==== Add Bulkead ====//
bulkhead_id = AddFeaPart( pod_id, struct_ind, FEA_SLICE )

SetParmVal( FindParm( bulkhead_id, "IncludedElements", "FeaPart" ), FEA_SHELL_AND_BEAM )

SetParmVal( FindParm( bulkhead_id, "RelCenterLocation", "FeaPart" ), 0.15 )

See also: FEA_PART_TYPE :param [in]: geom_id string Parent Geom ID :param [in]: fea_struct_ind int FEA Structure index :param [in]: type int FEA Part type enum (i.e. FEA_RIB) :rtype: string :return: string FEA Part ID

openvsp.vsp.AddFeaPolySparPt(pspar_id)

Add a point to the end of an FEA Poly Spar and return its ID. The new point is appended after all existing points.

wing_id = AddGeom( "WING" )

struct_ind = AddFeaStruct( wing_id )

pspar_id = AddFeaPart( wing_id, struct_ind, FEA_POLY_SPAR )

pt_id = AddFeaPolySparPt( pspar_id )

if GetFeaPolySparNumPt( pspar_id ) != 3:
    print( "Error: AddFeaPolySparPt" )
    assert False, "Error: AddFeaPolySparPt"

See also: InsertFeaPolySparPt, DelFeaPolySparPt, GetFeaPolySparNumPt :param [in]: pspar_id string FEA Poly Spar part ID :rtype: string :return: string ID of the newly added Poly Spar point

openvsp.vsp.AddFeaProperty(int property_type=0) std::string
openvsp.vsp.AddFeaStruct(geom_id, init_skin=True, surfindex=0)

Add an FEA Structure to a specified Geom Warning: init_skin should ALWAYS be set to true.

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

#==== Add FeaStructure to Pod ====//
struct_ind = AddFeaStruct( pod_id )

# The first structure on this Geom lands at index 0, and its ID has to lead
# back to that index.
assert struct_ind == 0, "AddFeaStruct did not add a structure"
assert NumFeaStructures() == 1, "AddFeaStruct did not add a structure"

struct_id = GetFeaStructID( pod_id, struct_ind )

assert len( struct_id ) > 0, "AddFeaStruct did not give the structure a usable ID"
assert GetFeaStructIndex( struct_id ) == struct_ind, "AddFeaStruct did not give the structure a usable ID"

# init_skin defaults to true, so the structure starts with an FEA Skin.
assert NumFeaParts( struct_id ) == 1, "AddFeaStruct did not initialize the skin"
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – init_skin bool Flag to initialize the FEA Structure by creating an FEA Skin from the parent Geom’s OML at surfindex

  • [in] – surfindex int Main surface index for the FEA Structure

Return type:

int

Returns:

int FEA Structure index

openvsp.vsp.AddFeaStructureToAssembly(assembly_id, struct_id)

Add an FEA Structure to an FEA Assembly

pod_id = AddGeom( "POD" )

struct_ind_1 = AddFeaStruct( pod_id )
struct_ind_2 = AddFeaStruct( pod_id )

struct_id_1 = GetFeaStructID( pod_id, struct_ind_1 )
struct_id_2 = GetFeaStructID( pod_id, struct_ind_2 )

assembly_id = AddFeaAssembly()

AddFeaStructureToAssembly( assembly_id, struct_id_1 )
AddFeaStructureToAssembly( assembly_id, struct_id_2 )

struct_ids = GetFeaAssemblyStructureIDVec( assembly_id )

assert len( struct_ids ) == 2, "the assembly does not hold the Structures it was given"
assert struct_ids[0] == struct_id_1, "the assembly does not hold the Structures it was given"
assert struct_ids[1] == struct_id_2, "the assembly does not hold the Structures it was given"

# A Structure that does not exist has to be rejected.
err_mgr = ErrorMgrSingleton.getInstance()

AddFeaStructureToAssembly( assembly_id, "NOSUCHSTRUCT" )

assert err_mgr.GetNumTotalErrors() > 0, "AddFeaStructureToAssembly accepted a bad Structure ID"

while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: AddFeaAssembly, DeleteFeaStructureFromAssembly, GetFeaAssemblyStructureIDVec :param [in]: assembly_id string FEA Assembly ID :param [in]: struct_id string FEA Structure ID

openvsp.vsp.AddFeaSubSurf(geom_id, fea_struct_ind, type)

Add an FEA SubSurface to a Structure

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

#==== Add FeaStructure to Pod ====//
struct_ind = AddFeaStruct( pod_id )

#==== Add LineArray ====//
line_array_id = AddFeaSubSurf( pod_id, struct_ind, SS_LINE_ARRAY )

SetParmVal( FindParm( line_array_id, "ConstLineType", "SS_LineArray" ), 1 ) # Constant W

SetParmVal( FindParm( line_array_id, "Spacing", "SS_LineArray" ), 0.25 )

See also: SUBSURF_TYPE :param [in]: geom_id string Parent Geom ID :param [in]: fea_struct_ind int FEA Structure index :param [in]: type int FEA SubSurface type enum (i.e. SS_ELLIPSE) :rtype: string :return: string FEA SubSurface ID

openvsp.vsp.AddFeaTrimPart(trim_id, part_id)

Get the total number of FEA Structures in the vehicle

#==== Add Pod Geometry ====//
wing_id = AddGeom( "WING" )

#==== Add FeaStructure to Pod ====//
struct_1 = AddFeaStruct( wing_id )
struct_2 = AddFeaStruct( wing_id )

if  NumFeaStructures() != 2 :
    print( "Error: NumFeaStructures" )
    assert False, "Error: NumFeaStructures"

See also: GetFeaStructIDVec :rtype: void :return: int Total Number of FEA Structures

Add an FEA Assembly. An assembly gathers several FEA Structures and the connections between them so they can be meshed and written out as one model.

assembly_id = AddFeaAssembly()

assert len( assembly_id ) > 0, "AddFeaAssembly did not add an assembly"
assert NumFeaAssemblies() == 1, "AddFeaAssembly did not add an assembly"

assy_ids = GetFeaAssemblyIDVec()

assert len( assy_ids ) == 1 and assy_ids[0] == assembly_id, "the assembly is not in the assembly list"

# A new assembly is named and holds nothing yet.
assert len( GetFeaAssemblyName( assembly_id ) ) > 0, "AddFeaAssembly did not name the assembly"
assert len( GetFeaAssemblyStructureIDVec( assembly_id ) ) == 0, "a new assembly already holds structures"

See also: DeleteFeaAssembly, AddFeaStructureToAssembly, ComputeFeaAssemblyMesh :rtype: void :return: string FEA Assembly ID

Add an FEA Part to the list a Trim part trims against. This is the Trim part’s Add button.

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

struct_ind = AddFeaStruct( pod_id )

#==== A Trim part and something for it to trim against ====//
trim_id = AddFeaPart( pod_id, struct_ind, FEA_TRIM )

slice_id = AddFeaPart( pod_id, struct_ind, FEA_SLICE )

assert len( GetFeaTrimPartIDVec( trim_id ) ) == 0, "a new Trim part already trims against something"

AddFeaTrimPart( trim_id, slice_id )

trim_parts = GetFeaTrimPartIDVec( trim_id )

assert len( trim_parts ) == 1, "AddFeaTrimPart did not add the part"
assert trim_parts[0] == slice_id, "AddFeaTrimPart did not add the part"

DeleteFeaTrimPart( trim_id, 0 )

assert len( GetFeaTrimPartIDVec( trim_id ) ) == 0, "DeleteFeaTrimPart did not remove the part"

# An FEA Part that is not a Trim part has to be rejected.
err_mgr = ErrorMgrSingleton.getInstance()

AddFeaTrimPart( slice_id, slice_id )

assert err_mgr.GetNumTotalErrors() > 0, "AddFeaTrimPart accepted a part that is not a Trim part"

while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: DeleteFeaTrimPart, GetFeaTrimPartIDVec :param [in]: trim_id string FEA Trim part ID :param [in]: part_id string FEA Part ID to trim against

openvsp.vsp.AddGeom(*args)

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 ====//
wing_id = AddGeom( "WING" )
Parameters:
  • [in] – type string Geom type (i.e FUSELAGE, POD, etc.)

  • [in] – parent string Parent Geom ID

Return type:

string

Returns:

string Geom ID

openvsp.vsp.AddGeometryAnalysis()

Add a new Geometry Analysis case to the Geometry Analysis Manager. The Geometry Analysis Manager allows users to configure and execute geometric analysis tasks typical of the aircraft design process, such as wetted area, projected area, mass properties, clearance, and visibility analyses.

##==== GeometryAnalysis: Add and configure a case ====##
ga_id = AddGeometryAnalysis()
print( "Added Geometry Analysis: ", ga_id )

See also: DeleteGeometryAnalysis, DeleteAllGeometryAnalyses, GetAllGeometryAnalysesIDVec :rtype: string :return: string ID of the newly created Geometry Analysis case

openvsp.vsp.AddGeometryAnalysisAzEl(geom_analysis_id, azimuth, elevation)

Delete a specific Geometry Analysis case from the Geometry Analysis Manager.

##==== GeometryAnalysis: Delete a specific case ====##
ga_id = AddGeometryAnalysis()

assert len( GetAllGeometryAnalysesIDVec() ) == 1, "AddGeometryAnalysis did not add a case"

DeleteGeometryAnalysis( ga_id )

assert len( GetAllGeometryAnalysesIDVec() ) == 0, "DeleteGeometryAnalysis did not remove the case"

See also: AddGeometryAnalysis, DeleteAllGeometryAnalyses, GetAllGeometryAnalysesIDVec :param [in]: id string ID of the Geometry Analysis case to delete

Add a discrete azimuth and elevation pair to a Geometry Analysis case. A visibility analysis with the discrete visibility flag set is evaluated at each pair that has been added.

ga_id = AddGeometryAnalysis()

assert GetNumGeometryAnalysisAzEl( ga_id ) == 0, "a new Geometry Analysis already carries az/el pairs"

AddGeometryAnalysisAzEl( ga_id, 30.0, 15.0 )

assert GetNumGeometryAnalysisAzEl( ga_id ) == 1, "AddGeometryAnalysisAzEl did not add a pair"

# Each pair is a pair of Parms, so the values can be read and changed.
az_id = GetGeometryAnalysisAzimuthParm( ga_id, 0 )
el_id = GetGeometryAnalysisElevationParm( ga_id, 0 )

assert abs( GetParmVal( az_id ) - 30.0 ) < 1e-6, "the az/el pair does not hold the values it was given"
assert abs( GetParmVal( el_id ) - 15.0 ) < 1e-6, "the az/el pair does not hold the values it was given"

# An ID that is not a Geometry Analysis has to be rejected.
err_mgr = ErrorMgrSingleton.getInstance()

AddGeometryAnalysisAzEl( "NOSUCHANALYSIS", 0.0, 0.0 )

assert err_mgr.GetNumTotalErrors() > 0, "AddGeometryAnalysisAzEl accepted a bad ID"

while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: AddGeometryAnalysis, DeleteGeometryAnalysisAzEl, GetNumGeometryAnalysisAzEl :param [in]: geom_analysis_id string Geometry Analysis case ID :param [in]: azimuth double Azimuth angle (degrees, -180 to 180) :param [in]: elevation double Elevation angle (degrees, -90 to 90)

openvsp.vsp.AddMaterial(name, ambient, diffuse, specular, emissive, alpha, shininess)

Set the visualization material the specified geometry

pid = AddGeom( "POD" )

AddMaterial( "RedGlass", vec3d( 44, 2, 2 ), vec3d( 156, 10, 10 ), vec3d( 185, 159, 159 ), vec3d( 44, 2, 2 ), 30, 0.4 )

SetGeomMaterialName( pid, "RedGlass" )

# The new material joins the library and can then be applied by name.
assert "RedGlass" in GetMaterialNames(), "AddMaterial did not add the material to the library"

# Adding it again under the same name has to be rejected.  The error queue is
# reached through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

AddMaterial( "RedGlass", vec3d( 44, 2, 2 ), vec3d( 156, 10, 10 ), vec3d( 185, 159, 159 ), vec3d( 44, 2, 2 ), 30, 0.4 )

assert err_mgr.GetNumTotalErrors() > 0, "AddMaterial accepted a duplicate name"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()
Parameters:
  • [in] – name string Material name

  • [in] – ambient vec3d Ambient color RGB triple on scale [0, 255]

  • [in] – diffuse vec3d Diffuse color RGB triple on scale [0, 255]

  • [in] – specular vec3d Specular color RGB triple on scale [0, 255]

  • [in] – emissive vec3d Emissive color RGB triple on scale [0, 255]

  • [in] – shininess double Shininess exponent on scale [0, 127]

  • [in] – alpha double Transparency factor on scale [0, 1]

openvsp.vsp.AddProbe(geomid, surfindx, u, w, name)

Create a new Probe and add it to the Measure Tool

pid1 = AddGeom( "POD", "" )

SetParmVal( pid1, "Y_Rel_Location", "XForm", 2.0 )

probe_id = AddProbe( pid1, 0, 0.5, 0.8, "Probe 1" )

SetParmVal( FindParm( probe_id, "Len", "Measure" ), 3.0 )
Parameters:
  • [in] – geomid string Parent Geom ID

  • [in] – surfindx int Main surface index from the parent Geom

  • [in] – u double Surface u (0 - 1) coordinate

  • [in] – w double Surface w (0 - 1) coordinate

  • [in] – name string Probe name

Return type:

string

Returns:

string Probe ID

openvsp.vsp.AddProtractor(std: :string const & startgeomid, int startsurfindx, double startu, double startw, std: :string const & midgeomid, int midsurfindx, double midu, double midw, std: :string const & endgeomid, int endsurfindx, double endu, double endw, std: :string const & name) std::string
openvsp.vsp.AddRSTProbe(geomid, surfindx, r, s, t, name)

Create and add an RST Probe object to the Measure Tool. An RST Probe marks a point in the volume of a Geom rather than on its surface.

pod1 = AddGeom( "POD", "" )

pid = AddRSTProbe( pod1, 0, 0.5, 0.5, 0.5, "Example_RSTProbe" )

assert len( pid ) > 0 and pid != "NONE", "AddRSTProbe returned no id"

# The new probe is the only one in the model, and it is not confused with a
# surface probe.
probe_array = GetAllRSTProbes()

assert len( probe_array ) == 1, "AddRSTProbe did not add the probe"
assert probe_array[0] == pid, "AddRSTProbe did not add the probe"
assert len( GetAllProbes() ) == 0, "an RST probe was counted as a surface probe"
assert GetContainerName( pid ) == "Example_RSTProbe", "AddRSTProbe did not name the probe"

See also: GetAllRSTProbes, DelRSTProbe, DeleteAllRSTProbes, AddProbe :param [in]: geomid string Parent Geom ID :param [in]: surfindx int Main surface index from the parent Geom :param [in]: r double R (0 - 1) volume coordinate :param [in]: s double S (0 - 1) volume coordinate :param [in]: t double T (0 - 1) volume coordinate :param [in]: name string RST Probe name :rtype: string :return: string RST Probe ID

openvsp.vsp.AddRoutingPt(routing_id, geom_id, surf_index)

Add a routing point to a RoutingGeom. The new point will be the last point in the route. The new point will be anchored to the specified geom and surface.

pod1 = vsp.AddGeom('POD', '')

pod2 = vsp.AddGeom('POD', '')
ypod2 = vsp.GetParm(pod2, 'Y_Rel_Location', 'XForm')
vsp.SetParmVal(ypod2, 2.0)

routing_geom = vsp.AddGeom('ROUTING', '')

rpt0 = vsp.AddRoutingPt(routing_geom, pod1, 0)
u0 = vsp.GetParm( rpt0, 'U', 'RoutePt')
vsp.SetParmVal(u0, 0.0)

rpt1 = vsp.AddRoutingPt(routing_geom, pod2, 0)

rpt2 = vsp.AddRoutingPt(routing_geom, pod1, 0)
u2 = vsp.GetParm( rpt2, 'U', 'RoutePt')
vsp.SetParmVal(u2, 1.0)

See also: AddRoutingPt, DelRoutingPt, InsertRoutingPt :param [in]: routing_id string RoutingGeom Geom ID :param [in]: geom_id string Geom ID of geom to anchor new routing point to :param [in]: surf_index int Index of surf to anchor new routing point to :rtype: string :return: string ParmContainer ID for the newly added routing point

openvsp.vsp.AddRuler(std: :string const & startgeomid, int startsurfindx, double startu, double startw, std: :string const & endgeomid, int endsurfindx, double endu, double endw, std: :string const & name) std::string
openvsp.vsp.AddSelectedToCSGroup(selected, CSGroupIndex)

Add each control surfaces in the array of control surface indexes to the control surface group at the specified index.

Warning: The indexes in input “selected” must be matched with available control surfaces identified by GetAvailableCSNameVec. The “selected” input uses one- based indexing to associate available control surfaces.

wid = AddGeom( "WING", "" ) # Add Wing

aileron_id = AddSubSurf( wid, SS_CONTROL ) # Add Control Surface Sub-Surface

group_index = CreateVSPAEROControlSurfaceGroup() # Empty control surface group

cs_name_vec = GetAvailableCSNameVec( group_index )

cs_ind_vec = [0] * len(cs_name_vec)

for i in range(int( len(cs_name_vec) )):

    cs_ind_vec[i] = i + 1

AddSelectedToCSGroup( cs_ind_vec, group_index ) # Add all available control surfaces to the group

# Everything that was named moved from available to active.
assert len( GetActiveCSNameVec( group_index ) ) == len( cs_name_vec ), "AddSelectedToCSGroup did not add them all"
assert len( GetAvailableCSNameVec( group_index ) ) == 0, "control surfaces are still available after adding them all"

See also: GetAvailableCSNameVec :param [in]: selected vector <int> Array of control surface indexes to add to the group. Note, the integer values are one based. :param [in]: CSGroupIndex int Index of the control surface group

openvsp.vsp.AddSubSurf(geom_id, type, surfindex=0)

Add a sub-surface to the specified Geom

wid = AddGeom( "WING", "" )                             # Add Wing

# Note: Parm Group for SubSurfaces in the form: "SS_" + type + "_" + count (initialized at 1)
ss_line_id = AddSubSurf( wid, SS_LINE )                      # Add Sub Surface Line

SetParmVal( wid, "Const_Line_Value", "SubSurface_1", 0.4 )     # Change Location

See also: SUBSURF_TYPE :param [in]: geom_id string Geom ID :param [in]: type int Sub-surface type enum (i.e. SS_RECTANGLE) :param [in]: surfindex int Main surface index (default: 0) :rtype: string :return: string Sub-surface ID

openvsp.vsp.AddUserParm(type, name, group)

Function to add a new user Parm of input type, name, and group

length = AddUserParm( PARM_DOUBLE_TYPE, "Length", "Design" )

SetParmValLimits( length, 10.0, 0.001, 1.0e12 )

SetParmDescript( length, "Length user parameter" )

See also: PARM_TYPE :param [in]: type int Parm type enum (i.e. PARM_DOUBLE_TYPE) :param [in]: name string Parm name :param [in]: group string Parm group :rtype: string :return: string Parm ID

openvsp.vsp.AddVarPresetGroup(group_name)

Add a Variable Preset Group

# Add Pod Geom
pod1 = AddGeom( "POD", "" )

gid = AddVarPresetGroup( "Tess" )
Parameters:

[in] – group_name string Name for Var Preset Group

Return type:

string

Returns:

string Var Preset Group ID

openvsp.vsp.AddVarPresetParm(group_id, parm_id)

Add a Parm to the Variable Preset Group

# Add Pod Geom
pod1 = AddGeom( "POD", "" )

gid = AddVarPresetGroup( "Tess" )

sid = AddVarPresetSetting( gid, "Coarse" )

p1 = FindParm( pod1, "Tess_U", "Shape" )

AddVarPresetParm( gid, p1 )

# The Parm has to show up in the group's list, and only once.
parm_ids = GetVarPresetParmIDs( gid )

assert len( parm_ids ) == 1, "AddVarPresetParm did not add the Parm to the group"
assert parm_ids[0] == p1, "AddVarPresetParm added the wrong Parm"

# Adding it again has to be rejected rather than duplicating it.  The error
# queue is reached through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

AddVarPresetParm( gid, p1 )

assert err_mgr.GetNumTotalErrors() > 0, "AddVarPresetParm accepted the same Parm twice"
assert len( GetVarPresetParmIDs( gid ) ) == 1, "AddVarPresetParm added the same Parm twice"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()
Parameters:
  • [in] – group_id string Var Preset Group ID

  • [in] – parm_id string Parm ID

openvsp.vsp.AddVarPresetSetting(group_id, setting_name)

Add a Setting to the Variable Preset Group

# Add Pod Geom
pod1 = AddGeom( "POD", "" )

gid = AddVarPresetGroup( "Tess" )

sid = AddVarPresetSetting( gid, "Coarse" )
Parameters:
  • [in] – group_id string Var Preset Group ID

  • [in] – setting_name string Var Preset Setting Name

Return type:

string

Returns:

string Var Preset Setting ID

openvsp.vsp.AddVec3D(Vec3dVec INOUT, double x, double y, double z)
openvsp.vsp.AdjustAllCFDSourceLen(mult)

Scale the edge length of every CFD Mesh source in the model by a common factor. This is what the four global source length buttons on the CFD Mesh screen do, at 1/1.5, 1/1.1, 1.1 and 1.5. Sources are usually sized relative to one another, so scaling them together is how a mesh is refined or coarsened as a whole.

pid = AddGeom( "POD", "" )

AddCFDSource( POINT_SOURCE, pid, 0, 0.25, 2.0, 0.5, 0.5 )

src_id = GetCFDSourceID( pid, 0 )

AdjustAllCFDSourceLen( 2.0 )

assert abs( GetParmVal( src_id, "SrcLen", "Source" ) - 0.5 ) < 1e-6, "AdjustAllCFDSourceLen did not scale the source"

See also: AdjustAllCFDSourceRad, GetCFDSourceID :param [in]: mult double Factor to scale every source length by

openvsp.vsp.AdjustAllCFDSourceRad(mult)

Scale the radius of influence of every CFD Mesh source in the model by a common factor. This is what the four global source radius buttons on the CFD Mesh screen do, at 1/1.5, 1/1.1, 1.1 and 1.5.

pid = AddGeom( "POD", "" )

AddCFDSource( POINT_SOURCE, pid, 0, 0.25, 2.0, 0.5, 0.5 )

src_id = GetCFDSourceID( pid, 0 )

AdjustAllCFDSourceRad( 0.5 )

assert abs( GetParmVal( src_id, "SrcRad", "Source" ) - 1.0 ) < 1e-6, "AdjustAllCFDSourceRad did not scale the source"

See also: AdjustAllCFDSourceLen, GetCFDSourceID :param [in]: mult double Factor to scale every source radius by

openvsp.vsp.ApplyModeSettings(std: :string const & mid)
openvsp.vsp.ApplyVarPresetSetting(group_id, setting_id)

Apply Parm values for Var Preset Setting

# Add Pod Geom
pod1 = AddGeom( "POD", "" )

gid = AddVarPresetGroup( "Tess" )

sid = AddVarPresetSetting( gid, "Coarse" )

p1 = FindParm( pod1, "Tess_U", "Shape" )

AddVarPresetParm( gid, p1 )

# Store a value in the setting, move the Parm somewhere else, then apply.
target = GetParmVal( p1 ) + 5.0

SetVarPresetParmVal( gid, sid, p1, target )

SetParmVal( p1, GetParmVal( p1 ) - 2.0 )

Update()

ApplyVarPresetSetting( gid, sid )

Update()

# Applying the setting drives the Parm to the stored value.
assert abs( GetParmVal( p1 ) - target ) < 1e-9, "ApplyVarPresetSetting did not apply the stored value"
Parameters:
  • [in] – group_id string Var Preset Group ID

  • [in] – setting_id string Var Preset Setting ID

openvsp.vsp.ApproximateAllPropellerPCurves(geom_id)

Approximate all propeller blade curves with cubic Bezier curves.

# Add Propeller
prop = AddGeom( "PROP", "" )

# Take the blade curves off Bezier so the approximation has something to do.
PCurveConvertTo( prop, PROP_CHORD, PCHIP )
PCurveConvertTo( prop, PROP_TWIST, PCHIP )
PCurveConvertTo( prop, PROP_THICK, PCHIP )

Update()

assert PCurveGetType( prop, PROP_CHORD ) == PCHIP, "the blade curves would not convert to PCHIP"

ApproximateAllPropellerPCurves( prop )

# Every blade curve is now a cubic Bezier.
assert PCurveGetType( prop, PROP_CHORD ) == CEDIT, "ApproximateAllPropellerPCurves did not convert the curves"
assert PCurveGetType( prop, PROP_TWIST ) == CEDIT, "ApproximateAllPropellerPCurves did not convert the curves"
assert PCurveGetType( prop, PROP_THICK ) == CEDIT, "ApproximateAllPropellerPCurves did not convert the curves"

# A cubic Bezier is stored in groups of three, so the control point count is
# one more than a multiple of three.
tvec = PCurveGetTVec( prop, PROP_CHORD )

assert len( tvec ) >= 4 and ( len( tvec ) - 1 ) % 3 == 0, "the converted curve is not a cubic Bezier"
Parameters:

[in] – geom_id string Geom ID

openvsp.vsp.AttachGeomTexture(geom_id, file_name)

Attach a texture image to a Geom, the way the Add button on the Texture screen does. A texture is drawn on the Geom’s surface at a placement given by its Parms; the returned ID is a ParmContainer ID, so U, W, U_Scale, W_Scale, Transparency, U_Flip and W_Flip in the “Texture_Parm” group are reached the usual way.

pod_id = AddGeom( "POD", "" )

tex_id = AttachGeomTexture( pod_id, "textures/nasa-logo.tga" )

assert len( tex_id ) > 0, "AttachGeomTexture attached nothing"

# Place the logo on the upper surface, at half size.
SetParmVal( tex_id, "U", "Texture_Parm", 0.35 )
SetParmVal( tex_id, "W", "Texture_Parm", 0.25 )
SetParmVal( tex_id, "U_Scale", "Texture_Parm", 0.5 )
SetParmVal( tex_id, "W_Scale", "Texture_Parm", 0.5 )

Update()

tex_ids = GetGeomTextureIDVec( pod_id )

assert len( tex_ids ) == 1, "the texture is not in the texture list"
assert tex_ids[0] == tex_id, "the texture is not in the texture list"

See also: RemoveGeomTexture, GetGeomTextureIDVec, GetGeomTextureFileName :param [in]: geom_id string Geom ID :param [in]: file_name string Name of the texture image file :rtype: string :return: string ParmContainer ID for the attached texture

openvsp.vsp.AutoGroupVSPAEROControlSurfaces()

Creates the initial default grouping for the control surfaces. The initial grouping collects all surface copies of the sub-surface into a single group. For example if a wing is defined with an aileron and that wing is symmetrical about the xz plane there will be a surface copy of the master wing surface as well as a copy of the sub-surface. The two sub-surfaces may get deflected differently during analysis routines and can be identified uniquely by their full name.

wid = AddGeom( "WING", "" )                             # Add Wing

aileron_id = AddSubSurf( wid, SS_CONTROL )                      # Add Control Surface Sub-Surface

#==== Add Vertical tail and set some parameters =====//
vert_id = AddGeom( "WING" )

SetGeomName( vert_id, "Vert" )

SetParmValUpdate( vert_id, "TotalArea", "WingGeom", 10.0 )
SetParmValUpdate( vert_id, "X_Rel_Location", "XForm", 8.5 )
SetParmValUpdate( vert_id, "X_Rel_Rotation", "XForm", 90 )

rudder_id = AddSubSurf( vert_id, SS_CONTROL )                      # Add Control Surface Sub-Surface

AutoGroupVSPAEROControlSurfaces()

Update()

print( "COMPLETE\n" )
control_group_settings_container_id = FindContainer( "VSPAEROSettings", 0 )   # auto grouping produces parm containers within VSPAEROSettings

#==== Set Control Surface Group Deflection Angle ====//
print( "\tSetting control surface group deflection angles..." )

# subsurfaces get added to groups with "CSGQualities_[geom_name]_[control_surf_name]"
# subsurfaces gain parm name is "Surf[surfndx]_Gain" starting from 0 to NumSymmetricCopies-1

deflection_gain_id = FindParm( control_group_settings_container_id, "Surf_" + aileron_id + "_0_Gain", "ControlSurfaceGroup_0" )
deflection_gain_id = FindParm( control_group_settings_container_id, "Surf_" + aileron_id + "_1_Gain", "ControlSurfaceGroup_0" )

#  deflect aileron
deflection_angle_id = FindParm( control_group_settings_container_id, "DeflectionAngle", "ControlSurfaceGroup_0" )

# Auto grouping puts each control surface in a group of its own, so the two
# that were added make two groups, and each holds one surface.
assert GetNumControlSurfaceGroups() == 2, "AutoGroupVSPAEROControlSurfaces did not make a group per surface"

for i in range( 2 ):
    # Each wing is symmetric, so its control surface arrives as two copies
    # and both land in the group.
    assert len( GetActiveCSNameVec( i ) ) == 2, "group " + str( i ) + " does not hold its control surface copies"
    assert len( GetVSPAEROControlGroupName( i ) ) > 0, "group " + str( i ) + " was not named"

# The Parms the grouping created have to be findable.
assert len( deflection_gain_id ) > 0, "the control surface group Parms were not created"
assert len( deflection_angle_id ) > 0, "the control surface group Parms were not created"

See also: CreateVSPAEROControlSurfaceGroup

openvsp.vsp.AxisProjPnt01(geom_id, surf_indx, iaxis, pt)

Project an input 3D coordinate point onto a surface along a specified axis. If the axis-aligned ray from the point intersects the surface multiple times, the nearest intersection is returned. If the axis-aligned ray from the point does not intersect the surface, the original point is returned and -1 is returned in the other output parameters.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

u = 0.12345
w = 0.67890

surf_pt = CompPnt01( geom_id, surf_indx, u, w )

# Assignment binds a reference in Python rather than copying as it does in
# AngelScript, so build a separate point instead of offsetting surf_pt.
pt = vec3d( surf_pt.x(), surf_pt.y(), surf_pt.z() )

pt.offset_y( -5.0 )

idist, u_out, w_out = AxisProjPnt01( geom_id, surf_indx, Y_DIR, pt )

# pt is the surface point pushed off in -Y, so projecting back along Y
# has to land on the point it came from.
p_out = CompPnt01( geom_id, surf_indx, u_out, w_out )
assert abs( surf_pt.x() - p_out.x() ) < 1e-6 and abs( surf_pt.y() - p_out.y() ) < 1e-6 and abs( surf_pt.z() - p_out.z() ) < 1e-6, "AxisProjPnt01 did not recover the original point"

print( f"iDist {idist} u_out {u_out} w_out {w_out}" )
print( "3D Offset ", False)

See also: AxisProjPnt01Guess, AxisProjPnt01I, AxisProjVecPnt01, AxisProjVecPnt01Guess :param [in]: geom_id string Parent Geom ID :param [in]: surf_indx int Main surface index from the parent Geom :param [in]: iaxis int Axis direction to project point along (X_DIR, Y_DIR, or Z_DIR) :param [in]: pt vec3d Input 3D coordinate point :param [out]: u_out double Output closest U (0 - 1) surface coordinate :param [out]: w_out double Output closest W (0 - 1) surface coordinate :rtype: float :return: double Axis aligned distance between the 3D point and the projected point on the surface

openvsp.vsp.AxisProjPnt01Guess(geom_id, surf_indx, iaxis, pt, u0, w0)

Project an input 3D coordinate point onto a surface along a specified axis given an initial guess of surface parameter. If the axis-aligned ray from the point intersects the surface multiple times, the nearest intersection is returned. If the axis-aligned ray from the point does not intersect the surface, the original point is returned and -1 is returned in the other output parameters. The surface parameter guess should allow this call to be faster than calling AxisProjPnt01 without a guess.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

u = 0.12345
w = 0.67890



surf_pt = CompPnt01( geom_id, surf_indx, u, w )

# Assignment binds a reference in Python rather than copying as it does in
# AngelScript, so build a separate point instead of offsetting surf_pt.
pt = vec3d( surf_pt.x(), surf_pt.y(), surf_pt.z() )

pt.offset_y( -5.0 )

# Construct initial guesses near actual parameters
u0 = u + 0.01234
w0 = w - 0.05678

d, uout, wout = AxisProjPnt01Guess( geom_id, surf_indx, Y_DIR, pt, u0, w0 )

print( f"Dist {d} u {uout} w {wout}" )

# The test point sits five units away along Y from a known surface point, so
# projecting back along Y has to recover that point and that distance.
assert abs( uout - u ) < 1e-6, "AxisProjPnt01Guess did not recover the surface point"
assert abs( wout - w ) < 1e-6, "AxisProjPnt01Guess did not recover the surface point"
assert abs( d - 5.0 ) < 1e-6, "AxisProjPnt01Guess reported the wrong distance"

# Starting from a guess must not change the answer.
d_ng, uout_ng, wout_ng = AxisProjPnt01( geom_id, surf_indx, Y_DIR, pt )

assert abs( uout_ng - uout ) < 1e-6, "the guess changed the answer"
assert abs( wout_ng - wout ) < 1e-6, "the guess changed the answer"
assert abs( d_ng - d ) < 1e-6, "the guess changed the answer"

See also: AxisProjPnt01, AxisProjPnt01I, AxisProjVecPnt01, AxisProjVecPnt01Guess :param [in]: geom_id string Parent Geom ID :param [in]: surf_indx int Main surface index from the parent Geom :param [in]: iaxis int Axis direction to project point along (X_DIR, Y_DIR, or Z_DIR) :param [in]: pt vec3d Input 3D coordinate point :param [in]: u0 double Input U (0 - 1) surface coordinate guess :param [in]: w0 double Input W (0 - 1) surface coordinate guess :param [out]: u_out double Output closest U (0 - 1) surface coordinate :param [out]: w_out double Output closest W (0 - 1) surface coordinate :rtype: float :return: double Distance between the 3D point and the closest point of the surface

openvsp.vsp.AxisProjPnt01I(geom_id, iaxis, pt)

Project an input 3D coordinate point onto a Geom along a specified axis. The intersecting surface index is also returned. If the axis-aligned ray from the point intersects the Geom multiple times, the nearest intersection is returned. If the axis-aligned ray from the point does not intersect the Geom, the original point is returned and -1 is returned in the other output parameters.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

u = 0.12345
w = 0.67890

surf_pt = CompPnt01( geom_id, surf_indx, u, w )

# Assignment binds a reference in Python rather than copying as it does in
# AngelScript, so build a separate point instead of offsetting surf_pt.
pt = vec3d( surf_pt.x(), surf_pt.y(), surf_pt.z() )

pt.offset_y( -5.0 )


idist, surf_indx_out, u_out, w_out = AxisProjPnt01I( geom_id, Y_DIR, pt )

# pt is the surface point pushed off in -Y, so projecting back along Y
# has to land on the point it came from.
p_out = CompPnt01( geom_id, surf_indx, u_out, w_out )
assert abs( surf_pt.x() - p_out.x() ) < 1e-6 and abs( surf_pt.y() - p_out.y() ) < 1e-6 and abs( surf_pt.z() - p_out.z() ) < 1e-6, "AxisProjPnt01I did not recover the original point"

print( "iDist {idist} u_out {u_out} w_out {w_out} surf_index {surf_indx_out}" )
print( "3D Offset ", False)

See also: AxisProjPnt01, AxisProjPnt01Guess, AxisProjVecPnt01, AxisProjVecPnt01Guess :param [in]: geom_id string Parent Geom ID :param [in]: iaxis int Axis direction to project point along (X_DIR, Y_DIR, or Z_DIR) :param [in]: pt vec3d Input 3D coordinate point :param [out]: surf_indx_out int Output main surface index from the parent Geom :param [out]: u_out double Output closest U (0 - 1) surface coordinate :param [out]: w_out double Output closest W (0 - 1) surface coordinate :rtype: float :return: double Axis aligned distance between the 3D point and the projected point on the surface

openvsp.vsp.AxisProjVecPnt01(geom_id, surf_indx, iaxis, pts)

Project an input array of 3D coordinate points onto a surface along a specified axis. If the axis-aligned ray from the point intersects the surface multiple times, the nearest intersection is returned. If the axis-aligned ray from the point does not intersect the surface, the original point is returned and -1 is returned in the other output parameters.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )
surf_indx = 0

n = 5

uvec = [0]*n
wvec = [0]*n

for i in range(n):

    uvec[i] = (i+1)*1.0/(n+1)

    wvec[i] = (n-i)*1.0/(n+1)

ptvec = CompVecPnt01( geom_id, surf_indx, uvec, wvec )

for i in range(n):

    ptvec[i].offset_y( -5.0 )

uoutv, woutv, doutv = AxisProjVecPnt01( geom_id, surf_indx, Y_DIR, ptvec )

# Some of these outputs are expected to be non-zero because the projected point is on the opposite side of
# the pod from the originally computed point.  I.e. there were multiple solutions and the original point
# is not the closest intersection point.  We could offset those points in the +Y direction instead of -Y.
for i in range(n):

    print( i, False )
    print( "U delta ", False )
    print( uvec[i] - uoutv[i], False )
    print( "W delta ", False )
    print( wvec[i] - woutv[i] )

# Whichever intersection was found, it has to be a real one: the reported
# coordinates have to name a point on the surface, and that point has to sit
# on the same Y ray the test point was offset along.
for i in range(n):

    assert uoutv[i] >= 0.0 and woutv[i] >= 0.0, "no intersection was found for point " + str( i )

    hit = CompPnt01( geom_id, surf_indx, uoutv[i], woutv[i] )

    assert abs( hit.x() - ptvec[i].x() ) < 1e-6, "the intersection left the Y ray at point " + str( i )
    assert abs( hit.z() - ptvec[i].z() ) < 1e-6, "the intersection left the Y ray at point " + str( i )
    assert abs( doutv[i] - abs( hit.y() - ptvec[i].y() ) ) < 1e-6, "the wrong distance was reported at point " + str( i )

See also: AxisProjPnt01, AxisProjPnt01Guess, AxisProjPnt01I, AxisProjVecPnt01Guess :param [in]: geom_id string Geom ID :param [in]: surf_indx int Main surface index from the Geom :param [in]: iaxis int Axis direction to project point along (X_DIR, Y_DIR, or Z_DIR) :param [in]: pts vector<vec3d> Input vector of 3D coordinate points :param [out]: u_out_vec vector<double> Output vector of the closest U (0 - 1) surface coordinate for each 3D input point :param [out]: w_out_vec vector<double> Output vector of the closest W (0 - 1) surface coordinate for each 3D input point :param [out]: d_out_vec vector<double> Output vector of axis distances for each 3D point and the projected point of the surface

openvsp.vsp.AxisProjVecPnt01Guess(geom_id, surf_indx, iaxis, pts, u0s, w0s)

Project an input array of 3D coordinate points onto a surface along a specified axis given initial guess arrays of surface parameter. If the axis-aligned ray from the point intersects the surface multiple times, the nearest intersection is returned. If the axis-aligned ray from the point does not intersect the surface, the original point is returned and -1 is returned in the other output parameters. The surface parameter guess should allow this call to be faster than calling AxisProjVecPnt01 without a guess.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )
surf_indx = 0

n = 5

uvec = [0]*n
wvec = [0]*n

for i in range(n):

    uvec[i] = (i+1)*1.0/(n+1)

    wvec[i] = (n-i)*1.0/(n+1)

ptvec = CompVecPnt01( geom_id, surf_indx, uvec, wvec )

for i in range(n):

    ptvec[i].offset_y( -5.0 )

u0v = [0]*n
w0v = [0]*n

for i in range(n):

    u0v[i] = uvec[i] + 0.01234
    w0v[i] = wvec[i] - 0.05678

uoutv, woutv, doutv = AxisProjVecPnt01Guess( geom_id, surf_indx, Y_DIR, ptvec, u0v,  w0v )

for i in range(n):

    print( i, False )
    print( "U delta ", False )
    print( uvec[i] - uoutv[i], False )
    print( "W delta ", False )
    print( wvec[i] - woutv[i] )

# Whichever intersection was found, it has to be a real one: the reported
# coordinates have to name a point on the surface, and that point has to sit
# on the same Y ray the test point was offset along.
for i in range(n):

    assert uoutv[i] >= 0.0 and woutv[i] >= 0.0, "no intersection was found for point " + str( i )

    hit = CompPnt01( geom_id, surf_indx, uoutv[i], woutv[i] )

    assert abs( hit.x() - ptvec[i].x() ) < 1e-6, "the intersection left the Y ray at point " + str( i )
    assert abs( hit.z() - ptvec[i].z() ) < 1e-6, "the intersection left the Y ray at point " + str( i )
    assert abs( doutv[i] - abs( hit.y() - ptvec[i].y() ) ) < 1e-6, "the wrong distance was reported at point " + str( i )

See also: AxisProjPnt01, AxisProjPnt01Guess, AxisProjPnt01I, AxisProjVecPnt01 :param [in]: geom_id string Parent Geom ID :param [in]: surf_indx int Main surface index from the parent Geom :param [in]: iaxis int Axis direction to project point along (X_DIR, Y_DIR, or Z_DIR) :param [in]: pts vector<vec3d> Input vector of 3D coordinate points :param [in]: u0s vector<double> Input vector of U (0 - 1) surface coordinate guesses :param [in]: w0s vector<double> Input vector of W (0 - 1) surface coordinate guesses :param [out]: u_out_vec vector<double> Output vector of the closest U (0 - 1) surface coordinate for each 3D input point :param [out]: w_out_vec vector<double> Output vector of the closest W (0 - 1) surface coordinate for each 3D input point :param [out]: d_out_vec vector<double> Output vector of axis distances for each 3D point and the projected point of the surface

openvsp.vsp.BEZIER_AF_EXPORT = 1

Bezier airfoil file format

openvsp.vsp.BFT_UNIT = 3

FEA Files output in (ft, slug)

openvsp.vsp.BIN_UNIT = 4

FEA Files output in (in, lbf*sec^2/in)

openvsp.vsp.BLANK_GEOM_SCREEN = 3

Blank geom screen

openvsp.vsp.BLEND_ANGLES = 1

Blend based on angles (sweep & dihedral)

openvsp.vsp.BLEND_FREE = 0

Free blending

openvsp.vsp.BLEND_MATCH_IN_ANGLES = 6

Match inboard angles

openvsp.vsp.BLEND_MATCH_IN_LE_TRAP = 2

Match inboard leading edge trapezoid

openvsp.vsp.BLEND_MATCH_IN_TE_TRAP = 3

Match inboard trailing edge trapezoid

openvsp.vsp.BLEND_MATCH_LE_ANGLES = 7

Match leading edge angles

openvsp.vsp.BLEND_MATCH_OUT_LE_TRAP = 4

Match outboard leading edge trapezoid

openvsp.vsp.BLEND_MATCH_OUT_TE_TRAP = 5

Match outboard trailing edge trapezoid

openvsp.vsp.BLEND_NUM_TYPES = 8

Number of blending types

openvsp.vsp.BOGIE_CENTER_DIST = 0

Distance between centers

openvsp.vsp.BOGIE_CENTER_DIST_FRAC = 1

Fractional distance between centers

openvsp.vsp.BOGIE_GAP = 2

Gap

openvsp.vsp.BOGIE_GAP_FRAC = 3

Fractional gap

openvsp.vsp.BOOL_DATA = 0

Bool data type

openvsp.vsp.BOR_FLOWTHROUGH = 0

Flowthrough mode (default)

openvsp.vsp.BOR_GEOM_SCREEN = 14

Body of revolution geom screen

openvsp.vsp.BOR_LOWER = 2

Lower surface mode

openvsp.vsp.BOR_NUM_MODES = 3

Number of Body of Revolution modes

openvsp.vsp.BOR_UPPER = 1

Upper surface mode

openvsp.vsp.BOX_SOURCE = 2

Box source

openvsp.vsp.BarycentricWeights(vec3d v0, vec3d v1, vec3d v2, vec3d p) vec3d
openvsp.vsp.BilinearWeights(vec3d p0, vec3d p1, vec3d p, DoubleVector weights)
class openvsp.vsp.BoolVector(*args)

Bases: object

Proxy of C++ std::vector< bool > class.

append(BoolVector self, std: :vector< bool >::value_type x)
assign(BoolVector self, std: :vector< bool >::size_type n, std: :vector< bool >::value_type x)
back(BoolVector self) std::vector< bool >::value_type
begin(BoolVector self) std::vector< bool >::iterator
capacity(BoolVector self) std::vector< bool >::size_type
clear(BoolVector self)
empty(BoolVector self) bool
end(BoolVector self) std::vector< bool >::iterator
erase(BoolVector self, std: :vector< bool >::iterator pos) std::vector< bool >::iterator
erase(BoolVector self, std: :vector< bool >::iterator first, std: :vector< bool >::iterator last) std::vector< bool >::iterator
front(BoolVector self) std::vector< bool >::value_type
get_allocator(BoolVector self) std::vector< bool >::allocator_type
insert(BoolVector self, std: :vector< bool >::iterator pos, std: :vector< bool >::value_type x) std::vector< bool >::iterator
insert(BoolVector self, std: :vector< bool >::iterator pos, std: :vector< bool >::size_type n, std: :vector< bool >::value_type x)
iterator(BoolVector self) SwigPyIterator
pop(BoolVector self) std::vector< bool >::value_type
pop_back(BoolVector self)
push_back(BoolVector self, std: :vector< bool >::value_type x)
rbegin(BoolVector self) std::vector< bool >::reverse_iterator
rend(BoolVector self) std::vector< bool >::reverse_iterator
reserve(BoolVector self, std: :vector< bool >::size_type n)
resize(BoolVector self, std: :vector< bool >::size_type new_size)
resize(BoolVector self, std: :vector< bool >::size_type new_size, std: :vector< bool >::value_type x)
size(BoolVector self) std::vector< bool >::size_type
swap(BoolVector self, BoolVector v)
property thisown

The membership flag

openvsp.vsp.BuildAdvLinkScript(index)

Build (ready for execution and perform syntax check) an advanced link.

pod = AddGeom( "POD", "" )
length = FindParm( pod, "Length", "Design" )
x_pos = GetParm( pod, "X_Rel_Location", "XForm" )

AddAdvLink( "ExampleLink" )
indx = GetLinkIndex( "ExampleLink" )
AddAdvLinkInput( indx, length, "len" )
AddAdvLinkOutput( indx, x_pos, "x" )

SetAdvLinkCode( indx, "x = 10.0 - len;" )

success = BuildAdvLinkScript( indx )

# The link built above is well formed, so this has to come back true.
assert success, "BuildAdvLinkScript did not report success"

if  success :
    print( "Advanced link build successful." )
else:
    print( "Advanced link build not successful." )
Parameters:

[in] – index int Index for advanced link

Return type:

boolean

Returns:

bool Flag indicating whether advanced link build was successful

openvsp.vsp.CAM_BOTTOM = 5

Camera bottom view

openvsp.vsp.CAM_CENTER = 9

Camera center view

openvsp.vsp.CAM_FRONT = 1

Camera front view

openvsp.vsp.CAM_FRONT_YUP = 2

Camera front Y-up view

openvsp.vsp.CAM_LEFT = 3

Camera left view

openvsp.vsp.CAM_LEFT_ISO = 4

Camera left isometric view

openvsp.vsp.CAM_REAR = 6

Camera rear view

openvsp.vsp.CAM_RIGHT = 7

Camera right view

openvsp.vsp.CAM_RIGHT_ISO = 8

Camera right isometric view

openvsp.vsp.CAM_TOP = 0

Camera top view

openvsp.vsp.CCE_INTERFERENCE = 11

Interference with composite clearance envelope

openvsp.vsp.CEDIT = 2

Cubic Bezier curve type

openvsp.vsp.CFD_DAT_FILE_NAME = 4

DAT export type

openvsp.vsp.CFD_FACET_FILE_NAME = 8

FACET export type

openvsp.vsp.CFD_FAR_FIELD_FLAG = 8

Flag to generate a far field mesh

openvsp.vsp.CFD_FAR_HEIGHT = 15

Far field height

openvsp.vsp.CFD_FAR_LENGTH = 13

Far field length

openvsp.vsp.CFD_FAR_LOC_MAN_FLAG = 19

Far field location flag: centered or manual

openvsp.vsp.CFD_FAR_LOC_X = 20

Far field X location

openvsp.vsp.CFD_FAR_LOC_Y = 21

Far field Y location

openvsp.vsp.CFD_FAR_LOC_Z = 22

Far field Z location

openvsp.vsp.CFD_FAR_MAX_EDGE_LEN = 9

Maximum far field mesh edge length

openvsp.vsp.CFD_FAR_MAX_GAP = 10

Maximum far field mesh edge gap

openvsp.vsp.CFD_FAR_NUM_CIRCLE_SEGS = 11

Number of far field edge segments to resolve circle

openvsp.vsp.CFD_FAR_SIZE_ABS_FLAG = 12

Relative or absolute size flag

openvsp.vsp.CFD_FAR_WIDTH = 14

Far field width

openvsp.vsp.CFD_FAR_X_SCALE = 16

Far field X scale

openvsp.vsp.CFD_FAR_Y_SCALE = 17

Far field Y scale

openvsp.vsp.CFD_FAR_Z_SCALE = 18

Far field Z scale

openvsp.vsp.CFD_GMSH_FILE_NAME = 6

GMSH export type

openvsp.vsp.CFD_GROWTH_RATIO = 4

Maximum allowed edge growth ratio

openvsp.vsp.CFD_HALF_MESH_FLAG = 7

Flag to generate a half mesh

openvsp.vsp.CFD_INTERSECT_SUBSURFACE_FLAG = 6

Flag to intersect sub-surfaces

openvsp.vsp.CFD_KEY_FILE_NAME = 5

KEY export type

openvsp.vsp.CFD_LIMIT_GROWTH_FLAG = 5

Rigorous 3D growth limiting flag

openvsp.vsp.CFD_MAX_EDGE_LEN = 1

Maximum mesh edge length

openvsp.vsp.CFD_MAX_GAP = 2

Maximum mesh edge gap

openvsp.vsp.CFD_MEASURE_DUCT = 5

Measure duct cross sectional area surface

openvsp.vsp.CFD_MIN_EDGE_LEN = 0

Minimum mesh edge length

openvsp.vsp.CFD_NEGATIVE = 1

Negative volume CFD Mesh surface

openvsp.vsp.CFD_NORMAL = 0

Normal CFD Mesh surface

openvsp.vsp.CFD_NUM_CIRCLE_SEGS = 3

Number of edge segments to resolve circle

openvsp.vsp.CFD_NUM_FILE_NAMES = 10

Number of CFD Mesh export file types

openvsp.vsp.CFD_NUM_TYPES = 6

Number of CFD Mesh surface types

openvsp.vsp.CFD_OBJ_FILE_NAME = 3

OBJ export type

openvsp.vsp.CFD_POLY_FILE_NAME = 1

POLY export type

openvsp.vsp.CFD_SRF_XYZ_FLAG = 23

Flag to include X,Y,Z intersection curves in export files

openvsp.vsp.CFD_STIFFENER = 4

FEA stiffener CFD Mesh surface

openvsp.vsp.CFD_STL_FILE_NAME = 0

STL export type

openvsp.vsp.CFD_STRUCTURE = 3

FEA structure CFD Mesh surface

openvsp.vsp.CFD_TKEY_FILE_NAME = 7

TKEY export type

openvsp.vsp.CFD_TRANSPARENT = 2

Transparent CFD Mesh surface

openvsp.vsp.CFD_TRI_FILE_NAME = 2

TRI export type

openvsp.vsp.CFD_VSPGEOM_FILE_NAME = 9

VSPGEOM export type

openvsp.vsp.CF_LAM_BLASIUS = 0

Blasius laminar Cf equation

openvsp.vsp.CF_LAM_BLASIUS_W_HEAT = 1

Blasius laminar Cf equation with heat (NOT IMPLEMENTED)

openvsp.vsp.CF_TURB_EXPLICIT_FIT_SCHOENHERR = 2

Explicit Fit of Schoenherr turbulent Cf equation

openvsp.vsp.CF_TURB_EXPLICIT_FIT_SPALDING = 0

Explicit Fit of Spalding turbulent Cf equation

openvsp.vsp.CF_TURB_EXPLICIT_FIT_SPALDING_CHI = 1

Explicit Fit of Spalding and Chi turbulent Cf equation

openvsp.vsp.CF_TURB_HEATTRANSFER_WHITE_CHRISTOPH = 20

Heat Transfer White-Christoph turbulent Cf equation.

openvsp.vsp.CF_TURB_IMPLICIT_KARMAN_SCHOENHERR = 5

Implicit Karman-Schoenherr turbulent Cf equation

openvsp.vsp.CF_TURB_IMPLICIT_SCHOENHERR = 4

Implicit Schoenherr turbulent Cf equation

openvsp.vsp.CF_TURB_POWER_LAW_BLASIUS = 6

Power Law Blasius turbulent Cf equation

openvsp.vsp.CF_TURB_POWER_LAW_PRANDTL_HIGH_RE = 9

Power Law Prandtl High Re turbulent Cf equation

openvsp.vsp.CF_TURB_POWER_LAW_PRANDTL_LOW_RE = 7

Power Law Prandtl Low Re turbulent Cf equation

openvsp.vsp.CF_TURB_POWER_LAW_PRANDTL_MEDIUM_RE = 8

Power Law Prandtl Medium Re turbulent Cf equation

openvsp.vsp.CF_TURB_ROUGHNESS_SCHLICHTING_AVG = 16

Roughness Schlichting Avg turbulent Cf equation.

openvsp.vsp.CF_TURB_ROUGHNESS_SCHLICHTING_AVG_FLOW_CORRECTION = 19

Roughness Schlichting Avg Compressible turbulent Cf equation.

openvsp.vsp.CF_TURB_SCHLICHTING_COMPRESSIBLE = 10

Schlichting Compressible turbulent Cf equation

openvsp.vsp.CF_TURB_SCHULTZ_GRUNOW_SCHOENHERR = 14

Schultz-Grunow Estimate of Schoenherr turbulent Cf equation.

openvsp.vsp.CGS_UNIT = 1

FEA Files output in (cm, g)

openvsp.vsp.CHEVRON_FULL = 2

Full period of chevrons.

openvsp.vsp.CHEVRON_NONE = 0

No chevron.

openvsp.vsp.CHEVRON_NUM_TYPES = 3

Number of chevron types.

openvsp.vsp.CHEVRON_PARTIAL = 1

One or more chevrons of limited extent.

openvsp.vsp.CHEVRON_W01_CW = 1

Center and Width

openvsp.vsp.CHEVRON_W01_NUM_MODES = 2

Number of chevron W parameter mode types.

openvsp.vsp.CHEVRON_W01_SE = 0

Start and End

openvsp.vsp.CLOSE_EXTRAP = 4

Extrapolate closure

openvsp.vsp.CLOSE_NONE = 0

No closure

openvsp.vsp.CLOSE_NUM_TYPES = 5

Number of XSec closure types

openvsp.vsp.CLOSE_SKEWBOTH = 3

Skew both closure

openvsp.vsp.CLOSE_SKEWLOW = 1

Skew lower closure

openvsp.vsp.CLOSE_SKEWUP = 2

Skew upper closure

openvsp.vsp.COBRA_GEOM_SCREEN = 20

Cobra body geom screen

openvsp.vsp.COLLISION_CLEAR_NO_SOLUTION = 2

Not touching, no solution

openvsp.vsp.COLLISION_INTERSECT_NO_SOLUTION = 1

Touching, no solution

openvsp.vsp.COLLISION_OK = 0

No Error.

openvsp.vsp.COMPONENT_REF = 1

Use a particular wing to calculate the reference area and lengths

openvsp.vsp.COMP_GEOM = 15

Calculate wetted area and volume

openvsp.vsp.CONFORMAL_SCREEN = 12

Conformal geom screen

openvsp.vsp.CONST_U = 0

Constant U sub-surface

openvsp.vsp.CONST_W = 1

Constant W sub-surface

openvsp.vsp.CP_PROP_DRIVER = 2

Power coefficient driver

openvsp.vsp.CQ_PROP_DRIVER = 7

Torque coefficient driver

openvsp.vsp.CT_PROP_DRIVER = 1

Thrust coefficient driver

openvsp.vsp.CURV_GAP = 2

Maximum gap curvature based criteria.

openvsp.vsp.CURV_NCIRCSEG = 3

Minimum number of segments to define a circle curvature based criteria.

openvsp.vsp.CUSTOM_GEOM_SCREEN = 7

Custom geom screen

openvsp.vsp.CalcAtmosphere(alt, delta_temp, atmos_type)

Calculate the atmospheric properties determined by a specified model at input altitude and temperature deviation. This function may not be used for any manual atmospheric model types (i.e. ATMOS_TYPE_MANUAL_P_T). This function assumes freestream units are metric, temperature units are Kelvin, and pressure units are kPA.

alt = 4000

delta_temp = 0

temp, pres, pres_ratio, rho_ratio = CalcAtmosphere( alt, delta_temp, ATMOS_TYPE_US_STANDARD_1976)

# The ratios are against sea level standard day, so asking at sea level with
# no temperature offset has to return the sea level standard itself.
sl_temp, sl_pres, sl_pres_ratio, sl_rho_ratio = CalcAtmosphere( 0.0, 0.0, ATMOS_TYPE_US_STANDARD_1976 )

assert abs( sl_temp - 288.15 ) < 1e-2, "sea level is not the standard day temperature"

# The density ratio carries a little rounding from the model constants.
assert abs( sl_pres_ratio - 1.0 ) < 1e-9, "the sea level ratios are not one"
assert abs( sl_rho_ratio - 1.0 ) < 1e-4, "the sea level ratios are not one"

# The atmosphere thins with altitude.
assert temp < sl_temp, "the atmosphere did not thin with altitude"
assert pres < sl_pres, "the atmosphere did not thin with altitude"
assert pres_ratio < 1.0, "the atmosphere did not thin with altitude"
assert rho_ratio < 1.0, "the atmosphere did not thin with altitude"

# The pressure ratio is the pressure against sea level.
assert abs( pres_ratio - pres / sl_pres ) < 1e-6, "the pressure ratio does not match the pressure"

See also: ATMOS_TYPE :param [in]: alt double Altitude :param [in]: delta_temp double Deviation in temperature from the value specified in the atmospheric model :param [in]: atmos_type int Atmospheric model enum (i.e. ATMOS_TYPE_HERRINGTON_1966) :param [out]: temp double output Temperature :param [out]: pres double output Pressure :param [out]: pres_ratio double Output pressure ratio :param [out]: rho_ratio double Output density ratio

openvsp.vsp.ChangeBORXSecShape(bor_id, type)

Set the XSec type for a BOR component

# Add Body of Recolution
bor_id = AddGeom( "BODYOFREVOLUTION", "" )

ChangeBORXSecShape( bor_id, XS_ROUNDED_RECTANGLE )

if  GetBORXSecShape( bor_id ) != XS_ROUNDED_RECTANGLE :
    print( "ERROR: ChangeBORXSecShape" )
    assert False, "ERROR: ChangeBORXSecShape"

See also: XSEC_CRV_TYPE :param [in]: bor_id string Body of revolution Geom ID :param [in]: type int XSec type enum (i.e. XS_ROUNDED_RECTANGLE)

openvsp.vsp.ChangeXSecShape(xsec_surf_id, xsec_index, type)

Change the shape of a particular XSec, identified by an XSecSurf ID and XSec index

# Add Stack
sid = AddGeom( "STACK", "" )

# Get First (and Only) XSec Surf
xsec_surf = GetXSecSurf( sid, 0 )

# Set XSec 1 & 2 to Edit Curve type
ChangeXSecShape( xsec_surf, 1, XS_EDIT_CURVE )
ChangeXSecShape( xsec_surf, 2, XS_EDIT_CURVE )

xsec_2 = GetXSec( xsec_surf, 2 )

if  GetXSecShape( xsec_2 ) != XS_EDIT_CURVE :
    print( "Error: ChangeXSecShape" )
    assert False, "Error: ChangeXSecShape"

See also: XSEC_CRV_TYPE :param [in]: xsec_surf_id string XSecSurf ID :param [in]: xsec_index int Xsec index :param [in]: type int Xsec type enum (i.e. XS_ELLIPSE)

openvsp.vsp.CheckForVSPAERO(path)

Check if all VSPAERO executables (Solver, Viewer, and Slicer) are in a given directory. Note that this function will return false if only one or two VSPAERO executables are found. An error message will indicate the executables that are missing. This may be acceptable, as only the Solver is needed in all cases. The Viewer and Slicer may not be needed.

vspaero_path = "C:/Users/example_user/Documents/OpenVSP_3.4.5"

if  CheckForVSPAERO( vspaero_path ) :
    SetVSPAEROPath( vspaero_path )

# A directory that cannot exist must not report VSPAERO in it.
assert not CheckForVSPAERO( "/no/such/directory/anywhere" ), "CheckForVSPAERO found VSPAERO in a nonexistent directory"

See also: GetVSPExePath, GetVSPAEROPath, SetVSPAEROPath :param [in]: path string Absolute path to check for VSPAERO executables :rtype: boolean :return: bool Flag that indicates if all VSPAERO executables are found or not

openvsp.vsp.CheckForVSPHelp(path)

Check if all OpenVSP help files are in a given directory.

vsphelp_path = "C:/Users/example_user/Documents/OpenVSP_3.4.5/help"

if  CheckForVSPHelp( vsphelp_path ) :
    SetVSPHelpPath( vsphelp_path )

# A directory that cannot exist must not report help files in it.
assert not CheckForVSPHelp( "/no/such/directory/anywhere" ), "CheckForVSPHelp found help in a nonexistent directory"

See also: GetVSPExePath, GetVSPAEROPath, SetVSPHelpPath :param [in]: path string Absolute path to check for VSPAERO executables :rtype: boolean :return: bool Flag that indicates if OpenVSP help files are found or not

openvsp.vsp.ClearSkinning(geom_id, index=-1)

Clear the skinning of one cross section, or of every cross section when the index is left at -1. This is the Skinning tab’s Clear and Clear All buttons.

sid = AddGeom( "STACK", "" )

xsec_surf = GetXSecSurf( sid, 0 )

xsec = GetXSec( xsec_surf, 1 )

SetXSecTanAngles( xsec, XSEC_BOTH_SIDES, 15.0, -1.0e12, -1.0e12, -1.0e12 )

Update()

assert abs( GetParmVal( GetXSecParm( xsec, "TopLAngleSet" ) ) - 1.0 ) < 1e-12, "the skinning was never set"

ClearSkinning( sid, 1 )

Update()

# Clearing releases the section's skinning controls and puts symmetry back
# on; the angle itself becomes whatever the skin solves for.
assert abs( GetParmVal( GetXSecParm( xsec, "TopLAngleSet" ) ) ) < 1e-12, "ClearSkinning did not release the section"
assert abs( GetParmVal( GetXSecParm( xsec, "AllSym" ) ) - 1.0 ) < 1e-12, "ClearSkinning did not release the section"

# A Geom with no cross sections has to be rejected.
err_mgr = ErrorMgrSingleton.getInstance()

pid = AddGeom( "POD" )

ClearSkinning( pid )

assert err_mgr.GetNumTotalErrors() > 0, "ClearSkinning accepted a Geom with no cross sections"

while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: ResetXSecSkinParms :param [in]: geom_id string Geom ID :param [in]: index int Cross section index, or -1 for every section

openvsp.vsp.ClearVSPModel()

Clear the current OpenVSP model

fid = AddGeom( "FUSELAGE", "" )             # Add Fuselage

#==== Reset Geometry ====//
print( "--->Resetting VSP model to blank slate\n" )
ClearVSPModel()

assert len( FindGeoms() ) == 0, "ClearVSPModel left Geoms behind"
openvsp.vsp.CompCurvature01(geom_id, surf_indx, u, w)

Determine the curvature of a specified surface at the input surface coordinate point

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0


u = 0.25
w = 0.75

k1, k2, ka, kg = CompCurvature01( geom_id, surf_indx, u, w )

print( f"Curvature : k1 {k1} k2 {k2} ka {ka} kg {kg}" )

# The mean curvature is the average of the principal curvatures, and the
# Gaussian curvature is their product.
assert abs( ka - 0.5 * ( k1 + k2 ) ) < 1e-9, "the mean curvature does not match the principal curvatures"
assert abs( kg - k1 * k2 ) < 1e-9, "the Gaussian curvature does not match the principal curvatures"

# A Pod is convex everywhere, so the Gaussian curvature is positive.
assert kg > 0.0, "a Pod should be convex here"
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – surf_indx int Main surface index from the parent Geom

  • [in] – u double U (0 - 1) surface coordinate

  • [in] – w double W (0 - 1) surface coordinate

  • [out] – k1_out double Output value of maximum principal curvature

  • [out] – k2_out double Output value of minimum principal curvature

  • [out] – ka_out double Output value of mean curvature

  • [out] – kg_out double Output value of Gaussian curvature

openvsp.vsp.CompNorm01(geom_id, surf_indx, u, w)

Calculate the normal vector on the specified surface at input surface coordinate

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

u = 0.12345
w = 0.67890

norm = CompNorm01( geom_id, surf_indx, u, w )

assert abs( norm.mag() - 1.0 ) < 1e-9, "CompNorm01 is not a unit vector"

print( "Point: ( {norm.x()}, {norm.y()}, {norm.z()} )" )
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – surf_indx int Main surface index from the parent Geom

  • [in] – u double U (0 - 1) surface coordinate

  • [in] – w double W (0 - 1) surface coordinate

Return type:

vec3d

Returns:

vec3d Normal vector

openvsp.vsp.CompPnt01(geom_id, surf_indx, u, w)

Calculate the 3D coordinate equivalent for the input surface coordinate point

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

u = 0.12345
w = 0.67890

pnt = CompPnt01( geom_id, surf_indx, u, w )

print( f"Point: ( {pnt.x()}, {pnt.y()}, {pnt.z()} )" )

# The point is on the surface, so projecting it back has to land on it and
# recover the coordinates it came from.
d, u_out, w_out = ProjPnt01( geom_id, surf_indx, pnt )

assert d < 1e-6, "CompPnt01 returned a point off the surface"
assert abs( u_out - u ) < 1e-6, "CompPnt01 does not round trip through ProjPnt01"
assert abs( w_out - w ) < 1e-6, "CompPnt01 does not round trip through ProjPnt01"

# W wraps around the section, so 0 and 1 are the same place.
assert dist( CompPnt01( geom_id, surf_indx, u, 0.0 ), CompPnt01( geom_id, surf_indx, u, 1.0 ) ) < 1e-6, "the surface does not close in W"
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – surf_indx int Main surface index from the parent Geom

  • [in] – u double U (0 - 1) surface coordinate

  • [in] – w double W (0 - 1) surface coordinate

Return type:

vec3d

Returns:

vec3d Normal vector3D coordinate point

openvsp.vsp.CompPntRST(geom_id, surf_indx, r, s, t)

Calculate the (X, Y, Z) coordinate for the input volume (R, S, T) coordinate point

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

r = 0.12
s = 0.68
t = 0.56

pnt = CompPntRST( geom_id, surf_indx, r, s, t )

print( f"Point: ( {pnt.x()}, {pnt.y()}, {pnt.z()} )" )

# T runs from the interior out to the skin, so t = 1 lands on the surface and
# anything short of that lands inside it.
d, u_out, w_out = ProjPnt01( geom_id, surf_indx, CompPntRST( geom_id, surf_indx, r, s, 1.0 ) )

assert d < 1e-6, "CompPntRST at t = 1 is not on the surface"
assert InsideSurf( geom_id, surf_indx, pnt ), "CompPntRST at t < 1 is not inside the surface"

# The point has to round trip back through the coordinates it came from.
d_rst, r_out, s_out, t_out = FindRST( geom_id, surf_indx, pnt )

assert dist( CompPntRST( geom_id, surf_indx, r_out, s_out, t_out ), pnt ) < 1e-6, "CompPntRST does not round trip through FindRST"
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – surf_indx int Main surface index from the parent Geom

  • [in] – r double R (0 - 1) volume coordinate

  • [in] – s double S (0 - 1) volume coordinate

  • [in] – t double T (0 - 1) volume coordinate

Return type:

vec3d

Returns:

vec3d coordinate point

openvsp.vsp.CompTanU01(geom_id, surf_indx, u, w)

Calculate the vector tangent to the specified surface at input surface coordinate in the U direction

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

u = 0.12345
w = 0.67890

tanu = CompTanU01( geom_id, surf_indx, u, w )

assert tanu.mag() > 0.0, "CompTanU01 is degenerate"

print( f"Point: ( {tanu.x()}, {tanu.y()}, {tanu.z()} )" )
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – surf_indx int Main surface index from the parent Geom

  • [in] – u double U (0 - 1) surface coordinate

  • [in] – w double W (0 - 1) surface coordinate

Return type:

vec3d

Returns:

vec3d Tangent vector in U direction

openvsp.vsp.CompTanW01(geom_id, surf_indx, u, w)

Calculate the vector tangent to the specified surface at input surface coordinate in the W direction

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

u = 0.12345
w = 0.67890

tanw = CompTanW01( geom_id, surf_indx, u, w )

assert tanw.mag() > 0.0, "CompTanW01 is degenerate"

print( f"Point: ( {tanw.x()}, {tanw.y()}, {tanw.z()} )" )
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – surf_indx int Main surface index from the parent Geom

  • [in] – u double U (0 - 1) surface coordinate

  • [in] – w double W (0 - 1) surface coordinate

Return type:

vec3d

Returns:

vec3d Tangent vector in W direction

openvsp.vsp.CompVecCurvature01(geom_id, surf_indx, us, ws)

Determine the curvature of a specified surface at each surface coordinate point in the input arrays

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

n = 5

uvec = [0]*n
wvec = [0]*n

for i in range(n):

    uvec[i] = (i+1)*1.0/(n+1)

    wvec[i] = (n-i)*1.0/(n+1)



k1vec, k2vec, kavec, kgvec = CompVecCurvature01( geom_id, 0, uvec, wvec )

# One value per coordinate pair, matching what the scalar form gives, and
# holding the same relationships between the four curvatures.
assert len( k1vec ) == n, "CompVecCurvature01 returned the wrong number of values"
assert len( k2vec ) == n, "CompVecCurvature01 returned the wrong number of values"
assert len( kavec ) == n, "CompVecCurvature01 returned the wrong number of values"
assert len( kgvec ) == n, "CompVecCurvature01 returned the wrong number of values"

for i in range(n):
    k1, k2, ka, kg = CompCurvature01( geom_id, 0, uvec[i], wvec[i] )

    assert abs( k1vec[i] - k1 ) < 1e-9, "CompVecCurvature01 disagrees with CompCurvature01 at " + str( i )
    assert abs( k2vec[i] - k2 ) < 1e-9, "CompVecCurvature01 disagrees with CompCurvature01 at " + str( i )
    assert abs( kavec[i] - ka ) < 1e-9, "CompVecCurvature01 disagrees with CompCurvature01 at " + str( i )
    assert abs( kgvec[i] - kg ) < 1e-9, "CompVecCurvature01 disagrees with CompCurvature01 at " + str( i )

    assert abs( kavec[i] - 0.5 * ( k1vec[i] + k2vec[i] ) ) < 1e-9, "the curvatures are inconsistent at " + str( i )
    assert abs( kgvec[i] - k1vec[i] * k2vec[i] ) < 1e-9, "the curvatures are inconsistent at " + str( i )
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – surf_indx int Main surface index from the parent Geom

  • [in] – us vector<double> Input vector of U (0 - 1) surface coordinates

  • [in] – ws vector<double> Input vector of W (0 - 1) surface coordinates

  • [out] – k1_out_vec vector<double> Output vector of maximum principal curvatures

  • [out] – k2_out_vec vector<double> Output vector of minimum principal curvatures

  • [out] – ka_out_vec vector<double> Output vector of mean curvatures

  • [out] – kg_out_vec vector<double> Output vector of Gaussian curvatures

openvsp.vsp.CompVecDegenPnt01(geom_id, surf_indx, degen_type, u_in_vec, w_in_vec)

Determine 3D coordinate for each degen surface coordinate point in the input arrays

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

n = 5

uvec = [0]*n
wvec = [0]*n

for i in range(n):

    uvec[i] = (i+1)*1.0/(n+1)

    wvec[i] = (n-i)*1.0/(n+1)

ptvec = CompVecDegenPnt01( geom_id, 0, 0, uvec, wvec )

# One point per coordinate pair.  Degen type 0 is the surface itself, so
# those points are the ones the surface form gives.
assert len( ptvec ) == n, "CompVecDegenPnt01 returned the wrong number of points"

surfvec = CompVecPnt01( geom_id, 0, uvec, wvec )

for i in range(n):
    assert dist( ptvec[i], surfvec[i] ) < 1e-6, "the degen surface does not follow the surface at " + str( i )
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – surf_indx int Main surface index from the parent Geom

  • [in] – degen_type int Type of degen surface (0-S, 1-V, 2-H, 3-C)

  • [in] – u_in_vec vector<double> Input vector of U (0 - 1) surface coordinates

  • [in] – w_in_vec vector<double> Input vector of W (0 - 1) surface coordinates

Return type:

std::vector< vec3d,std::allocator< vec3d > >

Returns:

vector<vec3d> Vector of 3D coordinate points

openvsp.vsp.CompVecNorm01(geom_id, surf_indx, us, ws)

Determine the normal vector on a surface for each surface coordinate point in the input arrays

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

n = 5

uvec = [0]*n
wvec = [0]*n

for i in range(n):

    uvec[i] = (i+1)*1.0/(n+1)

    wvec[i] = (n-i)*1.0/(n+1)

normvec = CompVecNorm01( geom_id, 0, uvec, wvec )

for i in range( len( normvec ) ):
    assert abs( normvec[i].mag() - 1.0 ) < 1e-9, "CompVecNorm01 is not a unit vector"
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – surf_indx int Main surface index from the parent Geom

  • [in] – us vector<double> Input vector of U (0 - 1) surface coordinates

  • [in] – ws vector<double> Input vector of W (0 - 1) surface coordinates

Return type:

std::vector< vec3d,std::allocator< vec3d > >

Returns:

vector<vec3d> Vector of 3D normal vectors

openvsp.vsp.CompVecPnt01(geom_id, surf_indx, u_in_vec, w_in_vec)

Determine 3D coordinate for each surface coordinate point in the input arrays

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

n = 5

uvec = [0]*n
wvec = [0]*n

for i in range(n):

    uvec[i] = (i+1)*1.0/(n+1)

    wvec[i] = (n-i)*1.0/(n+1)

ptvec = CompVecPnt01( geom_id, 0, uvec, wvec )

# One point per coordinate pair, each the same point the scalar form gives.
assert len( ptvec ) == n, "CompVecPnt01 returned the wrong number of points"

for i in range(n):
    assert dist( ptvec[i], CompPnt01( geom_id, 0, uvec[i], wvec[i] ) ) < 1e-9, "CompVecPnt01 disagrees with CompPnt01 at " + str( i )
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – surf_indx int Main surface index from the parent Geom

  • [in] – u_in_vec vector<double> Input vector of U (0 - 1) surface coordinates

  • [in] – w_in_vec vector<double> Input vector of W (0 - 1) surface coordinates

Return type:

std::vector< vec3d,std::allocator< vec3d > >

Returns:

vector<vec3d> Vector of 3D coordinate points

openvsp.vsp.CompVecPntRST(geom_id, surf_indx, r_in_vec, s_in_vec, t_in_vec)

Determine 3D coordinate for each volume coordinate point in the input arrays

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

n = 5

rvec = [0]*n
svec = [0]*n
tvec = [0]*n

for i in range(n):

    rvec[i] = (i+1)*1.0/(n+1)

    svec[i] = (n-i)*1.0/(n+1)

    tvec[i] = (i+1)*1.0/(n+1)

ptvec = CompVecPntRST( geom_id, 0, rvec, svec, tvec )

# One point per coordinate triple, each the same point the scalar form
# gives, and every one of them inside the surface.
assert len( ptvec ) == n, "CompVecPntRST returned the wrong number of points"

for i in range(n):
    assert dist( ptvec[i], CompPntRST( geom_id, 0, rvec[i], svec[i], tvec[i] ) ) < 1e-9, "CompVecPntRST disagrees with CompPntRST at " + str( i )
    assert InsideSurf( geom_id, 0, ptvec[i] ), "CompVecPntRST returned a point outside the surface at " + str( i )
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – surf_indx int Main surface index from the parent Geom

  • [in] – r_in_vec vector<double> Input vector of R (0 - 1.0) volume coordinates

  • [in] – s_in_vec vector<double> Input vector of S (0 - 1.0) volume coordinates

  • [in] – t_in_vec vector<double> Input vector of T (0 - 1.0) volume coordinates

Return type:

std::vector< vec3d,std::allocator< vec3d > >

Returns:

vector<vec3d> Vector of 3D coordinate points

openvsp.vsp.ComputeBORXSecPnt(bor_id, fract)

Compute 3D coordinate for a point on a BOR XSecCurve given the parameter value (U) along the curve

#==== Add Geom ====//
# Add Body of Recolution
bor_id = AddGeom( "BODYOFREVOLUTION", "" )

u_fract = 0.25

pnt = ComputeBORXSecPnt( bor_id, u_fract )

# The section is a closed curve, so the ends meet.
assert dist( ComputeBORXSecPnt( bor_id, 0.0 ), ComputeBORXSecPnt( bor_id, 1.0 ) ) < 1e-6, "the BOR section does not close"

# The section lies in a plane of constant Z.
assert abs( pnt.z() - ComputeBORXSecPnt( bor_id, 0.0 ).z() ) < 1e-9, "the BOR section is not planar"

# Walking the curve has to move, not sit still.
assert dist( pnt, ComputeBORXSecPnt( bor_id, u_fract + 0.25 ) ) > 1e-9, "ComputeBORXSecPnt does not advance along the curve"
Parameters:
  • [in] – bor_id string Body of revolution Geom ID

  • [in] – fract double Curve parameter value (range: 0 - 1)

Return type:

vec3d

Returns:

vec3d Coordinate point on curve

openvsp.vsp.ComputeBORXSecTan(bor_id, fract)

Compute the tangent vector of a point on a BOR XSecCurve given the parameter value (U) along the curve

# Add Body of Recolution
bor_id = AddGeom( "BODYOFREVOLUTION", "" )

u_fract = 0.25

tan = ComputeBORXSecTan( bor_id, u_fract )

# A tangent is a direction, so it has to have some length.
assert tan.mag() > 1e-9, "ComputeBORXSecTan returned a degenerate tangent"

# The tangent has to follow the curve, so stepping along the curve from the
# point has to line up with it.
du = 1.0e-5

p0 = ComputeBORXSecPnt( bor_id, u_fract )
p1 = ComputeBORXSecPnt( bor_id, u_fract + du )

fd = vec3d( p1.x() - p0.x(), p1.y() - p0.y(), p1.z() - p0.z() )

assert fd.mag() > 1e-12, "the BOR section does not advance"

align = ( fd.x() * tan.x() + fd.y() * tan.y() + fd.z() * tan.z() ) / ( fd.mag() * tan.mag() )

assert align > 0.999, "ComputeBORXSecTan does not follow the curve"
Parameters:
  • [in] – bor_id string Body of revolution Geom ID

  • [in] – fract double Curve parameter value (range: 0 - 1)

Return type:

vec3d

Returns:

vec3d Tangent vector on curve

openvsp.vsp.ComputeCFDMesh(set, degenset, file_export_types)

Create a CFD Mesh for the components in the set. This analysis cannot be run through the Analysis Manager.

 #==== Add Pod Geometry ====//
 pid = AddGeom( "POD" )

 Update()

 #==== Keep the mesh coarse so the example runs quickly ====//
 SetCFDMeshVal( CFD_MAX_EDGE_LEN, 1.0 )
 SetCFDMeshVal( CFD_MIN_EDGE_LEN, 0.1 )

 #==== CFDMesh Method Facet Export =====//
 SetComputationFileName( CFD_FACET_TYPE, "TestCFDMeshFacet_API.facet" )
 SetComputationFileName( CFD_STL_TYPE, "TestCFDMesh_API.stl" )

print( "\tComputing CFDMesh..." )

 ComputeCFDMesh( SET_ALL, SET_NONE, CFD_FACET_TYPE | CFD_STL_TYPE )

 # CFD Mesh reports nothing through the Results Manager, so read the mesh it
 # just wrote back in to prove it produced one.
 mesh_id = ImportFile( "TestCFDMesh_API.stl", IMPORT_STL, "" )

 assert len( mesh_id ) > 0, "ComputeCFDMesh did not write a readable mesh"
 assert GetGeomTypeName( mesh_id ) == "Mesh", "ComputeCFDMesh did not write a readable mesh"

 DeleteGeom( mesh_id )

See also: COMPUTATION_FILE_TYPE :param [in]: set int Set index (i.e. SET_ALL) :param [in]: degenset int DegenSet index (i.e. SET_NONE) :param [in]: file_export_types int CFD Mesh file type to export (supports XOR i.e CFD_SRF_TYPE & CFD_STL_TYPE)

openvsp.vsp.ComputeCompGeom(set, half_mesh, 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 ====//
mesh_id = ComputeCompGeom( SET_ALL, False, 0 )                      # Half Mesh false and no file export
assert len( mesh_id ) > 0, "ComputeCompGeom returned no id"


comp_res_id = FindLatestResultsID( "Comp_Geom" )                    # Find Results ID

double_arr = GetDoubleResults( comp_res_id, "Wet_Area" )    # Extract Results

See also: SetAnalysisInputDefaults, PrintAnalysisInputs, ExecAnalysis, COMPUTATION_FILE_TYPE :param [in]: set int Set index (i.e. SET_ALL) :param [in]: half_mesh bool Flag to ignore surfaces on the negative side of the XZ plane (e.g. symmetry) :param [in]: file_export_types int CompGeom file type to export (supports XOR i.e. COMP_GEOM_CSV_TYPE & COMP_GEOM_TXT_TYPE ) :rtype: string :return: string MeshGeom ID

openvsp.vsp.ComputeDegenGeom(set, file_export_types)

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

#==== Add Pod Geometry ====//
pid = AddGeom( "POD" )

#==== Set File Name ====//
SetComputationFileName( DEGEN_GEOM_CSV_TYPE, "TestDegenScript.csv" )

#==== Run Degen Geom ====//
ComputeDegenGeom( SET_ALL, DEGEN_GEOM_CSV_TYPE )

# The degenerate representation is reported through the Results Manager as
# well as written to file.  A Pod yields a surface, a plate and a stick.
assert GetNumResults( "DegenGeom" ) == 1, "ComputeDegenGeom produced no DegenGeom result"
assert GetNumResults( "Degen_surf" ) >= 1, "ComputeDegenGeom produced no Degen_surf result"
assert GetNumResults( "Degen_plate" ) >= 1, "ComputeDegenGeom produced no Degen_plate result"
assert GetNumResults( "Degen_stick" ) >= 1, "ComputeDegenGeom produced no Degen_stick result"

See also: SetAnalysisInputDefaults, PrintAnalysisInputs, ExecAnalysis, COMPUTATION_FILE_TYPE :param [in]: set int Set index (i.e. SET_ALL) :param [in]: file_export_types int DegenGeom file type to export (supports XOR i.e DEGEN_GEOM_M_TYPE & DEGEN_GEOM_CSV_TYPE)

openvsp.vsp.ComputeFeaAssemblyMesh(std: :string const & assembly_id)
openvsp.vsp.ComputeFeaMesh(*args)

Overload 1:

Compute an FEA Mesh for a Structure. Only a single output file can be generated with this function.

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

#==== Add FeaStructure to Pod ====//
struct_ind = AddFeaStruct( pod_id )

struct_id = GetFeaStructID( pod_id, struct_ind )

#==== Generate FEA Mesh and Export ====//
print( "--> Generating FeaMesh " )

#==== Get Parent Geom ID and Index ====//
parent_id = GetFeaStructParentGeomID( struct_id ) # same as pod_id

#==== Keep the mesh coarse so the example runs quickly ====//
SetFeaMeshVal( parent_id, struct_ind, CFD_MAX_EDGE_LEN, 0.75 )

SetFeaMeshFileName( parent_id, struct_ind, FEA_CALCULIX_FILE_NAME, "FEAMeshTest_calculix.dat" )

ComputeFeaMesh( parent_id, struct_ind, FEA_CALCULIX_FILE_NAME )

# FEA Mesh reports nothing through the Results Manager, so the output file is
# the evidence that it ran.
import os
assert os.path.getsize( "FEAMeshTest_calculix.dat" ) > 0, "ComputeFeaMesh wrote no file"

See also: SetFeaMeshFileName, FEA_EXPORT_TYPE :param [in]: geom_id string Parent Geom ID :param [in]: fea_struct_ind int FEA Structure index :param [in]: file_type int FEA output file type enum (i.e. FEA_EXPORT_TYPE)


Overload 2:

Compute an FEA Mesh for a Structure. Only a single output file can be generated with this function.

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

#==== Add FeaStructure to Pod ====//
struct_ind = AddFeaStruct( pod_id )

struct_id = GetFeaStructID( pod_id, struct_ind )

#==== Generate FEA Mesh and Export ====//
print( "--> Generating FeaMesh " )

#==== Get Parent Geom ID and Index ====//
parent_id = GetFeaStructParentGeomID( struct_id ) # same as pod_id

#==== Keep the mesh coarse so the example runs quickly ====//
SetFeaMeshVal( parent_id, struct_ind, CFD_MAX_EDGE_LEN, 0.75 )

SetFeaMeshFileName( parent_id, struct_ind, FEA_CALCULIX_FILE_NAME, "FEAMeshTest_calculix.dat" )

# This form names the Structure directly rather than its parent and index.
ComputeFeaMesh( struct_id, FEA_CALCULIX_FILE_NAME )

# FEA Mesh reports nothing through the Results Manager, so the output file is
# the evidence that it ran.
import os
assert os.path.getsize( "FEAMeshTest_calculix.dat" ) > 0, "ComputeFeaMesh wrote no file"

See also: SetFeaMeshFileName, FEA_EXPORT_TYPE :param [in]: struct_id string FEA Structure index :param [in]: file_type int FEA output file type enum (i.e. FEA_EXPORT_TYPE)

openvsp.vsp.ComputeMassProps(set, num_slices, idir)

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", "" )

mesh_id = ComputeMassProps( SET_ALL, 20, X_DIR )

mass_res_id = FindLatestResultsID( "Mass_Properties" )

double_arr = GetDoubleResults( mass_res_id, "Total_Mass" )

if  len(double_arr) != 1 :
    print( "---> Error: API ComputeMassProps" )
    assert False, "---> Error: API ComputeMassProps"

See also: SetAnalysisInputDefaults, PrintAnalysisInputs, ExecAnalysis :param [in]: set int Set index (i.e. SET_ALL) :param [in]: num_slices int Number of slices :param [in]: idir int Direction of slicing for integration :rtype: string :return: string MeshGeom ID

openvsp.vsp.ComputeMinClearanceDistance(*args)

Compute the minimum clearance distance for the specified geometry

fid = AddGeom( "FUSELAGE", "" )             # Add Fuselage

pid = AddGeom( "POD", "" )                     # Add Pod

x = GetParm( pid, "X_Rel_Location", "XForm" )

SetParmVal( x, 3.0 )

Update()

min_dist = ComputeMinClearanceDistance( pid, SET_ALL )

# The Pod was moved clear of the Fuselage, so there is a real gap between
# them.  Sliding it back into the Fuselage has to close that gap.
assert min_dist > 0.0, "ComputeMinClearanceDistance reports no clearance between separated Geoms"

SetParmVal( x, 0.0 )

Update()

assert ComputeMinClearanceDistance( pid, SET_ALL ) < min_dist, "ComputeMinClearanceDistance did not close as the Geoms came together"
Parameters:
  • [in] – geom_id string Geom ID

  • [in] – set int Collision set enum (i.e. SET_ALL)

  • [in] – useMode bool Flag determine if mode is used instead of sets

  • [in] – modeID string ID of Mode to use

Return type:

float

Returns:

double Minimum clearance distance

openvsp.vsp.ComputePlaneSlice(set, num_slices, norm, auto_bnd, start_bnd=0, end_bnd=0, measureduct=False)

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 ====//
slice_mesh_id = ComputePlaneSlice( 0, 6, vec3d( 0.0, 0.0, 1.0 ), True )

pslice_results = FindLatestResultsID( "Slice" )

double_arr = GetDoubleResults( pslice_results, "Slice_Area" )

if  len(double_arr) != 6 :
    print( "---> Error: API ComputePlaneSlice" )
    assert False, "---> Error: API ComputePlaneSlice"

See also: SetAnalysisInputDefaults, PrintAnalysisInputs, ExecAnalysis :param [in]: set int Set index (i.e. SET_ALL) :param [in]: num_slices int Number of slices :param [in]: norm vec3d Normal axis for all slices :param [in]: auto_bnd bool Flag to automatically set the start and end bound locations :param [in]: start_bnd double Location of the first slice along the normal axis (default: 0.0) :param [in]: end_bnd double Location of the last slice along the normal axis (default: 0.0) :param [in]: measureduct bool Flag to measure negative area inside positive area (default: false) :rtype: string :return: string MeshGeom ID

openvsp.vsp.ComputeXSecPnt(xsec_id, fract)

Compute 3D coordinate for a point on an XSec curve given the parameter value (U) along the curve

#==== Add Geom ====//
stack_id = AddGeom( "STACK" )

#==== Get The XSec Surf ====//
xsec_surf = GetXSecSurf( stack_id, 0 )

xsec = GetXSec( xsec_surf, 2 )

u_fract = 0.25

pnt = ComputeXSecPnt(xsec, u_fract)

# The section is a closed curve, so the ends meet.
assert dist( ComputeXSecPnt( xsec, 0.0 ), ComputeXSecPnt( xsec, 1.0 ) ) < 1e-6, "the XSec curve does not close"

# The point has to lie on the section, which is sized by its width and
# height about the section origin.
w = GetXSecWidth( xsec )
h = GetXSecHeight( xsec )

assert abs( pnt.y() ) <= 0.5 * w + 1e-6, "ComputeXSecPnt returned a point off the section"
assert abs( pnt.z() ) <= 0.5 * h + 1e-6, "ComputeXSecPnt returned a point off the section"
Parameters:
  • [in] – xsec_id string XSec ID

  • [in] – fract double Curve parameter value (range: 0 - 1)

Return type:

vec3d

Returns:

vec3d 3D coordinate point

openvsp.vsp.ComputeXSecTan(xsec_id, fract)

Compute the tangent vector of a point on an XSec curve given the parameter value (U) along the curve

#==== Add Geom ====//
stack_id = AddGeom( "STACK" )

#==== Get The XSec Surf ====//
xsec_surf = GetXSecSurf( stack_id, 0 )

xsec = GetXSec( xsec_surf, 2 )

u_fract = 0.25

tan = ComputeXSecTan( xsec, u_fract )

# A tangent is a direction, so it has to have some length.
assert tan.mag() > 1e-9, "ComputeXSecTan returned a degenerate tangent"

# The tangent has to follow the curve, so stepping along the curve from the
# point has to line up with it.
du = 1.0e-5

p0 = ComputeXSecPnt( xsec, u_fract )
p1 = ComputeXSecPnt( xsec, u_fract + du )

fd = vec3d( p1.x() - p0.x(), p1.y() - p0.y(), p1.z() - p0.z() )

assert fd.mag() > 1e-12, "the XSec curve does not advance"

align = ( fd.x() * tan.x() + fd.y() * tan.y() + fd.z() * tan.z() ) / ( fd.mag() * tan.mag() )

assert align > 0.999, "ComputeXSecTan does not follow the curve"
Parameters:
  • [in] – xsec_id string XSec ID

  • [in] – fract double Curve parameter value (range: 0 - 1)

Return type:

vec3d

Returns:

vec3d Tangent vector

openvsp.vsp.ConvertEtatoU(geom_id, eta)

Convert eta wing coordinate to u coordinate.

# Add Wing Geom
geom_id = AddGeom( "WING", "" )

surf_indx = 0

eta= 0.25

u = ConvertEtatoU( geom_id, eta )

# Converting back has to return the coordinate we started from.
eta_back = ConvertUtoEta( geom_id, u )

assert abs( eta_back - eta ) < 1e-6, "ConvertEtatoU does not round trip"
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – eta double Eta (0 - 1) wing spanwise coordinate

  • [out] – u_out double U (0 - 1) surface coordinate

openvsp.vsp.ConvertLMNtoRST(geom_id, surf_indx, l, m, n)

Convert LMN volumetric coordinates to RST coordinates.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

l = 0.12
m = 0.34
n = 0.56

r_out, s_out, t_out = ConvertLMNtoRST( geom_id, surf_indx, l, m, n )

# The conversion is invertible, so going back has to return the input.
l_out, m_out, n_out = ConvertRSTtoLMN( geom_id, surf_indx, r_out, s_out, t_out )

assert abs( l_out - l ) < 1e-6, "ConvertLMNtoRST does not invert"
assert abs( m_out - m ) < 1e-6, "ConvertLMNtoRST does not invert"
assert abs( n_out - n ) < 1e-6, "ConvertLMNtoRST does not invert"

# Both coordinate systems run over the unit cube.
assert 0.0 <= r_out <= 1.0, "ConvertLMNtoRST left the unit cube"
assert 0.0 <= s_out <= 1.0, "ConvertLMNtoRST left the unit cube"
assert 0.0 <= t_out <= 1.0, "ConvertLMNtoRST left the unit cube"

# The coordinates name a point in the volume, so evaluating them has to land
# inside the surface.
assert InsideSurf( geom_id, surf_indx, CompPntRST( geom_id, surf_indx, r_out, s_out, t_out ) ), "ConvertLMNtoRST did not name a point in the volume"
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – surf_indx int Main surface index from the parent Geom

  • [in] – l double L (0 - 1) linear volume coordinate

  • [in] – m double M (0 - 1) linear volume coordinate

  • [in] – n double N (0 - 1) linear volume coordinate

  • [out] – r_out double R (0 - 1) volume coordinate

  • [out] – s_out double S (0 - 1) volume coordinate

  • [out] – t_out double T (0 - 1) volume coordinate

openvsp.vsp.ConvertLMNtoRSTVec(geom_id, surf_indx, l_vec, m_vec, n_vec)

Convert vector of LMN volumetric coordinates to RST coordinates.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

n = 5

lvec = [0]*n
mvec = [0]*n
nvec = [0]*n

for i in range(n):

    lvec[i] = (i+1)*1.0/(n+1)
    mvec[i] = (n-i)*1.0/(n+1)
    nvec[i] = (i+1)*1.0/(n+1)

rvec, svec, tvec = ConvertLMNtoRSTVec( geom_id, 0, lvec, mvec, nvec )

# One triple out per triple in, each matching the scalar form, and the whole
# conversion invertible.
lback, mback, nback = ConvertRSTtoLMNVec( geom_id, 0, rvec, svec, tvec )

assert len( rvec ) == n, "ConvertLMNtoRSTVec returned the wrong number of values"
assert len( svec ) == n, "ConvertLMNtoRSTVec returned the wrong number of values"
assert len( tvec ) == n, "ConvertLMNtoRSTVec returned the wrong number of values"

for i in range(n):
    r_one, s_one, t_one = ConvertLMNtoRST( geom_id, 0, lvec[i], mvec[i], nvec[i] )

    assert abs( rvec[i] - r_one ) < 1e-9, "ConvertLMNtoRSTVec disagrees with ConvertLMNtoRST at " + str( i )
    assert abs( svec[i] - s_one ) < 1e-9, "ConvertLMNtoRSTVec disagrees with ConvertLMNtoRST at " + str( i )
    assert abs( tvec[i] - t_one ) < 1e-9, "ConvertLMNtoRSTVec disagrees with ConvertLMNtoRST at " + str( i )

    assert abs( lback[i] - lvec[i] ) < 1e-6, "ConvertLMNtoRSTVec does not invert at " + str( i )
    assert abs( mback[i] - mvec[i] ) < 1e-6, "ConvertLMNtoRSTVec does not invert at " + str( i )
    assert abs( nback[i] - nvec[i] ) < 1e-6, "ConvertLMNtoRSTVec does not invert at " + str( i )

See also: ConvertRSTtoLMNVec, ConvertRSTtoLMN, ConvertLMNtoRST :param [in]: geom_id string Parent Geom ID :param [in]: surf_indx int Main surface index from the parent Geom :param [in]: l_vec vector<double> Input vector of L (0 - 1) linear volumetric coordinate :param [in]: m_vec vector<double> Input vector of M (0 - 1) linear volumetric coordinate :param [in]: n_vec vector<double> Input vector of N (0 - 1) linear volumetric coordinate :param [out]: r_out_vec vector<double> Output vector of R (0 - 1) volumetric coordinate :param [out]: s_out_vec vector<double> Output vector of S (0 - 1) volumetric coordinate :param [out]: t_out_vec vector<double> Output vector of T (0 - 1) volumetric coordinate

openvsp.vsp.ConvertLtoR(geom_id, surf_indx, l)

Convert L volumetric coordinate to R coordinate.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

l = 0.12

r_out = ConvertLtoR( geom_id, surf_indx, l )

# The conversion is invertible, so going back has to return the input.
l_out = ConvertRtoL( geom_id, surf_indx, r_out )

assert abs( l_out - l ) < 1e-6, "ConvertLtoR does not invert"
assert 0.0 <= r_out <= 1.0, "ConvertLtoR left the unit interval"

# Both coordinates run nose to tail, so the mapping is increasing.
r_more = ConvertLtoR( geom_id, surf_indx, l + 0.1 )

assert r_more > r_out, "ConvertLtoR is not increasing"
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – surf_indx int Main surface index from the parent Geom

  • [in] – l double L (0 - 1) volume coordinate

  • [out] – r_out double R (0 - 1) linear volume coordinate

openvsp.vsp.ConvertRSTtoLMN(geom_id, surf_indx, r, s, t)

Convert RST volumetric coordinates to LMN coordinates.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

r = 0.12
s = 0.68
t = 0.56

l_out, m_out, n_out = ConvertRSTtoLMN( geom_id, surf_indx, r, s, t )

# Converting back has to return the coordinates we started from.
r_back, s_back, t_back = ConvertLMNtoRST( geom_id, surf_indx, l_out, m_out, n_out )

assert abs( r_back - r ) < 1e-6 and abs( s_back - s ) < 1e-6 and abs( t_back - t ) < 1e-6, "ConvertRSTtoLMN does not round trip"
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – surf_indx int Main surface index from the parent Geom

  • [in] – r double R (0 - 1) volume coordinate

  • [in] – s double S (0 - 1) volume coordinate

  • [in] – t double T (0 - 1) volume coordinate

  • [out] – l_out double L (0 - 1) linear volume coordinate

  • [out] – m_out double M (0 - 1) linear volume coordinate

  • [out] – n_out double N (0 - 1) linear volume coordinate

openvsp.vsp.ConvertRSTtoLMNVec(geom_id, surf_indx, r_vec, s_vec, t_vec)

Convert vector of RST volumetric coordinates to LMN coordinates.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

n = 5

rvec = [0]*n
svec = [0]*n
tvec = [0]*n

for i in range(n):

    rvec[i] = (i+1)*1.0/(n+1)
    svec[i] = (n-i)*1.0/(n+1)
    tvec[i] = (i+1)*1.0/(n+1)



lvec, mvec, nvec = ConvertRSTtoLMNVec( geom_id, 0, rvec, svec, tvec )

See also: ConvertLMNtoRSTVec, ConvertRSTtoLMN, ConvertLMNtoRST :param [in]: geom_id string Parent Geom ID :param [in]: surf_indx int Main surface index from the parent Geom :param [in]: r_vec vector<double> Input vector of R (0 - 1) volumetric coordinate :param [in]: s_vec vector<double> Input vector of S (0 - 1) volumetric coordinate :param [in]: t_vec vector<double> Input vector of T (0 - 1) volumetric coordinate :param [out]: l_out_vec vector<double> Output vector of L (0 - 1) linear volumetric coordinate :param [out]: m_out_vec vector<double> Output vector of M (0 - 1) linear volumetric coordinate :param [out]: n_out_vec vector<double> Output vector of N (0 - 1) linear volumetric coordinate

openvsp.vsp.ConvertRtoL(geom_id, surf_indx, r)

Convert R volumetric coordinate to L coordinate.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

r = 0.12

l_out = ConvertRtoL( geom_id, surf_indx, r )

# Converting back has to return the coordinate we started from.
r_back = ConvertLtoR( geom_id, surf_indx, l_out )

assert abs( r_back - r ) < 1e-6, "ConvertRtoL does not round trip"
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – surf_indx int Main surface index from the parent Geom

  • [in] – r double R (0 - 1) volume coordinate

  • [out] – l_out double L (0 - 1) linear volume coordinate

openvsp.vsp.ConvertUtoEta(geom_id, u)

Convert U coordinate to eta wing coordinate.

# Add Wing Geom
geom_id = AddGeom( "WING", "" )

surf_indx = 0

# U runs from 1 to N+1 over an N section wing when the root end cap is on,
# so a U below 1 sits in the cap and does not map to a span station.
u = 1.25

eta_out = ConvertUtoEta( geom_id, u )

# Converting back has to return the coordinate we started from.
u_back = ConvertEtatoU( geom_id, eta_out )

assert abs( u_back - u ) < 1e-6, "ConvertUtoEta does not round trip"
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – u double U (0 - 1) surface coordinate

  • [out] – eta_out double Eta (0 - 1) wing spanwise coordinate

openvsp.vsp.ConvertXSecToEdit(geom_id, indx=0)

Convert any XSec type into an EditCurveXSec. This function will work for BOR Geoms, in which case the input XSec index is ignored.

# Add Stack
sid = AddGeom( "STACK", "" )

# Get First (and Only) XSec Surf
xsec_surf = GetXSecSurf( sid, 0 )

ChangeXSecShape( xsec_surf, 1, XS_ROUNDED_RECTANGLE )

# Convert Rounded Rectangle to Edit Curve type XSec
ConvertXSecToEdit( sid, 1 )

# Identify XSec 1
xsec_1 = GetXSec( xsec_surf, 1 )

# Get the control points for the default shape
xsec1_pts = GetEditXSecCtrlVec( xsec_1, True ) # The returned control points will not be scaled by width and height

# The section is an edit curve carrying a closed cubic Bezier, normalized to
# the unit box.
assert GetXSecShape( xsec_1 ) == XS_EDIT_CURVE, "the section is not an edit curve"
assert len( xsec1_pts ) >= 4, "the edit curve carries too few control points"
assert dist( xsec1_pts[0], xsec1_pts[-1] ) < 1e-9, "the edit curve does not close"
Parameters:
  • [in] – geom_id string Geom ID

  • [in] – indx int XSec index

openvsp.vsp.CopyAirfoil(geom_id, index)

Link two Parms so that changing the first drives the second. This is the simple Parm Link the Link screen builds, not an Advanced Link. The link is created with its offset active and set to the difference between the two Parms, so B follows A while holding its current separation.

pod1 = AddGeom( "POD", "" )
pod2 = AddGeom( "POD", "" )

xa = GetParm( pod1, "X_Rel_Location", "XForm" )
xb = GetParm( pod2, "X_Rel_Location", "XForm" )

SetParmVal( xb, 3.0 )

Update()

link_id = AddParmLink( xa, xb )

assert len( link_id ) > 0, "AddParmLink returned no id"
assert GetNumParmLinks() == 1, "AddParmLink did not add the link"
assert GetParmLinkID( 0 ) == link_id, "AddParmLink did not add the link"

# The link drives B from A, holding the three unit offset it started with.
SetParmValUpdate( xa, 5.0 )

Update()

assert abs( GetParmVal( xb ) - 8.0 ) < 1e-6, "the parm link did not drive its output"

# Linking the same pair twice has to be refused.  The error queue is reached
# through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

AddParmLink( xa, xb )

assert err_mgr.GetNumTotalErrors() > 0, "AddParmLink accepted a duplicate link"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: GetNumParmLinks, GetParmLinkID, DelParmLink, DelAllParmLinks, AddAdvLink :param [in]: parm_a_id string Parm ID of the driving Parm :param [in]: parm_b_id string Parm ID of the driven Parm :rtype: void :return: string Parm Link ID

Copy the airfoil of a wing section to the airfoil clipboard. This is a separate clipboard from the one CopyXSec uses, so an airfoil can be moved without carrying the section geometry with it.

wid = AddGeom( "WING" )

# Give section 1 a distinctive airfoil.
xsec_surf = GetXSecSurf( wid, 0 )

ChangeXSecShape( xsec_surf, 1, XS_SIX_SERIES )

Update()

CopyAirfoil( wid, 1 )

PasteAirfoil( wid, 0 )

# The airfoil travels; the section geometry does not.
assert GetXSecShape( GetXSec( xsec_surf, 0 ) ) == XS_SIX_SERIES, "the airfoil did not paste"

# A Geom that is not a wing has to be rejected.
err_mgr = ErrorMgrSingleton.getInstance()

pid = AddGeom( "POD" )

CopyAirfoil( pid, 0 )

assert err_mgr.GetNumTotalErrors() > 0, "CopyAirfoil accepted a Geom that is not a wing"

while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: PasteAirfoil, CopyXSec :param [in]: geom_id string Wing Geom ID :param [in]: index int Wing section index

openvsp.vsp.CopyAttribute(attrID)

Copy an attribute to the clipboard by attributeID

##==== Attribute: CopyAttribute  =====##

VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
AttrName = 'Example_String_Attr'
StringValue = 'Example_String_Attr_DataVal'
AttrID = AddAttributeString( CollID, AttrName, StringValue )
CopyError = CopyAttribute( AttrID )
if not CopyError:
    print("Successfully copied Attribute")
else:
    print("CopyAttribute Error!")
    assert False, "CopyAttribute Error!"
Parameters:

[in] – attrID string ID of attribute to be copied

openvsp.vsp.CopyGeomToClipboard(geom_id)

Copy Geom from current location and store on clipboard

#==== Add Pod Geometries ====//
pid1 = AddGeom( "POD", "" )
pid2 = AddGeom( "POD", "" )

CopyGeomToClipboard( pid1 )

PasteGeomClipboard( pid2 ) # Paste Pod 1 as child of Pod 2

geom_ids = FindGeoms()

if  len(geom_ids) != 3 :
    print( "---> Error: API Copy/Paste Geom  " )
    assert False, "---> Error: API Copy/Paste Geom"

See also: PasteGeomClipboard :param [in]: geom_id string Geom ID

openvsp.vsp.CopyPasteSet(copyIndex, pasteIndex)

Copies all the states of a geom set and pastes them into a specific set based on passed in indexs

# Add Fuselage Geom
fuseid = AddGeom( "FUSELAGE", "" )

#set fuseid's state for set 3 to true
SetSetFlag( fuseid, 3, True )

#Copy set 3 and Paste into set 4
CopyPasteSet( 3, 4 )

#get fuseid's state for set 4
flag_value = GetSetFlag( fuseid, 4 )

if  flag_value != True:
    print( "---> Error: API CopyPasteSet " )
    assert False, "---> Error: API CopyPasteSet"
Parameters:
  • [in] – copyIndex int Copy Index

  • [in] – pasteIndex int Paste Index

openvsp.vsp.CopyXSec(geom_id, index)

Copy a cross-section from the specified geometry and maintain it in memory

# Add Stack
sid = AddGeom( "STACK", "" )

xsec_surf = GetXSecSurf( sid, 0 )

# Give XSec 1 a shape that XSec 3 does not have.
ChangeXSecShape( xsec_surf, 1, XS_ROUNDED_RECTANGLE )

Update()

num_start = GetNumXSec( xsec_surf )

# Copy XSec To Clipboard
CopyXSec( sid, 1 )

# Paste To XSec 3
PasteXSec( sid, 3 )

Update()

# Pasting replaces the target section, so the count is unchanged and XSec 3
# now carries the shape that was copied.
assert GetNumXSec( xsec_surf ) == num_start, "PasteXSec changed the number of sections"
assert GetXSecShape( GetXSec( xsec_surf, 3 ) ) == XS_ROUNDED_RECTANGLE, "PasteXSec did not paste the copied section"

# The section that was copied has to be left alone.
assert GetXSecShape( GetXSec( xsec_surf, 1 ) ) == XS_ROUNDED_RECTANGLE, "CopyXSec disturbed the section it copied"

See also: PasteXSec :param [in]: geom_id string Geom ID :param [in]: index int XSec index

openvsp.vsp.CopyXSecCurve(geom_id, index)

Copy the XSecCurve of a cross section to the XSecCurve clipboard. This carries the section shape without the section’s placement, and works on a body of revolution too, where the index is ignored because it holds only one curve.

# Add Stack
sid = AddGeom( "STACK", "" )

xsec_surf = GetXSecSurf( sid, 0 )

ChangeXSecShape( xsec_surf, 1, XS_ROUNDED_RECTANGLE )

Update()

CopyXSecCurve( sid, 1 )

PasteXSecCurve( sid, 3 )

Update()

# The shape travels to the pasted section.
assert GetXSecShape( GetXSec( xsec_surf, 3 ) ) == XS_ROUNDED_RECTANGLE, "the XSecCurve did not paste"

# A Geom that carries no cross sections has to be rejected.
err_mgr = ErrorMgrSingleton.getInstance()

pid = AddGeom( "POD" )

CopyXSecCurve( pid, 0 )

assert err_mgr.GetNumTotalErrors() > 0, "CopyXSecCurve accepted a Geom with no cross sections"

while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: PasteXSecCurve, CopyXSec, CopyAirfoil :param [in]: geom_id string Geom ID :param [in]: index int XSec index, ignored for a body of revolution

openvsp.vsp.CreateAndAddBogie(gear_id)

Create a new Bogie and add it to the end of the Bogie list of the specified GearGeom. A GearGeom’s landing gear is described by its list of Bogies. Each Bogie is a ParmContainer, so once you have the returned Bogie ID you can query and set its Parms with the normal Parm API functions.

gear_id = AddGeom( "GEAR", "" )             # Add a landing gear Geom

bogie_id = CreateAndAddBogie( gear_id )     # Create and add a Bogie

# Bogies are ParmContainers -- work with their Parms once you have the ID.
SetParmVal( bogie_id, "NumAcross", "Bogie", 2 )    # Two wheels across
SetParmVal( bogie_id, "NumTandem", "Bogie", 2 )    # Two wheels in tandem

See also: GetAllBogies, GetNumBogies, DelBogie, DelAllBogies :param [in]: gear_id string GearGeom Geom ID :rtype: string :return: string ParmContainer ID for the newly added Bogie

openvsp.vsp.CreateAndAddMode(name, normal_set, degen_set)

Create a Mode – a combination of Sets and Variable Presets

# Illustrating use of Modes requires substantial setup of the model including components, sets, and variable presets.
#
# Setup boiler plate.
pod1 = AddGeom( "POD", "" )
wing = AddGeom( "WING", pod1 )

SetParmVal( wing, "Trans_Attach_Flag", "Attach", ATTACH_TRANS_LMN )
SetParmVal( wing, "L_Attach_Location", "Attach", 0.35 )

SetSetName( SET_FIRST_USER, "NonLifting" )
SetSetName( SET_FIRST_USER + 1, "Lifting" )

SetSetFlag( pod1, SET_FIRST_USER, True )
SetSetFlag( wing, SET_FIRST_USER + 1, True )


gid = AddVarPresetGroup( "Tess" )

p1 = FindParm( pod1, "Tess_U", "Shape" )
AddVarPresetParm( gid, p1 )

p2 = FindParm( pod1, "Tess_W", "Shape" )
AddVarPresetParm( gid, p2 )

sid = AddVarPresetSetting( gid, "Default" )
SaveVarPresetParmVals( gid, sid )

sid1 = AddVarPresetSetting( gid, "Coarse" )
SetVarPresetParmVal( gid, sid1, p1, 3 )
SetVarPresetParmVal( gid, sid1, p2, 5 )

sid2 = AddVarPresetSetting( gid, "Fine" )
SetVarPresetParmVal( gid, sid2, p1, 35 )
SetVarPresetParmVal( gid, sid2, p2, 21 )


gid2 = AddVarPresetGroup( "Design" )

p3 = FindParm( pod1, "Length", "Design" )
AddVarPresetParm( gid2, p3 )

p4 = FindParm( pod1, "FineRatio", "Design" )
AddVarPresetParm( gid2, p4 )

sid3 = AddVarPresetSetting( gid2, "Normal" )
SaveVarPresetParmVals( gid2, sid3 )

sid4 = AddVarPresetSetting( gid2, "ShortFat" )
SetVarPresetParmVal( gid2, sid4, p3, 3.0 )
SetVarPresetParmVal( gid2, sid4, p4, 5.0 )

sid5 = AddVarPresetSetting( gid2, "LongThin" )
SetVarPresetParmVal( gid2, sid5, p3, 20.0 )
SetVarPresetParmVal( gid2, sid5, p4, 35.0 )

# End of setup boiler plate.

mid1 = CreateAndAddMode( "FatWetAreas", SET_ALL, SET_NONE )
ModeAddGroupSetting( mid1, gid, sid1 )
ModeAddGroupSetting( mid1, gid2, sid4 )

mid2 = CreateAndAddMode( "ThinAero", SET_FIRST_USER, SET_FIRST_USER + 1 )
ModeAddGroupSetting( mid2, gid, sid2 )
ModeAddGroupSetting( mid2, gid2, sid5 )

ApplyModeSettings( mid2 )
Update()

assert len( mid1 ) > 0 and mid1 != "NONE", "CreateAndAddMode returned no id"
assert mid1 != mid2, "CreateAndAddMode reused an ID"
Parameters:
  • [in] – name string Name for new Mode

  • [in] – normal_set int Normal set for Mode

  • [in] – degen_set int Degen set for Mode

Return type:

string

Returns:

string Mode ID for new Mode

openvsp.vsp.CreateConvexHull(geom_id)

Build the convex hull of a Point Cloud Geom. The hull arrives as a new MeshGeom; the point cloud itself is left alone. This is the Point Cloud screen’s Convex Hull button.

pid = AddGeom( "POD" )

mesh_id = ExportFile( "Example_Mesh.msh", SET_ALL, EXPORT_GMSH )

cloud_id = CreatePtCloudGeom( mesh_id )

num_pnts = len( GetPtCloudPnts( cloud_id ) )

hull_id = CreateConvexHull( cloud_id )

Update()

# The hull is a mesh of its own, and the cloud it came from is untouched.
assert len( hull_id ) > 0, "CreateConvexHull did not make a hull mesh"
assert GetGeomTypeName( hull_id ) == "Mesh", "CreateConvexHull did not make a hull mesh"
assert len( GetPtCloudPnts( cloud_id ) ) == num_pnts, "CreateConvexHull disturbed the point cloud"

# A Geom that is not a point cloud has to be rejected.
err_mgr = ErrorMgrSingleton.getInstance()

CreateConvexHull( pid )

assert err_mgr.GetNumTotalErrors() > 0, "CreateConvexHull accepted a Geom that is not a point cloud"

while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: CreatePtCloudGeom, GetPtCloudPnts :param [in]: geom_id string Point Cloud Geom ID :rtype: string :return: string MeshGeom ID of the hull

openvsp.vsp.CreateGeomResults(geom_id, name)

Create a new result for a Geom

#==== Test Comp Geom ====//
gid1 = AddGeom( "POD", "" )

mesh_id = ComputeCompGeom( 0, False, 0 )

#==== Test Comp Geom Mesh Results ====//
mesh_geom_res_id = CreateGeomResults( mesh_id, "Comp_Mesh" )

int_arr = GetIntResults( mesh_geom_res_id, "Num_Tris" )

if  int_arr[0] < 4 :
    print( "---> Error: API CreateGeomResults" )
    assert False, "---> Error: API CreateGeomResults"
Parameters:
  • [in] – geom_id string Geom ID

  • [in] – name string Result name

Return type:

string

Returns:

string Result ID

openvsp.vsp.CreateNGonMeshGeom(geom_id)

Turn a MeshGeom into an NGon Mesh Geom. This is the Mesh screen’s Convert to NGon Mesh button.

pid = AddGeom( "POD" )

mesh_id = ExportFile( "Example_Mesh.msh", SET_ALL, EXPORT_GMSH )

ngon_id = CreateNGonMeshGeom( mesh_id )

assert len( ngon_id ) > 0, "CreateNGonMeshGeom did not make an NGon mesh"
assert GetGeomTypeName( ngon_id ) == "NGonMesh", "CreateNGonMeshGeom did not make an NGon mesh"

# A Geom that is not a mesh has to be rejected.
err_mgr = ErrorMgrSingleton.getInstance()

CreateNGonMeshGeom( pid )

assert err_mgr.GetNumTotalErrors() > 0, "CreateNGonMeshGeom accepted a Geom that is not a mesh"

while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: CreatePtCloudGeom :param [in]: geom_id string MeshGeom ID :rtype: string :return: string NGon Mesh Geom ID

openvsp.vsp.CreatePtCloudGeom(std: :string const & geom_id) std::string
openvsp.vsp.CreateVSPAEROControlSurfaceGroup() int
openvsp.vsp.CutAttribute(attrID)

Cut an attribute from its collection to the clipboard by attributeID

##==== Attribute: CopyAttribute  =====##

VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
AttrName = 'Example_String_Attr'
StringValue = 'Example_String_Attr_DataVal'
AttrID = AddAttributeString( CollID, AttrName, StringValue )
CutAttribute( AttrID )

NewCollID = GetChildCollection( "_AttrWMGroup" )
NewAttrIDs = PasteAttribute( NewCollID )

MatchIDs = NewAttrIDs[0] == AttrID
Attr_Cut_Check = AttrID not in FindAttributesInCollection( CollID )
if MatchIDs and Attr_Cut_Check:
    print("Successfully cut Attribute")
else:
    print("CutAttribute Error!")
    assert False, "CutAttribute Error!"
Parameters:

[in] – attrID string ID of attribute to be copied

openvsp.vsp.CutGeomToClipboard(geom_id)

Cut Geom from current location and store on clipboard

#==== Add Pod Geometries ====//
pid1 = AddGeom( "POD", "" )
pid2 = AddGeom( "POD", "" )

CutGeomToClipboard( pid1 )

PasteGeomClipboard( pid2 ) # Paste Pod 1 as child of Pod 2

geom_ids = FindGeoms()

if  len(geom_ids) != 2 :
    print( "---> Error: API Cut/Paste Geom  " )
    assert False, "---> Error: API Cut/Paste Geom"

See also: PasteGeomClipboard :param [in]: geom_id string Geom ID

openvsp.vsp.CutXSec(geom_id, index)

Cut a cross-section from the specified geometry and maintain it in memory

fid = AddGeom( "FUSELAGE", "" )             # Add Fuselage

#==== Insert, Cut, Paste Example ====//
xsec_surf = GetXSecSurf( fid, 0 )

num_start = GetNumXSec( xsec_surf )

InsertXSec( fid, 1, XS_ROUNDED_RECTANGLE )         # Insert A Cross-Section

assert GetNumXSec( xsec_surf ) == num_start + 1, "InsertXSec did not add a section"
assert GetXSecShape( GetXSec( xsec_surf, 2 ) ) == XS_ROUNDED_RECTANGLE, "InsertXSec did not insert after the given index"

CopyXSec( fid, 2 )                                 # Copy Just Created XSec To Clipboard

PasteXSec( fid, 1 )                                # Paste Clipboard

# Pasting replaces a section rather than adding one, and section 1 now
# carries the shape that was copied.
assert GetNumXSec( xsec_surf ) == num_start + 1, "PasteXSec changed the number of sections"
assert GetXSecShape( GetXSec( xsec_surf, 1 ) ) == XS_ROUNDED_RECTANGLE, "PasteXSec did not paste the copied section"

CutXSec( fid, 2 )                                  # Cut Created XSec

assert GetNumXSec( xsec_surf ) == num_start, "CutXSec did not remove a section"

See also: PasteXSec :param [in]: geom_id string Geom ID :param [in]: index int XSec index

openvsp.vsp.DELIM_COMMA = 0

Comma delimiter

openvsp.vsp.DELIM_NONE = 3

No delimiter

openvsp.vsp.DELIM_NUM_TYPES = 4

Number of delimiter types

openvsp.vsp.DELIM_SPACE = 2

Space delimiter

openvsp.vsp.DELIM_USCORE = 1

Underscore delimiter

openvsp.vsp.DEPTH_FREE = 2

Set 3D background at specified location

openvsp.vsp.DEPTH_FRONT = 0

Set 3D background before model

openvsp.vsp.DEPTH_REAR = 1

Set 3D background behind model

openvsp.vsp.DESIGN_CL = 1

Input ideal lift coefficient, calculate maximum camber

openvsp.vsp.DISK_SURF = 2

Disk VSP surface

openvsp.vsp.DISPLAY_BEZIER = 0

Display the normal Bezier surface (default)

openvsp.vsp.DISPLAY_DEGEN_CAMBER = 3

Display as camber Degen Geom

openvsp.vsp.DISPLAY_DEGEN_PLATE = 2

Display as plate Degen Geom

openvsp.vsp.DISPLAY_DEGEN_SURF = 1

Display as surface Degen Geom

openvsp.vsp.DOUBLE_DATA = 2

Double data type

openvsp.vsp.DOUBLE_MATRIX_DATA = 6

Double matrix data type

openvsp.vsp.DO_NOT_USE_CF_TURB_IMPLICIT_KARMAN = 3

Implicit Karman turbulent Cf equation (DO NOT USE)

openvsp.vsp.DO_NOT_USE_CF_TURB_ROUGHNESS_SCHLICHTING_LOCAL = 17

Roughness Schlichting Local turbulent Cf equation (DO NOT USE)

openvsp.vsp.DO_NOT_USE_CF_TURB_ROUGHNESS_WHITE = 18

Roughness White turbulent Cf equation (DO NOT USE)

openvsp.vsp.DO_NOT_USE_CF_TURB_SCHLICHTING_INCOMPRESSIBLE = 11

Schlichting Incompressible turbulent Cf equation (DO NOT USE)

openvsp.vsp.DO_NOT_USE_CF_TURB_SCHLICHTING_PRANDTL = 12

Schlichting-Prandtl turbulent Cf equation (DO NOT USE)

openvsp.vsp.DO_NOT_USE_CF_TURB_SCHULTZ_GRUNOW_HIGH_RE = 13

Schultz-Grunow High Re turbulent Cf equation (DO NOT USE)

openvsp.vsp.DO_NOT_USE_CF_TURB_WHITE_CHRISTOPH_COMPRESSIBLE = 15

White-Christoph Compressible turbulent Cf equation (DO NOT USE)

openvsp.vsp.DelAdvLinkInput(int index, std: :string const & var_name)
openvsp.vsp.DelAdvLinkOutput(index, var_name)

Delete an output variable from an advanced link

pod = AddGeom( "POD", "" )
length = FindParm( pod, "Length", "Design" )
x_pos = GetParm( pod, "X_Rel_Location", "XForm" )
y_pos = GetParm( pod, "Y_Rel_Location", "XForm" )

AddAdvLink( "ExampleLink" )
indx = GetLinkIndex( "ExampleLink" )
AddAdvLinkInput( indx, length, "len" )
AddAdvLinkOutput( indx, x_pos, "x" )
AddAdvLinkOutput( indx, y_pos, "y" )

SetAdvLinkCode( indx, "x = 10.0 - len;" )

BuildAdvLinkScript( indx )

num_before_del = len( GetAdvLinkOutputNames( indx ) )
DelAdvLinkOutput( indx, "y" )
assert len( GetAdvLinkOutputNames( indx ) ) < num_before_del, "DelAdvLinkOutput removed nothing"


BuildAdvLinkScript( indx )

# The link was named, so it has to be findable by that name and by that
# index, and it has to actually drive its output: x is 10 minus the Pod's
# length, so changing the length has to move the Pod.
assert indx >= 0, "the advanced link was not registered under its name"
assert len( GetAdvLinkNames() ) == 1, "the advanced link was not registered under its name"
assert GetAdvLinkNames()[0] == "ExampleLink", "the advanced link was not registered under its name"

SetParmValUpdate( length, 6.0 )

Update()

assert abs( GetParmVal( x_pos ) - 4.0 ) < 1e-6, "the advanced link did not drive its output"
Parameters:
  • [in] – index int Advanced link index

  • [in] – var_name string Name for advanced link output variable to delete

openvsp.vsp.DelAllAdvLinkInputs(index)

Delete an input variable from an advanced link

pod = AddGeom( "POD", "" )
length = FindParm( pod, "Length", "Design" )
x_pos = GetParm( pod, "X_Rel_Location", "XForm" )
y_pos = GetParm( pod, "Y_Rel_Location", "XForm" )

AddAdvLink( "ExampleLink" )
indx = GetLinkIndex( "ExampleLink" )
AddAdvLinkInput( indx, length, "len" )
AddAdvLinkOutput( indx, x_pos, "x" )
AddAdvLinkInput( indx, y_pos, "y" )

SetAdvLinkCode( indx, "x = 10.0 - len;" )

BuildAdvLinkScript( indx )

num_before_del = len( GetAdvLinkInputNames( indx ) )
DelAdvLinkInput( indx, "y" )
assert len( GetAdvLinkInputNames( indx ) ) < num_before_del, "DelAdvLinkInput removed nothing"


BuildAdvLinkScript( indx )

# The link was named, so it has to be findable by that name and by that
# index, and it has to actually drive its output: x is 10 minus the Pod's
# length, so changing the length has to move the Pod.
assert indx >= 0, "the advanced link was not registered under its name"
assert len( GetAdvLinkNames() ) == 1, "the advanced link was not registered under its name"
assert GetAdvLinkNames()[0] == "ExampleLink", "the advanced link was not registered under its name"

SetParmValUpdate( length, 6.0 )

Update()

assert abs( GetParmVal( x_pos ) - 4.0 ) < 1e-6, "the advanced link did not drive its output"
Parameters:
  • [in] – index int Advanced link index

  • [in] – var_name string Name for advanced link input variable to delete

Delete all input variables from an advanced link

pod = AddGeom( "POD", "" )
length = FindParm( pod, "Length", "Design" )
x_pos = GetParm( pod, "X_Rel_Location", "XForm" )
y_pos = GetParm( pod, "Y_Rel_Location", "XForm" )

AddAdvLink( "ExampleLink" )
indx = GetLinkIndex( "ExampleLink" )
AddAdvLinkInput( indx, length, "len" )
AddAdvLinkInput( indx, y_pos, "y" )
AddAdvLinkOutput( indx, x_pos, "x" )

assert len( GetAdvLinkInputNames( indx ) ) == 2, "the inputs were not both added"

DelAllAdvLinkInputs( indx )

# Every input goes; the outputs are left alone.
assert len( GetAdvLinkInputNames( indx ) ) == 0, "DelAllAdvLinkInputs left inputs behind"
assert len( GetAdvLinkOutputNames( indx ) ) == 1, "DelAllAdvLinkInputs removed an output"

See also: AddAdvLinkInput, DelAdvLinkInput, DelAllAdvLinkOutputs :param [in]: index int Advanced link index

openvsp.vsp.DelAllAdvLinkOutputs(index)

Delete all output variables from an advanced link

pod = AddGeom( "POD", "" )
length = FindParm( pod, "Length", "Design" )
x_pos = GetParm( pod, "X_Rel_Location", "XForm" )
y_pos = GetParm( pod, "Y_Rel_Location", "XForm" )

AddAdvLink( "ExampleLink" )
indx = GetLinkIndex( "ExampleLink" )
AddAdvLinkInput( indx, length, "len" )
AddAdvLinkOutput( indx, x_pos, "x" )
AddAdvLinkOutput( indx, y_pos, "y" )

assert len( GetAdvLinkOutputNames( indx ) ) == 2, "the outputs were not both added"

DelAllAdvLinkOutputs( indx )

# Every output goes; the inputs are left alone.
assert len( GetAdvLinkOutputNames( indx ) ) == 0, "DelAllAdvLinkOutputs left outputs behind"
assert len( GetAdvLinkInputNames( indx ) ) == 1, "DelAllAdvLinkOutputs removed an input"

See also: AddAdvLinkOutput, DelAdvLinkOutput, DelAllAdvLinkInputs :param [in]: index int Advanced link index

Delete all advanced links

pod = AddGeom( "POD", "" )
length = FindParm( pod, "Length", "Design" )
x_pos = GetParm( pod, "X_Rel_Location", "XForm" )

AddAdvLink( "ExampleLink" )
indx = GetLinkIndex( "ExampleLink" )
AddAdvLinkInput( indx, length, "len" )
AddAdvLinkOutput( indx, x_pos, "x" )

SetAdvLinkCode( indx, "x = 10.0 - len;" )

BuildAdvLinkScript( indx )

DelAllAdvLinks()

link_array = GetAdvLinkNames()

# Should print nothing.
for n in range( len(link_array) ):

    print( link_array[n] )

assert len( link_array ) == 0, "links were left behind"

# With the link gone, the Pod is no longer driven.
x_before = GetParmVal( x_pos )

SetParmValUpdate( length, 7.0 )

Update()

assert abs( GetParmVal( x_pos ) - x_before ) < 1e-9, "a deleted advanced link is still driving its output"
openvsp.vsp.DelAllBackground3Ds()

Delete all Background3Ds in model

# Add Background3D
AddBackground3D()
AddBackground3D()
AddBackground3D()

DelAllBackground3Ds()

nbg = GetNumBackground3Ds()

if nbg != 0 :
    print( "ERROR: DelAllBackground3Ds" )
    assert False, "ERROR: DelAllBackground3Ds"
openvsp.vsp.DelAllBogies(gear_id)

Delete all Bogies from the specified GearGeom.

gear_id = AddGeom( "GEAR", "" )

CreateAndAddBogie( gear_id )
CreateAndAddBogie( gear_id )

DelAllBogies( gear_id )                            # GetNumBogies( gear_id ) == 0
assert GetNumBogies( gear_id ) == 0, "DelAllBogies left something behind"

See also: CreateAndAddBogie, DelBogie :param [in]: gear_id string GearGeom Geom ID

openvsp.vsp.DelAllFeaPolySparPt(pspar_id)

Delete all points from an FEA Poly Spar.

wing_id = AddGeom( "WING" )

struct_ind = AddFeaStruct( wing_id )

pspar_id = AddFeaPart( wing_id, struct_ind, FEA_POLY_SPAR )

AddFeaPolySparPt( pspar_id )
AddFeaPolySparPt( pspar_id )

DelAllFeaPolySparPt( pspar_id )

if GetFeaPolySparNumPt( pspar_id ) != 0:
    print( "Error: DelAllFeaPolySparPt" )
    assert False, "Error: DelAllFeaPolySparPt"

See also: DelFeaPolySparPt, AddFeaPolySparPt, GetFeaPolySparNumPt :param [in]: pspar_id string FEA Poly Spar part ID

openvsp.vsp.DelAllModes()

Delete all modes from the model.

# Illustrating use of Modes requires substantial setup of the model including components, sets, and variable presets.
#
# Setup boiler plate.
pod1 = AddGeom( "POD", "" )
wing = AddGeom( "WING", pod1 )

SetParmVal( wing, "Trans_Attach_Flag", "Attach", ATTACH_TRANS_LMN )
SetParmVal( wing, "L_Attach_Location", "Attach", 0.35 )

SetSetName( SET_FIRST_USER, "NonLifting" )
SetSetName( SET_FIRST_USER + 1, "Lifting" )

SetSetFlag( pod1, SET_FIRST_USER, True )
SetSetFlag( wing, SET_FIRST_USER + 1, True )


gid = AddVarPresetGroup( "Tess" )

p1 = FindParm( pod1, "Tess_U", "Shape" )
AddVarPresetParm( gid, p1 )

p2 = FindParm( pod1, "Tess_W", "Shape" )
AddVarPresetParm( gid, p2 )

sid = AddVarPresetSetting( gid, "Default" )
SaveVarPresetParmVals( gid, sid )

sid1 = AddVarPresetSetting( gid, "Coarse" )
SetVarPresetParmVal( gid, sid1, p1, 3 )
SetVarPresetParmVal( gid, sid1, p2, 5 )

sid2 = AddVarPresetSetting( gid, "Fine" )
SetVarPresetParmVal( gid, sid2, p1, 35 )
SetVarPresetParmVal( gid, sid2, p2, 21 )


gid2 = AddVarPresetGroup( "Design" )

p3 = FindParm( pod1, "Length", "Design" )
AddVarPresetParm( gid2, p3 )

p4 = FindParm( pod1, "FineRatio", "Design" )
AddVarPresetParm( gid2, p4 )

sid3 = AddVarPresetSetting( gid2, "Normal" )
SaveVarPresetParmVals( gid2, sid3 )

sid4 = AddVarPresetSetting( gid2, "ShortFat" )
SetVarPresetParmVal( gid2, sid4, p3, 3.0 )
SetVarPresetParmVal( gid2, sid4, p4, 5.0 )

sid5 = AddVarPresetSetting( gid2, "LongThin" )
SetVarPresetParmVal( gid2, sid5, p3, 20.0 )
SetVarPresetParmVal( gid2, sid5, p4, 35.0 )

# End of setup boiler plate.

mid1 = CreateAndAddMode( "FatWetAreas", SET_ALL, SET_NONE )
ModeAddGroupSetting( mid1, gid, sid1 )
ModeAddGroupSetting( mid1, gid2, sid4 )

mid2 = CreateAndAddMode( "ThinAero", SET_FIRST_USER, SET_FIRST_USER + 1 )
ModeAddGroupSetting( mid2, gid, sid2 )
ModeAddGroupSetting( mid2, gid2, sid5 )

ApplyModeSettings( mid2 )
Update()

DelAllModes()
assert GetNumModes() == 0, "DelAllModes left something behind"

Delete every simple Parm Link in the model. Advanced Links are a separate list and are left alone.

pod1 = AddGeom( "POD", "" )
pod2 = AddGeom( "POD", "" )

AddParmLink( GetParm( pod1, "X_Rel_Location", "XForm" ), GetParm( pod2, "X_Rel_Location", "XForm" ) )
AddParmLink( GetParm( pod1, "Y_Rel_Location", "XForm" ), GetParm( pod2, "Y_Rel_Location", "XForm" ) )

AddAdvLink( "ExampleAdvLink" )

DelAllParmLinks()

assert GetNumParmLinks() == 0, "DelAllParmLinks left links behind"
assert len( GetAdvLinkNames() ) == 1, "DelAllParmLinks removed an advanced link"

See also: AddParmLink, DelParmLink

openvsp.vsp.DelAllRoutingPt(routing_id)

Delete all routing points from a RoutingGeom.

pod1 = vsp.AddGeom('POD', '')

pod2 = vsp.AddGeom('POD', '')
ypod2 = vsp.GetParm(pod2, 'Y_Rel_Location', 'XForm')
vsp.SetParmVal(ypod2, 2.0)

routing_geom = vsp.AddGeom('ROUTING', '')

rpt0 = vsp.AddRoutingPt(routing_geom, pod1, 0)
u0 = vsp.GetParm( rpt0, 'U', 'RoutePt')
vsp.SetParmVal(u0, 0.0)

rpt1 = vsp.AddRoutingPt(routing_geom, pod2, 0)

rpt2 = vsp.AddRoutingPt(routing_geom, pod1, 0)
u2 = vsp.GetParm( rpt2, 'U', 'RoutePt')
vsp.SetParmVal(u2, 1.0)

vsp.DelAllRoutingPt( routing_geom )

assert vsp.GetNumRoutingPts( routing_geom ) == 0, "DelAllRoutingPt left something behind"

See also: AddRoutingPt, DelRoutingPt :param [in]: routing_id string RoutingGeom Geom ID

openvsp.vsp.DelBackground3D(id)

Delete specific Background3D frommodel

# Add Background3D
AddBackground3D()
bg_id = AddBackground3D()
AddBackground3D()

nbg = GetNumBackground3Ds()

DelBackground3D( bg_id )

if GetNumBackground3Ds() != nbg -1 :
    print( "ERROR: DelBackground3D" )
    assert False, "ERROR: DelBackground3D"
Parameters:

[in] – id string Background3D ID to delete

openvsp.vsp.DelBogie(gear_id, bogie_id)

Delete the specified Bogie from the specified GearGeom.

gear_id = AddGeom( "GEAR", "" )

bogie_id = CreateAndAddBogie( gear_id )

num_before_del = GetNumBogies( gear_id )
DelBogie( gear_id, bogie_id )
assert GetNumBogies( gear_id ) < num_before_del, "DelBogie removed nothing"

See also: CreateAndAddBogie, DelAllBogies :param [in]: gear_id string GearGeom Geom ID :param [in]: bogie_id string Bogie ParmContainer ID

openvsp.vsp.DelCpSlice(slice_index)

Delete a single Cp slice from the VSPAERO Cp Slicer

DeleteAllCpSlices()

first = AddCpSlice( X_DIR, 0.5 )
second = AddCpSlice( Y_DIR, 0.25 )

DelCpSlice( 0 )

# Only the indexed slice goes, and the rest slide down.
assert GetNumCpSlices() == 1, "DelCpSlice removed the wrong slice"
assert GetCpSliceID( 0 ) == second, "DelCpSlice removed the wrong slice"

# An index past the end has to be rejected.  The error queue is reached
# through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

DelCpSlice( GetNumCpSlices() )

assert err_mgr.GetNumTotalErrors() > 0, "DelCpSlice accepted an index past the end"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: AddCpSlice, DeleteAllCpSlices :param [in]: slice_index int Cp slice index

openvsp.vsp.DelFeaBC(fea_struct_id, bc_id)

Delete an FEA BC from a Structure

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

#==== Add FeaStructure to Pod ====//
struct_ind = AddFeaStruct( pod_id )

struct_id = GetFeaStructID( pod_id, struct_ind );

#==== Add BC ====//
bc_id = AddFeaBC( struct_id, FEA_BC_STRUCTURE )

assert NumFeaBCs( struct_id ) == 1, "AddFeaBC did not add a boundary condition"

DelFeaBC( struct_id, bc_id )

assert NumFeaBCs( struct_id ) == 0, "DelFeaBC did not remove the boundary condition"
assert len( GetFeaBCIDVec( struct_id ) ) == 0, "DelFeaBC left the boundary condition in the ID list"

See also: FEA_BC_TYPE :param [in]: fea_struct_id string FEA Structure ID :param [in]: bc_id int FEA BC ID

openvsp.vsp.DelFeaPolySparPt(pspar_id, index)

Delete the point at the given index from an FEA Poly Spar.

wing_id = AddGeom( "WING" )

struct_ind = AddFeaStruct( wing_id )

pspar_id = AddFeaPart( wing_id, struct_ind, FEA_POLY_SPAR )

AddFeaPolySparPt( pspar_id )
AddFeaPolySparPt( pspar_id )

# Delete the point at index 2 (leaving 3 points)
DelFeaPolySparPt( pspar_id, 2 )

if GetFeaPolySparNumPt( pspar_id ) != 3:
    print( "Error: DelFeaPolySparPt" )
    assert False, "Error: DelFeaPolySparPt"

See also: DelAllFeaPolySparPt, AddFeaPolySparPt, GetFeaPolySparNumPt :param [in]: pspar_id string FEA Poly Spar part ID :param [in]: index int Index of the point to delete

openvsp.vsp.DelMode(mid)

Delete a mode from the model.

# Illustrating use of Modes requires substantial setup of the model including components, sets, and variable presets.
#
# Setup boiler plate.
pod1 = AddGeom( "POD", "" )
wing = AddGeom( "WING", pod1 )

SetParmVal( wing, "Trans_Attach_Flag", "Attach", ATTACH_TRANS_LMN )
SetParmVal( wing, "L_Attach_Location", "Attach", 0.35 )

SetSetName( SET_FIRST_USER, "NonLifting" )
SetSetName( SET_FIRST_USER + 1, "Lifting" )

SetSetFlag( pod1, SET_FIRST_USER, True )
SetSetFlag( wing, SET_FIRST_USER + 1, True )


gid = AddVarPresetGroup( "Tess" )

p1 = FindParm( pod1, "Tess_U", "Shape" )
AddVarPresetParm( gid, p1 )

p2 = FindParm( pod1, "Tess_W", "Shape" )
AddVarPresetParm( gid, p2 )

sid = AddVarPresetSetting( gid, "Default" )
SaveVarPresetParmVals( gid, sid )

sid1 = AddVarPresetSetting( gid, "Coarse" )
SetVarPresetParmVal( gid, sid1, p1, 3 )
SetVarPresetParmVal( gid, sid1, p2, 5 )

sid2 = AddVarPresetSetting( gid, "Fine" )
SetVarPresetParmVal( gid, sid2, p1, 35 )
SetVarPresetParmVal( gid, sid2, p2, 21 )


gid2 = AddVarPresetGroup( "Design" )

p3 = FindParm( pod1, "Length", "Design" )
AddVarPresetParm( gid2, p3 )

p4 = FindParm( pod1, "FineRatio", "Design" )
AddVarPresetParm( gid2, p4 )

sid3 = AddVarPresetSetting( gid2, "Normal" )
SaveVarPresetParmVals( gid2, sid3 )

sid4 = AddVarPresetSetting( gid2, "ShortFat" )
SetVarPresetParmVal( gid2, sid4, p3, 3.0 )
SetVarPresetParmVal( gid2, sid4, p4, 5.0 )

sid5 = AddVarPresetSetting( gid2, "LongThin" )
SetVarPresetParmVal( gid2, sid5, p3, 20.0 )
SetVarPresetParmVal( gid2, sid5, p4, 35.0 )

# End of setup boiler plate.

mid1 = CreateAndAddMode( "FatWetAreas", SET_ALL, SET_NONE )
ModeAddGroupSetting( mid1, gid, sid1 )
ModeAddGroupSetting( mid1, gid2, sid4 )

mid2 = CreateAndAddMode( "ThinAero", SET_FIRST_USER, SET_FIRST_USER + 1 )
ModeAddGroupSetting( mid2, gid, sid2 )
ModeAddGroupSetting( mid2, gid2, sid5 )

ApplyModeSettings( mid2 )
Update()

num_before_del = GetNumModes()
DelMode( mid1 )
assert GetNumModes() < num_before_del, "DelMode removed nothing"
Parameters:

[in] – mid string Mode ID of mode to delete

Delete a single Parm Link

pod1 = AddGeom( "POD", "" )
pod2 = AddGeom( "POD", "" )

first = AddParmLink( GetParm( pod1, "X_Rel_Location", "XForm" ), GetParm( pod2, "X_Rel_Location", "XForm" ) )
second = AddParmLink( GetParm( pod1, "Y_Rel_Location", "XForm" ), GetParm( pod2, "Y_Rel_Location", "XForm" ) )

DelParmLink( first )

# Only the named link goes.
assert GetNumParmLinks() == 1, "DelParmLink removed the wrong link"
assert GetParmLinkID( 0 ) == second, "DelParmLink removed the wrong link"

# An ID that is not a link has to be rejected.  The error queue is reached
# through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

DelParmLink( "NOSUCHLINK" )

assert err_mgr.GetNumTotalErrors() > 0, "DelParmLink accepted a bad ID"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: AddParmLink, DelAllParmLinks :param [in]: link_id string Parm Link ID

openvsp.vsp.DelProbe(id)

Delete a specific Probe from the Measure Tool

pid1 = AddGeom( "POD", "" )

SetParmVal( pid1, "Y_Rel_Location", "XForm", 2.0 )

probe_id_1 = AddProbe( pid1, 0, 0.5, 0.8, "Probe 1" )
probe_id_2 = AddProbe( pid1, 0, 0.2, 0.3, "Probe 2" )

DelProbe( probe_id_1 )

probe_array = GetAllProbes()

if  len(probe_array) != 1 :
    print( "Error: DelProbe" )
    assert False, "Error: DelProbe"
Parameters:

[in] – id string Probe ID

openvsp.vsp.DelProtractor(id)

Delete a particular Protractor from the Measure Tool

pod1 = AddGeom( "POD", "" )

pid1 = AddProtractor( pod1, 0, 0.2, 0.0, pod1, 0, 0.5, 0.0, pod1, 0, 0.8, 0.0, "Protractor_1" )
pid2 = AddProtractor( pod1, 0, 0.1, 0.0, pod1, 0, 0.4, 0.0, pod1, 0, 0.7, 0.0, "Protractor_2" )

DelProtractor( pid1 )

# Only the named protractor goes.
prot_array = GetAllProtractors()

assert len( prot_array ) == 1, "DelProtractor removed the wrong protractor"
assert prot_array[0] == pid2, "DelProtractor removed the wrong protractor"

See also: AddProtractor, GetAllProtractors, DeleteAllProtractors :param [in]: id string Protractor ID

openvsp.vsp.DelRSTProbe(id)

Delete a particular RST Probe from the Measure Tool

pod1 = AddGeom( "POD", "" )

pid1 = AddRSTProbe( pod1, 0, 0.5, 0.5, 0.5, "RSTProbe_1" )
pid2 = AddRSTProbe( pod1, 0, 0.25, 0.5, 0.5, "RSTProbe_2" )

DelRSTProbe( pid1 )

# Only the named probe goes.
probe_array = GetAllRSTProbes()

assert len( probe_array ) == 1, "DelRSTProbe removed the wrong probe"
assert probe_array[0] == pid2, "DelRSTProbe removed the wrong probe"

See also: AddRSTProbe, GetAllRSTProbes, DeleteAllRSTProbes :param [in]: id string RST Probe ID

openvsp.vsp.DelRoutingPt(routing_id, index)

Delete a specified routing point from a RoutingGeom.

pod1 = vsp.AddGeom('POD', '')

pod2 = vsp.AddGeom('POD', '')
ypod2 = vsp.GetParm(pod2, 'Y_Rel_Location', 'XForm')
vsp.SetParmVal(ypod2, 2.0)

routing_geom = vsp.AddGeom('ROUTING', '')

rpt0 = vsp.AddRoutingPt(routing_geom, pod1, 0)
u0 = vsp.GetParm( rpt0, 'U', 'RoutePt')
vsp.SetParmVal(u0, 0.0)

rpt1 = vsp.AddRoutingPt(routing_geom, pod2, 0)

rpt2 = vsp.AddRoutingPt(routing_geom, pod1, 0)
u2 = vsp.GetParm( rpt2, 'U', 'RoutePt')
vsp.SetParmVal(u2, 1.0)

num_before_del = vsp.GetNumRoutingPts( routing_geom )
vsp.DelRoutingPt( routing_geom, 1 )
assert vsp.GetNumRoutingPts( routing_geom ) < num_before_del, "DelRoutingPt removed nothing"

See also: AddRoutingPt, DelAllRoutingPt :param [in]: routing_id string RoutingGeom Geom ID :param [in]: index int Index of routing point to delete

openvsp.vsp.DelRuler(id)

Delete a particular Ruler from the Measure Tool

pid1 = AddGeom( "POD", "" )

SetParmVal( pid1, "Y_Rel_Location", "XForm", 2.0 )

pid2 = AddGeom( "POD", "" )

SetParmVal( pid2, "Z_Rel_Location", "XForm", 4.0 )

rid1 = AddRuler( pid1, 1, 0.2, 0.3, pid2, 0, 0.2, 0.3, "Ruler 1" )

rid2 = AddRuler( pid1, 0, 0.4, 0.6, pid1, 1, 0.8, 0.9, "Ruler 2" )

ruler_array = GetAllRulers()

num_before_del = len( GetAllRulers() )
DelRuler( ruler_array[0] )
assert len( GetAllRulers() ) < num_before_del, "DelRuler removed nothing"
Parameters:

[in] – id string Ruler ID

openvsp.vsp.DeleteAllCFDSources()
openvsp.vsp.DeleteAllCpSlices()

Delete all Cp slices from the VSPAERO Cp Slicer

AddCpSlice( X_DIR, 0.5 )
AddCpSlice( Y_DIR, 0.25 )

DeleteAllCpSlices()

assert GetNumCpSlices() == 0, "DeleteAllCpSlices left slices behind"

# Clearing an empty slicer is not an error.
err_mgr = ErrorMgrSingleton.getInstance()

DeleteAllCpSlices()

assert err_mgr.GetNumTotalErrors() == 0, "DeleteAllCpSlices complained about an empty slicer"

See also: AddCpSlice, DelCpSlice, GetNumCpSlices

openvsp.vsp.DeleteAllDesignVars()

Delete all design variables

openvsp.vsp.DeleteAllExcrescences()

Delete all Excresences from the Parasite Drag Tool

AddExcrescence( "Miscellaneous", EXCRESCENCE_COUNT, 8.5 )

AddExcrescence( "Cowl Boattail", EXCRESCENCE_CD, 0.0003 )

AddExcrescence( "Percentage Example", EXCRESCENCE_PERCENT_GEOM, 5 )

DeleteAllExcrescences()

assert GetNumExcrescences() == 0, "DeleteAllExcrescences left excrescences behind"

# Clearing an empty table is not an error.
err_mgr = ErrorMgrSingleton.getInstance()

DeleteAllExcrescences()

assert err_mgr.GetNumTotalErrors() == 0, "DeleteAllExcrescences complained about an empty table"

See also: AddExcrescence, DeleteExcrescence, GetNumExcrescences

openvsp.vsp.DeleteAllGeometryAnalyses()

Delete all Geometry Analysis cases from the Geometry Analysis Manager.

##==== GeometryAnalysis: Delete all cases ====##
ga_id_1 = AddGeometryAnalysis()
ga_id_2 = AddGeometryAnalysis()

assert ga_id_1 != ga_id_2, "AddGeometryAnalysis reused an ID"
assert len( GetAllGeometryAnalysesIDVec() ) == 2, "the two cases were not both added"

DeleteAllGeometryAnalyses()
ga_ids = GetAllGeometryAnalysesIDVec()
print( "Number of Geometry Analyses after delete: ", len( ga_ids ) )

assert len( ga_ids ) == 0, "DeleteAllGeometryAnalyses left cases behind"

See also: AddGeometryAnalysis, DeleteGeometryAnalysis, GetAllGeometryAnalysesIDVec

openvsp.vsp.DeleteAllGeometryAnalysisAzEl(geom_analysis_id)

Delete every azimuth and elevation pair from a Geometry Analysis case

ga_id = AddGeometryAnalysis()

AddGeometryAnalysisAzEl( ga_id, 30.0, 15.0 )
AddGeometryAnalysisAzEl( ga_id, 60.0, 45.0 )

DeleteAllGeometryAnalysisAzEl( ga_id )

assert GetNumGeometryAnalysisAzEl( ga_id ) == 0, "DeleteAllGeometryAnalysisAzEl left pairs behind"

# Clearing an empty case is not an error.
err_mgr = ErrorMgrSingleton.getInstance()

DeleteAllGeometryAnalysisAzEl( ga_id )

assert err_mgr.GetNumTotalErrors() == 0, "DeleteAllGeometryAnalysisAzEl complained about an empty case"

See also: AddGeometryAnalysisAzEl, DeleteGeometryAnalysisAzEl :param [in]: geom_analysis_id string Geometry Analysis case ID

openvsp.vsp.DeleteAllProbes()

Delete all Probes from the Measure Tool

pid1 = AddGeom( "POD", "" )

SetParmVal( pid1, "Y_Rel_Location", "XForm", 2.0 )

probe_id_1 = AddProbe( pid1, 0, 0.5, 0.8, "Probe 1" )
probe_id_2 = AddProbe( pid1, 0, 0.2, 0.3, "Probe 2" )

DeleteAllProbes()

probe_array = GetAllProbes()

if  len(probe_array) != 0 :
    print( "Error: DeleteAllProbes" )
    assert False, "Error: DeleteAllProbes"
openvsp.vsp.DeleteAllProtractors()

Delete all Protractors from the Measure Tool

pod1 = AddGeom( "POD", "" )

AddProtractor( pod1, 0, 0.2, 0.0, pod1, 0, 0.5, 0.0, pod1, 0, 0.8, 0.0, "Protractor_1" )
AddProtractor( pod1, 0, 0.1, 0.0, pod1, 0, 0.4, 0.0, pod1, 0, 0.7, 0.0, "Protractor_2" )

DeleteAllProtractors()

assert len( GetAllProtractors() ) == 0, "DeleteAllProtractors left protractors behind"

See also: AddProtractor, GetAllProtractors, DelProtractor

openvsp.vsp.DeleteAllRSTProbes()

Delete all RST Probes from the Measure Tool

pod1 = AddGeom( "POD", "" )

AddRSTProbe( pod1, 0, 0.5, 0.5, 0.5, "RSTProbe_1" )
AddRSTProbe( pod1, 0, 0.25, 0.5, 0.5, "RSTProbe_2" )

# Surface probes are a separate list and are left alone.
AddProbe( pod1, 0, 0.5, 0.5, "Surface_Probe" )

DeleteAllRSTProbes()

assert len( GetAllRSTProbes() ) == 0, "DeleteAllRSTProbes left probes behind"
assert len( GetAllProbes() ) == 1, "DeleteAllRSTProbes removed a surface probe"

See also: AddRSTProbe, GetAllRSTProbes, DelRSTProbe

openvsp.vsp.DeleteAllResults()

Delete all results

#==== Test Comp Geom ====//
gid1 = AddGeom( "POD", "" )

mesh_id = ComputeCompGeom( 0, False, 0 )

#==== Test Comp Geom Mesh Results ====//
mesh_geom_res_id = CreateGeomResults( mesh_id, "Comp_Mesh" )

DeleteAllResults()

if ( GetNumResults( "Comp_Mesh" ) != 0 ):
    print( "---> Error: API DeleteAllResults" )
    assert False, "---> Error: API DeleteAllResults"
openvsp.vsp.DeleteAllRulers()

Delete all Rulers from the Measure Tool

pid1 = AddGeom( "POD", "" )

SetParmVal( pid1, "Y_Rel_Location", "XForm", 2.0 )

pid2 = AddGeom( "POD", "" )

SetParmVal( pid2, "Z_Rel_Location", "XForm", 4.0 )

rid1 = AddRuler( pid1, 1, 0.2, 0.3, pid2, 0, 0.2, 0.3, "Ruler 1" )

rid2 = AddRuler( pid1, 0, 0.4, 0.6, pid1, 1, 0.8, 0.9, "Ruler 2" )

DeleteAllRulers()
assert len( GetAllRulers() ) == 0, "DeleteAllRulers left something behind"
openvsp.vsp.DeleteAllUserParm()

Delete all user created Parms. The predefined User_0 through User_15 Parms belong to the vehicle and are not removed.

# A fresh model already carries the predefined user Parms, so record the
# starting count rather than expecting to end at zero.
num_before = GetNumUserParms()

AddUserParm( PARM_DOUBLE_TYPE, "Param1", "Group1" )
AddUserParm( PARM_DOUBLE_TYPE, "Param2", "Group1" )

assert GetNumUserParms() == num_before + 2, "AddUserParm"

DeleteAllUserParm()

assert GetNumUserParms() == num_before, "DeleteAllUserParm"
openvsp.vsp.DeleteAllVarPresetGroups()

Delete Variable Preset Group (and all contained settings)

# Add Pod Geom
pod1 = AddGeom( "POD", "" )

gid = AddVarPresetGroup( "Tess" )

sid = AddVarPresetSetting( gid, "Coarse" )

p1 = FindParm( pod1, "Tess_U", "Shape" )

AddVarPresetParm( gid, p1 )

num_before_del = len( GetVarPresetGroups() )
DeleteVarPresetGroup( gid )
assert len( GetVarPresetGroups() ) < num_before_del, "DeleteVarPresetGroup removed nothing"
Parameters:

[in] – group_id string Var Preset Group ID

Delete every Variable Preset Group, along with all the settings they contain

gid1 = AddVarPresetGroup( "Tess" )
gid2 = AddVarPresetGroup( "Design" )

assert len( GetVarPresetGroups() ) == 2, "the two groups were not both added"

DeleteAllVarPresetGroups()

assert len( GetVarPresetGroups() ) == 0, "DeleteAllVarPresetGroups left groups behind"

See also: AddVarPresetGroup, DeleteVarPresetGroup, GetVarPresetGroups

openvsp.vsp.DeleteAllVarPresetSettings(group_id)

Delete Variable Preset Setting

# Add Pod Geom
pod1 = AddGeom( "POD", "" )

gid = AddVarPresetGroup( "Tess" )

sid = AddVarPresetSetting( gid, "Coarse" )

p1 = FindParm( pod1, "Tess_U", "Shape" )

AddVarPresetParm( gid, p1 )

num_before_del = len( GetVarPresetSettings( gid ) )
DeleteVarPresetSetting( gid, sid )
assert len( GetVarPresetSettings( gid ) ) < num_before_del, "DeleteVarPresetSetting removed nothing"
Parameters:
  • [in] – group_id string Var Preset Group ID

  • [in] – setting_id string Var Preset Setting ID

Delete every setting in a Variable Preset Group, leaving the group itself in place

gid = AddVarPresetGroup( "Tess" )

AddVarPresetSetting( gid, "Coarse" )
AddVarPresetSetting( gid, "Fine" )

gid2 = AddVarPresetGroup( "Design" )
AddVarPresetSetting( gid2, "Normal" )

DeleteAllVarPresetSettings( gid )

# The group stays; its settings go.  The other group is left alone.
assert len( GetVarPresetSettings( gid ) ) == 0, "DeleteAllVarPresetSettings left settings behind"
assert len( GetVarPresetGroups() ) == 2, "DeleteAllVarPresetSettings removed the group"
assert len( GetVarPresetSettings( gid2 ) ) == 1, "DeleteAllVarPresetSettings reached another group"

See also: AddVarPresetSetting, DeleteVarPresetSetting, GetVarPresetSettings :param [in]: group_id string Var Preset Group ID

openvsp.vsp.DeleteAttribute(attrID)

Delete attribute by attribute ID

##==== Attribute: DeleteAttribute  =====##

VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
InitVal = "This_Attribute_Will_Be_Deleted"
AttrID = AddAttributeString( CollID, "TestStringAttr", InitVal )


AttrIDs = FindAllAttributes()
AttrAdded = AttrID in AttrIDs

DeleteAttribute( AttrID )
NewAttrIDs = FindAllAttributes()
AttrDeleted = AttrID not in NewAttrIDs

if AttrAdded and AttrDeleted:
    print( "Attribute successfully deleted" )
else:
    print( "DeleteAttribute error!" )
    assert False, "DeleteAttribute error!"
Parameters:

[in] – attrID string of attribute ID

openvsp.vsp.DeleteCFDSource(geom_id, source_index)

Delete a single CFD Mesh source from the specified Geom

#==== Add Pod Geom ====//
pid = AddGeom( "POD", "" )

AddDefaultSources() # 3 Sources: Def_Fwd_PS, Def_Aft_PS, Def_Fwd_Aft_LS

second_name = GetCFDSourceName( pid, 1 )

DeleteCFDSource( pid, 0 )

# Only the named source goes, and the rest slide down.
assert GetNumCFDSources( pid ) == 2, "DeleteCFDSource did not remove one source"
assert GetCFDSourceName( pid, 0 ) == second_name, "DeleteCFDSource removed the wrong source"

# An index past the end has to be rejected.  The error queue is reached
# through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

DeleteCFDSource( pid, GetNumCFDSources( pid ) )

assert err_mgr.GetNumTotalErrors() > 0, "DeleteCFDSource accepted an index past the end"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: AddCFDSource, AddDefaultSources, DeleteAllCFDSources, GetNumCFDSources :param [in]: geom_id string Geom ID :param [in]: source_index int Source index

openvsp.vsp.DeleteExcrescence(int const & index)
openvsp.vsp.DeleteFeaAssembly(assembly_id)

Delete an FEA Assembly. The Structures it gathered are left in the model.

pod_id = AddGeom( "POD" )

struct_ind = AddFeaStruct( pod_id )

assembly_id = AddFeaAssembly()

AddFeaStructureToAssembly( assembly_id, GetFeaStructID( pod_id, struct_ind ) )

DeleteFeaAssembly( assembly_id )

assert NumFeaAssemblies() == 0, "DeleteFeaAssembly did not remove the assembly"

# The Structure it held survives.
assert NumFeaStructures() == 1, "DeleteFeaAssembly removed the Structure it gathered"

# An ID that is not an assembly has to be rejected.
err_mgr = ErrorMgrSingleton.getInstance()

DeleteFeaAssembly( "NOSUCHASSEMBLY" )

assert err_mgr.GetNumTotalErrors() > 0, "DeleteFeaAssembly accepted a bad ID"

while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: AddFeaAssembly, GetFeaAssemblyIDVec :param [in]: assembly_id string FEA Assembly ID

openvsp.vsp.DeleteFeaAssemblyConnection(assembly_id, connection_index)

Delete a connection from an FEA Assembly See also: AddFeaAssemblyConnection, NumFeaAssemblyConnections :param [in]: assembly_id string FEA Assembly ID :param [in]: connection_index int Connection index

openvsp.vsp.DeleteFeaLayer(material_id, layer_id)

Delete a layer from an FEA laminate material See also: AddFeaLayer, GetFeaLayerIDVec :param [in]: material_id string FEA Material ID of a laminate :param [in]: layer_id string FEA Layer ID

openvsp.vsp.DeleteFeaMaterial(id)

Delete an FEA Material from the FEA Mesh material library. Only materials created with AddFeaMaterial can be deleted; the built in materials belong to the library.

#==== Create FeaMaterial ====//
mat_id = AddFeaMaterial()

num_before = len( GetFeaMaterialIDVec() )

DeleteFeaMaterial( mat_id )

assert len( GetFeaMaterialIDVec() ) == num_before - 1, "DeleteFeaMaterial did not remove the material"

# An ID that is not a material has to be rejected.  The error queue is
# reached through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

DeleteFeaMaterial( "NOSUCHMATERIAL" )

assert err_mgr.GetNumTotalErrors() > 0, "DeleteFeaMaterial accepted a bad ID"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: AddFeaMaterial, GetFeaMaterialIDVec :param [in]: id string FEA Material ID

openvsp.vsp.DeleteFeaPart(geom_id, fea_struct_ind, part_id)

Delete an FEA Part from a Structure

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

#==== Add FeaStructure to Pod ====//
struct_ind = AddFeaStruct( pod_id )

#==== Add Bulkead ====//
bulkhead_id = AddFeaPart( pod_id, struct_ind, FEA_SLICE )

#==== Add Fixed Point ====//
fixed_id = AddFeaPart( pod_id, struct_ind, FEA_FIX_POINT )

struct_id = GetFeaStructID( pod_id, struct_ind )

# The skin, the bulkhead and the fixed point.
num_before = NumFeaParts( struct_id )

assert num_before == 3, "the parts were not all added"

#==== Delete Bulkead ====//
DeleteFeaPart( pod_id, struct_ind, bulkhead_id )

# Only the named part goes; the fixed point stays.
assert NumFeaParts( struct_id ) == num_before - 1, "DeleteFeaPart did not remove the part"
assert len( GetFeaPartName( fixed_id ) ) > 0, "DeleteFeaPart removed the wrong part"
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – fea_struct_ind int FEA Structure index

  • [in] – part_id string FEA Part ID

openvsp.vsp.DeleteFeaProperty(id)

Delete an FEA Property from the FEA Mesh property library

#==== Create FeaProperty ====//
prop_id = AddFeaProperty()

num_before = len( GetFeaPropertyIDVec() )

DeleteFeaProperty( prop_id )

assert len( GetFeaPropertyIDVec() ) == num_before - 1, "DeleteFeaProperty did not remove the property"

# An ID that is not a property has to be rejected.  The error queue is
# reached through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

DeleteFeaProperty( "NOSUCHPROPERTY" )

assert err_mgr.GetNumTotalErrors() > 0, "DeleteFeaProperty accepted a bad ID"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: AddFeaProperty, GetFeaPropertyIDVec :param [in]: id string FEA Property ID

openvsp.vsp.DeleteFeaStruct(geom_id, fea_struct_ind)

Delete an FEA Structure and all FEA Parts and FEA SubSurfaces associated with it

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

#==== Add FeaStructure to Pod ====//
struct_ind_1 = AddFeaStruct( pod_id )

struct_ind_2 = AddFeaStruct( pod_id )

struct_id_2 = GetFeaStructID( pod_id, struct_ind_2 )

assert NumFeaStructures() == 2, "the two structures were not both added"

DeleteFeaStruct( pod_id, struct_ind_1 )

# Deleting the first structure leaves the second one, which slides down to
# take its index.
assert NumFeaStructures() == 1, "DeleteFeaStruct did not remove the structure"
assert GetFeaStructID( pod_id, 0 ) == struct_id_2, "DeleteFeaStruct removed the wrong structure"
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – fea_struct_ind int FEA Structure index

openvsp.vsp.DeleteFeaStructureFromAssembly(assembly_id, struct_id)

Remove an FEA Structure from an FEA Assembly. The Structure itself is left in the model.

pod_id = AddGeom( "POD" )

struct_ind_1 = AddFeaStruct( pod_id )
struct_ind_2 = AddFeaStruct( pod_id )

struct_id_1 = GetFeaStructID( pod_id, struct_ind_1 )
struct_id_2 = GetFeaStructID( pod_id, struct_ind_2 )

assembly_id = AddFeaAssembly()

AddFeaStructureToAssembly( assembly_id, struct_id_1 )
AddFeaStructureToAssembly( assembly_id, struct_id_2 )

DeleteFeaStructureFromAssembly( assembly_id, struct_id_1 )

# Only the named Structure leaves the assembly, and it survives in the model.
struct_ids = GetFeaAssemblyStructureIDVec( assembly_id )

assert len( struct_ids ) == 1, "DeleteFeaStructureFromAssembly removed the wrong Structure"
assert struct_ids[0] == struct_id_2, "DeleteFeaStructureFromAssembly removed the wrong Structure"
assert NumFeaStructures() == 2, "DeleteFeaStructureFromAssembly deleted the Structure itself"

# A Structure the assembly does not hold has to be rejected.
err_mgr = ErrorMgrSingleton.getInstance()

DeleteFeaStructureFromAssembly( assembly_id, struct_id_1 )

assert err_mgr.GetNumTotalErrors() > 0, "DeleteFeaStructureFromAssembly accepted a Structure it does not hold"

while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: AddFeaStructureToAssembly, GetFeaAssemblyStructureIDVec :param [in]: assembly_id string FEA Assembly ID :param [in]: struct_id string FEA Structure ID

openvsp.vsp.DeleteFeaSubSurf(geom_id, fea_struct_ind, ss_id)

Delete an FEA SubSurface from a Structure

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

#==== Add FeaStructure to Pod ====//
struct_ind = AddFeaStruct( pod_id )

#==== Add LineArray ====//
line_array_id = AddFeaSubSurf( pod_id, struct_ind, SS_LINE_ARRAY )

#==== Add Rectangle ====//
rect_id = AddFeaSubSurf( pod_id, struct_ind, SS_RECTANGLE )

struct_id = GetFeaStructID( pod_id, struct_ind )

num_before = NumFeaSubSurfs( struct_id )

#==== Delete LineArray ====//
DeleteFeaSubSurf( pod_id, struct_ind, line_array_id )

assert NumFeaSubSurfs( struct_id ) == num_before - 1, "DeleteFeaSubSurf did not remove the sub-surface"
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – fea_struct_ind int FEA Structure index

  • [in] – ss_id string FEA SubSurface ID

openvsp.vsp.DeleteFeaTrimPart(trim_id, index)

Remove an entry from the list a Trim part trims against See also: AddFeaTrimPart, GetFeaTrimPartIDVec :param [in]: trim_id string FEA Trim part ID :param [in]: index int Trim entry index

openvsp.vsp.DeleteGeom(geom_id)

Delete a particular Geom

#==== Add Wing Geometry ====//
wing_id = AddGeom( "WING" )

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

num_before_del = len( FindGeoms() )
DeleteGeom( wing_id )
assert len( FindGeoms() ) < num_before_del, "DeleteGeom removed nothing"
Parameters:

[in] – geom_id string Geom ID

openvsp.vsp.DeleteGeomVec(del_vec)

Delete multiple Geoms

#==== Add Pod Geometry ====//
pid = AddGeom( "POD", "" )

rid = ExecAnalysis( "CompGeom" )

mesh_id_vec = GetStringResults( rid, "Mesh_GeomID" )

num_before_del = len( FindGeoms() )
DeleteGeomVec( mesh_id_vec )
assert len( FindGeoms() ) < num_before_del, "DeleteGeomVec removed nothing"
Parameters:

[in] – del_vec vector<string> Vector of Geom IDs

openvsp.vsp.DeleteGeometryAnalysis(std: :string const & id)
openvsp.vsp.DeleteGeometryAnalysisAzEl(geom_analysis_id, index)

Delete one azimuth and elevation pair from a Geometry Analysis case

ga_id = AddGeometryAnalysis()

AddGeometryAnalysisAzEl( ga_id, 30.0, 15.0 )
AddGeometryAnalysisAzEl( ga_id, 60.0, 45.0 )

DeleteGeometryAnalysisAzEl( ga_id, 0 )

# Only the indexed pair goes, and the rest slide down.
assert GetNumGeometryAnalysisAzEl( ga_id ) == 1, "DeleteGeometryAnalysisAzEl did not remove one pair"
assert abs( GetParmVal( GetGeometryAnalysisAzimuthParm( ga_id, 0 ) ) - 60.0 ) < 1e-6, "DeleteGeometryAnalysisAzEl removed the wrong pair"

# An index past the end has to be rejected.
err_mgr = ErrorMgrSingleton.getInstance()

DeleteGeometryAnalysisAzEl( ga_id, GetNumGeometryAnalysisAzEl( ga_id ) )

assert err_mgr.GetNumTotalErrors() > 0, "DeleteGeometryAnalysisAzEl accepted an index past the end"

while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: AddGeometryAnalysisAzEl, DeleteAllGeometryAnalysisAzEl :param [in]: geom_analysis_id string Geometry Analysis case ID :param [in]: index int Az/El pair index

openvsp.vsp.DeleteResult(id)

Delete a particular result

#==== Test Comp Geom ====//
gid1 = AddGeom( "POD", "" )

mesh_id = ComputeCompGeom( 0, False, 0 )

#==== Test Comp Geom Mesh Results ====//
mesh_geom_res_id = CreateGeomResults( mesh_id, "Comp_Mesh" )

DeleteResult( mesh_geom_res_id )

if ( GetNumResults( "Comp_Mesh" ) != 0 ):
    print( "---> Error: API DeleteResult" )
    assert False, "---> Error: API DeleteResult"
Parameters:

[in] – id string Result ID

openvsp.vsp.DeleteSubSurf(*args)

Overload 1:

Delete the specified sub-surface

wid = AddGeom( "WING", "" )                             # Add Wing

ss_line_id = AddSubSurf( wid, SS_LINE )                      # Add Sub Surface Line
ss_rec_id = AddSubSurf( wid, SS_RECTANGLE )                        # Add Sub Surface Rectangle

print("Delete SS_Line\n")

num_before_del = GetNumSubSurf( wid )
DeleteSubSurf( wid, ss_line_id )
assert GetNumSubSurf( wid ) < num_before_del, "DeleteSubSurf removed nothing"


num_ss = GetNumSubSurf( wid )

num_str = f"Number of SubSurfaces: {num_ss}\n"

print( num_str )
Parameters:
  • [in] – geom_id string Geom ID

  • [in] – sub_id string Sub-surface ID


Overload 2:

Delete the specified sub-surface

wid = AddGeom( "WING", "" )                             # Add Wing

ss_line_id = AddSubSurf( wid, SS_LINE )                      # Add Sub Surface Line
ss_rec_id = AddSubSurf( wid, SS_RECTANGLE )                        # Add Sub Surface Rectangle

print("Delete SS_Line\n")

num_before_del = GetNumSubSurf( wid )
DeleteSubSurf( ss_line_id )
assert GetNumSubSurf( wid ) < num_before_del, "DeleteSubSurf removed nothing"


num_ss = GetNumSubSurf( wid )

num_str = f"Number of SubSurfaces: {num_ss}\n"

print( num_str )
Parameters:

[in] – sub_id string Sub-surface ID

openvsp.vsp.DeleteUserParm(id)

Get the user parm container ID

n = GetNumPredefinedUserParms()
id_arr = GetAllUserParms()

if  len(id_arr) > n :
    num_before_del = GetNumUserParms()
    DeleteUserParm( id_arr[n] )
    assert GetNumUserParms() < num_before_del, "DeleteUserParm removed nothing"
openvsp.vsp.DeleteVSPAEROControlSurfaceGroup(int CSGroupIndex)
openvsp.vsp.DeleteVarPresetGroup(std: :string const & group_id)
openvsp.vsp.DeleteVarPresetParm(group_id, parm_id)

Delete Parm from Variable Preset Group

# Add Pod Geom
pod1 = AddGeom( "POD", "" )

gid = AddVarPresetGroup( "Tess" )

sid = AddVarPresetSetting( gid, "Coarse" )

p1 = FindParm( pod1, "Tess_U", "Shape" )

AddVarPresetParm( gid, p1 )

num_before_del = len( GetVarPresetParmIDs( gid ) )
DeleteVarPresetParm( gid, p1 )
assert len( GetVarPresetParmIDs( gid ) ) < num_before_del, "DeleteVarPresetParm removed nothing"
Parameters:
  • [in] – group_id string Var Preset Group ID

  • [in] – parm_id string Var Parm ID

openvsp.vsp.DeleteVarPresetSetting(std: :string const & group_id, std: :string const & setting_id)
openvsp.vsp.DemoteBORCSTLower(bor_id)

Demote the CST for the lower airfoil surface of a BOR. The XSecCurve must be of type XS_CST_AIRFOIL See also: GetLowerCSTDegree :param [in]: bor_id string Body of revolution Geom ID

openvsp.vsp.DemoteBORCSTUpper(bor_id)

Demote the CST for the upper airfoil surface of a BOR. The XSecCurve must be of type XS_CST_AIRFOIL See also: GetUpperCSTDegree :param [in]: bor_id string Body of revolution Geom ID

openvsp.vsp.DemoteCSTLower(xsec_id)

Demote the CST for the lower airfoil surface. The XSec must be of type XS_CST_AIRFOIL See also: GetLowerCSTDegree :param [in]: xsec_id string XSec ID

openvsp.vsp.DemoteCSTUpper(xsec_id)

Demote the CST for the upper airfoil surface. The XSec must be of type XS_CST_AIRFOIL See also: GetUpperCSTDegree :param [in]: xsec_id string XSec ID

openvsp.vsp.DisableStopGUIMenuItem()

Disable Stop GUI Menu Item from the OpenVSP GUI.

This reverses the operation of EnableStopGUIMenuItem.

EnableStopGUIMenuItem()
DisableStopGUIMenuItem()
StartGUI()

See also: EnableStopGUIMenuItem

class openvsp.vsp.DoubleVecVec(*args)

Bases: object

Proxy of C++ std::vector< std::vector< double > > class.

append(DoubleVecVec self, DoubleVector x)
assign(DoubleVecVec self, std: :vector< std::vector< double > >::size_type n, DoubleVector x)
back(DoubleVecVec self) DoubleVector
begin(DoubleVecVec self) std::vector< std::vector< double > >::iterator
capacity(DoubleVecVec self) std::vector< std::vector< double > >::size_type
clear(DoubleVecVec self)
empty(DoubleVecVec self) bool
end(DoubleVecVec self) std::vector< std::vector< double > >::iterator
erase(DoubleVecVec self, std: :vector< std::vector< double > >::iterator pos) std::vector< std::vector< double > >::iterator
erase(DoubleVecVec self, std: :vector< std::vector< double > >::iterator first, std: :vector< std::vector< double > >::iterator last) std::vector< std::vector< double > >::iterator
front(DoubleVecVec self) DoubleVector
get_allocator(DoubleVecVec self) std::vector< std::vector< double > >::allocator_type
insert(DoubleVecVec self, std: :vector< std::vector< double > >::iterator pos, DoubleVector x) std::vector< std::vector< double > >::iterator
insert(DoubleVecVec self, std: :vector< std::vector< double > >::iterator pos, std: :vector< std::vector< double > >::size_type n, DoubleVector x)
iterator(DoubleVecVec self) SwigPyIterator
pop(DoubleVecVec self) DoubleVector
pop_back(DoubleVecVec self)
push_back(DoubleVecVec self, DoubleVector x)
rbegin(DoubleVecVec self) std::vector< std::vector< double > >::reverse_iterator
rend(DoubleVecVec self) std::vector< std::vector< double > >::reverse_iterator
reserve(DoubleVecVec self, std: :vector< std::vector< double > >::size_type n)
resize(DoubleVecVec self, std: :vector< std::vector< double > >::size_type new_size)
resize(DoubleVecVec self, std: :vector< std::vector< double > >::size_type new_size, DoubleVector x)
size(DoubleVecVec self) std::vector< std::vector< double > >::size_type
swap(DoubleVecVec self, DoubleVecVec v)
property thisown

The membership flag

class openvsp.vsp.DoubleVector(*args)

Bases: object

Proxy of C++ std::vector< double > class.

append(DoubleVector self, std: :vector< double >::value_type const & x)
assign(DoubleVector self, std: :vector< double >::size_type n, std: :vector< double >::value_type const & x)
back(DoubleVector self) std::vector< double >::value_type const &
begin(DoubleVector self) std::vector< double >::iterator
capacity(DoubleVector self) std::vector< double >::size_type
clear(DoubleVector self)
empty(DoubleVector self) bool
end(DoubleVector self) std::vector< double >::iterator
erase(DoubleVector self, std: :vector< double >::iterator pos) std::vector< double >::iterator
erase(DoubleVector self, std: :vector< double >::iterator first, std: :vector< double >::iterator last) std::vector< double >::iterator
front(DoubleVector self) std::vector< double >::value_type const &
get_allocator(DoubleVector self) std::vector< double >::allocator_type
insert(DoubleVector self, std: :vector< double >::iterator pos, std: :vector< double >::value_type const & x) std::vector< double >::iterator
insert(DoubleVector self, std: :vector< double >::iterator pos, std: :vector< double >::size_type n, std: :vector< double >::value_type const & x)
iterator(DoubleVector self) SwigPyIterator
pop(DoubleVector self) std::vector< double >::value_type
pop_back(DoubleVector self)
push_back(DoubleVector self, std: :vector< double >::value_type const & x)
rbegin(DoubleVector self) std::vector< double >::reverse_iterator
rend(DoubleVector self) std::vector< double >::reverse_iterator
reserve(DoubleVector self, std: :vector< double >::size_type n)
resize(DoubleVector self, std: :vector< double >::size_type new_size)
resize(DoubleVector self, std: :vector< double >::size_type new_size, std: :vector< double >::value_type const & x)
size(DoubleVector self) std::vector< double >::size_type
swap(DoubleVector self, DoubleVector v)
property thisown

The membership flag

openvsp.vsp.EDGE_END_CAP = 3

Edge end cap

openvsp.vsp.EDIT_XSEC_CIRCLE = 0

Circle initialized as cubic Bezier type

openvsp.vsp.EDIT_XSEC_ELLIPSE = 1

Ellipse initialized as PCHIP type

openvsp.vsp.EDIT_XSEC_RECTANGLE = 2

Rectangle initialized as linear type

openvsp.vsp.ELLIPSOID_GEOM_SCREEN = 13

Ellipsoid geom screen

openvsp.vsp.ENGINE_GEOM_FLOWPATH = 2

Component flowpath is modeled.

openvsp.vsp.ENGINE_GEOM_FLOWTHROUGH = 0

Component is modeled as flowthrough engine.

openvsp.vsp.ENGINE_GEOM_INLET = 1

Component represents integrated flowpath inlet.

openvsp.vsp.ENGINE_GEOM_INLET_OUTLET = 2

Component represents integrated flowpath inlet and outlet.

openvsp.vsp.ENGINE_GEOM_IO_NUM_TYPES = 4

Number of integrated flowpath component types.

openvsp.vsp.ENGINE_GEOM_NONE = 0

Component is not an integrated flowpath component.

openvsp.vsp.ENGINE_GEOM_NUM_TYPES = 4

Number of integrated flowpath modeling types.

openvsp.vsp.ENGINE_GEOM_OUTLET = 3

Component represents integrated flowpath outlet.

openvsp.vsp.ENGINE_GEOM_TO_FACE = 3

Component is modeled to face.

openvsp.vsp.ENGINE_GEOM_TO_LIP = 1

Component is modeled to the lip.

openvsp.vsp.ENGINE_LOC_INDEX = 0

Integrated flowpath key point identified by XSec index.

openvsp.vsp.ENGINE_LOC_INLET_FACE = 1

Integrated flowpath key point is inlet face.

openvsp.vsp.ENGINE_LOC_INLET_LIP = 0

Integrated flowpath key point is inlet lip.

openvsp.vsp.ENGINE_LOC_NUM = 4

Number of integrated flowpath key point locations.

openvsp.vsp.ENGINE_LOC_OUTLET_FACE = 3

Integrated flowpath key point is outlet face.

openvsp.vsp.ENGINE_LOC_OUTLET_LIP = 2

Integrated flowpath key point is outlet lip.

openvsp.vsp.ENGINE_LOC_U = 1

Integrated flowpath key point identified by U parameter.

openvsp.vsp.ENGINE_MODE_EXTEND = 7

Represent integrated flowpath with farfield extensions.

openvsp.vsp.ENGINE_MODE_FLOWTHROUGH = 0

Represent integrated flowpath as flowthrough engine.

openvsp.vsp.ENGINE_MODE_FLOWTHROUGH_NEG = 1

Represent integrated flowpath as flowthrough engine with negative flowpath.

openvsp.vsp.ENGINE_MODE_FLOWTHROUGH_NEG_ONLY = 2

Represent ONLY the integrated flowpath as flowthrough engine with negative flowpath.

openvsp.vsp.ENGINE_MODE_NUM_TYPES = 8

Number of integrated flowpath representations.

openvsp.vsp.ENGINE_MODE_TO_FACE = 4

Represent integrated flowpath to the face.

openvsp.vsp.ENGINE_MODE_TO_FACE_NEG = 5

Represent integrated flowpath to the face with negative flowpath to the face.

openvsp.vsp.ENGINE_MODE_TO_FACE_NEG_ONLY = 6

Represent ONLY the integrated flowpath to the face with negative flowpath to the face.

openvsp.vsp.ENGINE_MODE_TO_LIP = 3

Represent integrated flowpath to the lip.

openvsp.vsp.ETA_PROP_DRIVER = 4

Prop efficiency driver

openvsp.vsp.ETA_TRIM = 2

Trim by Eta coordinate

openvsp.vsp.EXCRESCENCE_CD = 1

Drag coefficient excressence type

openvsp.vsp.EXCRESCENCE_COUNT = 0

Drag counts excressence type

openvsp.vsp.EXCRESCENCE_DRAGAREA = 4

Drag area (D/q) excressence type

openvsp.vsp.EXCRESCENCE_MARGIN = 3

Percent margin excressence type

openvsp.vsp.EXCRESCENCE_PERCENT_GEOM = 2

Percent of parent Geom drag coefficient excressence type

openvsp.vsp.EXPORT_AWAVE = 3

AWAVE export type (NOT IMPLEMENTED)

openvsp.vsp.EXPORT_BEM = 15

Blade Element (*.bem) export type

openvsp.vsp.EXPORT_BEZIER_AIRFOIL = 22

Airfoil curves (*.bz) export type

openvsp.vsp.EXPORT_CART3D = 6

Cart3D (*.tri) export type

openvsp.vsp.EXPORT_DXF = 16

AutoCAD (*.dxf) export type

openvsp.vsp.EXPORT_FACET = 17

Xpatch (*.facet) export type

openvsp.vsp.EXPORT_FELISA = 0

FELISA export type (NOT IMPLEMENTED)

openvsp.vsp.EXPORT_GMSH = 10

Gmsh (*.msh) export type

openvsp.vsp.EXPORT_IGES = 14

IGES (*.igs) export type

openvsp.vsp.EXPORT_IGES_STRUCTURE = 23

IGES structure (*.igs) export type

openvsp.vsp.EXPORT_NASCART = 4

NASCART (*.dat) export type

openvsp.vsp.EXPORT_OBJ = 20

OBJ (*.obj) export type

openvsp.vsp.EXPORT_PLOT3D = 13

PLOT3D (*.p3d) export type

openvsp.vsp.EXPORT_PMARC = 19

PMARC 12 (*.pmin) export type

openvsp.vsp.EXPORT_POVRAY = 5

POVRAY (*.pov) export type

openvsp.vsp.EXPORT_SELIG_AIRFOIL = 21

Airfoil points (*.dat) export type

openvsp.vsp.EXPORT_STEP = 12

STEP (*.stp) export type

openvsp.vsp.EXPORT_STEP_STRUCTURE = 24

STEP structure (*.stp) export type

openvsp.vsp.EXPORT_STL = 2

Stereolith (*.stl) export type

openvsp.vsp.EXPORT_SVG = 18

SVG (*.svg) export type

openvsp.vsp.EXPORT_VORXSEC = 8

VORXSEC export type (NOT IMPLEMENTED)

openvsp.vsp.EXPORT_VSPGEOM = 7

VSPGeom (*.vspgeom) export type

openvsp.vsp.EXPORT_X3D = 11

X3D (*.x3d) export type

openvsp.vsp.EXPORT_XSEC = 1

XSec (*.hrm) export type

openvsp.vsp.EXPORT_XSECGEOM = 9

XSECGEOM export type (NOT IMPLEMENTED)

openvsp.vsp.EXTENT_FORWARD_FINITE = 2

Forward displacement.

openvsp.vsp.EXTENT_FORWARD_INF = 0

Forward beyond extent of model.

openvsp.vsp.EXTENT_REVERSE_FINITE = 3

Reverse displacement.

openvsp.vsp.EXTENT_REVERSE_INF = 1

Reverse beyond extent of model.

openvsp.vsp.EXTENT_SLIDER_AFTER = 6

Slider motion from current position to end.

openvsp.vsp.EXTENT_SLIDER_BEFORE = 5

Slider motion from start to current position.

openvsp.vsp.EXTENT_SLIDER_FULL = 4

Full range of slider motion.

openvsp.vsp.EXTERNAL_INTERFERENCE = 0

Interference between mutually external bodies

openvsp.vsp.EXTERNAL_SELF_INTERFERENCE = 2

Interference between multiple surfaces of one Geom / Set

openvsp.vsp.EditXSecConvertTo(xsec_id, newtype)

Convert the EditCurveXSec curve type to the specified new type. Note, EditCurveXSec uses the same enumerations for PCurve to identify curve type, but APPROX_CEDIT is not supported at this time.

# Add Stack
sid = AddGeom( "STACK", "" )

# Get First (and Only) XSec Surf
xsec_surf = GetXSecSurf( sid, 0 )

ChangeXSecShape( xsec_surf, 1, XS_EDIT_CURVE )

# Identify XSec 1
xsec_1 = GetXSec( xsec_surf, 1 )

# The default shape is a Bezier ellipse, stored in groups of three plus a
# closing point.
bezier_pts = GetEditXSecCtrlVec( xsec_1, True )

assert len( bezier_pts ) >= 4 and ( len( bezier_pts ) - 1 ) % 3 == 0, "the edit curve did not start out as a cubic Bezier"

# Set XSec 1 to Linear
EditXSecConvertTo( xsec_1, LINEAR )

Update()

# A linear curve needs no interior control points, so the conversion drops
# them: the ellipse keeps only the points that were on the curve.
linear_pts = GetEditXSecCtrlVec( xsec_1, True )

assert len( linear_pts ) == ( len( bezier_pts ) - 1 ) // 3 + 1, "EditXSecConvertTo did not drop the interior control points"

# Converting back has to put them back.
EditXSecConvertTo( xsec_1, CEDIT )

Update()

assert len( GetEditXSecCtrlVec( xsec_1, True ) ) == len( bezier_pts ), "EditXSecConvertTo would not convert back"

See also: PCURV_TYPE :param [in]: xsec_id string XSec ID :param [in]: newtype int New curve type enum (i.e. CEDIT)

openvsp.vsp.EditXSecDelPnt(xsec_id, indx)

Delete an EditCurveXSec control point. Note, cubic Bezier intermediate control points (those not on the curve) cannot be deleted. The previous and next Bezier control point will be deleted along with the point on the curve. Regardless of curve type, the first and last points may not be deleted.

# Add Stack
sid = AddGeom( "STACK", "" )

# Get First (and Only) XSec Surf
xsec_surf = GetXSecSurf( sid, 0 )

ChangeXSecShape( xsec_surf, 2, XS_EDIT_CURVE )

# Identify XSec 2
xsec_2 = GetXSec( xsec_surf, 2 )

# Turn off R/L symmetry
SetParmVal( GetXSecParm( xsec_2, "SymType"), SYM_NONE )

old_pnts = GetEditXSecCtrlVec( xsec_2, True ) # The returned control points will not be scaled by width and height

EditXSecDelPnt( xsec_2, 3 ) # Remove control point at bottom of circle

new_pnts = GetEditXSecCtrlVec( xsec_2, True ) # The returned control points will not be scaled by width and height

if  len(old_pnts) - len(new_pnts) != 3  :
    print( "Error: EditXSecDelPnt")
    assert False, "Error: EditXSecDelPnt"
Parameters:
  • [in] – xsec_id string XSec ID

  • [in] – indx int Control point index

openvsp.vsp.EditXSecInitShape(xsec_id)

Initialize the EditCurveXSec to the current value of m_ShapeType (i.e. EDIT_XSEC_ELLIPSE)

# Add Stack
sid = AddGeom( "STACK", "" )

# Get First (and Only) XSec Surf
xsec_surf = GetXSecSurf( sid, 0 )

ChangeXSecShape( xsec_surf, 2, XS_EDIT_CURVE )

# Identify XSec 2
xsec_2 = GetXSec( xsec_surf, 2 )

# Set XSec 2 to linear
EditXSecConvertTo( xsec_2, LINEAR )

linear_pts = GetEditXSecCtrlVec( xsec_2, True )

EditXSecInitShape( xsec_2 ) # Change back to default ellipse

Update()

# The default ellipse is a four point Bezier, so it carries more control
# points than the linear square it replaced.
ellipse_pts = GetEditXSecCtrlVec( xsec_2, True )

assert len( ellipse_pts ) >= 4 and ( len( ellipse_pts ) - 1 ) % 3 == 0, "EditXSecInitShape did not restore a cubic Bezier"
assert len( ellipse_pts ) > len( linear_pts ), "EditXSecInitShape did not rebuild the control points"

# The ellipse is symmetric about both axes, so it stays inside the unit box
# the control points are normalized to.
for p in ellipse_pts:
    assert abs( p.x() ) <= 0.5 + 1e-9, "the rebuilt shape is not normalized"
    assert abs( p.y() ) <= 0.5 + 1e-9, "the rebuilt shape is not normalized"

See also: INIT_EDIT_XSEC_TYPE :param [in]: xsec_id string XSec ID

openvsp.vsp.EditXSecSplit01(xsec_id, u)

Split the EditCurveXSec at the specified U value

# Add Stack
sid = AddGeom( "STACK", "" )

# Get First (and Only) XSec Surf
xsec_surf = GetXSecSurf( sid, 0 )

ChangeXSecShape( xsec_surf, 2, XS_EDIT_CURVE )

# Identify XSec 2
xsec_2 = GetXSec( xsec_surf, 2 )

# Turn off R/L symmetry
SetParmVal( GetXSecParm( xsec_2, "SymType"), SYM_NONE )

old_pnts = GetEditXSecCtrlVec( xsec_2, True ) # The returned control points will not be scaled by width and height

new_pnt_ind = EditXSecSplit01( xsec_2, 0.375 )

new_pnts = GetEditXSecCtrlVec( xsec_2, True ) # The returned control points will not be scaled by width and height

if  len(new_pnts) - len(old_pnts) != 3  :
    print( "Error: EditXSecSplit01")
    assert False, "Error: EditXSecSplit01"
Parameters:
  • [in] – xsec_id string XSec ID

  • [in] – u double U value to split the curve at (0 - 1)

Return type:

int

Returns:

int Index of the point added from the split

openvsp.vsp.EnableStopGUIMenuItem()

Enable Stop GUI Menu Item from the OpenVSP GUI.

Typically used for the blocking-mode OpenVSP GUI from the API.

This will add a “Stop GUI” option to the file pulldown menu and will also cause the exit button on the window frame to have the same effect. When selected, these options will stop the OpenVSP GUI event loop, returning control to the API program. OpenVSP will not terminate, the model will remain in memory and will be responsive to subsequent API calls.

EnableStopGUIMenuItem()
StartGUI()

See also: DisableStopGUIMenuItem

class openvsp.vsp.ErrorMgrSingleton(*args, **kwargs)

Bases: object

Proxy of C++ vsp::ErrorMgrSingleton class.

AddError(ErrorMgrSingleton self, vsp: :ERROR_CODE code, string const & desc)
GetErrorLastCallFlag()

Check if there was an error on the last call to the API

#==== Force API to silence error messages ====##
SilenceErrors()

#==== Bogus Call To Create API Error ====##
print( "---> Test Error Handling" )

SetParmVal( "BogusParmID", 23.0 )

if not GetErrorLastCallFlag():
    print( "---> Error: API GetErrorLastCallFlag" )

#==== Tell API to print error messages ====##
PrintOnErrors()
Return type:

boolean

Returns:

False if no error, true otherwise

GetLastError()

Return the most recent error from the stack (does NOT pop error off the stack)

#==== Force API to silence error messages ====##
SilenceErrors()

print( "Creating an API error" )
SetParmVal( "ABCDEFG", "Test_Name", "Test_Group", 123.4 )

#==== Check For API Errors ====##
err = GetLastError()

print( err.GetErrorString() )

#==== Tell API to print error messages ====##
PrintOnErrors()

See also: SilenceErrors, PrintOnErrors; :rtype: ErrorObj :return: Error object

GetNumTotalErrors()

Count the total number of errors on the stack

#==== Force API to silence error messages ====##
SilenceErrors()

print( "Creating an API error" )
SetParmVal( "ABCDEFG", "Test_Name", "Test_Group", 123.4 )

#==== Check For API Errors ====##
while GetNumTotalErrors() > 0:
    err = PopLastError()
    print( err.GetErrorString() )

#==== Tell API to print error messages ====##
PrintOnErrors()
Return type:

int

Returns:

Number of errors

MessageCallback(ErrorMgrSingleton self, MessageBase const * _from, MessageData const & data)
NoError(ErrorMgrSingleton self)
PopErrorAndPrint(ErrorMgrSingleton self, FILE * stream) bool
PopLastError()

Pop (remove) and return the most recent error from the stack. Note, errors are printed on occurrence by default.

#==== Force API to silence error messages ====##
SilenceErrors()

print( "Creating an API error" )
SetParmVal( "ABCDEFG", "Test_Name", "Test_Group", 123.4 )

#==== Check For API Errors ====##
while GetNumTotalErrors() > 0:
    err = PopLastError()
    print( err.GetErrorString() )

#==== Tell API to print error messages ====##
PrintOnErrors()
Return type:

ErrorObj

Returns:

Error object

PrintOnErrors()

Cause errors to be printed to stdout as they occur.

#==== Force API to silence error messages ====##
SilenceErrors()

print( "Creating an API error" )
SetParmVal( "ABCDEFG", "Test_Name", "Test_Group", 123.4 )

#==== Tell API to print error messages ====##
PrintOnErrors()

See also: SilenceErrors

SilenceErrors()

Prevent errors from printing to stdout as they occur.

#==== Force API to silence error messages ====##
SilenceErrors()

print( "Creating an API error" )
SetParmVal( "ABCDEFG", "Test_Name", "Test_Group", 123.4 )

#==== Tell API to print error messages ====##
PrintOnErrors()

See also: PrintOnErrors

static getInstance() ErrorMgrSingleton
property thisown

The membership flag

class openvsp.vsp.ErrorObj(*args)

Bases: object

ErrorObj is defined by an error code enum and associated error string.

GetErrorCode()

Get the ERROR_CODE enum of the last raised error

err = PopLastError()

if err.GetErrorCode() != vsp.VSP_CANT_FIND_PARM:
    print( "---> Error: API PopLast" )

See also: ERROR_CODE :rtype: int :return: ERROR_CODE error code enum

GetErrorString()

Get the error string of the last raised error

#==== Check For API Errors ====##
while GetNumTotalErrors() > 0:
    err = PopLastError()
    print( err.GetErrorString() )
Return type:

string

Returns:

Error string

NoError(ErrorObj self)
property m_ErrorCode

m_ErrorCode : vsp::ERROR_CODE

property m_ErrorString

m_ErrorString : string

property thisown

The membership flag

openvsp.vsp.ExecAnalysis(analysis)

Execute an analysis through the Analysis Manager

analysis_name = "VSPAEROComputeGeometry"

res_id = ExecAnalysis( analysis_name )
assert len( res_id ) > 0, "ExecAnalysis returned no id"
Parameters:

[in] – analysis string Analysis name

Return type:

string

Returns:

string Result ID

openvsp.vsp.ExportFile(*args)

Export a file from OpenVSP. Many formats are available, such as STL, IGES, and SVG. If a mesh is generated for a particular export, the ID of the MeshGeom will be returned. If no mesh is generated an empty string will be returned.

wid = AddGeom( "WING" )             # Add Wing

ExportFile( "Airfoil_Metadata.csv", SET_ALL, EXPORT_SELIG_AIRFOIL )

mesh_id = ExportFile( "Example_Mesh.msh", SET_ALL, EXPORT_GMSH )
assert len( mesh_id ) > 0, "ExportFile returned no id"

DeleteGeom( mesh_id ) # Delete the mesh generated by the GMSH export

See also: EXPORT_TYPE :param [in]: file_name string Export file name :param [in]: thick_set int Set index to export (i.e. SET_ALL) :param [in]: file_type int File type enum (i.e. EXPORT_IGES) :param [in]: subsFlag int Flag to tag subsurfaces if MeshGeom is created :param [in]: thin_set int Set index to export as degenerate geometry (i.e. SET_NONE) :param [in]: useMode bool Flag determine if mode is used instead of sets :param [in]: modeID string ID of Mode to use :rtype: string :return: string Mesh Geom ID if the export generates a mesh

openvsp.vsp.ExportParasiteDragToCSV(file_name)

Write the Parasite Drag Tool buildup table out to a CSV file, the way the Export CSV button on the tool does. The same table is also placed in the Results Manager under the name “Parasite_Drag”, so the returned ID gives access to it without going through the file.

pod_id = AddGeom( "POD", "" )

Update()

# The table is filled in by running the buildup, so do that first.
ExecAnalysis( "ParasiteDrag" )

res_id = ExportParasiteDragToCSV( "ParasiteDragExample.csv" )

assert len( res_id ) > 0, "ExportParasiteDragToCSV returned no results"

# The buildup carries one row per Geom, so the Pod has to be in there.
labels = GetStringResults( res_id, "Comp_Label" )

assert len( labels ) > 0, "the buildup table is empty"

See also: UpdateParasiteDrag :param [in]: file_name string Name of the CSV file to write :rtype: string :return: string Results ID for the buildup table

openvsp.vsp.FAN_FRAGMENT = 3

Fan blade fragment

openvsp.vsp.FC_NATIVE = 1

Operating system’s native file chooser

openvsp.vsp.FC_OPENVSP = 0

OpenVSP’s own file chooser with directory preferences.

openvsp.vsp.FEA_BCM_ALL = 1

FEA boundary condition constrains all DOF.

openvsp.vsp.FEA_BCM_ASYMM = 4

FEA boundary condition antisymmetrical constraints.

openvsp.vsp.FEA_BCM_PIN = 2

FEA boundary condition pin constraints.

openvsp.vsp.FEA_BCM_SYMM = 3

FEA boundary condition symmetrical constraints.

openvsp.vsp.FEA_BCM_USER = 0

FEA boundary condition constraints user defined.

openvsp.vsp.FEA_BC_PART = 1

FEA boundary condition assigned to part.

openvsp.vsp.FEA_BC_STRUCTURE = 0

FEA boundary condition assigned to structure.

openvsp.vsp.FEA_BC_SUBSURF = 2

FEA boundary condition assigned to subsurface.

openvsp.vsp.FEA_BEAM = 1

Beam FEA element type

openvsp.vsp.FEA_CALCULIX_FILE_NAME = 3

FEA Mesh Calculix export type

openvsp.vsp.FEA_CURV_FILE_NAME = 7

FEA Mesh CURV export type

openvsp.vsp.FEA_DELETE = 1

Delete shell elements

openvsp.vsp.FEA_DEPRECATED = -1

Flag for deprecated element type option

openvsp.vsp.FEA_DOME = 4

Dome FEA Part type

openvsp.vsp.FEA_ENG_ORTHO = 1

Orthotropic material in engineering parameters

openvsp.vsp.FEA_ENG_ORTHO_TRANS_ISO = 2

Orthotropic material with transverse isotropy assumed in engineering parameters

openvsp.vsp.FEA_FIX_POINT = 3

Fixed Point FEA Part type

openvsp.vsp.FEA_FIX_PT_DELTA_UVN = 3

Delta UVN off body fixed point type

openvsp.vsp.FEA_FIX_PT_DELTA_XYZ = 2

Delta XYZ off body fixed point type

openvsp.vsp.FEA_FIX_PT_GEOM_CG = 5

Geom CG off body fixed point type

openvsp.vsp.FEA_FIX_PT_GEOM_ORIGIN = 4

Geom origin off body fixed point type

openvsp.vsp.FEA_FIX_PT_GLOBAL_XYZ = 1

Global XYZ off body fixed point type

openvsp.vsp.FEA_FIX_PT_ON_BODY = 0

On body fixed point type

openvsp.vsp.FEA_GMSH_FILE_NAME = 5

FEA Mesh GMSH export type

openvsp.vsp.FEA_IGES_FILE_NAME = 9

FEA Mesh trimmed IGES export type

openvsp.vsp.FEA_ISOTROPIC = 0

Isotropic material

openvsp.vsp.FEA_KEEP = 0

Keep shell elements

openvsp.vsp.FEA_LAMINATE = 3

Laminate buildup material

openvsp.vsp.FEA_MASS_FILE_NAME = 0

FEA Mesh mass export type

openvsp.vsp.FEA_NASTRAN_FILE_NAME = 1

FEA Mesh NASTRAN export type

openvsp.vsp.FEA_NKEY_FILE_NAME = 2

FEA Mesh NKey export type

openvsp.vsp.FEA_NO_ELEMENTS = 3

FEA part with no elements

openvsp.vsp.FEA_NUM_BCM_MODES = 5

Number of FEA boundary condition constraint types.

openvsp.vsp.FEA_NUM_BC_TYPES = 3

Number of FEA boundary condition definition types.

openvsp.vsp.FEA_NUM_ELEMENT_TYPES = 4

Number of FEA element type choices

openvsp.vsp.FEA_NUM_FILE_NAMES = 11

Number of FEA Mesh export type.

openvsp.vsp.FEA_NUM_FIX_PT_TYPES = 6

Number of off body fixed point types

openvsp.vsp.FEA_NUM_MAT_TYPES = 4

Number of FEA material types

openvsp.vsp.FEA_NUM_ORIENT_TYPES = 13

Number of FEA material orientation types

openvsp.vsp.FEA_NUM_SHELL_TREATMENT_TYPES = 2

Number of FEA subsurface treatment choices

openvsp.vsp.FEA_NUM_TYPES = 10

Number of FEA Part types

openvsp.vsp.FEA_ORIENT_COMP_X = 3

FEA Comp X material orientation

openvsp.vsp.FEA_ORIENT_COMP_Y = 4

FEA Comp Y material orientation

openvsp.vsp.FEA_ORIENT_COMP_Z = 5

FEA Comp Z material orientation

openvsp.vsp.FEA_ORIENT_GLOBAL_X = 0

FEA Global X material orientation

openvsp.vsp.FEA_ORIENT_GLOBAL_Y = 1

FEA Global Y material orientation

openvsp.vsp.FEA_ORIENT_GLOBAL_Z = 2

FEA Global Z material orientation

openvsp.vsp.FEA_ORIENT_OML_R = 10

FEA OML R material orientation

openvsp.vsp.FEA_ORIENT_OML_S = 11

FEA OML S material orientation

openvsp.vsp.FEA_ORIENT_OML_T = 12

FEA OML T material orientation

openvsp.vsp.FEA_ORIENT_OML_U = 8

FEA OML U material orientation

openvsp.vsp.FEA_ORIENT_OML_V = 9

FEA OML V material orientation

openvsp.vsp.FEA_ORIENT_PART_U = 6

FEA Part U material orientation

openvsp.vsp.FEA_ORIENT_PART_V = 7

FEA Part V material orientation

openvsp.vsp.FEA_PLOT3D_FILE_NAME = 8

FEA Mesh PLOT3D export type

openvsp.vsp.FEA_POLY_SPAR = 9

Poly Spar FEA Part type

openvsp.vsp.FEA_RIB = 1

Rib FEA Part type

openvsp.vsp.FEA_RIB_ARRAY = 5

Rib array FEA Part type

openvsp.vsp.FEA_SHELL = 0

Shell (tris) FEA element type

openvsp.vsp.FEA_SHELL_AND_BEAM = 2

Both Shell and Beam FEA element types

openvsp.vsp.FEA_SKIN = 7

Skin FEA Part type

openvsp.vsp.FEA_SLICE = 0

Slice FEA Part type

openvsp.vsp.FEA_SLICE_ARRAY = 6

Slice array FEA Part type

openvsp.vsp.FEA_SPAR = 2

Spar FEA Part type

openvsp.vsp.FEA_SRF_FILE_NAME = 6

FEA Mesh SRF export type

openvsp.vsp.FEA_STEP_FILE_NAME = 10

FEA Mesh trimmed STEP export type

openvsp.vsp.FEA_STL_FILE_NAME = 4

FEA Mesh STL export type

openvsp.vsp.FEA_TRIM = 8

Trim FEA Part type

openvsp.vsp.FEA_XSEC_BOX = 5

Box XSec type

openvsp.vsp.FEA_XSEC_CIRC = 1

Circle XSec type

openvsp.vsp.FEA_XSEC_GENERAL = 0

General XSec type

openvsp.vsp.FEA_XSEC_I = 3

I XSec type

openvsp.vsp.FEA_XSEC_PIPE = 2

Pipe XSec type

openvsp.vsp.FEA_XSEC_RECT = 4

Rectangle XSec type

openvsp.vsp.FEMALE = 1

Female Human component

openvsp.vsp.FF_B_COVERT = 6

Covert FF equation

openvsp.vsp.FF_B_HOERNER_STREAMBODY = 3

Hoerner Streamlined Body FF equation

openvsp.vsp.FF_B_JENKINSON_AFT_FUSE_NACELLE = 9

Jenkinson Aft Fuselage Nacelle FF equation

openvsp.vsp.FF_B_JENKINSON_FUSE = 7

Jenkinson Fuselage FF equation

openvsp.vsp.FF_B_JENKINSON_WING_NACELLE = 8

Jenkinson Wing Nacelle FF equation

openvsp.vsp.FF_B_MANUAL = 0

Manual FF equation

openvsp.vsp.FF_B_SCHEMENSKY_FUSE = 1

Schemensky Fuselage FF equation

openvsp.vsp.FF_B_SCHEMENSKY_NACELLE = 2

Schemensky Nacelle FF equation

openvsp.vsp.FF_B_SHEVELL = 5

Shevell FF equation

openvsp.vsp.FF_B_TORENBEEK = 4

Torenbeek FF equation

openvsp.vsp.FF_W_COVERT = 4

Covert FF equation

openvsp.vsp.FF_W_DATCOM = 8

DATCOM FF equation

openvsp.vsp.FF_W_EDET_ADV = 2

EDET Advanced Airfoil FF equation

openvsp.vsp.FF_W_EDET_CONV = 1

EDET Conventional Airfoil FF equation

openvsp.vsp.FF_W_HOERNER = 3

Hoerner FF equation

openvsp.vsp.FF_W_JENKINSON_TAIL = 12

Jenkinson Tail FF equation

openvsp.vsp.FF_W_JENKINSON_WING = 11

Jenkinson Wing FF equation

openvsp.vsp.FF_W_KROO = 6

Kroo FF equation

openvsp.vsp.FF_W_MANUAL = 0

Manual FF equation

openvsp.vsp.FF_W_SCHEMENSKY_4_SERIES_AF = 10

Schemensky 4 Series Airfoil FF equation

openvsp.vsp.FF_W_SCHEMENSKY_6_SERIES_AF = 9

Schemensky 6 Series Airfoil FF equation

openvsp.vsp.FF_W_SCHEMENSKY_SUPERCRITICAL_AF = 13

Schemensky Supercritical Airfoil FF equation

openvsp.vsp.FF_W_SHEVELL = 5

Shevell FF equation

openvsp.vsp.FF_W_TORENBEEK = 7

Torenbeek FF equation

openvsp.vsp.FLAP_NONE = 0

No flap

openvsp.vsp.FLAP_NUM_TYPES = 2

Number of flap types

openvsp.vsp.FLAP_PLAIN = 1

Plain flap

openvsp.vsp.FLAT_END_CAP = 1

Flat end cap

openvsp.vsp.FUSELAGE_GEOM_SCREEN = 1

Fuselage geom screen

openvsp.vsp.FindActuatorDisk(disk_index)

Get the ID of a VSPAERO actuator disk at the specified index. An empty string is returned if the index is out of range.

# Add a propeller
prop_id = AddGeom( "PROP", "" )
SetParmVal( prop_id, "PropMode", "Design", PROP_DISK )
SetParmVal( prop_id, "Diameter", "Design", 6.0 )

Update()

# Setup the actuator disk VSPAERO parms
disk_id = FindActuatorDisk( 0 )
assert len( disk_id ) > 0, "FindActuatorDisk found nothing"

SetParmVal( FindParm( disk_id, "RotorRPM", "Rotor" ), 1234.0 )
SetParmVal( FindParm( disk_id, "RotorCT", "Rotor" ), 0.35 )
SetParmVal( FindParm( disk_id, "RotorCP", "Rotor" ), 0.55 )
SetParmVal( FindParm( disk_id, "RotorHubDiameter", "Rotor" ), 1.0 )

See also: PROP_MODE :param [in]: disk_index int Actuator disk index for the current VSPAERO set :rtype: string :return: string Actuator disk ID

openvsp.vsp.FindAllAttributes()

Returns a vector of string IDs for all Attributes in the vehicle

##==== Attributes: FindAllAttributes ====##
AttrIDs = FindAllAttributes()
assert len( AttrIDs ) > 0, "FindAllAttributes found nothing"
for AttrID in AttrIDs:
    print( AttrID )
Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector <string> Vector of All Attribute IDs

openvsp.vsp.FindAttributeByName(search_str, index)

Searches all attributes that contain the search string, case insensitive, and returns the user-specified index

##==== Attributes: FindAttributeByName ====##
AttrID = FindAttributeByName( "Watermark", 0 )
assert len( AttrID ) > 0, "FindAttributeByName found nothing"
print( AttrID )
Return type:

string

Returns:

string Returns a StringID of the attribute indexed/searched by user, if found

Parameters:
  • [in] – search_str string for filtering attributes in model

  • [in] – index int for indexing which of the vector of found attributes to select

openvsp.vsp.FindAttributeInCollection(obj_id, search_str, index)

Searches all attributes in an OpenVSP object or AttributeCollection that contain the search string, case insensitive, and returns the user-specified index. Works either with the ID of an object that contains an attributeCollection or just the ID of an attributeCollection.

##==== Attributes: FindAttributeInCollection ====##
VehID = GetVehicleID()
AttrID = FindAttributeInCollection( VehID, 'Watermark', 0 )
assert len( AttrID ) > 0, "FindAttributeInCollection found nothing"
print( AttrID )
Return type:

string

Returns:

string Returns a StringID of the attribute indexed/searched by user, if found

Parameters:
  • [in] – obj_id string id of object to search within for attributes

  • [in] – search_str string for filtering attributes in object

  • [in] – index int for indexing which of the vector of found attributes to select

openvsp.vsp.FindAttributeNamesInCollection(collID)

Return a list of all attribute Names within an attribute collection

##==== Attributes: FindAttributeNamesInCollection ====##
VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
AttrNames = FindAttributeNamesInCollection( CollID )
assert len( AttrNames ) > 0, "FindAttributeNamesInCollection found nothing"
for AttrName in AttrNames:
    print( AttrName )
Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<string> Array of result names

Parameters:

[in] – collID string ID of an attribute collection

openvsp.vsp.FindAttributedObjects()

Get array of IDs of all OpenVSP entities that have populated attributeCollections Includes attributeGroups

##==== Attributes: FindAttributedObjects ====##
AttachIDs = FindAttributedObjects()
assert len( AttachIDs ) > 0, "FindAttributedObjects found nothing"
for AttachID in AttachIDs:
    print( AttachID )
Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<string> Array of IDs of entities in OpenVSP that contain populated attribute collections

openvsp.vsp.FindAttributesByName(search_str)

Returns all attributes that contain the string search_str within their name, case insensitive

##==== Attributes: FindAttributesByName ====##
AttrIDs = FindAttributesByName( "Watermark" )
assert len( AttrIDs ) > 0, "FindAttributesByName found nothing"
for AttrID in AttrIDs:
    print( AttrID )
Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector <string> Vector of string IDs of matching Attributes

Parameters:

[in] – search_str string for filtering attributes in model

openvsp.vsp.FindAttributesInCollection(collID)

Get all attribute IDs within a single AttributeCollection, referenced by collID

##==== Attributes: FindAttributesInCollection ====##
VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
AttrIDs = FindAttributesInCollection( CollID )
assert len( AttrIDs ) > 0, "FindAttributesInCollection found nothing"
for AttrID in AttrIDs:
    print( AttrID )
Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<string> Vector of attribute IDs in an attribute collection.

Parameters:

[in] – collID string ID of an attribute collection

openvsp.vsp.FindContainer(name, index)

Get the ID of a Parm Container with specified name at input index

#===== Get Vehicle Parm Container ID ====//
veh_id = FindContainer( "Vehicle", 0 )
assert len( veh_id ) > 0, "FindContainer found nothing"

See also: FindContainersWithName :param [in]: name string Parm Container name :param [in]: index int Parm Container index :rtype: string :return: string Parm Container ID

openvsp.vsp.FindContainerGroupNames(parm_container_id)

Get an array of Parm group names included in the specified Container

user_ctr = FindContainer( "UserParms", 0 )

grp_arr = FindContainerGroupNames( user_ctr )
assert len( grp_arr ) > 0, "FindContainerGroupNames found nothing"

print( "---> UserParms Container Group IDs: " )
for i in range(int( len(grp_arr) )):

    message = "\t" + grp_arr[i] + "\n"

    print( message )
Parameters:

[in] – parm_container_id string Parm Container ID

Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<string> Array of Parm group names

openvsp.vsp.FindContainerParmIDs(parm_container_id)

Get an array of Parm IDs included in the specified Container

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

#==== Add FeaStructure to Pod ====//
struct_ind = AddFeaStruct( pod_id )

#==== Get Structure Name and Parm Container ID ====//
parm_container_name = GetFeaStructName( pod_id, struct_ind )

parm_container_id = FindContainer( parm_container_name, struct_ind )

#==== Get and List All Parms in the Container ====//
parm_ids = FindContainerParmIDs( parm_container_id )
assert len( parm_ids ) > 0, "FindContainerParmIDs found nothing"

for i in range(len(parm_ids)):

    name_id = GetParmName( parm_ids[i] ) + ": " + parm_ids[i] + "\n"

    print( name_id )
Parameters:

[in] – parm_container_id string Parm Container ID

Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<string> Array of Parm IDs

openvsp.vsp.FindContainers()

Get an array of all Parm Container IDs

ctr_arr = FindContainers()
assert len( ctr_arr ) > 0, "FindContainers found nothing"

print( "---> API Parm Container IDs: " )

for i in range(int( len(ctr_arr) )):

    message = "\t" + ctr_arr[i] + "\n"

    print( message )
Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<string> Array of Parm Container IDs

openvsp.vsp.FindContainersWithName(name)

Get an array of Parm Container IDs for Containers with the specified name

ctr_arr = FindContainersWithName( "UserParms" )
assert len( ctr_arr ) > 0, "FindContainersWithName found nothing"

if  len(ctr_arr) > 0 : print( ( "UserParms Parm Container ID: " + ctr_arr[0] ) )
Parameters:

[in] – name string Parm Container name

Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<string> Array of Parm Container IDs

openvsp.vsp.FindGeom(name, index)

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

#==== Add Pod Geometry ====//
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" )
    assert False, "---> Error: API FindGeom & FindGeomsWithName"

See also: FindGeomsWithName :param [in]: name string Geom name :param [in]: index :rtype: string :return: string Geom ID with name at specified index

openvsp.vsp.FindGeoms()

Find and return all Geom IDs in the model

#==== Add Pod Geometries ====//
pod1 = AddGeom( "POD", "" )
pod2 = AddGeom( "POD", "" )

#==== There Should Be Two Geoms =====//
geom_ids = FindGeoms()

if  len(geom_ids) != 2 :
    print( "---> Error: API FindGeoms " )
    assert False, "---> Error: API FindGeoms"
Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<string> Array of all Geom IDs

openvsp.vsp.FindGeomsWithName(name)

Find and return all Geom IDs with the specified name

#==== Add Pod Geometry ====//
pid = AddGeom( "POD", "" )

SetGeomName( pid, "ExamplePodName" )

geom_ids = FindGeomsWithName( "ExamplePodName" )

if  len(geom_ids) != 1 :
    print( "---> Error: API FindGeomsWithName " )
    assert False, "---> Error: API FindGeomsWithName"

See also: FindGeom :param [in]: name string Geom name :rtype: std::vector< std::string,std::allocator< std::string > > :return: vector<string> Array of Geom IDs

openvsp.vsp.FindLatestResultsID(name)

Find the latest results ID for particular result name

#==== Write Some Fake Test Results =====//
WriteTestResults()

results_array = GetAllResultsNames()

for i in range(int( len(results_array) )):

    resid = FindLatestResultsID( results_array[i] )
    assert len( resid ) > 0, "FindLatestResultsID found nothing"
    PrintResults( resid )
Parameters:

[in] – name string Result name

Return type:

string

Returns:

string Result ID

openvsp.vsp.FindParm(parm_container_id, parm_name, group_name)

Find a Parm ID given the Parm Container ID, Parm name, and Parm group

#==== Add Wing Geometry ====//
wing_id = AddGeom( "WING" )

#==== Turn Symmetry OFF ====//
sym_id = FindParm( wing_id, "Sym_Planar_Flag", "Sym")
assert len( sym_id ) > 0, "FindParm found nothing"

SetParmVal( sym_id, 0.0 ) # Note: bool input not supported in SetParmVal
Parameters:
  • [in] – parm_container_id string Parm Container ID

  • [in] – parm_name string Parm name

  • [in] – group_name string Parm group name

Return type:

string

Returns:

string Parm ID

openvsp.vsp.FindRST(geom_id, surf_indx, pt)

Determine the nearest (R, S, T) volume coordinate for an input (X, Y, Z) 3D coordinate point and calculate the distance between the 3D point and the found volume point.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

r = 0.12
s = 0.68
t = 0.56

pnt = CompPntRST( geom_id, surf_indx, r, s, t )


d, rout, sout, tout = FindRST( geom_id, surf_indx, pnt )

print( f"Dist {d} r {rout} s {sout} t {tout}" )

# pnt came from CompPntRST at r, s, t, so the search has to land back on it.
assert abs( d ) < 1e-6, "FindRST distance"
assert abs( rout - r ) < 1e-6 and abs( sout - s ) < 1e-6 and abs( tout - t ) < 1e-6, "FindRST r, s, t"

See also: FindRSTGuess :param [in]: geom_id string Parent Geom ID :param [in]: surf_indx int Main surface index from the parent Geom :param [in]: pt vec3d Input 3D coordinate point :param [out]: r_out double Output closest R (0 - 1.0) volume coordinate :param [out]: s_out double Output closest S (0 - 1.0) volume coordinate :param [out]: t_out double Output closest T (0 - 1.0) volume coordinate :rtype: float :return: double Distance between the 3D point and the closest point of the volume

openvsp.vsp.FindRSTGuess(geom_id, surf_indx, pt, r0, s0, t0)

Determine the nearest (R, S, T) volume coordinate for an input (X, Y, Z) 3D coordinate point given an initial guess of volume coordinates. Also calculate the distance between the 3D point and the found volume point.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

r = 0.12
s = 0.68
t = 0.56

pnt = CompPntRST( geom_id, surf_indx, r, s, t )


r0 = 0.1
s0 = 0.6
t0 = 0.5

d, rout, sout, tout = FindRSTGuess( geom_id, surf_indx, pnt, r0, s0, t0 )

print( f"Dist {d} r {rout} s {sout} t {tout}" )

# pnt came from CompPntRST at r, s, t, so the search has to land back on it.
assert abs( d ) < 1e-6, "FindRSTGuess distance"
assert abs( rout - r ) < 1e-6 and abs( sout - s ) < 1e-6 and abs( tout - t ) < 1e-6, "FindRSTGuess r, s, t"

See also: FindRST :param [in]: geom_id string Parent Geom ID :param [in]: surf_indx int Main surface index from the parent Geom :param [in]: pt vec3d Input 3D coordinate point :param [in]: r0 double Input R (0 - 1.0) volume coordinate guess :param [in]: s0 double Input S (0 - 1.0) volume coordinate guess :param [in]: t0 double Input T (0 - 1.0) volume coordinate guess :param [out]: r_out double Output closest R (0 - 1.0) volume coordinate :param [out]: s_out double Output closest S (0 - 1.0) volume coordinate :param [out]: t_out double Output closest T (0 - 1.0) volume coordinate :rtype: float :return: double Distance between the 3D point and the closest point of the volume

openvsp.vsp.FindRSTVec(geom_id, surf_indx, pts)

Determine the nearest volume coordinates for an input array of 3D coordinate points and calculate the distance between each 3D point and the found point in the volume.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

n = 5

rvec = [0]*n
svec = [0]*n
tvec = [0]*n

for i in range(n):

    rvec[i] = (i+1)*1.0/(n+1)

    svec[i] = (n-i)*1.0/(n+1)

    tvec[i] = (i+1)*1.0/(n+1)

ptvec = CompVecPntRST( geom_id, 0, rvec, svec, tvec )



routv, soutv, toutv, doutv = FindRSTVec( geom_id, 0, ptvec )

# Every point came from CompVecPntRST, so each search lands back on its own.
for i in range( n ):
    assert abs( doutv[i] ) < 1e-6, "FindRSTVec distance"
    assert abs( routv[i] - rvec[i] ) < 1e-6, "FindRSTVec r"
    assert abs( soutv[i] - svec[i] ) < 1e-6, "FindRSTVec s"
    assert abs( toutv[i] - tvec[i] ) < 1e-6, "FindRSTVec t"

See also: FindRSTVecGuess :param [in]: geom_id string Parent Geom ID :param [in]: surf_indx int Main surface index from the parent Geom :param [in]: pts vector<vec3d> Input vector of 3D coordinate points :param [out]: r_out_vec vector<double> Output vector of the closest R (0 - 1.0) volume coordinate for each 3D input point :param [out]: s_out_vec vector<double> Output vector of the closest S (0 - 1.0) volume coordinate for each 3D input point :param [out]: t_out_vec vector<double> Output vector of the closest T (0 - 1.0) volume coordinate for each 3D input point :param [out]: d_out_vec vector<double> Output vector of distances for each 3D point and the closest point of the volume

openvsp.vsp.FindRSTVecGuess(geom_id, surf_indx, pts, r0s, s0s, t0s)

Determine the nearest volume coordinates for an input array of 3D coordinate points and calculate the distance between each 3D point and the closest point of the volume. This function takes an input array of volume coordinate guesses for each 3D coordinate, offering a potential decrease in computation time compared to FindRSTVec.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

n = 5

rvec = [0]*n
svec = [0]*n
tvec = [0]*n

for i in range(n):

    rvec[i] = (i+1)*1.0/(n+1)

    svec[i] = (n-i)*1.0/(n+1)

    tvec[i] = (i+1)*1.0/(n+1)

ptvec = CompVecPntRST( geom_id, 0, rvec, svec, tvec )

for i in range(n):

    ptvec[i].set_xyz(ptvec[i].x() * 0.9, ptvec[i].y() * 0.9, ptvec[i].z() * 0.9)

 routv, soutv, toutv, doutv = FindRSTVecGuess( geom_id, 0, ptvec, rvec, svec, tvec )

 # The points above were scaled off the surface on purpose, so the search
 # does not return to the original r, s, t.  What must hold is that every
 # point got an answer and that the reported distances are real.
 assert len( routv ) == n and len( soutv ) == n and len( toutv ) == n and len( doutv ) == n, "FindRSTVecGuess result count"
 for i in range( len( doutv ) ):
     assert doutv[i] >= 0.0, "FindRSTVecGuess distance"

See also: FindRSTVec, :param [in]: geom_id string Parent Geom ID :param [in]: surf_indx int Main surface index from the parent Geom :param [in]: pts vector<vec3d> Input vector of 3D coordinate points :param [in]: r0s vector<double> Input vector of U (0 - 1.0) volume coordinate guesses :param [in]: s0s vector<double> Input vector of S (0 - 1.0) volume coordinate guesses :param [in]: t0s vector<double> Input vector of T (0 - 1.0) volume coordinate guesses :param [out]: r_out_vec vector<double> Output vector of the closest R (0 - 1.0) volume coordinate for each 3D input point :param [out]: s_out_vec vector<double> Output vector of the closest S (0 - 1.0) volume coordinate for each 3D input point :param [out]: t_out_vec vector<double> Output vector of the closest T (0 - 1.0) volume coordinate for each 3D input point :param [out]: d_out_vec vector<double> Output vector of distances for each 3D point and the closest point of the volume

openvsp.vsp.FindResultsID(name, index=0)

Find a results ID given its name and index

#==== Write Some Fake Test Results =====//
WriteTestResults()

res_id = FindResultsID( "Test_Results" )

if  len(res_id) == 0 :
    print( "---> Error: API FindResultsID" )
    assert False, "---> Error: API FindResultsID"
Parameters:
  • [in] – name string Result name

  • [in] – index int Result index

Return type:

string

Returns:

string Result ID

openvsp.vsp.FindUnsteadyGroup(group_index)

Get the ID of the VSPAERO unsteady group at the specified index. An empty string is returned if the index is out of range.

wing_id = AddGeom( "WING" )
pod_id = AddGeom( "POD" )

# Create an actuator disk
prop_id = AddGeom( "PROP", "" )
SetParmVal( prop_id, "PropMode", "Design", PROP_BLADES )

Update()

# Setup the unsteady group VSPAERO parms
disk_id = FindUnsteadyGroup( 1 ) # fixed components are in group 0 (wing & pod)
assert len( disk_id ) > 0, "FindUnsteadyGroup found nothing"

SetParmVal( FindParm( disk_id, "RPM", "UnsteadyGroup" ), 1234.0 )

See also: PROP_MODE :param [in]: group_index int Unsteady group index for the current VSPAERO set :rtype: string :return: string Unsteady group ID

openvsp.vsp.FitAfCST(xsec_surf_id, xsec_index, deg)

Fit a CST airfoil for an existing airfoil of type XS_FOUR_SERIES, XS_SIX_SERIES, XS_FOUR_DIGIT_MOD, XS_FIVE_DIGIT, XS_FIVE_DIGIT_MOD, XS_ONE_SIX_SERIES, or XS_FILE_AIRFOIL. :param [in]: xsec_surf_id string XsecSurf ID :param [in]: xsec_index int XSec index :param [in]: deg int CST degree

openvsp.vsp.FitAllViews()

Fit contents to all viewports

FitAllViews()
openvsp.vsp.FitBORAfCST(bor_id, deg)

Fit a CST airfoil for an existing airfoil of a BOR of type XS_FOUR_SERIES, XS_SIX_SERIES, XS_FOUR_DIGIT_MOD, XS_FIVE_DIGIT, XS_FIVE_DIGIT_MOD, XS_ONE_SIX_SERIES, or XS_FILE_AIRFOIL. :param [in]: bor_id string Body of revolution Geom ID :param [in]: deg int CST degree

openvsp.vsp.FitCSTAirfoil(xsec_surf_id, xsec_index, deg)

Convert an airfoil cross section to a CST airfoil fitted to the shape it already has, the way the Fit CST button on the airfoil panels does. A CST airfoil is described by coefficients rather than by a table or a series designation, which is what makes it useful for optimization; fitting is how an airfoil of any other type is brought into that form without changing shape.

wing_id = AddGeom( "WING", "" )

xsec_surf = GetXSecSurf( wing_id, 0 )

ChangeXSecShape( xsec_surf, 1, XS_FOUR_SERIES )

Update()

FitCSTAirfoil( xsec_surf, 1, 8 )

Update()

xsec = GetXSec( xsec_surf, 1 )

assert GetXSecShape( xsec ) == XS_CST_AIRFOIL, "FitCSTAirfoil did not convert the XSec"

# The fit is carried out at the degree that was asked for.
assert GetUpperCSTDegree( xsec ) == 8, "FitCSTAirfoil did not fit at the requested degree"
assert GetLowerCSTDegree( xsec ) == 8, "FitCSTAirfoil did not fit at the requested degree"

See also: ChangeXSecShape, GetUpperCSTCoefs, PromoteCSTUpper :param [in]: xsec_surf_id string XSecSurf ID :param [in]: xsec_index int XSec index :param [in]: deg int Degree to fit the CST airfoil at

openvsp.vsp.FitPlane(Vec3dVec pts, vec3d cen, vec3d norm)
openvsp.vsp.GDEV_ADD_CHOICE_ITEM = 17

Add item to custom GUI Choice

openvsp.vsp.GDEV_BEGIN_SAME_LINE = 27

Set begin same line flag for custom GUI

openvsp.vsp.GDEV_CHECK_BUTTON = 8

Custom GUI CheckButton

openvsp.vsp.GDEV_CHECK_BUTTON_BIT = 9

Custom GUI CheckButtonBit

openvsp.vsp.GDEV_CHOICE = 16

Custom GUI Choice

openvsp.vsp.GDEV_COLOR_PICKER = 24

Custom GUI ColorPicker

openvsp.vsp.GDEV_COUNTER = 15

Custom GUI Counter

openvsp.vsp.GDEV_DIVIDER_BOX = 26

Custom GUI divider box

openvsp.vsp.GDEV_END_SAME_LINE = 28

Set end same line flag for custom GUI

openvsp.vsp.GDEV_FORCE_WIDTH = 29

Set forced width for custom GUI

openvsp.vsp.GDEV_FRACT_PARM_SLIDER = 21

Custom GUI FractParmSlider

openvsp.vsp.GDEV_GROUP = 2

Custom GUI Group

openvsp.vsp.GDEV_INDEX_SELECTOR = 23

Custom GUI IndexSelector

openvsp.vsp.GDEV_INPUT = 4

Custom GUI Input

openvsp.vsp.GDEV_OUTPUT = 5

Custom GUI Output

openvsp.vsp.GDEV_PARM_BUTTON = 3

Custom GUI ParmButton

openvsp.vsp.GDEV_RADIO_BUTTON = 10

Custom GUI RadioButton

openvsp.vsp.GDEV_SCROLL_TAB = 1

Custom GUI Fl_Scroll and Tab

openvsp.vsp.GDEV_SET_FORMAT = 30

Set format label for custom GUI

openvsp.vsp.GDEV_SLIDER = 6

Custom GUI Slider

openvsp.vsp.GDEV_SLIDER_ADJ_RANGE = 7

Custom GUI SliderAdjRangeInput

openvsp.vsp.GDEV_SLIDER_ADJ_RANGE_INPUT = 19

Custom GUI SliderAdjRangeInput

openvsp.vsp.GDEV_SLIDER_ADJ_RANGE_TWO_INPUT = 20

Custom GUI SliderAdjRangeInput with two inputs (NOT IMPLEMENTED)

openvsp.vsp.GDEV_SLIDER_INPUT = 18

Custom GUI SliderInput

openvsp.vsp.GDEV_STRING_INPUT = 22

Custom GUI StringInput

openvsp.vsp.GDEV_TAB = 0

Custom GUI Tab

openvsp.vsp.GDEV_TOGGLE_BUTTON = 11

Custom GUI ToggleButton

openvsp.vsp.GDEV_TOGGLE_BUTTON_FREE = 12

Custom GUI ToggleButton without Parm

openvsp.vsp.GDEV_TOGGLE_RADIO_GROUP = 13

Custom GUI ToggleRadioGroup (NOT IMPLEMENTED)

openvsp.vsp.GDEV_TRIGGER_BUTTON = 14

Custom GUI TriggerButton

openvsp.vsp.GDEV_YGAP = 25

Custom GUI Y gap

openvsp.vsp.GEAR_CG_TIPBACK_ANALYSIS = 5

Calculate tipback angle

openvsp.vsp.GEAR_CONFIGURATION_ALL = 4

Gear drawn in all configurations

openvsp.vsp.GEAR_CONFIGURATION_DOWN = 0

Gear drawn down

openvsp.vsp.GEAR_CONFIGURATION_INTERMEDIATE = 3

Gear drawn somewhere beteween down and up

openvsp.vsp.GEAR_CONFIGURATION_UP = 1

Gear drawn up

openvsp.vsp.GEAR_CONFIGURATION_UP_AND_DOWN = 2

Gear drawn both up and down

openvsp.vsp.GEAR_GEOM_SCREEN = 19

Gear geom screen

openvsp.vsp.GEAR_MECHANISM = 1

Specified by mechanism

openvsp.vsp.GEAR_STOWED_POSITION = 0

Specified by stowed position

openvsp.vsp.GEAR_SUSPENSION_COMPRESSED = 1

Gear suspension is compressed

openvsp.vsp.GEAR_SUSPENSION_EXTENDED = 2

Gear suspension is extended

openvsp.vsp.GEAR_SUSPENSION_NOMINAL = 0

Gear suspension at nominal extension

openvsp.vsp.GEAR_TIPOVER_ANALYSIS = 8

Calculate tipover angle

openvsp.vsp.GEAR_TURN_ANALYSIS = 9

Calculate ground manueveribility

openvsp.vsp.GEAR_WEIGHT_DISTRIBUTION_ANALYSIS = 7

Calculate distribution of weight across landing gear

openvsp.vsp.GENERIC_FRAGMENT = 5

Generic fragment

openvsp.vsp.GEOM_BOUNDARY = 2

Geom boundary

openvsp.vsp.GEOM_DRAW_HIDDEN = 1

Draw the hidden mesh

openvsp.vsp.GEOM_DRAW_NONE = 4

Do not draw anything

openvsp.vsp.GEOM_DRAW_SHADE = 2

Draw the shaded mesh

openvsp.vsp.GEOM_DRAW_TEXTURE = 3

Draw the textured mesh

openvsp.vsp.GEOM_DRAW_WIRE = 0

Draw the wireframe mesh (see through)

openvsp.vsp.GEOM_PROJ = 3

Project toward a Geom

openvsp.vsp.GEOM_TARGET = 1

Geom target type

openvsp.vsp.GEOM_XSECS = 2

GeomXSec Geom type

openvsp.vsp.GROW_LIMIT_CURV_GAP = 10

Maximum growth limit from maximum gap.

openvsp.vsp.GROW_LIMIT_CURV_NCIRCSEG = 11

Maximum growth limit from number of segments to define a circle.

openvsp.vsp.GROW_LIMIT_INCREMENT = 8

Reason increment when adding growth limit constraint.

openvsp.vsp.GROW_LIMIT_MAX_LEN_CONSTRAINT = 9

Maximum growth limit from maximum edge length (not used, growth limited small to large).

openvsp.vsp.GROW_LIMIT_MIN_LEN_CONSTRAINT = 13

Maximum growth limit from minimum length constraint.

openvsp.vsp.GROW_LIMIT_MIN_LEN_CONSTRAINT_CURV_GAP = 14

Maximum growth limit from maximum gap constrained by minimum length.

openvsp.vsp.GROW_LIMIT_MIN_LEN_CONSTRAINT_CURV_NCIRCSEG = 15

Maximum growth limit from number of segments to define a circle constrained by minimum length.

openvsp.vsp.GROW_LIMIT_MIN_LEN_CONSTRAINT_SOURCES = 16

Maximum growth limit from sources constrained by minimum length.

openvsp.vsp.GROW_LIMIT_SOURCES = 12

Maximum growth limit from mesh sources.

openvsp.vsp.GetActiveCSNameVec(CSGroupIndex)

Get the names of each active (used) control surface in the control surface group at the specified index

wid = AddGeom( "WING", "" )                             # Add Wing

aileron_id = AddSubSurf( wid, SS_CONTROL )                      # Add Control Surface Sub-Surface

group_index = CreateVSPAEROControlSurfaceGroup() # Empty control surface group

AddAllToVSPAEROControlSurfaceGroup( group_index )

cs_name_vec = GetActiveCSNameVec( group_index )
assert len( cs_name_vec ) > 0, "GetActiveCSNameVec returned nothing"

print( "Active CS in Group Index #", False )
print( group_index )

for i in range(int( len(cs_name_vec) )):

    print( cs_name_vec[i] )
Parameters:

[in] – CSGroupIndex int Index of the control surface group

Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector <string> Array of active control surface names

openvsp.vsp.GetActiveGeometryAnalysis()

Get the ID of the active Geometry Analysis case.

ga_id = AddGeometryAnalysis()
SetActiveGeometryAnalysis( ga_id )
active = GetActiveGeometryAnalysis()
assert len( active ) > 0, "GetActiveGeometryAnalysis returned nothing"

See also: SetActiveGeometryAnalysis :rtype: string :return: string Active Geometry Analysis case ID (empty string if none)

openvsp.vsp.GetAdvLinkCode(index)

Get the code from an advanced link

pod = AddGeom( "POD", "" )
length = FindParm( pod, "Length", "Design" )
x_pos = GetParm( pod, "X_Rel_Location", "XForm" )

AddAdvLink( "ExampleLink" )
indx = GetLinkIndex( "ExampleLink" )
AddAdvLinkInput( indx, length, "len" )
AddAdvLinkOutput( indx, x_pos, "x" )

SetAdvLinkCode( indx, "x = 10.0 - len;" )

BuildAdvLinkScript( indx )

code = GetAdvLinkCode( indx )
assert len( code ) > 0, "GetAdvLinkCode returned nothing"

print( code )
Parameters:

[in] – index int Index for advanced link

Return type:

string

Returns:

string String containing advanced link code

openvsp.vsp.GetAdvLinkInputNames(index)

Get the name of all the inputs to a specified advanced link index

pod = AddGeom( "POD", "" )
length = FindParm( pod, "Length", "Design" )
x_pos = GetParm( pod, "X_Rel_Location", "XForm" )

AddAdvLink( "ExampleLink" )
indx = GetLinkIndex( "ExampleLink" )
AddAdvLinkInput( indx, length, "len" )
AddAdvLinkOutput( indx, x_pos, "x" )

SetAdvLinkCode( indx, "x = 10.0 - len;" )

BuildAdvLinkScript( indx )

name_array = GetAdvLinkInputNames( indx )
assert len( name_array ) > 0, "GetAdvLinkInputNames returned nothing"

for n in range(len(name_array) ):

    print( name_array[n] )
Parameters:

[in] – index int Advanced link index

Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<string> Array of advanced link input names

openvsp.vsp.GetAdvLinkInputParms(index)

Get the Parm IDs of all the inputs to a specified advanced link index

pod = AddGeom( "POD", "" )
length = FindParm( pod, "Length", "Design" )
x_pos = GetParm( pod, "X_Rel_Location", "XForm" )

AddAdvLink( "ExampleLink" )
indx = GetLinkIndex( "ExampleLink" )
AddAdvLinkInput( indx, length, "len" )
AddAdvLinkOutput( indx, x_pos, "x" )

SetAdvLinkCode( indx, "x = 10.0 - len;" )

BuildAdvLinkScript( indx )

parm_array = GetAdvLinkInputParms( indx )
assert len( parm_array ) > 0, "GetAdvLinkInputParms returned nothing"

for n in range( len(parm_array) ):

    print( parm_array[n] )
Parameters:

[in] – index int Advanced link index

Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<string> Array of advanced link input Parm IDs

openvsp.vsp.GetAdvLinkName(index)

Delete an advanced link specified by index

pod = AddGeom( "POD", "" )
length = FindParm( pod, "Length", "Design" )
x_pos = GetParm( pod, "X_Rel_Location", "XForm" )

AddAdvLink( "ExampleLink" )
indx = GetLinkIndex( "ExampleLink" )
AddAdvLinkInput( indx, length, "len" )
AddAdvLinkOutput( indx, x_pos, "x" )

SetAdvLinkCode( indx, "x = 10.0 - len;" )

BuildAdvLinkScript( indx )

num_before_del = len( GetAdvLinkNames() )
DelAdvLink( indx )
assert len( GetAdvLinkNames() ) < num_before_del, "DelAdvLink removed nothing"


link_array = GetAdvLinkNames()

# Should print nothing.
for n in range(len(link_array) ):

    print( link_array[n] )

assert len( link_array ) == 0, "links were left behind"

# With the link gone, the Pod is no longer driven.
x_before = GetParmVal( x_pos )

SetParmValUpdate( length, 7.0 )

Update()

assert abs( GetParmVal( x_pos ) - x_before ) < 1e-9, "a deleted advanced link is still driving its output"
Parameters:

[in] – index int Index for advanced link

Get the name of an advanced link.

AddAdvLink( "ExampleLink" )

indx = GetLinkIndex( "ExampleLink" )

assert GetAdvLinkName( indx ) == "ExampleLink", "GetAdvLinkName did not report the name the link was created with"

# The single name and the list of names agree.
link_array = GetAdvLinkNames()

assert len( link_array ) == 1, "GetAdvLinkName disagrees with GetAdvLinkNames"
assert link_array[0] == GetAdvLinkName( indx ), "GetAdvLinkName disagrees with GetAdvLinkNames"

# An index past the end has to be rejected.  The error queue is reached
# through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

GetAdvLinkName( 100 )

assert err_mgr.GetNumTotalErrors() > 0, "GetAdvLinkName accepted an index past the end"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: AddAdvLink, GetAdvLinkNames, SetAdvLinkName :param [in]: index int Advanced link index :rtype: string :return: string Advanced link name

openvsp.vsp.GetAdvLinkNames()

Get an array of all advanced link names

#==== Set up an advanced link so there is something to find ====//
pod = AddGeom( "POD", "" )
length = FindParm( pod, "Length", "Design" )
x_pos = GetParm( pod, "X_Rel_Location", "XForm" )

AddAdvLink( "ExampleLink" )
indx = GetLinkIndex( "ExampleLink" )
AddAdvLinkInput( indx, length, "len" )
AddAdvLinkOutput( indx, x_pos, "x" )

link_array = GetAdvLinkNames()
assert len( link_array ) > 0, "GetAdvLinkNames returned nothing"

for n in range(len(link_array) ):

    print( link_array[n] )
Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<string> Array of advanced link names

openvsp.vsp.GetAdvLinkOutputNames(index)

Get the Parm IDs of all the outputs to a specified advanced link index

pod = AddGeom( "POD", "" )
length = FindParm( pod, "Length", "Design" )
x_pos = GetParm( pod, "X_Rel_Location", "XForm" )

AddAdvLink( "ExampleLink" )
indx = GetLinkIndex( "ExampleLink" )
AddAdvLinkInput( indx, length, "len" )
AddAdvLinkOutput( indx, x_pos, "x" )

SetAdvLinkCode( indx, "x = 10.0 - len;" )

BuildAdvLinkScript( indx )

name_array = GetAdvLinkOutputNames( indx )
assert len( name_array ) > 0, "GetAdvLinkOutputNames returned nothing"

for n in range( len(name_array) ):

    print( name_array[n] )
Parameters:

[in] – index int Advanced link index

Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<string> Array of advanced link output names

openvsp.vsp.GetAdvLinkOutputParms(index)

Get the Parm IDs of all the outputs to a specified advanced link index

pod = AddGeom( "POD", "" )
length = FindParm( pod, "Length", "Design" )
x_pos = GetParm( pod, "X_Rel_Location", "XForm" )

AddAdvLink( "ExampleLink" )
indx = GetLinkIndex( "ExampleLink" )
AddAdvLinkInput( indx, length, "len" )
AddAdvLinkOutput( indx, x_pos, "x" )

SetAdvLinkCode( indx, "x = 10.0 - len;" )

BuildAdvLinkScript( indx )

parm_array = GetAdvLinkOutputParms( indx )
assert len( parm_array ) > 0, "GetAdvLinkOutputParms returned nothing"

for n in range( len(parm_array) ):

    print( parm_array[n] )
Parameters:

[in] – index int Advanced link index

Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<string> Array of advanced link output Parm IDs

openvsp.vsp.GetAirfoilCoordinates(geom_id, foilsurf_u)

Get the untwisted unit-length 2D coordinate points for the specified airfoil See also: WriteSeligAirfoil :param [in]: geom_id string Geom ID :param [in]: foilsurf_u double U location (range: 0 - 1) along the surface. The foil surface does not include root and tip caps (i.e. 2 section wing -> XSec0 @ u=0, XSec1 @ u=0.5, XSec2 @ u=1.0)

openvsp.vsp.GetAirfoilLowerPnts(xsec_id)

Get the coordinate points for the lower surface of an airfoil. The XSec must be of type XS_FILE_AIRFOIL

# Add Fuselage Geom
fuseid = AddGeom( "FUSELAGE", "" )

xsec_surf = GetXSecSurf( fuseid, 0 )

ChangeXSecShape( xsec_surf, 1, XS_FILE_AIRFOIL )

xsec = GetXSec( xsec_surf, 1 )

ReadFileAirfoil( xsec, "airfoil/N0012_VSP.af" )

low_array = GetAirfoilLowerPnts( xsec )
assert len( low_array ) > 0, "GetAirfoilLowerPnts returned nothing"

See also: SetAirfoilPnts :param [in]: xsec_id string XSec ID :rtype: std::vector< vec3d,std::allocator< vec3d > > :return: vector<vec3d> Vector of coordinate points for the lower airfoil surface

openvsp.vsp.GetAirfoilUpperPnts(xsec_id)

Get the coordinate points for the upper surface of an airfoil. The XSec must be of type XS_FILE_AIRFOIL

# Add Fuselage Geom
fuseid = AddGeom( "FUSELAGE", "" )

xsec_surf = GetXSecSurf( fuseid, 0 )

ChangeXSecShape( xsec_surf, 1, XS_FILE_AIRFOIL )

xsec = GetXSec( xsec_surf, 1 )

ReadFileAirfoil( xsec, "airfoil/N0012_VSP.af" )

up_array = GetAirfoilUpperPnts( xsec )
assert len( up_array ) > 0, "GetAirfoilUpperPnts returned nothing"

See also: SetAirfoilPnts :param [in]: xsec_id string XSec ID :rtype: std::vector< vec3d,std::allocator< vec3d > > :return: vector<vec3d> VectorArray of coordinate points for the upper airfoil surface

openvsp.vsp.GetAllBackground3DAbsolutePaths()

Get absolute paths to all Background3D images in model.

# Add Background3D
AddBackground3D()
AddBackground3D()
AddBackground3D()

bg_file_array = GetAllBackground3DAbsolutePaths()
assert len( bg_file_array ) > 0, "GetAllBackground3DAbsolutePaths returned nothing"

for n in range( len( bg_file_array ) ):
    print( bg_file_array[n] )

DelAllBackground3Ds()
Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<string> Vector of absolute paths to Background3D image files

openvsp.vsp.GetAllBackground3DRelativePaths()

Get relative paths to all Background3D images in model. Note that path is relative to the model’s *.vsp3 file. Consequently, if a file has not yet been saved or assigned a file name, the relative path is meaningless.

# Add Background3D
AddBackground3D()
AddBackground3D()
AddBackground3D()

bg_file_array = GetAllBackground3DRelativePaths()
assert len( bg_file_array ) > 0, "GetAllBackground3DRelativePaths returned nothing"

for n in range( len( bg_file_array ) ):
    print( bg_file_array[n] )

DelAllBackground3Ds()
Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<string> Vector of relative paths to Background3D image files

openvsp.vsp.GetAllBackground3Ds()

Get id’s of all Background3Ds in model

nbg = GetNumBackground3Ds()

# Add Background3D
AddBackground3D()
AddBackground3D()
AddBackground3D()

if GetNumBackground3Ds() != nbg + 3 :
    print( "ERROR: AddBackground3D" )
    assert False, "ERROR: AddBackground3D"

bg_array = GetAllBackground3Ds()

for n in range( len( bg_array ) ):
    print( bg_array[n] )

DelAllBackground3Ds()
Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<string> Vector of Background3D IDs

openvsp.vsp.GetAllBogies(gear_id)

Get the ParmContainer IDs of all the Bogies in the specified GearGeom, in list order.

gear_id = AddGeom( "GEAR", "" )

CreateAndAddBogie( gear_id )
CreateAndAddBogie( gear_id )

bogie_ids = GetAllBogies( gear_id )
assert len( bogie_ids ) > 0, "GetAllBogies returned nothing"

See also: CreateAndAddBogie, GetNumBogies, DelBogie :param [in]: gear_id string GearGeom Geom ID :rtype: std::vector< std::string,std::allocator< std::string > > :return: vector<string> Vector of Bogie ParmContainer IDs

openvsp.vsp.GetAllDataNames(results_id)

Get all data names for a particular result

#==== Write Some Fake Test Results =====//
WriteTestResults()

res_id = FindResultsID( "Test_Results" )

data_names = GetAllDataNames( res_id )

if  len(data_names) != 5 :
    print( "---> Error: API GetAllDataNames" )
    assert False, "---> Error: API GetAllDataNames"
Parameters:

[in] – results_id string Result ID

Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<string> Array of result names

openvsp.vsp.GetAllFeaPolySparPtIDVec(pspar_id)

Get a vector of IDs for all points in an FEA Poly Spar. Each ID is a ParmContainer ID that can be used with FindParm to access the point’s parameters such as Eta, U01, U0N, and XoC.

wing_id = AddGeom( "WING" )

struct_ind = AddFeaStruct( wing_id )

pspar_id = AddFeaPart( wing_id, struct_ind, FEA_POLY_SPAR )

AddFeaPolySparPt( pspar_id )

pt_ids = GetAllFeaPolySparPtIDVec( pspar_id )

if len( pt_ids ) != 3:
    print( "Error: GetAllFeaPolySparPtIDVec" )
    assert False, "Error: GetAllFeaPolySparPtIDVec"

# Set each point's spanwise eta location
SetParmVal( FindParm( pt_ids[0], "Eta", "FeaPolySparPoint" ), 0.1 )
SetParmVal( FindParm( pt_ids[1], "Eta", "FeaPolySparPoint" ), 0.5 )
SetParmVal( FindParm( pt_ids[2], "Eta", "FeaPolySparPoint" ), 0.9 )

See also: GetFeaPolySparPtID, FindParm, SetParmVal :param [in]: pspar_id string FEA Poly Spar part ID :rtype: std::vector< std::string,std::allocator< std::string > > :return: vector <string> Vector of Poly Spar point ParmContainer IDs

openvsp.vsp.GetAllGeometryAnalysesIDVec()

Get a vector of all Geometry Analysis case IDs in the Geometry Analysis Manager.

##==== GeometryAnalysis: List all cases ====##
ga_id_1 = AddGeometryAnalysis()
ga_id_2 = AddGeometryAnalysis()
ga_ids = GetAllGeometryAnalysesIDVec()
assert len( ga_ids ) > 0, "GetAllGeometryAnalysesIDVec returned nothing"
for ga_id in ga_ids:
    print( "Geometry Analysis ID: ", ga_id )

See also: AddGeometryAnalysis, DeleteGeometryAnalysis, DeleteAllGeometryAnalyses :rtype: std::vector< std::string,std::allocator< std::string > > :return: vector<string> Array of all Geometry Analysis case IDs

openvsp.vsp.GetAllModes()

Get all ModeID’s in model.

# Illustrating use of Modes requires substantial setup of the model including components, sets, and variable presets.
#
# Setup boiler plate.
pod1 = AddGeom( "POD", "" )
wing = AddGeom( "WING", pod1 )

SetParmVal( wing, "Trans_Attach_Flag", "Attach", ATTACH_TRANS_LMN )
SetParmVal( wing, "L_Attach_Location", "Attach", 0.35 )

SetSetName( SET_FIRST_USER, "NonLifting" )
SetSetName( SET_FIRST_USER + 1, "Lifting" )

SetSetFlag( pod1, SET_FIRST_USER, True )
SetSetFlag( wing, SET_FIRST_USER + 1, True )


gid = AddVarPresetGroup( "Tess" )

p1 = FindParm( pod1, "Tess_U", "Shape" )
AddVarPresetParm( gid, p1 )

p2 = FindParm( pod1, "Tess_W", "Shape" )
AddVarPresetParm( gid, p2 )

sid = AddVarPresetSetting( gid, "Default" )
SaveVarPresetParmVals( gid, sid )

sid1 = AddVarPresetSetting( gid, "Coarse" )
SetVarPresetParmVal( gid, sid1, p1, 3 )
SetVarPresetParmVal( gid, sid1, p2, 5 )

sid2 = AddVarPresetSetting( gid, "Fine" )
SetVarPresetParmVal( gid, sid2, p1, 35 )
SetVarPresetParmVal( gid, sid2, p2, 21 )


gid2 = AddVarPresetGroup( "Design" )

p3 = FindParm( pod1, "Length", "Design" )
AddVarPresetParm( gid2, p3 )

p4 = FindParm( pod1, "FineRatio", "Design" )
AddVarPresetParm( gid2, p4 )

sid3 = AddVarPresetSetting( gid2, "Normal" )
SaveVarPresetParmVals( gid2, sid3 )

sid4 = AddVarPresetSetting( gid2, "ShortFat" )
SetVarPresetParmVal( gid2, sid4, p3, 3.0 )
SetVarPresetParmVal( gid2, sid4, p4, 5.0 )

sid5 = AddVarPresetSetting( gid2, "LongThin" )
SetVarPresetParmVal( gid2, sid5, p3, 20.0 )
SetVarPresetParmVal( gid2, sid5, p4, 35.0 )

# End of setup boiler plate.

mid1 = CreateAndAddMode( "FatWetAreas", SET_ALL, SET_NONE )
ModeAddGroupSetting( mid1, gid, sid1 )
ModeAddGroupSetting( mid1, gid2, sid4 )

mid2 = CreateAndAddMode( "ThinAero", SET_FIRST_USER, SET_FIRST_USER + 1 )
ModeAddGroupSetting( mid2, gid, sid2 )
ModeAddGroupSetting( mid2, gid2, sid5 )

ApplyModeSettings( mid2 )
Update()

modids = GetAllModes();
assert len( modids ) > 0, "GetAllModes returned nothing"
Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

array<string> array of Mode IDs

openvsp.vsp.GetAllProbes()

Get an array of all Probe IDs from the Measure Tool

pid1 = AddGeom( "POD", "" )

SetParmVal( pid1, "Y_Rel_Location", "XForm", 2.0 )

probe_id = AddProbe( pid1, 0, 0.5, 0.8, "Probe 1" )

probe_array = GetAllProbes()
assert len( probe_array ) > 0, "GetAllProbes returned nothing"

print( "One Probe: ", False )

print( probe_array[0] )
Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<string> Array of Probe IDs

openvsp.vsp.GetAllProtractors()

Get an array of all Protractor IDs from the Measure Tool

pod1 = AddGeom( "POD", "" )

AddProtractor( pod1, 0, 0.2, 0.0, pod1, 0, 0.5, 0.0, pod1, 0, 0.8, 0.0, "Protractor_1" )
AddProtractor( pod1, 0, 0.1, 0.0, pod1, 0, 0.4, 0.0, pod1, 0, 0.7, 0.0, "Protractor_2" )

prot_array = GetAllProtractors()

assert len( prot_array ) == 2, "GetAllProtractors did not report both protractors"
assert prot_array[0] != prot_array[1], "GetAllProtractors reported the same protractor twice"

See also: AddProtractor, DelProtractor, DeleteAllProtractors :rtype: std::vector< std::string,std::allocator< std::string > > :return: vector<string> Array of Protractor IDs

openvsp.vsp.GetAllRSTProbes()

Get an array of all RST Probe IDs from the Measure Tool

pod1 = AddGeom( "POD", "" )

AddRSTProbe( pod1, 0, 0.5, 0.5, 0.5, "RSTProbe_1" )
AddRSTProbe( pod1, 0, 0.25, 0.5, 0.5, "RSTProbe_2" )

probe_array = GetAllRSTProbes()

assert len( probe_array ) == 2, "GetAllRSTProbes did not report both probes"
assert probe_array[0] != probe_array[1], "GetAllRSTProbes reported the same probe twice"

See also: AddRSTProbe, DelRSTProbe, DeleteAllRSTProbes :rtype: std::vector< std::string,std::allocator< std::string > > :return: vector<string> Array of RST Probe IDs

openvsp.vsp.GetAllResultsNames()

Get the name of all results in the Results Manager

#==== Write Some Fake Test Results =====//
WriteTestResults()

results_array = GetAllResultsNames()
assert len( results_array ) > 0, "GetAllResultsNames returned nothing"

for i in range(int( len(results_array) )):

    resid = FindLatestResultsID( results_array[i] )
    PrintResults( resid )
Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<string> Array of result names

openvsp.vsp.GetAllRoutingPtCoords(routing_id, symm_index)

Get the coordinate locations along a RoutingGeom. The main copy is symm_index = 0.

pod1 = vsp.AddGeom('POD', '')

pod2 = vsp.AddGeom('POD', '')
ypod2 = vsp.GetParm(pod2, 'Y_Rel_Location', 'XForm')
vsp.SetParmVal(ypod2, 2.0)

routing_geom = vsp.AddGeom('ROUTING', '')

rpt0 = vsp.AddRoutingPt(routing_geom, pod1, 0)
u0 = vsp.GetParm( rpt0, 'U', 'RoutePt')
vsp.SetParmVal(u0, 0.0)

rpt1 = vsp.AddRoutingPt(routing_geom, pod2, 0)

rpt2 = vsp.AddRoutingPt(routing_geom, pod1, 0)
u2 = vsp.GetParm( rpt2, 'U', 'RoutePt')
vsp.SetParmVal(u2, 1.0)

vsp.Update()
pvec = vsp.GetAllRoutingPtCoords(routing_geom, 0)

# One coordinate per routing point, in the order they were added.
assert len( pvec ) == 3, "GetAllRoutingPtCoords returned the wrong number of points"

# rpt0 sits at the nose of pod1 and rpt2 at its tail, both on the
# centerline.  rpt1 rides on pod2, two units out in Y.
assert abs( pvec[0].y() ) < 1e-6, "GetAllRoutingPtCoords did not follow the parent Geoms"
assert abs( pvec[1].y() - 2.0 ) < 1e-6, "GetAllRoutingPtCoords did not follow the parent Geoms"
assert abs( pvec[2].y() ) < 1e-6, "GetAllRoutingPtCoords did not follow the parent Geoms"

assert pvec[2].x() > pvec[0].x(), "GetAllRoutingPtCoords did not order the points by U"

assert vsp.dist( pvec[1], vsp.GetMainRoutingPtCoord( rpt1 ) ) < 1e-6, "GetAllRoutingPtCoords disagrees with GetMainRoutingPtCoord"

See also: AddRoutingPt, DelRoutingPt, GetMainRoutingPtCoord, GetRoutingPtCoord, GetRoutingCurve :param [in]: routing_id string RoutingGeom Geom ID :param [in]: symm_index int Symmetry index to get coordinate of :rtype: std::vector< vec3d,std::allocator< vec3d > > :return: vector < vec3d > coordinate of routing points along RoutingGeom

openvsp.vsp.GetAllRoutingPtIds(routing_id)

Get the ParmContainer IDs of all the routing points within a RoutingGeom. The vector will contain the IDs in order.

pod1 = vsp.AddGeom('POD', '')

pod2 = vsp.AddGeom('POD', '')
ypod2 = vsp.GetParm(pod2, 'Y_Rel_Location', 'XForm')
vsp.SetParmVal(ypod2, 2.0)

routing_geom = vsp.AddGeom('ROUTING', '')

rpt0 = vsp.AddRoutingPt(routing_geom, pod1, 0)
u0 = vsp.GetParm( rpt0, 'U', 'RoutePt')
vsp.SetParmVal(u0, 0.0)

rpt1 = vsp.AddRoutingPt(routing_geom, pod2, 0)

rpt2 = vsp.AddRoutingPt(routing_geom, pod1, 0)
u2 = vsp.GetParm( rpt2, 'U', 'RoutePt')
vsp.SetParmVal(u2, 1.0)

rpts = vsp.GetAllRoutingPtIds(routing_geom)

See also: AddRoutingPt, DelAllRoutingPt, GetRoutingPtId :param [in]: routing_id string RoutingGeom Geom ID :rtype: std::vector< std::string,std::allocator< std::string > > :return: vector<string> Vector of routing point ParmConatiner IDs

openvsp.vsp.GetAllRulers()

Get an array of all Ruler IDs from the Measure Tool

pid1 = AddGeom( "POD", "" )

SetParmVal( pid1, "Y_Rel_Location", "XForm", 2.0 )

pid2 = AddGeom( "POD", "" )

SetParmVal( pid2, "Z_Rel_Location", "XForm", 4.0 )

rid1 = AddRuler( pid1, 1, 0.2, 0.3, pid2, 0, 0.2, 0.3, "Ruler 1" )

rid2 = AddRuler( pid1, 0, 0.4, 0.6, pid1, 1, 0.8, 0.9, "Ruler 2" )

ruler_array = GetAllRulers()
assert len( ruler_array ) > 0, "GetAllRulers returned nothing"

print("Two Rulers")

for n in range(len(ruler_array)):

    print( ruler_array[n] )
Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<string> Vector of Ruler IDs

openvsp.vsp.GetAllSubSurfIDs()

Get a vector of all sub-surface IDs for the entire model :rtype: std::vector< std::string,std::allocator< std::string > > :return: vector<string> Array of sub-surface IDs

openvsp.vsp.GetAllUserParms()

Get the vector of id’s for all user parameters

id_arr = GetAllUserParms()
assert len( id_arr ) > 0, "GetAllUserParms returned nothing"

print( "---> User Parm IDs: " )

for i in range(int( len(id_arr) )):

    message = "\t" + id_arr[i] + "\n"

    print( message )
Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector <string> Array of user parameter ids

openvsp.vsp.GetAnalysisDoc(analysis)

Get the analysis documentation string

analysis_name = "VSPAEROComputeGeometry"

doc = GetAnalysisDoc( analysis_name )
assert len( doc ) > 0, "GetAnalysisDoc returned nothing"
Parameters:

[in] – analysis string Analysis name

Return type:

string

Returns:

string Documentation string

openvsp.vsp.GetAnalysisInputDoc(analysis, name)

Get the documentation string for the particular analysis and input

Parameters:
  • [in] – analysis string Analysis name

  • [in] – name string Input name

Return type:

string

Returns:

string Documentation string

openvsp.vsp.GetAnalysisInputNames(analysis)

Get the name of every available input for a particular analysis

analysis_name = "VSPAEROComputeGeometry"

in_names =  GetAnalysisInputNames( analysis_name )
assert len( in_names ) > 0, "GetAnalysisInputNames returned nothing"

print("Analysis Inputs: ")

for i in range(int( len(in_names) )):

    print( ( "\t" + in_names[i] + "\n" ) )
Parameters:

[in] – analysis string Analysis name

Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<string> Array of input names

openvsp.vsp.GetAnalysisInputType(analysis, name)

Get the data type for a particulat analysis type and input

analysis = "VSPAEROComputeGeometry"

inp_array = GetAnalysisInputNames( analysis )

assert len( inp_array ) > 0, "GetAnalysisInputNames returned nothing"

for j in range(int( len(inp_array) )):

    typ = GetAnalysisInputType( analysis, inp_array[j] )

    # Every input the analysis lists has to report a real data type.
    assert typ != INVALID_TYPE, "GetAnalysisInputType returned INVALID_TYPE for " + inp_array[j]

# An input that does not exist has to report INVALID_TYPE.
assert GetAnalysisInputType( analysis, "NoSuchInput" ) == INVALID_TYPE, "GetAnalysisInputType accepted an unknown input"

# That lookup failure was raised deliberately, so take it back off the queue.
err_mgr = ErrorMgrSingleton.getInstance()

while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: RES_DATA_TYPE :param [in]: analysis string Analysis name :param [in]: name string Input name :rtype: int :return: int Data type enum (i.e. DOUBLE_DATA)

openvsp.vsp.GetAndResetUpdateCount()

Return the OpenVSP update count and also reset it to zero.

The OpenVSP update count tracks how many times the GUI has been told to update screens (set to dirty). It provides a simple means of testing whether the OpenVSP state has possibly changed (non-zero returned). Nothing marks a screen dirty when no GUI is running, so the count stays at zero in a plain script.

#==== Add Pod Geometry ====//
pid = AddGeom( "POD" )

Update()

# Reading the count clears it, so a second read with nothing in between
# reports no change.
GetAndResetUpdateCount()

assert GetAndResetUpdateCount() == 0, "the update count did not reset"

# The count is a GUI notion.  A script with no GUI running never marks a
# screen dirty, so the count stays where the read left it.
SetParmValUpdate( pid, "Length", "Design", 10.0 )

Update()

assert GetAndResetUpdateCount() >= 0, "the update count went negative"
Return type:

int

Returns:

int OpenVSP update count

openvsp.vsp.GetAttributeBoolVal(attrID)

Get the boolean value of a bool-type attribute

##==== Attribute: GetAttributeBoolVal  =====##
VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
InitVal = True
AttrID = AddAttributeBool( CollID, "TestBoolAttr", InitVal )

GetVal = GetAttributeBoolVal( AttrID )
if GetVal[0] == InitVal:
    print( "Got matching Bool Value from Attribute" )
else:
    print( "GetAttributeBoolVal error!" )
    assert False, "GetAttributeBoolVal error!"
Return type:

std::vector< int,std::allocator< int > >

Returns:

vector<int> Bool value of attribute

Parameters:

[in] – attrID string ID of attribute

openvsp.vsp.GetAttributeDoc(attrID)

Return string doc of attribute by its ID

##==== Attributes: GetAttributeDoc =====##
AttrID = FindAllAttributes()[0]
AttrDoc = GetAttributeDoc(AttrID)
assert len( AttrDoc ) > 0, "GetAttributeDoc returned nothing"
print( AttrDoc )
Return type:

string

Returns:

string Return string doc of attribute by its ID

Parameters:

[in] – attrID string ID of attribute

openvsp.vsp.GetAttributeDoubleMatrixVal(attrID)

Get the Double Matrix of an Double-matrix-type attribute

##==== Attribute: GetAttributeDoubleMatrixVal  =====##
VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
InitVal = [[0., 1.,],[-4., -1000.]]
AttrID = AddAttributeDoubleMatrix( CollID, "TestDoubleMatrixAttr", InitVal )

DblMatrixVal = GetAttributeDoubleMatrixVal( AttrID )
DblMatrixVal = [list(row) for row in DblMatrixVal]

if DblMatrixVal == InitVal:
    print( "Got matching Double Matrix Value from Attribute" )
else:
    print( "GetAttributeDoubleMatrixVal error!" )
    assert False, "GetAttributeDoubleMatrixVal error!"
Return type:

std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >

Returns:

vector<vector <double>> Double Matrix value of attribute as vector < vector < Double > >

Parameters:

[in] – attrID string ID of attribute

openvsp.vsp.GetAttributeDoubleVal(attrID)

Get the double value of a double-type attribute

##==== Attribute: GetAttributeDoubleVal  =====##
VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
InitVal = 3.14159
AttrID = AddAttributeDouble( CollID, "TestDoubleAttr", InitVal )

GetVal = GetAttributeDoubleVal( AttrID )
if GetVal[0] == InitVal:
    print( "Got matching Double Value from Attribute" )
else:
    print( "GetAttributeDoubleVal error!" )
    assert False, "GetAttributeDoubleVal error!"
Return type:

std::vector< double,std::allocator< double > >

Returns:

vector<double> Double value of attribute

Parameters:

[in] – attrID string ID of attribute

openvsp.vsp.GetAttributeID(collID, attributeName, index)

Return the ID of an attribute by its name and collection ID

##==== Attributes: GetAttributeID =====##

VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
AttrNames = FindAttributeNamesInCollection( CollID )
for AttrName in AttrNames:
    AttrID = GetAttributeID( CollID, AttrName, 0 )
    assert len( AttrID ) > 0, "GetAttributeID returned nothing"
    print( AttrID )
Return type:

string

Returns:

string String ID of attribute based on collectionID and name

Parameters:
  • [in] – collID string ID of an attribute collection

  • [in] – attributeName string name of an attribute in that collection

  • [in] – index int index of attribute in collection

openvsp.vsp.GetAttributeIntMatrixVal(attrID)

Get the Int Matrix of an Int-matrix-type attribute

##==== Attribute: GetAttributeIntMatrixVal  =====##

VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
InitVal = [[0, 1,],[-4, -1000]]
AttrID = AddAttributeIntMatrix( CollID, "TestIntMatrixAttr", InitVal )

IntMatrixVal = GetAttributeIntMatrixVal( AttrID )
IntMatrixVal = [list(row) for row in IntMatrixVal]

if IntMatrixVal == InitVal:
    print( "Got matching IntMatrix Value from Attribute" )
else:
    print( "GetAttributeIntMatrixVal error!" )
    assert False, "GetAttributeIntMatrixVal error!"
Return type:

std::vector< std::vector< int,std::allocator< int > >,std::allocator< std::vector< int,std::allocator< int > > > >

Returns:

vector<vector <int>> Int Matrix value of attribute as vector < vector < int > >

Parameters:

[in] – attrID string ID of attribute

openvsp.vsp.GetAttributeIntVal(attrID)

Get the integer value of an int-type attribute

##==== Attribute: GetAttributeIntVal  =====//
VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
InitVal = 55
AttrID = AddAttributeInt( CollID, "TestIntAttr", InitVal )

GetVal = GetAttributeIntVal( AttrID )
if GetVal[0] == InitVal:
    print( "Got matching Int Value from Attribute" )
else:
    print( "GetAttributeIntVal error!" )
    assert False, "GetAttributeIntVal error!"
Return type:

std::vector< int,std::allocator< int > >

Returns:

vector<int> Int value of attribute

Parameters:

[in] – attrID string ID of attribute

openvsp.vsp.GetAttributeName(attrID)

Return the name of an attribute by its ID

##==== Attributes: GetAttributeName =====##

AttrIDs = FindAllAttributes()

for AttrID in AttrIDs:
    AttrName = GetAttributeName( AttrID )
    assert len( AttrName ) > 0, "GetAttributeName returned nothing"
    print( AttrName )
Parameters:

[in] – attrID string ID of an attribute

Return type:

string

Returns:

string name of attribute

openvsp.vsp.GetAttributeParmID(attrID)

Get the parm value of a parm-type attribute

##==== Attribute: GetAttributeParmID  =====##
VehID = GetVehicleID()
CollID = GetChildCollection( VehID )

PodID = AddGeom( "POD", "" )
print( "---> Test Get Parm Val" )
ParmArray = GetGeomParmIDs( PodID )

ParmID = ParmArray[0]
AttrID = AddAttributeParm( CollID, "TestParmAttr", ParmID )

GetID = GetAttributeParmID( AttrID )

if GetID[0] == ParmID:
    print( "Got matching Parm ID from Attribute" )
else:
    print( "GetAttributeParmID error!" )
    assert False, "GetAttributeParmID error!"
Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<string> Parm value of attribute

Parameters:

[in] – attrID string ID of attribute

openvsp.vsp.GetAttributeParmName(attrID)

Get the name of the referenced parm of a parm-type attribute

##==== Attribute: GetAttributeParmName  =====##

VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
PodID = AddGeom( "POD", "" )
print( "---> Test Get Parm Val" )
ParmArray = GetGeomParmIDs( PodID )
AttrName = 'Example_Parm_Attr'
ParmID = ParmArray[0]
AddAttributeParm( CollID, AttrName, ParmID )
AttrID = GetAttributeID( CollID, AttrName, 0 )
ParmName = GetAttributeParmName( AttrID )[0]
if ParmName == GetParmName( ParmID ):
    print( "Got matching Parm Name from Attribute" )
else:
    print( "GetAttributeParmName error!" )
    assert False, "GetAttributeParmName error!"
Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector <string> Parm name of attribute

Parameters:

[in] – attrID string ID of attribute

openvsp.vsp.GetAttributeParmVal(attrID)

Get the parm value of a parm-type attribute

##==== Attribute: GetAttributeParmVal  =====##

VehID = GetVehicleID()
CollID = GetChildCollection( VehID )

PodID = AddGeom( "POD", "" )
print( "---> Test Get Parm Val" )
ParmArray = GetGeomParmIDs( PodID )

ParmID = ParmArray[0]
AttrID = AddAttributeParm( CollID, "TestParmAttr", ParmID )

InitVal = GetParmVal( ParmID )
GetVal = GetAttributeParmVal( AttrID )

if GetVal[0] == InitVal:
    print( "Got matching Parm Value from Attribute" )
else:
    print( "GetAttributeParmVal error!" )
    assert False, "GetAttributeParmVal error!"
Return type:

std::vector< double,std::allocator< double > >

Returns:

vector <double> Parm value of attribute

Parameters:

[in] – attrID string ID of attribute

openvsp.vsp.GetAttributeStringVal(attrID)

Get the string value of a string-type attribute

##==== Attribute: GetAttributeStringVal  =====##
VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
InitVal = "Hello_World_of_Attributes"
AttrID = AddAttributeString( CollID, "TestStringAttr", InitVal )

GetVal = GetAttributeStringVal( AttrID )
if GetVal[0] == InitVal:
    print( "Got matching String Value from Attribute" )
else:
    print( "GetAttributeStringVal error!" )
    assert False, "GetAttributeStringVal error!"
Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<string> String value of attribute

Parameters:

[in] – attrID string ID of attribute

openvsp.vsp.GetAttributeType(attrID)

Get int enum type of attribute by ID Use in conjunction with GetAttributeTypeName for getting strings or with the following enums

BOOL_DATA INT_DATA DOUBLE_DATA STRING_DATA VEC3D_DATA INT_MATRIX_DATA DOUBLE_MATRIX_DATA NAMEVAL_COLLECTION_DATA ATTR_COLLECTION_DATA

##==== Attributes: GetAttributeType =====##
AttrIDs = FindAllAttributes()

assert len( AttrIDs ) > 0, "FindAllAttributes found nothing"

AttrID = AttrIDs[0]
AttrType = GetAttributeType( AttrID )
print( AttrType )

# The attribute has to report a real type, and the enum has to agree with
# the name form.
assert AttrType != INVALID_TYPE, "GetAttributeType returned INVALID_TYPE"
assert len( GetAttributeTypeName( AttrID ) ) > 0, "GetAttributeTypeName returned nothing"

# An ID that is not an attribute has to report INVALID_TYPE.
assert GetAttributeType( "NOSUCHATTRIBUTE" ) == INVALID_TYPE, "GetAttributeType accepted a bad ID"

# That lookup failure was raised deliberately, so take it back off the queue.
err_mgr = ErrorMgrSingleton.getInstance()

while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()
Return type:

int

Returns:

int Int type of attribute

Parameters:

[in] – attrID string ID of attribute

openvsp.vsp.GetAttributeTypeName(attrID)

Get the attribute’s type as a string

##==== Attributes: GetAttributeTypeName =====##
AttrID = FindAllAttributes()[0]
AttributeTypeName = GetAttributeTypeName( AttrID )
assert len( AttributeTypeName ) > 0, "GetAttributeTypeName returned nothing"
print( AttributeTypeName )
Return type:

string

Returns:

string Type of attribute as string

Parameters:

[in] – attrID string ID of attribute

openvsp.vsp.GetAttributeVec3dVal(attrID)

Get the vec3d value of a string-type attribute

##==== Attribute: GetAttributeVec3dVal  =====##

VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
InitVal = vec3d([1., 0.5, -4.])
AttrID = AddAttributeVec3d( CollID, "TestVec3dAttr", [InitVal] )

Vec3dVal = GetAttributeVec3dVal( AttrID )
if ( Vec3dVal[0].x() == InitVal.x() ) and ( Vec3dVal[0].y() == InitVal.y() ) and ( Vec3dVal[0].z() == InitVal.z() ):
    print( "Got matching Vec3d Value from Attribute" )
else:
    print( "GetAttributeVec3dVal error!" )
    assert False, "GetAttributeVec3dVal error!"
Return type:

std::vector< vec3d,std::allocator< vec3d > >

Returns:

vector<vec3d> Vec3d value of attribute

Parameters:

[in] – attrID string ID of attribute

openvsp.vsp.GetAuxiliaryGeomContactPtID(geom_id, index)

Get the ID of the Bogie serving as one of the contact points of an AuxiliaryGeom.

gear_id = AddGeom( "GEAR", "" )

bogie_id = CreateAndAddBogie( gear_id )

aux_id = AddGeom( "AUXILIARY", gear_id )

SetParmVal( aux_id, "AuxiliaryGeomType", "Design", AUX_GEOM_ONE_PT_GROUND )

Update()

# With only one Bogie to choose from, every contact point resolves to it.
assert GetAuxiliaryGeomContactPtID( aux_id, 0 ) == bogie_id, "GetAuxiliaryGeomContactPtID"

See also: SetAuxiliaryGeomContactPtID :param [in]: geom_id string AuxiliaryGeom Geom ID :param [in]: index int Contact point index [0, 2] :rtype: string :return: string Bogie ParmContainer ID, empty if no Bogie is assigned

openvsp.vsp.GetAvailableCSNameVec(CSGroupIndex)

Get the names of each available (not used) control surface in the control surface group at the specified index

wid = AddGeom( "WING", "" ) # Add Wing

aileron_id = AddSubSurf( wid, SS_CONTROL ) # Add Control Surface Sub-Surface

group_index = CreateVSPAEROControlSurfaceGroup() # Empty control surface group

cs_name_vec = GetAvailableCSNameVec( group_index )
assert len( cs_name_vec ) > 0, "GetAvailableCSNameVec returned nothing"

cs_ind_vec = [1]

AddSelectedToCSGroup( cs_ind_vec, group_index ) # Add the first available control surface to the group

# One surface moved from available to active.
active_vec = GetActiveCSNameVec( group_index )

assert len( active_vec ) == 1, "AddSelectedToCSGroup did not add the surface that was named"
assert active_vec[0] == cs_name_vec[0], "AddSelectedToCSGroup added the wrong surface"
assert len( GetAvailableCSNameVec( group_index ) ) == len( cs_name_vec ) - 1, "the added surface is still available"
Parameters:

[in] – CSGroupIndex int Index of the control surface group

Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector <string> Array of active control surface names

openvsp.vsp.GetBBoxSet(set)

Get the corners of the bounding box of the specified Set.

#==== Add Pod Geometry ====//
pid = AddGeom( "POD" )

Update()

sethasmembers, xmin, ymin, zmin, xlen, ylen, zlen = GetBBoxSet( SET_ALL )

# A pod was added above, so the set is populated and the box has real size.
assert sethasmembers, "GetBBoxSet"
assert xlen > 0.0 and ylen > 0.0 and zlen > 0.0, "GetBBoxSet extent"
Parameters:
  • [in] – set int Desired Set

  • [out] – xmin_out double Minimum bounding box X coordinate

  • [out] – ymin_out double Minimum bounding box Y coordinate

  • [out] – zmin_out double Minimum bounding box Z coordinate

  • [out] – xlen_out double Maximum bounding box X length

  • [out] – ylen_out double Maximum bounding box Y length

  • [out] – zlen_out double Maximum bounding box Z length

Return type:

boolean

Returns:

bool Flag indicating whether the set has members (is non-empty)

openvsp.vsp.GetBEMPropID()

Set the ID of the propeller to be exported to a BEM file. Call this function before ExportFile.

#==== Add Prop Geometry ====//
prop_id = AddGeom( "PROP" )

SetBEMPropID( prop_id )

ExportFile( "ExampleBEM.bem", SET_ALL, EXPORT_BEM )

# A BEM export of a Geom that is not a propeller has to be rejected.  The
# error queue is reached through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

pod_id = AddGeom( "POD" )

SetBEMPropID( pod_id )

ExportFile( "ExampleBEM.bem", SET_ALL, EXPORT_BEM )

assert err_mgr.GetNumTotalErrors() > 0, "BEM export accepted a Geom that is not a propeller"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: EXPORT_TYPE, ExportFile :param [in]: prop_id string Propeller Geom ID

Get the ID of the propeller that will be exported to a BEM file.

#==== Add Prop Geometry ====//
prop_id = AddGeom( "PROP" )

SetBEMPropID( prop_id )

assert GetBEMPropID() == prop_id, "GetBEMPropID did not report the propeller that was set"

See also: SetBEMPropID, ExportFile :rtype: string :return: string Propeller Geom ID

openvsp.vsp.GetBORAirfoilLowerPnts(bor_id)

Get the coordinate points for the lower surface of an airfoil of a BOR. The XSecCurve must be of type XS_FILE_AIRFOIL

# Add Body of Recolution
bor_id = AddGeom( "BODYOFREVOLUTION", "" )

ChangeBORXSecShape( bor_id, XS_FILE_AIRFOIL )

ReadBORFileAirfoil( bor_id, "airfoil/N0012_VSP.af" )

low_array = GetBORAirfoilLowerPnts( bor_id )
assert len( low_array ) > 0, "GetBORAirfoilLowerPnts returned nothing"

See also: SetAirfoilPnts :param [in]: bor_id string Body of revolution Geom ID :rtype: std::vector< vec3d,std::allocator< vec3d > > :return: vector<vec3d> Vector of coordinate points for the lower airfoil surface

openvsp.vsp.GetBORAirfoilUpperPnts(bor_id)

Get the coordinate points for the upper surface of an airfoil on a BOR. The BOR XSecCurve must be of type XS_FILE_AIRFOIL

# Add Body of Recolution
bor_id = AddGeom( "BODYOFREVOLUTION", "" )

ChangeBORXSecShape( bor_id, XS_FILE_AIRFOIL )

ReadBORFileAirfoil( bor_id, "airfoil/N0012_VSP.af" )

up_array = GetBORAirfoilUpperPnts( bor_id )
assert len( up_array ) > 0, "GetBORAirfoilUpperPnts returned nothing"

See also: SetAirfoilPnts :param [in]: bor_id string Body of revolution Geom ID :rtype: std::vector< vec3d,std::allocator< vec3d > > :return: vector<vec3d> Vector of coordinate points for the upper airfoil surface

openvsp.vsp.GetBORLowerCSTCoefs(bor_id)

Get the CST coefficients for the lower surface of an airfoil of a BOR. The XSecCurve must be of type XS_CST_AIRFOIL See also: SetLowerCST :param [in]: bor_id string Body of revolution Geom ID :rtype: std::vector< double,std::allocator< double > > :return: vector<double> Vector of CST coefficients for the lower airfoil surface

openvsp.vsp.GetBORLowerCSTDegree(bor_id)

Get the CST degree for the lower surface of an airfoil of a BOR. The XSecCurve must be of type XS_CST_AIRFOIL See also: SetLowerCST :param [in]: bor_id string Body of revolution Geom ID :rtype: int :return: int CST Degree for lower airfoil surface

openvsp.vsp.GetBORUpperCSTCoefs(bor_id)

Get the CST coefficients for the upper surface of an airfoil of a BOR. The XSecCurve must be of type XS_CST_AIRFOIL See also: SetUpperCST :param [in]: bor_id string Body of revolution Geom ID :rtype: std::vector< double,std::allocator< double > > :return: vector<double> Vector of CST coefficients for the upper airfoil surface

openvsp.vsp.GetBORUpperCSTDegree(bor_id)

Get the CST degree for the upper surface of an airfoil of a BOR. The XSecCurve must be of type XS_CST_AIRFOIL See also: SetUpperCST :param [in]: bor_id string Body of revolution Geom ID :rtype: int :return: int CST Degree for upper airfoil surface

openvsp.vsp.GetBORXSecPnts(bor_id)

Set the coordinate points for a specific BOR. The BOR XSecCurve must be of type XS_FILE_FUSE.

# Add Body of Recolution
bor_id = AddGeom( "BODYOFREVOLUTION", "" )

ChangeBORXSecShape( bor_id, XS_FILE_FUSE )

# ReadBORFileXSec hands back a tuple, so copy it into a list to edit it.
vec_array = list( ReadBORFileXSec( bor_id, "TestXSec.fxs" ) )

Update()

before = ComputeBORXSecPnt( bor_id, 0.0 )

assert len( vec_array ) > 0, "ReadBORFileXSec returned no points"

# The Python vec3d carries no arithmetic operators, so scale by component.
vec_array[1] = vec3d( vec_array[1].x() * 2.0, vec_array[1].y() * 2.0, vec_array[1].z() * 2.0 )
vec_array[3] = vec3d( vec_array[3].x() * 2.0, vec_array[3].y() * 2.0, vec_array[3].z() * 2.0 )

SetBORXSecPnts( bor_id, vec_array )

Update()

after = ComputeBORXSecPnt( bor_id, 0.0 )

# Points 1 and 3 are the top and bottom of the diamond read from file, so
# doubling them doubles the height of the section while leaving its width
# alone.  The section is normalized to the body diameter by its height, so
# the section grows half as wide as it was.
assert abs( after.x() - 0.5 * before.x() ) < 1e-6, "SetBORXSecPnts did not reshape the section"
Parameters:
  • [in] – bor_id string Body of revolution Geom ID

  • [in] – pnt_vec vector<vec3d> Vector of XSec coordinate points

Get the coordinate points for a specific BOR. The BOR XSecCurve must be of type XS_FILE_FUSE. The points are returned normalized to the section’s width and height.

# Add Body of Recolution
bor_id = AddGeom( "BODYOFREVOLUTION", "" )

ChangeBORXSecShape( bor_id, XS_FILE_FUSE )

vec_array = list( ReadBORFileXSec( bor_id, "TestXSec.fxs" ) )

# The points that were read are the points the section is carrying.
check_array = GetBORXSecPnts( bor_id )

assert len( check_array ) > 0, "GetBORXSecPnts returned nothing"

# The stored points are normalized, so they fit in the unit box, and the
# curve closes on itself.
for p in check_array:
    assert abs( p.x() ) <= 0.5 + 1e-9, "GetBORXSecPnts returned a point outside the unit box"
    assert abs( p.y() ) <= 0.5 + 1e-9, "GetBORXSecPnts returned a point outside the unit box"

assert dist( check_array[0], check_array[-1] ) < 1e-8, "GetBORXSecPnts returned an open curve"

See also: SetBORXSecPnts, ReadBORFileXSec :param [in]: bor_id string Body of revolution Geom ID :rtype: std::vector< vec3d,std::allocator< vec3d > > :return: vector<vec3d> Vector of XSec coordinate points

openvsp.vsp.GetBORXSecShape(bor_id)

Get the XSec type for a BOR component

# Add Body of Recolution
bor_id = AddGeom( "BODYOFREVOLUTION", "" )

ChangeBORXSecShape( bor_id, XS_ROUNDED_RECTANGLE )

if  GetBORXSecShape( bor_id ) != XS_ROUNDED_RECTANGLE :
    print( "ERROR: GetBORXSecShape" )
    assert False, "ERROR: GetBORXSecShape"
Parameters:

[in] – bor_id string Body of revolution Geom ID

Return type:

int

Returns:

int XSec type enum (i.e. XS_ROUNDED_RECTANGLE)

openvsp.vsp.GetBackground3DAbsolutePath(id)

Get absolute path to specified Background3D’s image.

# Add Background3D
bg_id = AddBackground3D()

SetBackground3DAbsolutePath( bg_id, "/user/me/vsp_work/front.png" )
bg_file = GetBackground3DAbsolutePath( bg_id )
assert len( bg_file ) > 0, "GetBackground3DAbsolutePath returned nothing"

print( bg_file )

DelAllBackground3Ds()
Parameters:

[in] – id string Background3D ID

Return type:

string

Returns:

string Absolute path to Background3D image file

openvsp.vsp.GetBackground3DRelativePath(id)

Get relative path to specified Background3D’s image. Note that path is relative to the model’s *.vsp3 file. Consequently, if a file has not yet been saved or assigned a file name, the relative path is meaningless.

# Add Background3D
bg_id = AddBackground3D()

SetBackground3DRelativePath( bg_id, "front.png" )
bg_file = GetBackground3DRelativePath( bg_id )
assert len( bg_file ) > 0, "GetBackground3DRelativePath returned nothing"

print( bg_file )

DelAllBackground3Ds()
Parameters:

[in] – id string Background3D ID

Return type:

string

Returns:

string Relative path to Background3D image file

openvsp.vsp.GetBoolParmVal(parm_id)

Get the value of the specified bool type Parm

#==== Add Prop Geometry ====//
prop_id = AddGeom( "PROP" )

rev_flag_id = GetParm( prop_id, "ReverseFlag", "Design" )

SetParmVal( rev_flag_id, 1.0 )

reverse_flag = GetBoolParmVal( rev_flag_id )

assert reverse_flag, "GetBoolParmVal did not read back a set flag"

SetParmVal( rev_flag_id, 0.0 )

assert not GetBoolParmVal( rev_flag_id ), "GetBoolParmVal did not read back a cleared flag"
Parameters:

[in] – parm_id string Parm ID

Return type:

boolean

Returns:

bool Parm value

openvsp.vsp.GetCFDMeshVal(type)

Set the value of a specific CFD Mesh option

SetCFDMeshVal( CFD_MIN_EDGE_LEN, 1.0 )

# The control types are backed by Parms in the CFD grid density container,
# so the value that was set can be read back.
dens_id = FindContainer( "CFDGridDensity", 0 )

min_len_id = FindParm( dens_id, "MinLen", "CFDGridDensity" )

assert abs( GetParmVal( min_len_id ) - 1.0 ) < 1e-12, "SetCFDMeshVal did not set CFD_MIN_EDGE_LEN"

See also: CFD_CONTROL_TYPE :param [in]: type int CFD Mesh control type enum (i.e. CFD_GROWTH_RATIO) :param [in]: val double Value to set

Get the value of a specific CFD Mesh option

SetCFDMeshVal( CFD_MIN_EDGE_LEN, 1.0 )

assert abs( GetCFDMeshVal( CFD_MIN_EDGE_LEN ) - 1.0 ) < 1e-12, "GetCFDMeshVal did not report the value that was set"

# Flags read back as zero or one.
SetCFDMeshVal( CFD_HALF_MESH_FLAG, 1.0 )

assert abs( GetCFDMeshVal( CFD_HALF_MESH_FLAG ) - 1.0 ) < 1e-12, "GetCFDMeshVal did not report the half mesh flag"

# A control type that does not exist has to be rejected.  The error queue is
# reached through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

GetCFDMeshVal( -1 )

assert err_mgr.GetNumTotalErrors() > 0, "GetCFDMeshVal accepted an unknown control type"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: CFD_CONTROL_TYPE, SetCFDMeshVal :param [in]: type int CFD Mesh control type enum (i.e. CFD_GROWTH_RATIO) :rtype: float :return: double Value of the option

openvsp.vsp.GetCFDSourceID(geom_id, source_index)

Get the ParmContainer ID of a CFD Mesh source, so its size and placement can be read and driven after the source has been created. A source’s Parms live in the “Source” group and are named SrcLen, SrcRad, U_Loc and W_Loc, with SrcLen2, SrcRad2 and the numbered locations on the source types that take two ends.

pid = AddGeom( "POD", "" )

AddCFDSource( POINT_SOURCE, pid, 0, 0.25, 2.0, 0.5, 0.5 )

src_id = GetCFDSourceID( pid, 0 )

assert len( src_id ) > 0, "GetCFDSourceID returned no id"

# The source was created with a length of 0.25, and is editable from here.
assert abs( GetParmVal( src_id, "SrcLen", "Source" ) - 0.25 ) < 1e-6, "GetCFDSourceID did not reach the source"

SetParmVal( src_id, "SrcLen", "Source", 0.5 )

See also: AddCFDSource, GetCFDSourceName, GetCFDSourceType :param [in]: geom_id string Geom ID :param [in]: source_index int CFD Mesh source index :rtype: string :return: string ParmContainer ID for the source

openvsp.vsp.GetCFDSourceName(geom_id, source_index)

Get the name of a CFD Mesh source on the specified Geom

#==== Add Pod Geom ====//
pid = AddGeom( "POD", "" )

AddDefaultSources() # 3 Sources: Def_Fwd_PS, Def_Aft_PS, Def_Fwd_Aft_LS

assert GetCFDSourceName( pid, 0 ) == "Def_Fwd_PS", "GetCFDSourceName did not name the first default source"

# Every source the Geom counts has to be nameable.
for i in range( GetNumCFDSources( pid ) ):
    assert len( GetCFDSourceName( pid, i ) ) > 0, "source " + str( i ) + " has no name"

# An index past the end has to be rejected.  The error queue is reached
# through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

GetCFDSourceName( pid, GetNumCFDSources( pid ) )

assert err_mgr.GetNumTotalErrors() > 0, "GetCFDSourceName accepted an index past the end"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: GetNumCFDSources, GetCFDSourceType :param [in]: geom_id string Geom ID :param [in]: source_index int Source index :rtype: string :return: string Source name

openvsp.vsp.GetCFDSourceType(std: :string const & geom_id, int source_index) int
openvsp.vsp.GetCFDWakeFlag(geom_id)

Activate or deactivate the CFD Mesh wake for a particular Geom. Note, the wake flag is only applicable for wing-type surfaces. Also, this function is simply an alternative to setting the value of the Parm with the available Parm setting API functions.

#==== Add Wing Geom ====//
wid = AddGeom( "WING", "" )

SetCFDWakeFlag( wid, True )

assert abs( GetParmVal( wid, "Wake", "Shape" ) - 1.0 ) < 1e-12, "SetCFDWakeFlag did not activate the wake"

SetCFDWakeFlag( wid, False )

assert abs( GetParmVal( wid, "Wake", "Shape" ) ) < 1e-12, "SetCFDWakeFlag did not deactivate the wake"

# This is equivalent to SetParmValUpdate( wid, "Wake", "Shape", 1.0 )
# To change the scale: SetParmValUpdate( wid, "WakeScale", "WakeSettings", 10.0 )
# To change the angle: SetParmValUpdate( wid, "WakeAngle", "WakeSettings", -5.0 )

See also: SetParmVal, SetParmValUpdate :param [in]: geom_id string Geom ID :param [in]: flag bool True to activate, false to deactivate

Get the CFD Mesh wake flag for a particular Geom

#==== Add Wing Geom ====//
wid = AddGeom( "WING", "" )

# A new Geom starts with its wake off.
assert not GetCFDWakeFlag( wid ), "a new Geom starts with its wake on"

SetCFDWakeFlag( wid, True )

assert GetCFDWakeFlag( wid ), "GetCFDWakeFlag did not follow SetCFDWakeFlag"

# The flag is the Wake Parm, so the two have to agree.
assert abs( GetParmVal( wid, "Wake", "Shape" ) - 1.0 ) < 1e-12, "the wake flag disagrees with its Parm"

See also: SetCFDWakeFlag :param [in]: geom_id string Geom ID :rtype: boolean :return: bool True if the wake is active

openvsp.vsp.GetChildCollection(attachID)

Get collection ID from any OpenVSP object If ID is an attribute collection, return the same ID back If ID is an attribute group, return its nested collection

##==== Attributes: GetChildCollection =====##
VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
assert len( CollID ) > 0, "GetChildCollection returned nothing"
print( CollID )
Return type:

string

Returns:

string String ID of attribute collection associated with the attachID

Parameters:

[in] – attachID string ID of an OpenVSP object

openvsp.vsp.GetCompleteCSNameVec()

Get the names of all control surfaces. Some may be active (used) while others may be available.

wid = AddGeom( "WING", "" )                             # Add Wing

aileron_id = AddSubSurf( wid, SS_CONTROL )                      # Add Control Surface Sub-Surface

group_index = CreateVSPAEROControlSurfaceGroup() # Empty control surface group

cs_name_vec = GetCompleteCSNameVec()
assert len( cs_name_vec ) > 0, "GetCompleteCSNameVec returned nothing"

print( "All Control Surfaces: ", False )

for i in range(int( len(cs_name_vec) )):

    print( cs_name_vec[i] )
Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector <string> Array of all control surface names

openvsp.vsp.GetComputationFileName(file_type)

Get the file name of a specified file type. Note, this function cannot be used to set FEA Mesh file names.

#==== Add Pod Geometry ====//
pid = AddGeom( "POD" )

#==== Set File Name ====//
SetComputationFileName( DEGEN_GEOM_CSV_TYPE, "TestDegenScript.csv" )

#==== Run Degen Geom ====//
ComputeDegenGeom( SET_ALL, DEGEN_GEOM_CSV_TYPE )

# The degenerate representation is reported through the Results Manager as
# well as written to file.  A Pod yields a surface, a plate and a stick.
assert GetNumResults( "DegenGeom" ) == 1, "ComputeDegenGeom produced no DegenGeom result"
assert GetNumResults( "Degen_surf" ) >= 1, "ComputeDegenGeom produced no Degen_surf result"
assert GetNumResults( "Degen_plate" ) >= 1, "ComputeDegenGeom produced no Degen_plate result"
assert GetNumResults( "Degen_stick" ) >= 1, "ComputeDegenGeom produced no Degen_stick result"

See also: COMPUTATION_FILE_TYPE, SetFeaMeshFileName :param [in]: file_type int File type enum (i.e. CFD_TRI_TYPE, COMP_GEOM_TXT_TYPE) :param [in]: file_name string File name

Get the file name of a specified file type. Note, this function cannot be used to get FEA Mesh file names.

#==== Set File Name ====//
SetComputationFileName( DEGEN_GEOM_CSV_TYPE, "TestDegenScript.csv" )

assert GetComputationFileName( DEGEN_GEOM_CSV_TYPE ) == "TestDegenScript.csv", "GetComputationFileName did not report the name that was set"

# Each file type carries its own name.
SetComputationFileName( CFD_STL_TYPE, "TestCFDMesh.stl" )

assert GetComputationFileName( CFD_STL_TYPE ) == "TestCFDMesh.stl", "setting one file name disturbed another"
assert GetComputationFileName( DEGEN_GEOM_CSV_TYPE ) == "TestDegenScript.csv", "setting one file name disturbed another"

See also: COMPUTATION_FILE_TYPE, SetComputationFileName, GetFeaMeshFileName :param [in]: file_type int File type enum (i.e. CFD_TRI_TYPE, COMP_GEOM_TXT_TYPE) :rtype: string :return: string File name

openvsp.vsp.GetContainerName(std: :string const & parm_container_id) std::string
openvsp.vsp.GetCpSliceID(slice_index)

Get the ID of the Cp slice at the specified index

num_before = GetNumCpSlices()

first = AddCpSlice( X_DIR, 0.5 )
second = AddCpSlice( Y_DIR, 0.25 )

# Slices come back in the order they were added.
assert GetCpSliceID( num_before ) == first, "GetCpSliceID did not report the slices in order"
assert GetCpSliceID( num_before + 1 ) == second, "GetCpSliceID did not report the slices in order"

# An index past the end has to be rejected.  The error queue is reached
# through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

GetCpSliceID( GetNumCpSlices() )

assert err_mgr.GetNumTotalErrors() > 0, "GetCpSliceID accepted an index past the end"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: AddCpSlice, GetNumCpSlices :param [in]: slice_index int Cp slice index :rtype: string :return: string Cp slice ID

openvsp.vsp.GetDesignVar(index)

Get the Parm ID of the specified design variable :param [in]: index int Index of design variable :rtype: string :return: string Parm ID

openvsp.vsp.GetDesignVarType(index)

Get the XDDM type of the specified design variable See also: XDDM_QUANTITY_TYPE :param [in]: index int Index of design variable :rtype: int :return: int XDDM type enum (XDDM_VAR or XDDM_CONST)

openvsp.vsp.GetDoubleAnalysisInput(analysis, name, index=0)

Get the current double values for the particular analysis, input, and data index

vinfFCinput = list( GetDoubleAnalysisInput( "ParasiteDrag", "Vinf" ) )

vinfFCinput[0] = 629

SetDoubleAnalysisInput( "ParasiteDrag", "Vinf", vinfFCinput )

See also: RES_DATA_TYPE, SetDoubleAnalysisInput :param [in]: analysis string Analysis name :param [in]: name string Input name :param [in]: index int Data index :rtype: std::vector< double,std::allocator< double > > :return: vector<double> Array of analysis input values

openvsp.vsp.GetDoubleMatResults(id, name, index=0)

Get all matrix (vector<vector<double>>) values for a particular result, name, and index :param [in]: id string Result ID :param [in]: name string Data name :param [in]: index int Data index :rtype: std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > :return: vector<vector<double>> 2D array of data values

openvsp.vsp.GetDoubleResults(id, name, index=0)

Get all double values for a particular result, name, and index

#==== Add Pod Geom ====//
pid = AddGeom( "POD", "" )

#==== Run CompGeom And View Results ====//
mesh_id = ComputeCompGeom( SET_ALL, False, 0 )                      # Half Mesh false and no file export

comp_res_id = FindLatestResultsID( "Comp_Geom" )                    # Find Results ID

double_arr = GetDoubleResults( comp_res_id, "Wet_Area" )    # Extract Results
assert len( double_arr ) > 0, "GetDoubleResults returned nothing"
Parameters:
  • [in] – id string Result ID

  • [in] – name string Data name

  • [in] – index int Data index

Return type:

std::vector< double,std::allocator< double > >

Returns:

vector<double> Array of data values

openvsp.vsp.GetDriverGroup(geom_id, section_index)

Set the driver group for a wing section or a XSecCurve. Care has to be taken when setting these driver groups to ensure a valid combination.

#==== Add Wing Geometry and Set Parms ====//
wing_id = AddGeom( "WING", "" )

#==== Set Wing Section Controls ====//
SetDriverGroup( wing_id, 1, AR_WSECT_DRIVER, ROOTC_WSECT_DRIVER, TIPC_WSECT_DRIVER )

Update()

#==== Set Parms ====//
SetParmVal( wing_id, "Root_Chord", "XSec_1", 2 )
SetParmVal( wing_id, "Tip_Chord", "XSec_1", 1 )

Update()

# The three chosen drivers are the values that hold; span is now solved for
# from the aspect ratio and the two chords.
ar = GetParmVal( wing_id, "Aspect", "XSec_1" )
span = GetParmVal( wing_id, "Span", "XSec_1" )

assert abs( GetParmVal( wing_id, "Root_Chord", "XSec_1" ) - 2.0 ) < 1e-6, "the driving Parms did not hold their values"
assert abs( GetParmVal( wing_id, "Tip_Chord", "XSec_1" ) - 1.0 ) < 1e-6, "the driving Parms did not hold their values"

# A section of this planform has area span * ( root + tip ) / 2, and aspect
# ratio span * span / area.
area = span * ( 2.0 + 1.0 ) * 0.5

assert abs( ar - span * span / area ) < 1e-6, "SetDriverGroup left the section inconsistent"

See also: WING_DRIVERS, XSEC_DRIVERS :param [in]: geom_id string Geom ID :param [in]: section_index int Wing section index :param [in]: driver_0 int First driver enum (i.e. SPAN_WSECT_DRIVER) :param [in]: driver_1 int Second driver enum (i.e. ROOTC_WSECT_DRIVER) :param [in]: driver_2 int Third driver enum (i.e. TIPC_WSECT_DRIVER)

Get the driver group for a wing section or an XSec. A wing section reports three drivers; an XSecCurve reports the drivers of its own driver group.

#==== Add Wing Geometry ====//
wing_id = AddGeom( "WING", "" )

SetDriverGroup( wing_id, 1, AR_WSECT_DRIVER, ROOTC_WSECT_DRIVER, TIPC_WSECT_DRIVER )

Update()

drivers = GetDriverGroup( wing_id, 1 )

# The drivers come back in the order they were set.
assert len( drivers ) == 3, "GetDriverGroup did not report three wing drivers"
assert drivers[0] == AR_WSECT_DRIVER, "GetDriverGroup did not report the drivers that were set"
assert drivers[1] == ROOTC_WSECT_DRIVER, "GetDriverGroup did not report the drivers that were set"
assert drivers[2] == TIPC_WSECT_DRIVER, "GetDriverGroup did not report the drivers that were set"

# A section index past the end has to be rejected.  The error queue is
# reached through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

GetDriverGroup( wing_id, 100 )

assert err_mgr.GetNumTotalErrors() > 0, "GetDriverGroup accepted a section index past the end"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: WING_DRIVERS, XSEC_DRIVERS, SetDriverGroup :param [in]: geom_id string Geom ID :param [in]: section_index int Wing section or XSec index :rtype: std::vector< int,std::allocator< int > > :return: vector<int> Array of driver enums

openvsp.vsp.GetEditXSecCtrlVec(xsec_id, non_dimensional=True)

Get the control point vector for an EditCurveXSec. Note, the returned array of vec3d values will be represented in 2D with Z set to 0.

# Add Stack
sid = AddGeom( "STACK", "" )

# Get First (and Only) XSec Surf
xsec_surf = GetXSecSurf( sid, 0 )

ChangeXSecShape( xsec_surf, 1, XS_EDIT_CURVE )

# Identify XSec 1
xsec_1 = GetXSec( xsec_surf, 1 )

# Get the control points for the default shape
xsec1_pts = GetEditXSecCtrlVec( xsec_1, True ) # The returned control points will not be scaled by width and height
assert len( xsec1_pts ) > 0, "GetEditXSecCtrlVec returned nothing"

print( f"Normalized Bottom Point of XSecCurve: {xsec1_pts[3].x()}, {xsec1_pts[3].y()}, {xsec1_pts[3].z()}" )
Parameters:
  • [in] – xsec_id string XSec ID

  • [in] – non_dimensional bool True to get the points non-dimensionalized, False to get them scaled by m_Width and m_Height

Return type:

std::vector< vec3d,std::allocator< vec3d > >

Returns:

vector <vec3d> Array of control points

openvsp.vsp.GetEditXSecFixedUVec(xsec_id)

Get the vector of fixed U flags for each control point in an EditCurveXSec. The fixed U flag is used to hold the U parameter of the control point constant when performing an equal arc length reparameterization of the curve.

# Add Wing
wid = AddGeom( "WING" )

# Get First (and Only) XSec Surf
xsec_surf = GetXSecSurf( wid, 0 )

ChangeXSecShape( xsec_surf, 1, XS_EDIT_CURVE )

# Identify XSec 1
xsec_1 = GetXSec( xsec_surf, 1 )

fixed_u_vec = list(GetEditXSecFixedUVec( xsec_1 ))

fixed_u_vec[3] = True # change a flag

SetEditXSecFixedUVec( xsec_1, fixed_u_vec )

before_pts = GetEditXSecCtrlVec( xsec_1, True )

ReparameterizeEditXSec( xsec_1 )

Update()

# Reparameterizing redistributes U without changing the shape, so the same
# control points are still there.
after_pts = GetEditXSecCtrlVec( xsec_1, True )

assert len( after_pts ) == len( before_pts ), "ReparameterizeEditXSec changed the number of control points"

# The U values stay in order over the unit interval.
u_vec = GetEditXSecUVec( xsec_1 )

assert len( u_vec ) == len( after_pts ), "the U vector does not match the control points"
assert abs( u_vec[0] ) < 1e-9 and abs( u_vec[-1] - 1.0 ) < 1e-9, "the U vector does not span the curve"

for i in range( 1, len( u_vec ) ):
    assert u_vec[i] >= u_vec[i - 1], "the U vector is not increasing at " + str( i )

See also: SetEditXSecFixedUVec, ReparameterizeEditXSec :param [in]: xsec_id string XSec ID :rtype: std::vector< bool,std::allocator< bool > > :return: vector <bool> Array of bool values for each control point

openvsp.vsp.GetEditXSecUVec(xsec_id)

Get the U parameter vector for an EditCurveXSec. The vector will be in increasing order with a range of 0 - 1.

# Add Stack
sid = AddGeom( "STACK", "" )

# Get First (and Only) XSec Surf
xsec_surf = GetXSecSurf( sid, 0 )

ChangeXSecShape( xsec_surf, 2, XS_EDIT_CURVE )

# Identify XSec 2
xsec_2 = GetXSec( xsec_surf, 2 )

# Set XSec 2 to linear
EditXSecConvertTo( xsec_2, LINEAR )

u_vec = GetEditXSecUVec( xsec_2 )

if  u_vec[1] - 0.25 > 1e-6 :
    print( "Error: GetEditXSecUVec" )
    assert False, "Error: GetEditXSecUVec"
Parameters:

[in] – xsec_id string XSec ID

Return type:

std::vector< double,std::allocator< double > >

Returns:

vector <double> Array of U parameter values

openvsp.vsp.GetEllipsoidCpDist(surf_pnt_vec, abc_rad, V_inf)

Generate Analytical Solution for Potential Flow for specified ellipsoid shape at input surface points for input velocity vector. Based on Munk, M. M., ‘Remarks on the Pressure Distribution over the Surface of an Ellipsoid, Moving Translationally Through a Perfect Fluid,’ NACA TN-196, June 1924. Function initially created to compare VSPAERO results to theory.

import math
pi = 3.14159265358979323846

npts = 101

abc_rad = vec3d(1.0, 2.0, 3.0)

alpha = 5 # deg

beta = 5 # deg

V_inf = 100.0

x_slice_pnt_vec = [None]*npts
theta_vec = [None]*npts

theta_vec[0] = 0

for i in range(1, npts):
    theta_vec[i] = theta_vec[i-1] + (2 * pi / (npts - 1))


for i in range(npts):

    x_slice_pnt_vec[i] = vec3d( 0, abc_rad.y() * math.cos( theta_vec[i] ), abc_rad.z() * math.sin( theta_vec[i] ) )

V_vec = vec3d( ( V_inf * math.cos( alpha*pi/180 ) * math.cos( beta*pi/180 ) ), ( V_inf * math.sin( beta*pi/180 ) ), ( V_inf * math.sin( alpha*pi/180 ) * math.cos( beta*pi/180 ) ) )

cp_dist = GetEllipsoidCpDist( x_slice_pnt_vec, abc_rad, V_vec )
assert len( cp_dist ) > 0, "GetEllipsoidCpDist returned nothing"

See also: GetEllipsoidSurfPnts :param [in]: surf_pnt_vec vector<vec3d> Vector of points on the ellipsoid surface to assess :param [in]: abc_rad vec3d Radius along the A (X), B (Y), and C (Z) axes :param [in]: V_inf vec3d 3D components of freestream velocity :rtype: std::vector< double,std::allocator< double > > :return: vector<double> Vector of Cp results corresponding to each point in surf_pnt_arr

openvsp.vsp.GetEllipsoidSurfPnts(center, abc_rad, u_npts=20, w_npts=20)

Generate the surface coordinate points for a ellipsoid at specified center of input radius along each axis. Based on the MATLAB function ellipsoid (https://in.mathworks.com/help/matlab/ref/ellipsoid.html). See also: GetVKTAirfoilPnts :param [in]: center vec3d 3D location of the ellipsoid center :param [in]: abc_rad vec3d Radius along the A (X), B (Y), and C (Z) axes :param [in]: u_npts int Number of points in the U direction :param [in]: w_npts int Number of points in the W direction :rtype: std::vector< vec3d,std::allocator< vec3d > > :return: vector<vec3d> Array of coordinates describing the ellipsoid surface

openvsp.vsp.GetFeaAssemblyFileName(assembly_id, file_type)

Mesh and write out an FEA Assembly. Any Structure in the assembly that has not been meshed yet is meshed first.

pod_id = AddGeom( "POD" )

struct_ind = AddFeaStruct( pod_id )

struct_id = GetFeaStructID( pod_id, struct_ind )

#==== Keep the mesh coarse so the example runs quickly ====//
SetFeaMeshVal( pod_id, struct_ind, CFD_MAX_EDGE_LEN, 0.75 )

assembly_id = AddFeaAssembly()

SetFeaAssemblyName( assembly_id, "ExampleAssembly" )

AddFeaStructureToAssembly( assembly_id, struct_id )

out_name = GetFeaAssemblyFileName( assembly_id, FEA_CALCULIX_FILE_NAME )

ComputeFeaAssemblyMesh( assembly_id )

# The assembly writes the Calculix deck it named.
import os
assert os.path.getsize( out_name ) > 0, "ComputeFeaAssemblyMesh wrote no file"

See also: AddFeaAssembly, AddFeaStructureToAssembly :param [in]: assembly_id string FEA Assembly ID

Get the name of an FEA Assembly output file. The names are built from the assembly name when it is set, so this reports where ComputeFeaAssemblyMesh will write. See also: SetFeaAssemblyFileName, ComputeFeaAssemblyMesh, FEA_EXPORT_TYPE :param [in]: assembly_id string FEA Assembly ID :param [in]: file_type int FEA output file type enum (i.e. FEA_CALCULIX_FILE_NAME) :rtype: string :return: string Name of the output file

openvsp.vsp.GetFeaAssemblyIDVec()

Get the IDs of every FEA Assembly in the model

first = AddFeaAssembly()
second = AddFeaAssembly()

assy_ids = GetFeaAssemblyIDVec()

# Assemblies come back in the order they were added.
assert len( assy_ids ) == 2, "GetFeaAssemblyIDVec did not report the assemblies in order"
assert assy_ids[0] == first, "GetFeaAssemblyIDVec did not report the assemblies in order"
assert assy_ids[1] == second, "GetFeaAssemblyIDVec did not report the assemblies in order"

See also: AddFeaAssembly, NumFeaAssemblies :rtype: std::vector< std::string,std::allocator< std::string > > :return: vector<string> Array of FEA Assembly IDs

openvsp.vsp.GetFeaAssemblyName(assembly_id)

Get the name of an FEA Assembly

assembly_id = AddFeaAssembly()

SetFeaAssemblyName( assembly_id, "ExampleAssembly" )

assert GetFeaAssemblyName( assembly_id ) == "ExampleAssembly", "GetFeaAssemblyName did not report the name that was set"

# An ID that is not an assembly has to be rejected.
err_mgr = ErrorMgrSingleton.getInstance()

GetFeaAssemblyName( "NOSUCHASSEMBLY" )

assert err_mgr.GetNumTotalErrors() > 0, "GetFeaAssemblyName accepted a bad ID"

while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: AddFeaAssembly, SetFeaAssemblyName :param [in]: assembly_id string FEA Assembly ID :rtype: string :return: string FEA Assembly name

openvsp.vsp.GetFeaAssemblyStructureIDVec(assembly_id)

Get the IDs of the FEA Structures gathered by an FEA Assembly See also: AddFeaStructureToAssembly, DeleteFeaStructureFromAssembly :param [in]: assembly_id string FEA Assembly ID :rtype: std::vector< std::string,std::allocator< std::string > > :return: vector<string> Array of FEA Structure IDs

openvsp.vsp.GetFeaBCIDVec(fea_struct_id)

Return a vector of FEA BC ID’s for a structure

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

#==== Add FeaStructure to Pod ====//
struct_ind = AddFeaStruct( pod_id )

struct_id = GetFeaStructID( pod_id, struct_ind );

#==== Add BC ====//
bc_id = AddFeaBC( struct_id, FEA_BC_STRUCTURE )

bc_id_vec = GetFeaBCIDVec( struct_id )
assert len( bc_id_vec ) > 0, "GetFeaBCIDVec returned nothing"
Parameters:

[in] – fea_struct_id string FEA Structure ID

Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<string> Array of FEA BC IDs

openvsp.vsp.GetFeaLayerIDVec(material_id)

Get the IDs of every layer in an FEA laminate material See also: AddFeaLayer, DeleteFeaLayer :param [in]: material_id string FEA Material ID of a laminate :rtype: std::vector< std::string,std::allocator< std::string > > :return: vector<string> Array of FEA Layer IDs

openvsp.vsp.GetFeaMaterialIDVec() StringVector
openvsp.vsp.GetFeaMeshFileName(geom_id, fea_struct_ind, file_type)

Set the name of a particular FEA Mesh output file for a specified Structure

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

#==== Add FeaStructure to Pod ====//
struct_ind = AddFeaStruct( pod_id )

struct_id = GetFeaStructID( pod_id, struct_ind )

#=== Set Export File Name ===//
export_name = "FEAMeshTest_calculix.dat"

#==== Get Parent Geom ID and Index ====//
parent_id = GetFeaStructParentGeomID( struct_id ) # same as pod_id

assert parent_id == pod_id, "GetFeaStructParentGeomID did not report the parent Geom"

SetFeaMeshFileName( parent_id, struct_ind, FEA_CALCULIX_FILE_NAME, export_name )

# Keep the mesh coarse so the example runs quickly, then mesh to prove the
# name that was set is the name that gets written.
SetFeaMeshVal( parent_id, struct_ind, CFD_MAX_EDGE_LEN, 0.75 )

ComputeFeaMesh( parent_id, struct_ind, FEA_CALCULIX_FILE_NAME )

import os
assert os.path.getsize( export_name ) > 0, "SetFeaMeshFileName did not name the output file"
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – fea_struct_ind int FEA Structure index

  • [in] – file_type int FEA output file type enum (i.e. FEA_EXPORT_TYPE)

  • [in] – file_name string Name for the output file

Get the name of a particular FEA Mesh output file for a specified Structure

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

#==== Add FeaStructure to Pod ====//
struct_ind = AddFeaStruct( pod_id )

export_name = "FEAMeshTest_calculix.dat"

SetFeaMeshFileName( pod_id, struct_ind, FEA_CALCULIX_FILE_NAME, export_name )

assert GetFeaMeshFileName( pod_id, struct_ind, FEA_CALCULIX_FILE_NAME ) == export_name, "GetFeaMeshFileName did not report the name that was set"

# Each output type carries its own name.
SetFeaMeshFileName( pod_id, struct_ind, FEA_NASTRAN_FILE_NAME, "FEAMeshTest_nastran.dat" )

assert GetFeaMeshFileName( pod_id, struct_ind, FEA_CALCULIX_FILE_NAME ) == export_name, "setting one output name disturbed another"

See also: FEA_EXPORT_TYPE, SetFeaMeshFileName :param [in]: geom_id string Parent Geom ID :param [in]: fea_struct_ind int FEA Structure index :param [in]: file_type int FEA output file type enum (i.e. FEA_EXPORT_TYPE) :rtype: string :return: string Name of the output file

openvsp.vsp.GetFeaMeshStructIndex()

Sets FeaMeshMgr m_FeaMeshStructIndex member using passed in index of a FeaStructure

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

#==== Add FeaStructure to Pod ====//
struct_ind = AddFeaStruct( pod_id )

SetFeaMeshStructIndex( struct_ind )

if  len(FindGeoms()) != 1 :
    print( "ERROR: SetFeaMeshStructIndex" )
    assert False, "ERROR: SetFeaMeshStructIndex"

Get the index of the FEA Structure the FEA Mesh Manager is currently pointed at

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

#==== Add FeaStructure to Pod ====//
struct_ind = AddFeaStruct( pod_id )

struct_ind_2 = AddFeaStruct( pod_id )

SetFeaMeshStructIndex( struct_ind_2 )

assert GetFeaMeshStructIndex() == struct_ind_2, "GetFeaMeshStructIndex did not report the Structure that was set"

SetFeaMeshStructIndex( struct_ind )

assert GetFeaMeshStructIndex() == struct_ind, "GetFeaMeshStructIndex did not follow a second set"

See also: SetFeaMeshStructIndex :rtype: int :return: int FEA Structure index

openvsp.vsp.GetFeaMeshVal(geom_id, fea_struct_ind, type)

Set the value of a particular FEA Mesh option for the specified Structure. Note, FEA Mesh makes use of enums initially created for CFD Mesh but not all CFD Mesh options are available for FEA Mesh.

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

#==== Add FeaStructure to Pod ====//
struct_ind = AddFeaStruct( pod_id )

#==== Adjust FeaMeshSettings ====//
SetFeaMeshVal( pod_id, struct_ind, CFD_MAX_EDGE_LEN, 0.75 )

SetFeaMeshVal( pod_id, struct_ind, CFD_MIN_EDGE_LEN, 0.2 )

# The options are backed by Parms on the Structure, in its grid density
# group, so the values that were set can be read back.
struct_id = GetFeaStructID( pod_id, struct_ind )

assert abs( GetParmVal( FindParm( struct_id, "BaseLen", "FEAGridDensity" ) ) - 0.75 ) < 1e-12, "SetFeaMeshVal did not set CFD_MAX_EDGE_LEN"
assert abs( GetParmVal( FindParm( struct_id, "MinLen", "FEAGridDensity" ) ) - 0.2 ) < 1e-12, "SetFeaMeshVal did not set CFD_MIN_EDGE_LEN"

See also: CFD_CONTROL_TYPE :param [in]: geom_id string Parent Geom ID :param [in]: fea_struct_ind int FEA Structure index :param [in]: type int FEA Mesh option type enum (i.e. CFD_MAX_EDGE_LEN) :param [in]: val double Value the option is set to

Get the value of a specific FEA Mesh option for the specified Structure

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

#==== Add FeaStructure to Pod ====//
struct_ind = AddFeaStruct( pod_id )

SetFeaMeshVal( pod_id, struct_ind, CFD_MAX_EDGE_LEN, 0.75 )

assert abs( GetFeaMeshVal( pod_id, struct_ind, CFD_MAX_EDGE_LEN ) - 0.75 ) < 1e-12, "GetFeaMeshVal did not report the value that was set"

# Each Structure carries its own settings.
struct_ind_2 = AddFeaStruct( pod_id )

SetFeaMeshVal( pod_id, struct_ind_2, CFD_MAX_EDGE_LEN, 0.25 )

assert abs( GetFeaMeshVal( pod_id, struct_ind, CFD_MAX_EDGE_LEN ) - 0.75 ) < 1e-12, "setting one Structure disturbed another"

# A control type FEA Mesh does not use has to be rejected.  The error queue
# is reached through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

GetFeaMeshVal( pod_id, struct_ind, CFD_FAR_FIELD_FLAG )

assert err_mgr.GetNumTotalErrors() > 0, "GetFeaMeshVal accepted a control type FEA Mesh does not use"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: CFD_CONTROL_TYPE, SetFeaMeshVal :param [in]: geom_id string Parent Geom ID :param [in]: fea_struct_ind int FEA Structure index :param [in]: type int FEA Mesh option type enum (i.e. CFD_MAX_EDGE_LEN) :rtype: float :return: double Value of the option

openvsp.vsp.GetFeaPartID(fea_struct_id, fea_part_index)

Get the Parm ID of an FEA Part, identified from a FEA Structure Parm ID and FEA Part index.

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

#==== Add FeaStructure to Pod ====//
struct_ind = AddFeaStruct( pod_id )

struct_id = GetFeaStructID( pod_id, struct_ind )

#==== Add Bulkead ====//
bulkhead_id = AddFeaPart( pod_id, struct_ind, FEA_SLICE )

Update()

if  bulkhead_id != GetFeaPartID( struct_id, 1 ) : # These should be equivalent (index 0 is skin)

    print( "Error: GetFeaPartID" )
    assert False, "Error: GetFeaPartID"
Parameters:
  • [in] – fea_struct_id string FEA Structure ID

  • [in] – fea_part_index int FEA Part index

Return type:

string

Returns:

string FEA Part ID

openvsp.vsp.GetFeaPartIDVec(fea_struct_id)

Get the IDs of all FEA Parts in the given FEA Structure

#==== Add Geometries ====//
pod_id = AddGeom( "POD" )

#==== Add FeaStructure to Pod ====//
struct_ind = AddFeaStruct( pod_id )

struct_id = GetFeaStructID( pod_id, struct_ind )

#==== Add FEA Parts ====//
slice_id = AddFeaPart( pod_id, struct_ind, FEA_SLICE )
dome_id = AddFeaPart( pod_id, struct_ind, FEA_DOME )

part_id_vec = GetFeaPartIDVec( struct_id ) # Should include slice_id & dome_id
assert len( part_id_vec ) > 0, "GetFeaPartIDVec returned nothing"

See also: NumFeaParts :param [in]: fea_struct_id string FEA Structure ID :rtype: std::vector< std::string,std::allocator< std::string > > :return: vector<string> Array of FEA Part IDs

openvsp.vsp.GetFeaPartName(part_id)

Get the name of an FEA Part

#==== Add Fuselage Geometry ====//
fuse_id = AddGeom( "FUSELAGE" )

#==== Add FeaStructure to Pod ====//
struct_ind = AddFeaStruct( fuse_id )

#==== Add Bulkead ====//
bulkhead_id = AddFeaPart( fuse_id, struct_ind, FEA_SLICE )

name = "example_name"
SetFeaPartName( bulkhead_id, name )

if  name != GetFeaPartName( bulkhead_id ) : # These should be equivalent

    print( "Error: GetFeaPartName" )
    assert False, "Error: GetFeaPartName"

See also: SetFeaPartName :param [in]: part_id string FEA Part ID :rtype: string :return: string FEA Part name

openvsp.vsp.GetFeaPartPerpendicularSparID(part_id)

Get the ID of the perpendicular spar for an FEA Rib or Rib Array. Note, the FEA Rib or Rib Array doesn’t have to have “SPAR_NORMAL” set for the “PerpendicularEdgeType” Parm for this function to still return a value.

#==== Add Wing Geometry ====//
wing_id = AddGeom( "WING" )

#==== Add FeaStructure to Wing ====//
struct_ind = AddFeaStruct( wing_id )

#==== Add Rib ====//
rib_id = AddFeaPart( wing_id, struct_ind, FEA_RIB )

#==== Add Spars ====//
spar_id_1 = AddFeaPart( wing_id, struct_ind, FEA_SPAR )
spar_id_2 = AddFeaPart( wing_id, struct_ind, FEA_SPAR )

SetParmVal( FindParm( spar_id_1, "RelCenterLocation", "FeaPart" ), 0.25 )
SetParmVal( FindParm( spar_id_2, "RelCenterLocation", "FeaPart" ), 0.75 )

#==== Set Perpendicular Edge type to SPAR ====//
SetParmVal( FindParm( rib_id, "PerpendicularEdgeType", "FeaRib" ), SPAR_NORMAL )

SetFeaPartPerpendicularSparID( rib_id, spar_id_2 )

if  spar_id_2 != GetFeaPartPerpendicularSparID( rib_id ) :
    print( "Error: GetFeaPartPerpendicularSparID" )
    assert False, "Error: GetFeaPartPerpendicularSparID"

See also: FEA_RIB_NORMAL, SetFeaPartPerpendicularSparID :param [in]: part_id string FEA Part ID (Rib or Rib Array Type) :rtype: string :return: string Perpendicular FEA Spar ID

openvsp.vsp.GetFeaPartType(part_id)

Get the type of an FEA Part

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

#==== Add FeaStructure to Pod ====//
struct_ind = AddFeaStruct( pod_id )

#==== Add Slice ====//
slice_id = AddFeaPart( pod_id, struct_ind, FEA_SLICE )

if  FEA_SLICE != GetFeaPartType( slice_id ) : # These should be equivalent

    print( "Error: GetFeaPartType" )
    assert False, "Error: GetFeaPartType"

See also: FEA_PART_TYPE :param [in]: part_id string FEA Part ID :rtype: int :return: int FEA Part type enum

openvsp.vsp.GetFeaPolySparNumPt(pspar_id)

Get the number of points in an FEA Poly Spar. A newly created Poly Spar contains two points (the inboard and outboard endpoints).

wing_id = AddGeom( "WING" )

struct_ind = AddFeaStruct( wing_id )

pspar_id = AddFeaPart( wing_id, struct_ind, FEA_POLY_SPAR )

# A new Poly Spar starts with 2 points
if GetFeaPolySparNumPt( pspar_id ) != 2:
    print( "Error: GetFeaPolySparNumPt" )
    assert False, "Error: GetFeaPolySparNumPt"

See also: AddFeaPolySparPt, InsertFeaPolySparPt, DelFeaPolySparPt, DelAllFeaPolySparPt :param [in]: pspar_id string FEA Poly Spar part ID :rtype: int :return: int Number of points in the Poly Spar

openvsp.vsp.GetFeaPolySparPtID(pspar_id, index)

Get the ID of a point in an FEA Poly Spar. The returned ID is a ParmContainer ID that can be used with FindParm to access the point’s parameters such as Eta, U01, U0N, and XoC.

wing_id = AddGeom( "WING" )

struct_ind = AddFeaStruct( wing_id )

pspar_id = AddFeaPart( wing_id, struct_ind, FEA_POLY_SPAR )

pt_id = GetFeaPolySparPtID( pspar_id, 0 )
assert len( pt_id ) > 0, "GetFeaPolySparPtID returned nothing"

# Set the spanwise location of the inboard point to eta = 0.1
SetParmVal( FindParm( pt_id, "Eta", "FeaPolySparPoint" ), 0.1 )

pt_id_1 = GetFeaPolySparPtID( pspar_id, 1 )

# Set the spanwise location of the outboard point to eta = 0.9
SetParmVal( FindParm( pt_id_1, "Eta", "FeaPolySparPoint" ), 0.9 )

See also: GetAllFeaPolySparPtIDVec, FindParm, SetParmVal :param [in]: pspar_id string FEA Poly Spar part ID :param [in]: index int Index of the point :rtype: string :return: string ID of the Poly Spar point ParmContainer

openvsp.vsp.GetFeaPolySparPtName(pspar_id, index)

Get the name of a point in an FEA Poly Spar.

wing_id = AddGeom( "WING" )

struct_ind = AddFeaStruct( wing_id )

pspar_id = AddFeaPart( wing_id, struct_ind, FEA_POLY_SPAR )

SetFeaPolySparPtName( pspar_id, 0, "InboardPt" )

name = GetFeaPolySparPtName( pspar_id, 0 )
assert len( name ) > 0, "GetFeaPolySparPtName returned nothing"

print( "Point 0 name: " + name )

See also: SetFeaPolySparPtName :param [in]: pspar_id string FEA Poly Spar part ID :param [in]: index int Index of the point :rtype: string :return: string Name of the point

openvsp.vsp.GetFeaPropertyIDVec()

Add aa FEA Property the FEA Mesh property library. Properties are available across all Geoms and Structures. Currently only beam and shell properties are available. Note FEA_SHELL_AND_BEAM is not a valid property type.

#==== Create FeaProperty ====//
prop_id = AddFeaProperty()

SetParmVal( FindParm( prop_id, "Thickness", "FeaProperty" ), 0.01 )

See also: FEA_PART_ELEMENT_TYPE :param [in]: property_type int FEA Property type enum (i.e. FEA_SHELL). :rtype: std::vector< std::string,std::allocator< std::string > > :return: string FEA Property ID

Get the IDs of every FEA Property in the FEA Mesh property library, including the built in properties as well as any added through AddFeaProperty.

#==== Properties are created as structures need them, so start from
#==== whatever the library already holds ====//
num_before = len( GetFeaPropertyIDVec() )

#==== Create FeaProperty ====//
prop_id = AddFeaProperty()

prop_ids = GetFeaPropertyIDVec()

assert len( prop_ids ) == num_before + 1, "GetFeaPropertyIDVec did not follow AddFeaProperty"
assert prop_id in prop_ids, "the property that was added is not in the list"

See also: AddFeaProperty, DeleteFeaProperty :rtype: std::vector< std::string,std::allocator< std::string > > :return: vector<string> Array of FEA Property IDs

openvsp.vsp.GetFeaStructID(geom_id, fea_struct_ind)

Get the ID of an FEA Structure

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

#==== Add FeaStructure to Pod ====//
struct_ind = AddFeaStruct( pod_id )

struct_id = GetFeaStructID( pod_id, struct_ind )
assert len( struct_id ) > 0, "GetFeaStructID returned nothing"
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – fea_struct_ind int FEA Structure index

Return type:

string

Returns:

string FEA Structure ID

openvsp.vsp.GetFeaStructIDVec()

Get the IDs of all FEA Structures in the vehicle

#==== Add Geometries ====//
pod_id = AddGeom( "POD" )
wing_id = AddGeom( "WING" )

#==== Add FeaStructures ====//
pod_struct_ind = AddFeaStruct( pod_id )
wing_struct_ind = AddFeaStruct( wing_id )

struct_id_vec = GetFeaStructIDVec()
assert len( struct_id_vec ) > 0, "GetFeaStructIDVec returned nothing"

See also: NumFeaStructures :rtype: std::vector< std::string,std::allocator< std::string > > :return: vector<string> Array of FEA Structure IDs

openvsp.vsp.GetFeaStructIndex(struct_id)

Get the index of an FEA Structure in its Parent Geom’s vector of Structures

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

#==== Add FeaStructure to Pod ====//
struct_ind_1 = AddFeaStruct( pod_id )

struct_ind_2 = AddFeaStruct( pod_id )

struct_id_2 = GetFeaStructID( pod_id, struct_ind_2 )

DeleteFeaStruct( pod_id, struct_ind_1 )

struct_ind_2_new = GetFeaStructIndex( struct_id_2 )

# The second structure slides down to fill the gap the first one left.
assert struct_ind_2 == 1, "GetFeaStructIndex did not follow the delete"
assert struct_ind_2_new == 0, "GetFeaStructIndex did not follow the delete"

# The index has to lead back to the same structure.
assert GetFeaStructID( pod_id, struct_ind_2_new ) == struct_id_2, "GetFeaStructIndex disagrees with GetFeaStructID"

# An ID that is not a structure has to report -1.
assert GetFeaStructIndex( "NOSUCHSTRUCT" ) == -1, "GetFeaStructIndex accepted a bad ID"

# That lookup failure was raised deliberately, so take it back off the queue.
err_mgr = ErrorMgrSingleton.getInstance()

while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()
Parameters:

[in] – struct_id string FEA Structure ID

Return type:

int

Returns:

int FEA Structure index

openvsp.vsp.GetFeaStructName(geom_id, fea_struct_ind)

Get the name of an FEA Structure. The FEA Structure name functions as the the Parm Container name

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

#==== Add FeaStructure to Pod ====//
struct_ind = AddFeaStruct( pod_id )

#==== Get Structure Name ====//
parm_container_name = GetFeaStructName( pod_id, struct_ind )
assert len( parm_container_name ) > 0, "GetFeaStructName returned nothing"

display_name = "Current Structure Parm Container Name: " + parm_container_name + "\n"

print( display_name )

See also: FindContainer, SetFeaStructName :param [in]: geom_id string Parent Geom ID :param [in]: fea_struct_ind int FEA Structure index :rtype: string :return: string Name for the FEA Structure

openvsp.vsp.GetFeaStructParentGeomID(struct_id)

Get the Parent Geom ID for an FEA Structure

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

#==== Add FeaStructure to Pod ====//
struct_ind = AddFeaStruct( pod_id )

struct_id = GetFeaStructID( pod_id, struct_ind )

#==== Get Parent Geom ID and Index ====//
parent_id = GetFeaStructParentGeomID( struct_id )
assert len( parent_id ) > 0, "GetFeaStructParentGeomID returned nothing"
Parameters:

[in] – struct_id string FEA Structure ID

Return type:

string

Returns:

string Parent Geom ID

openvsp.vsp.GetFeaSubSurfIDVec(fea_struct_id)

Get the IDs of all FEA SubSurfaces in the given FEA Structure

#==== Add Geometries ====//
pod_id = AddGeom( "POD" )

#==== Add FeaStructure to Pod ====//
struct_ind = AddFeaStruct( pod_id )

struct_id = GetFeaStructID( pod_id, struct_ind )

#==== Add SubSurfaces ====//
line_array_id = AddFeaSubSurf( pod_id, struct_ind, SS_LINE_ARRAY )
rectangle_id = AddFeaSubSurf( pod_id, struct_ind, SS_RECTANGLE )

part_id_vec = GetFeaSubSurfIDVec( struct_id ) # Should include line_array_id & rectangle_id
assert len( part_id_vec ) > 0, "GetFeaSubSurfIDVec returned nothing"

See also: NumFeaSubSurfs :param [in]: fea_struct_id string FEA Structure ID :rtype: std::vector< std::string,std::allocator< std::string > > :return: vector<string> Array of FEA Part IDs

openvsp.vsp.GetFeaSubSurfIndex(ss_id)

Get the index of an FEA SubSurface give the SubSurface ID

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

#==== Add FeaStructure to Pod ====//
struct_ind = AddFeaStruct( pod_id )

#==== Add Slice ====//
slice_id = AddFeaPart( pod_id, struct_ind, FEA_SLICE )

#==== Add LineArray ====//
line_array_id = AddFeaSubSurf( pod_id, struct_ind, SS_LINE_ARRAY )

#==== Add Rectangle ====//
rect_id = AddFeaSubSurf( pod_id, struct_ind, SS_RECTANGLE )

if  1 != GetFeaSubSurfIndex( rect_id ) : # These should be equivalent

    print( "Error: GetFeaSubSurfIndex" )
    assert False, "Error: GetFeaSubSurfIndex"
Parameters:

[in] – ss_id string FEA SubSurface ID

Return type:

int

Returns:

int FEA SubSurface Index

openvsp.vsp.GetFeaSubSurfName(subsurf_id)

Set the name of an FEA SubSurface

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

#==== Add FeaStructure to Pod ====//
struct_ind = AddFeaStruct( pod_id )

#==== Add LineArray ====//
line_array_id = AddFeaSubSurf( pod_id, struct_ind, SS_LINE_ARRAY )

name = "example_name"
SetFeaSubSurfName( line_array_id, name )

if  name != GetFeaSubSurfName( line_array_id ) : # These should be equivalent
    print( "Error: GetFeaSubSurfName" )
    assert False, "Error: GetFeaSubSurfName"
Parameters:

[in] – subsurf_id string FEA SubSurface ID

Return type:

string

Returns:

string FEA SubSurf name

openvsp.vsp.GetFeaTrimPartIDVec(trim_id)

Get the FEA Parts a Trim part trims against See also: AddFeaTrimPart, DeleteFeaTrimPart :param [in]: trim_id string FEA Trim part ID :rtype: std::vector< std::string,std::allocator< std::string > > :return: vector<string> Array of FEA Part IDs

openvsp.vsp.GetFeatureLinePnts(geom_id)

Get the points along the feature lines of a particular Geom :param [in]: geom_id string Geom ID :rtype: std::vector< vec3d,std::allocator< vec3d > > :return: vector<vec3d> Array of points along the Geom’s feature lines

openvsp.vsp.GetGeomBBoxMax(geom_id, main_surf_ind=0, 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 ====//
pid = AddGeom( "POD" )

SetParmVal( FindParm( pid, "Y_Rotation", "XForm" ), 45 )
SetParmVal( FindParm( pid, "Z_Rotation", "XForm" ), 25 )

Update()

max_pnt = GetGeomBBoxMax( pid, 0, False )

min_pnt = GetGeomBBoxMin( pid, 0, False )

assert max_pnt.x() > min_pnt.x() and max_pnt.y() > min_pnt.y() and max_pnt.z() > min_pnt.z(), "GetGeomBBoxMax is not above the minimum corner"

See also: GetGeomBBoxMin :param [in]: geom_id string Geom ID :param [in]: main_surf_ind int Main surface index :param [in]: ref_frame_is_absolute bool Flag to specify absolute or body reference frame :rtype: vec3d :return: vec3d Maximum coordinate of the bounding box

openvsp.vsp.GetGeomBBoxMin(geom_id, main_surf_ind=0, 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 ====//
pid = AddGeom( "POD" )

SetParmVal( FindParm( pid, "Y_Rotation", "XForm" ), 45 )
SetParmVal( FindParm( pid, "Z_Rotation", "XForm" ), 25 )

Update()

min_pnt = GetGeomBBoxMin( pid, 0, False )

max_pnt = GetGeomBBoxMax( pid, 0, False )

assert min_pnt.x() < max_pnt.x() and min_pnt.y() < max_pnt.y() and min_pnt.z() < max_pnt.z(), "GetGeomBBoxMin is not below the maximum corner"

See also: GetGeomBBoxMax :param [in]: geom_id string Geom ID :param [in]: main_surf_ind int Main surface index :param [in]: ref_frame_is_absolute bool Flag to specify absolute or body reference frame :rtype: vec3d :return: vec3d Minimum coordinate of the bounding box

openvsp.vsp.GetGeomChildren(geom_id)

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

#==== Add Parent and Child Geometry ====//
pod1 = AddGeom( "POD" )

pod2 = AddGeom( "POD", pod1 )

pod3 = AddGeom( "POD", pod2 )

print( "Children of Pod #1: " )

children = GetGeomChildren( pod1 )
assert len( children ) > 0, "GetGeomChildren returned nothing"

for i in range(int( len(children) )):

    print( "\t", False )
    print( children[i] )
Parameters:

[in] – geom_id string Geom ID

Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<string> Vector of child Geom IDs

openvsp.vsp.GetGeomDisplayType(geom_id)

Get the display type of the specified geometry

pid = AddGeom( "POD" )

SetGeomDisplayType( pid, DISPLAY_DEGEN_PLATE )

assert GetGeomDisplayType( pid ) == DISPLAY_DEGEN_PLATE, "GetGeomDisplayType did not report the type that was set"

SetGeomDisplayType( pid, DISPLAY_BEZIER )

assert GetGeomDisplayType( pid ) == DISPLAY_BEZIER, "GetGeomDisplayType did not follow a second set"

See also: DISPLAY_TYPE, SetGeomDisplayType :param [in]: geom_id string Geom ID :rtype: int :return: int Display type enum (i.e. DISPLAY_BEZIER)

openvsp.vsp.GetGeomDrawType(geom_id)

Set the visualization material the specified geometry

pid = AddGeom( "POD" )

SetGeomMaterialName( pid, "Ruby" )

# Ruby is one of the materials the library ships with.
assert "Ruby" in GetMaterialNames(), "Ruby is not in the material library"

# A material that is not in the library has to be rejected.  The error queue
# is reached through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

SetGeomMaterialName( pid, "NoSuchMaterial" )

assert err_mgr.GetNumTotalErrors() > 0, "SetGeomMaterialName accepted an unknown material"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()
Parameters:
  • [in] – geom_id string Geom ID

  • [in] – name string Material name

Get the draw type of the specified geometry

pid = AddGeom( "POD", "" )

SetGeomDrawType( pid, GEOM_DRAW_SHADE )

assert GetGeomDrawType( pid ) == GEOM_DRAW_SHADE, "GetGeomDrawType did not report the type that was set"

SetGeomDrawType( pid, GEOM_DRAW_WIRE )

assert GetGeomDrawType( pid ) == GEOM_DRAW_WIRE, "GetGeomDrawType did not follow a second set"

See also: DRAW_TYPE, SetGeomDrawType :param [in]: geom_id string Geom ID :rtype: int :return: int Draw type enum (i.e. GEOM_DRAW_SHADE)

openvsp.vsp.GetGeomMaterialName(geom_id)

Get the name of the visualization material applied to the specified geometry

pid = AddGeom( "POD" )

SetGeomMaterialName( pid, "Ruby" )

assert GetGeomMaterialName( pid ) == "Ruby", "GetGeomMaterialName did not report the material that was set"

# The name that comes back has to be one the library knows.
assert GetGeomMaterialName( pid ) in GetMaterialNames(), "GetGeomMaterialName reported a material the library does not have"

See also: SetGeomMaterialName, GetMaterialNames :param [in]: geom_id string Geom ID :rtype: string :return: string Material name

openvsp.vsp.GetGeomName(geom_id)

Get the name of a specific Geom

#==== Add Pod Geometry ====//
pid = AddGeom( "POD", "" )

SetGeomName( pid, "ExamplePodName" )

name_str = "Geom Name: " + GetGeomName( pid )

print( name_str )

assert GetGeomName( pid ) == "ExamplePodName", "GetGeomName did not report the name that was set"

# The name is how FindGeomsWithName looks Geoms up.
found = FindGeomsWithName( "ExamplePodName" )

assert len( found ) == 1, "GetGeomName disagrees with FindGeomsWithName"
assert found[0] == pid, "GetGeomName disagrees with FindGeomsWithName"
Parameters:

[in] – geom_id string Geom ID

Return type:

string

Returns:

string Geom name

openvsp.vsp.GetGeomParent(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 ====//
pod1 = AddGeom( "POD" )

pod2 = AddGeom( "POD", pod1 )

print( "Parent ID of Pod #2: ", False )

print( GetGeomParent( pod2 ) )

assert GetGeomParent( pod2 ) == pod1, "GetGeomParent did not report the parent it was given"

# The relationship has to read the same from the other end.
children = GetGeomChildren( pod1 )

assert len( children ) == 1, "GetGeomParent disagrees with GetGeomChildren"
assert children[0] == pod2, "GetGeomParent disagrees with GetGeomChildren"

# A Geom added with no parent sits at the top level.
assert GetGeomParent( pod1 ) == "NONE", "GetGeomParent did not report NONE for a top level Geom"
Parameters:

[in] – geom_id string Geom ID

Return type:

string

Returns:

string Parent Geom ID

openvsp.vsp.GetGeomParmIDs(geom_id)

Get all Parm IDs associated with this Geom Parm container

#==== Add Pod Geometry ====//
pid = AddGeom( "POD", "" )

print( "---> Test Get Parm Arrays" )

parm_array = GetGeomParmIDs( pid )

if  len(parm_array) < 1 :
    print( "---> Error: API GetGeomParmIDs " )
    assert False, "---> Error: API GetGeomParmIDs"
Parameters:

[in] – geom_id string Geom ID

Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<string> Array of Parm IDs

openvsp.vsp.GetGeomSet(name)

Get an array of Geom IDs for the specified set name

SetSetName( 3, "SetFromScript" )

geom_arr1 = GetGeomSetAtIndex( 3 )

geom_arr2 = GetGeomSet( "SetFromScript" )

if  len(geom_arr1) != len(geom_arr2) :
    print( "---> Error: API GetGeomSet " )
    assert False, "---> Error: API GetGeomSet"
Parameters:

[in] – name string const string set name

Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

array<string> array of Geom IDs

openvsp.vsp.GetGeomSetAtIndex(index)

Get an array of Geom IDs for the specified set index

SetSetName( 3, "SetFromScript" )

geom_arr1 = GetGeomSetAtIndex( 3 )

geom_arr2 = GetGeomSet( "SetFromScript" )

if  len(geom_arr1) != len(geom_arr2) :
    print( "---> Error: API GetGeomSet " )
    assert False, "---> Error: API GetGeomSet"

See also: SET_TYPE :param [in]: index int Set index :rtype: std::vector< std::string,std::allocator< std::string > > :return: vector<string> Array of Geom IDs

openvsp.vsp.GetGeomSetCollection(index)

Get collection ID from a vehicle’s GeomSet

##==== Attributes: GetGeomSetCollection =====##
CollID = GetGeomSetCollection( 0 )
assert len( CollID ) > 0, "GetGeomSetCollection returned nothing"
print( CollID )
Return type:

string

Returns:

string String ID of attribute collection associated with the geom set

Parameters:

[in] – index int Geom set

openvsp.vsp.GetGeomTextureFileName(geom_id, texture_id)

Get the image file a texture was attached from.

pod_id = AddGeom( "POD", "" )

tex_id = AttachGeomTexture( pod_id, "textures/nasa-logo.tga" )

assert GetGeomTextureFileName( pod_id, tex_id ) == "textures/nasa-logo.tga", "GetGeomTextureFileName did not report the file"

See also: AttachGeomTexture :param [in]: geom_id string Geom ID :param [in]: texture_id string Texture ParmContainer ID :rtype: string :return: string Name of the texture image file

openvsp.vsp.GetGeomTextureIDVec(geom_id)

Get the ParmContainer IDs of all the textures attached to a Geom, in the order they are drawn.

pod_id = AddGeom( "POD", "" )

# A fresh Geom carries no textures.
assert len( GetGeomTextureIDVec( pod_id ) ) == 0, "a new Geom already carries textures"

AttachGeomTexture( pod_id, "textures/nasa-logo.tga" )
AttachGeomTexture( pod_id, "textures/window.tga" )

assert len( GetGeomTextureIDVec( pod_id ) ) == 2, "GetGeomTextureIDVec, two were attached"

See also: AttachGeomTexture, RemoveGeomTexture :param [in]: geom_id string Geom ID :rtype: std::vector< std::string,std::allocator< std::string > > :return: vector<string> Vector of texture ParmContainer IDs

openvsp.vsp.GetGeomTypeName(geom_id)

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

#==== Add Wing Geometry ====//
wing_id = AddGeom( "WING" )

print( "Geom Type Name: ", False )

print( GetGeomTypeName( wing_id ) )

assert GetGeomTypeName( wing_id ) == "Wing", "GetGeomTypeName did not report the type that was added"

# A Geom of a different type has to report a different name.
pod_id = AddGeom( "POD" )

assert GetGeomTypeName( pod_id ) != GetGeomTypeName( wing_id ), "GetGeomTypeName gave two types the same name"
Parameters:

[in] – geom_id string Geom ID

Return type:

string

Returns:

string Geom type name

openvsp.vsp.GetGeomTypes()

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

#==== Add Pod Geometries ====//
pod1 = AddGeom( "POD", "" )
pod2 = AddGeom( "POD", "" )

type_array = GetGeomTypes()

if ( type_array[0] != "POD" ):
    print( "---> Error: API GetGeomTypes  " )
    assert False, "---> Error: API GetGeomTypes"
Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<string> Array of Geom type names

openvsp.vsp.GetGeomVSPSurfCfdType(geom_id, main_surf_ind=0)

Get the VSP surface CFD type of the specified Geom

#==== Add Wing Geometry ====//
wing_id = AddGeom( "WING" )

if  GetGeomVSPSurfCfdType( wing_id ) != CFD_NORMAL :
    print( "---> Error: API GetGeomVSPSurfCfdType " )
    assert False, "---> Error: API GetGeomVSPSurfCfdType"

See also: VSP_SURF_CFD_TYPE :param [in]: geom_id string Geom ID :param [in]: main_surf_ind int Main surface index :rtype: int :return: int VSP surface CFD type enum (i.e. CFD_TRANSPARENT)

openvsp.vsp.GetGeomVSPSurfType(geom_id, main_surf_ind=0)

Get the VSP surface type of the specified Geom

#==== Add Wing Geometry ====//
wing_id = AddGeom( "WING" )

if  GetGeomVSPSurfType( wing_id ) != WING_SURF :
    print( "---> Error: API GetGeomVSPSurfType " )
    assert False, "---> Error: API GetGeomVSPSurfType"

See also: VSP_SURF_TYPE :param [in]: geom_id string Geom ID :param [in]: main_surf_ind int Main surface index :rtype: int :return: int VSP surface type enum (i.e. DISK_SURF)

openvsp.vsp.GetGeomWireColor(geom_id)

Get the wireframe color of the specified geometry. The color components are returned in the X, Y and Z members of the vector as red, green and blue over the range [0, 255].

pid = AddGeom( "POD", "" )

SetGeomWireColor( pid, 0, 0, 255 )

color = GetGeomWireColor( pid )

assert abs( color.x() ) < 1e-9, "GetGeomWireColor did not report the color that was set"
assert abs( color.y() ) < 1e-9, "GetGeomWireColor did not report the color that was set"
assert abs( color.z() - 255 ) < 1e-9, "GetGeomWireColor did not report the color that was set"

# Each Geom carries its own color.
p2id = AddGeom( "POD", "" )

SetGeomWireColor( p2id, 255, 0, 0 )

assert abs( GetGeomWireColor( pid ).z() - 255 ) < 1e-9, "setting one Geom's color disturbed another"

See also: SetGeomWireColor :param [in]: geom_id string Geom ID :rtype: vec3d :return: vec3d Red, green and blue components of the wireframe color

openvsp.vsp.GetGeometryAnalysisAzimuthParm(geom_analysis_id, index)

Get the Parm ID of the azimuth of one az/el pair, so its value can be read or changed See also: AddGeometryAnalysisAzEl, GetGeometryAnalysisElevationParm :param [in]: geom_analysis_id string Geometry Analysis case ID :param [in]: index int Az/El pair index :rtype: string :return: string Azimuth Parm ID

openvsp.vsp.GetGeometryAnalysisElevationParm(geom_analysis_id, index)

Get the Parm ID of the elevation of one az/el pair, so its value can be read or changed See also: AddGeometryAnalysisAzEl, GetGeometryAnalysisAzimuthParm :param [in]: geom_analysis_id string Geometry Analysis case ID :param [in]: index int Az/El pair index :rtype: string :return: string Elevation Parm ID

openvsp.vsp.GetGroupName(group_id)

Get Variable Preset group name

# Add Pod Geom
pod1 = AddGeom( "POD", "" )

gid = AddVarPresetGroup( "Tess" )

name = GetGroupName( gid )
assert len( name ) > 0, "GetGroupName returned nothing"
Parameters:

[in] – group_id string Var Preset Group ID

Return type:

string

Returns:

string Var Preset Group name

openvsp.vsp.GetHersheyBarDragDist(npts, alpha, Vinf, span, full_span_flag=False)

Get the theoretical drag (Cd) distribution for a Hershey Bar wing with unit chord length using Glauert’s Method. This function was initially created to compare VSPAERO results to Lifting Line Theory. If full_span_flag is set to true symmetry is applied to the results.

pi = 3.14159265358979323846
# Compute theoretical lift and drag distributions using 100 points
Vinf = 100

halfAR = 20

alpha_deg = 10

n_pts = 100

cl_dist_theo = GetHersheyBarLiftDist( int( n_pts ), alpha_deg*pi/180, Vinf, ( 2 * halfAR ), False )

cd_dist_theo = GetHersheyBarDragDist( int( n_pts ), alpha_deg*pi/180, Vinf, ( 2 * halfAR ), False )
assert len( cd_dist_theo ) > 0, "GetHersheyBarDragDist returned nothing"
Parameters:
  • [in] – npts int Number of points along the span to assess

  • [in] – alpha double Wing angle of attack (Radians)

  • [in] – Vinf double Freestream velocity

  • [in] – span double Hershey Bar full-span. Note, only half is used in the calculation

  • [in] – full_span_flag bool Flag to apply symmetry to results (default: false)

Return type:

std::vector< vec3d,std::allocator< vec3d > >

Returns:

vector<vec3d> Theoretical coefficient of drag distribution array (size = 2*npts if full_span_flag = true)

openvsp.vsp.GetHersheyBarLiftDist(npts, alpha, Vinf, span, full_span_flag=False)

Get the theoretical lift (Cl) distribution for a Hershey Bar wing with unit chord length using Glauert’s Method. This function was initially created to compare VSPAERO results to Lifting Line Theory. If full_span_flag is set to true symmetry is applied to the results.

pi = 3.14159265358979323846
# Compute theoretical lift and drag distributions using 100 points
Vinf = 100

halfAR = 20

alpha_deg = 10

n_pts = 100

cl_dist_theo = GetHersheyBarLiftDist( int( n_pts ), alpha_deg*pi/180, Vinf, ( 2 * halfAR ), False )
assert len( cl_dist_theo ) > 0, "GetHersheyBarLiftDist returned nothing"

cd_dist_theo = GetHersheyBarDragDist( int( n_pts ), alpha_deg*pi/180, Vinf, ( 2 * halfAR ), False )
Parameters:
  • [in] – npts int Number of points along the span to assess

  • [in] – alpha double Wing angle of attack (Radians)

  • [in] – Vinf double Freestream velocity

  • [in] – span double Hershey Bar full-span. Note, only half is used in the calculation

  • [in] – full_span_flag bool Flag to apply symmetry to results

Return type:

std::vector< vec3d,std::allocator< vec3d > >

Returns:

vector<vec3d> Theoretical coefficient of lift distribution array (size = 2*npts if full_span_flag = true)

openvsp.vsp.GetIntAnalysisInput(analysis, name, index=0)

Get the current integer values for the particular analysis, input, and data index

#==== Analysis: VSPAero Compute Geometry ====//
analysis_name = "VSPAEROComputeGeometry"

# Set to panel method
thick_set = GetIntAnalysisInput( analysis_name, "GeomSet" )
assert len( thick_set ) > 0, "GetIntAnalysisInput returned nothing"
thin_set = GetIntAnalysisInput( analysis_name, "ThinGeomSet" )

thick_set = [vsp.SET_NONE]
thin_set = [vsp.SET_ALL]

SetIntAnalysisInput( analysis_name, "GeomSet", thick_set )
SetIntAnalysisInput( analysis_name, "ThinGeomSet", thin_set )

See also: RES_DATA_TYPE, SetIntAnalysisInput :param [in]: analysis string Analysis name :param [in]: name string Input name :param [in]: index int Data index :rtype: std::vector< int,std::allocator< int > > :return: vector<int> Array of analysis input values

openvsp.vsp.GetIntParmVal(parm_id)

Get the value of the specified int type Parm

#==== Add Prop Geometry ====//
prop_id = AddGeom( "PROP" )

num_blade_id = GetParm( prop_id, "NumBlade", "Design" )

num_blade = GetIntParmVal( num_blade_id )

# A new propeller has three blades, and the int form has to agree with the
# double form.
assert num_blade == 3, "GetIntParmVal did not report the blade count"
assert num_blade == int( GetParmVal( num_blade_id ) ), "GetIntParmVal disagrees with GetParmVal"

# Setting it has to move both.
SetParmVal( num_blade_id, 5 )

assert GetIntParmVal( num_blade_id ) == 5, "GetIntParmVal did not follow the Parm"
Parameters:

[in] – parm_id string Parm ID

Return type:

int

Returns:

double Parm value

openvsp.vsp.GetIntResults(id, name, index=0)

Get all integer values for a particular result, name, and index

#==== Write Some Fake Test Results =====//
WriteTestResults()

res_id = FindResultsID( "Test_Results" )

if ( GetNumData( res_id, "Test_Int" ) != 2 ):
    print( "---> Error: API GetNumData " )
    assert False, "---> Error: API GetNumData"

int_arr = GetIntResults( res_id, "Test_Int", 0 )

if  int_arr[0] != 1 :
    print( "---> Error: API GetIntResults" )
    assert False, "---> Error: API GetIntResults"

int_arr = GetIntResults( res_id, "Test_Int", 1 )

if  int_arr[0] != 2 :
    print( "---> Error: API GetIntResults" )
    assert False, "---> Error: API GetIntResults"
Parameters:
  • [in] – id string Result ID

  • [in] – name string Data name

  • [in] – index int Data index

Return type:

std::vector< int,std::allocator< int > >

Returns:

vector<int> Array of data values

openvsp.vsp.GetIntersectSubSurfGeomID(sub_id)

Set Geom ID to intersect parent with to create intersection SS_INTERSECT type subsurfaces

pid = AddGeom( "POD", "" )
p2id = AddGeom( "POD", "" )

xpod2 = GetParm( p2id, "X_Rel_Location", "XForm" )
SetParmVal( xpod2, 4.0 )

zrotpod2 = GetParm( p2id, "Z_Rel_Rotation", "XForm" )
SetParmVal( zrotpod2, 60.0 )

sub_id = AddSubSurf( pid, SS_INTERSECT )

Update()

SetIntersectSubSurfGeomID( sub_id, p2id )

IntersectSubSurf( sub_id )

Update()

# The sub-surface is an intersection of the two Pods, and it belongs to the
# first one.
assert GetSubSurfType( sub_id ) == SS_INTERSECT, "the sub-surface is not an intersection"

sub_ids = GetSubSurfIDVec( pid )

assert len( sub_ids ) == 1, "the intersection sub-surface is not on the Geom it was added to"
assert sub_ids[0] == sub_id, "the intersection sub-surface is not on the Geom it was added to"

# Naming a Geom that does not exist has to be rejected.  The error queue is
# reached through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

SetIntersectSubSurfGeomID( sub_id, "NOSUCHGEOM" )

IntersectSubSurf( sub_id )

assert err_mgr.GetNumTotalErrors() > 0, "a bad Geom ID was accepted for the intersection"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()
Parameters:
  • [in] – sub_id string Sub-surface ID

  • [in] – geom_id string Geom ID to intersect with parent to create subsurface

Get the Geom ID that an SS_INTERSECT type sub-surface intersects its parent with

pid = AddGeom( "POD", "" )
p2id = AddGeom( "POD", "" )

sub_id = AddSubSurf( pid, SS_INTERSECT )

Update()

SetIntersectSubSurfGeomID( sub_id, p2id )

assert GetIntersectSubSurfGeomID( sub_id ) == p2id, "GetIntersectSubSurfGeomID did not report the Geom that was set"

# A sub-surface of the wrong type has to be rejected.  The error queue is
# reached through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

line_id = AddSubSurf( pid, SS_LINE )

GetIntersectSubSurfGeomID( line_id )

assert err_mgr.GetNumTotalErrors() > 0, "GetIntersectSubSurfGeomID accepted a sub-surface of the wrong type"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: SetIntersectSubSurfGeomID, IntersectSubSurf :param [in]: sub_id string Sub-surface ID :rtype: string :return: string Geom ID the sub-surface intersects with

openvsp.vsp.GetLinkIndex(name)

Find the index of a specific advanced link.

pod = AddGeom( "POD", "" )
length = FindParm( pod, "Length", "Design" )
x_pos = GetParm( pod, "X_Rel_Location", "XForm" )

AddAdvLink( "ExampleLink" )
indx = GetLinkIndex( "ExampleLink" )
AddAdvLinkInput( indx, length, "len" )
AddAdvLinkOutput( indx, x_pos, "x" )

SetAdvLinkCode( indx, "x = 10.0 - len;" )

BuildAdvLinkScript( indx )

# The link was named, so it has to be findable by that name and by that
# index, and it has to actually drive its output: x is 10 minus the Pod's
# length, so changing the length has to move the Pod.
assert indx >= 0, "the advanced link was not registered under its name"
assert len( GetAdvLinkNames() ) == 1, "the advanced link was not registered under its name"
assert GetAdvLinkNames()[0] == "ExampleLink", "the advanced link was not registered under its name"

SetParmValUpdate( length, 6.0 )

Update()

assert abs( GetParmVal( x_pos ) - 4.0 ) < 1e-6, "the advanced link did not drive its output"
Parameters:

[in] – name string Name for advanced link

Return type:

int

Returns:

int index for advanced link

openvsp.vsp.GetLowerCSTCoefs(xsec_id)

Get the CST coefficients for the lower surface of an airfoil. The XSec must be of type XS_CST_AIRFOIL See also: SetLowerCST :param [in]: xsec_id string XSec ID :rtype: std::vector< double,std::allocator< double > > :return: vector<double> Vector of CST coefficients for the lower airfoil surface

openvsp.vsp.GetLowerCSTDegree(xsec_id)

Get the CST degree for the lower surface of an airfoil. The XSec must be of type XS_CST_AIRFOIL See also: SetLowerCST :param [in]: xsec_id string XSec ID :rtype: int :return: int CST Degree for lower airfoil surface

openvsp.vsp.GetMainRoutingPtCoord(pt_id)

Get the main coordinate location a routing point. The main location is the location of the base copy before symmetry has been applied.

pod1 = vsp.AddGeom('POD', '')

pod2 = vsp.AddGeom('POD', '')
ypod2 = vsp.GetParm(pod2, 'Y_Rel_Location', 'XForm')
vsp.SetParmVal(ypod2, 2.0)

routing_geom = vsp.AddGeom('ROUTING', '')

rpt0 = vsp.AddRoutingPt(routing_geom, pod1, 0)
u0 = vsp.GetParm( rpt0, 'U', 'RoutePt')
vsp.SetParmVal(u0, 0.0)

rpt1 = vsp.AddRoutingPt(routing_geom, pod2, 0)

rpt2 = vsp.AddRoutingPt(routing_geom, pod1, 0)
u2 = vsp.GetParm( rpt2, 'U', 'RoutePt')
vsp.SetParmVal(u2, 1.0)

vsp.Update()
p1 = vsp.GetMainRoutingPtCoord(rpt1)

# rpt1 rides on pod2, which was moved two units out in Y.
assert abs( p1.y() - 2.0 ) < 1e-6, "GetMainRoutingPtCoord did not follow the parent Geom"

# With no symmetry applied, the main copy is also symm_index 0.
assert vsp.dist( p1, vsp.GetRoutingPtCoord( routing_geom, 1, 0 ) ) < 1e-6, "GetMainRoutingPtCoord disagrees with GetRoutingPtCoord"

See also: AddRoutingPt, DelRoutingPt, GetRoutingPtCoord, GetAllRoutingPtCoords, GetRoutingCurve :param [in]: pt_id string ParmContainer ID of desired routing point :rtype: vec3d :return: vec3d coordinate of main routing point

openvsp.vsp.GetMaterialNames()

Get the names of all visualization materials

mat_array = GetMaterialNames()
assert len( mat_array ) > 0, "GetMaterialNames returned nothing"

for i in range(int( len(mat_array) )):
    print( mat_array[i] )
Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<string> Array of material names

openvsp.vsp.GetModeName(mid)

Apply Parm settings corresponding to a Mode.

# Illustrating use of Modes requires substantial setup of the model including components, sets, and variable presets.
#
# Setup boiler plate.
pod1 = AddGeom( "POD", "" )
wing = AddGeom( "WING", pod1 )

SetParmVal( wing, "Trans_Attach_Flag", "Attach", ATTACH_TRANS_LMN )
SetParmVal( wing, "L_Attach_Location", "Attach", 0.35 )

SetSetName( SET_FIRST_USER, "NonLifting" )
SetSetName( SET_FIRST_USER + 1, "Lifting" )

SetSetFlag( pod1, SET_FIRST_USER, True )
SetSetFlag( wing, SET_FIRST_USER + 1, True )


gid = AddVarPresetGroup( "Tess" )

p1 = FindParm( pod1, "Tess_U", "Shape" )
AddVarPresetParm( gid, p1 )

p2 = FindParm( pod1, "Tess_W", "Shape" )
AddVarPresetParm( gid, p2 )

sid = AddVarPresetSetting( gid, "Default" )
SaveVarPresetParmVals( gid, sid )

sid1 = AddVarPresetSetting( gid, "Coarse" )
SetVarPresetParmVal( gid, sid1, p1, 3 )
SetVarPresetParmVal( gid, sid1, p2, 5 )

sid2 = AddVarPresetSetting( gid, "Fine" )
SetVarPresetParmVal( gid, sid2, p1, 35 )
SetVarPresetParmVal( gid, sid2, p2, 21 )


gid2 = AddVarPresetGroup( "Design" )

p3 = FindParm( pod1, "Length", "Design" )
AddVarPresetParm( gid2, p3 )

p4 = FindParm( pod1, "FineRatio", "Design" )
AddVarPresetParm( gid2, p4 )

sid3 = AddVarPresetSetting( gid2, "Normal" )
SaveVarPresetParmVals( gid2, sid3 )

sid4 = AddVarPresetSetting( gid2, "ShortFat" )
SetVarPresetParmVal( gid2, sid4, p3, 3.0 )
SetVarPresetParmVal( gid2, sid4, p4, 5.0 )

sid5 = AddVarPresetSetting( gid2, "LongThin" )
SetVarPresetParmVal( gid2, sid5, p3, 20.0 )
SetVarPresetParmVal( gid2, sid5, p4, 35.0 )

# End of setup boiler plate.

mid1 = CreateAndAddMode( "FatWetAreas", SET_ALL, SET_NONE )
ModeAddGroupSetting( mid1, gid, sid1 )
ModeAddGroupSetting( mid1, gid2, sid4 )

mid2 = CreateAndAddMode( "ThinAero", SET_FIRST_USER, SET_FIRST_USER + 1 )
ModeAddGroupSetting( mid2, gid, sid2 )
ModeAddGroupSetting( mid2, gid2, sid5 )

ApplyModeSettings( mid2 )
Update()

# Each Mode carries the pairings it was given, in order.
gids = ModeGetAllGroups( mid1 )
sids = ModeGetAllSettings( mid1 )

assert len( gids ) == 2 and gids[0] == gid and gids[1] == gid2, "the Mode did not record the pairings it was given"
assert len( sids ) == 2 and sids[0] == sid1 and sids[1] == sid4, "the Mode did not record the pairings it was given"
assert len( ModeGetAllGroups( mid2 ) ) == 2, "the second Mode did not record its pairings"

# ThinAero carries the Fine tessellation and the LongThin design, so applying
# it has to drive all four Parms to those stored values.
assert abs( GetParmVal( p1 ) - 35 ) < 1e-9, "the tessellation group was not applied"
assert abs( GetParmVal( p2 ) - 21 ) < 1e-9, "the tessellation group was not applied"
assert abs( GetParmVal( p3 ) - 20.0 ) < 1e-9, "the design group was not applied"
assert abs( GetParmVal( p4 ) - 35.0 ) < 1e-9, "the design group was not applied"

# The other Mode holds different values, so switching has to move them.
ApplyModeSettings( mid1 )
Update()

assert abs( GetParmVal( p1 ) - 3 ) < 1e-9, "switching Modes did not change the Parms"
assert abs( GetParmVal( p3 ) - 3.0 ) < 1e-9, "switching Modes did not change the Parms"
Parameters:

[in] – mid string Mode ID of mode to apply

Get the name of a Mode.

mid = CreateAndAddMode( "FatWetAreas", SET_ALL, SET_NONE )

assert GetModeName( mid ) == "FatWetAreas", "GetModeName did not report the name the Mode was created with"

# A Mode that does not exist has to be rejected.  The error queue is reached
# through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

GetModeName( "NOSUCHMODE" )

assert err_mgr.GetNumTotalErrors() > 0, "GetModeName accepted a bad Mode ID"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: CreateAndAddMode, SetModeName :param [in]: mid string Mode ID :rtype: string :return: string Mode name

openvsp.vsp.GetNumActuatorDisks()

Get the number of actuator disks in the current VSPAERO set. This is equivalent to the number of disk surfaces in the VSPAERO set.

# Set VSPAERO set index to SET_ALL
SetParmVal( FindParm( FindContainer( "VSPAEROSettings", 0 ), "GeomSet", "VSPAERO" ), SET_ALL )

# Add a propeller
prop_id = AddGeom( "PROP", "" )
SetParmValUpdate( prop_id, "PropMode", "Design", PROP_BLADES )

num_disk = GetNumActuatorDisks() # Should be 0

assert num_disk == 0, "a bladed propeller counts as an actuator disk"

SetParmValUpdate( prop_id, "PropMode", "Design", PROP_DISK )

num_disk = GetNumActuatorDisks() # Should be 1

assert num_disk == 1, "GetNumActuatorDisks did not count the disk"

# The disk has to be findable at every index it claims.
for i in range( num_disk ):
    assert len( FindActuatorDisk( i ) ) > 0, "GetNumActuatorDisks counted a disk that cannot be found"

See also: PROP_MODE :rtype: int :return: int Number of actuator disks in the current VSPAERO set

openvsp.vsp.GetNumAnalysis()

Get the number of analysis types available in the Analysis Manager

nanalysis = GetNumAnalysis()

print( f"Number of registered analyses: {nanalysis}" )

# The count has to match the list of names.
analysis_array = ListAnalysis()

assert nanalysis == len( analysis_array ), "GetNumAnalysis disagrees with ListAnalysis"
assert nanalysis >= 1, "no analyses registered"
Return type:

int

Returns:

int Number of analyses

openvsp.vsp.GetNumAnalysisInputData(analysis, name)

Get the documentation string for the particular analysis and input :param [in]: analysis string Analysis name :param [in]: name string Input name :rtype: int :return: int Documentation string

openvsp.vsp.GetNumBackground3Ds()

Get Number of Background3D’s in a model

nbg = GetNumBackground3Ds()

# Add Background3D
bg_id = AddBackground3D()

if GetNumBackground3Ds() != nbg + 1 :
    print( "ERROR: AddBackground3D" )
    assert False, "ERROR: AddBackground3D"

DelBackground3D( bg_id )
Return type:

int

Returns:

int Number of Background3D’s in model

openvsp.vsp.GetNumBogies(gear_id)

Get the number of Bogies in the specified GearGeom.

gear_id = AddGeom( "GEAR", "" )

CreateAndAddBogie( gear_id )
CreateAndAddBogie( gear_id )

num_bogie = GetNumBogies( gear_id )            # num_bogie == 2

assert num_bogie == 2, "GetNumBogies, two were added"

See also: CreateAndAddBogie, GetAllBogies :param [in]: gear_id string GearGeom Geom ID :rtype: int :return: int Number of Bogies in the specified GearGeom

openvsp.vsp.GetNumCFDSources(geom_id)

Delete all CFD Mesh sources for all Geoms

#==== Add Pod Geom ====//
pid = AddGeom( "POD", "" )

AddCFDSource( POINT_SOURCE, pid, 0, 0.25, 2.0, 0.5, 0.5 )      # Add A Point Source

assert GetNumCFDSources( pid ) == 1, "the source was not added"

DeleteAllCFDSources()

assert GetNumCFDSources( pid ) == 0, "DeleteAllCFDSources left sources behind"

Get the number of CFD Mesh sources on the specified Geom

#==== Add Pod Geom ====//
pid = AddGeom( "POD", "" )

assert GetNumCFDSources( pid ) == 0, "a new Geom starts with sources"

AddCFDSource( POINT_SOURCE, pid, 0, 0.25, 2.0, 0.5, 0.5 )      # Add A Point Source

assert GetNumCFDSources( pid ) == 1, "GetNumCFDSources did not count the source that was added"

AddDefaultSources() # 3 Sources: Def_Fwd_PS, Def_Aft_PS, Def_Fwd_Aft_LS

assert GetNumCFDSources( pid ) == 4, "GetNumCFDSources did not count the default sources"

DeleteAllCFDSources()

assert GetNumCFDSources( pid ) == 0, "DeleteAllCFDSources left sources behind"

See also: AddCFDSource, AddDefaultSources, DeleteCFDSource, DeleteAllCFDSources :param [in]: geom_id string Geom ID :rtype: int :return: int Number of CFD Mesh sources on the Geom

openvsp.vsp.GetNumControlSurfaceGroups()

Get the total number of control surface groups

wid = AddGeom( "WING", "" )                             # Add Wing

aileron_id = AddSubSurf( wid, SS_CONTROL )                      # Add Control Surface Sub-Surface

#==== Add Horizontal tail and set some parameters =====//
horiz_id = AddGeom( "WING", "" )

SetGeomName( horiz_id, "Vert" )

SetParmValUpdate( horiz_id, "TotalArea", "WingGeom", 10.0 )
SetParmValUpdate( horiz_id, "X_Rel_Location", "XForm", 8.5 )

elevator_id = AddSubSurf( horiz_id, SS_CONTROL )                      # Add Control Surface Sub-Surface

AutoGroupVSPAEROControlSurfaces()

num_group = GetNumControlSurfaceGroups()

if  num_group != 2 :
    print( "Error: GetNumControlSurfaceGroups" )
    assert False, "Error: GetNumControlSurfaceGroups"
Return type:

int

Returns:

int Number of control surface groups

openvsp.vsp.GetNumCpSlices()

Get the number of Cp slices in the VSPAERO Cp Slicer

num_before = GetNumCpSlices()

AddCpSlice( X_DIR, 0.5 )
AddCpSlice( Y_DIR, 0.25 )

assert GetNumCpSlices() == num_before + 2, "GetNumCpSlices did not count both slices"

# Every slice the count claims has to be findable.
for i in range( GetNumCpSlices() ):
    assert len( GetCpSliceID( i ) ) > 0, "slice " + str( i ) + " cannot be found"

See also: AddCpSlice, GetCpSliceID, DelCpSlice, DeleteAllCpSlices :rtype: int :return: int Number of Cp slices

openvsp.vsp.GetNumData(results_id, data_name)

Get the number of data values for a given result ID and data name

#==== Write Some Fake Test Results =====//
WriteTestResults()

res_id = FindResultsID( "Test_Results" )

if ( GetNumData( res_id, "Test_Int" ) != 2 ):
    print( "---> Error: API GetNumData " )
    assert False, "---> Error: API GetNumData"

int_arr = GetIntResults( res_id, "Test_Int", 0 )

if  int_arr[0] != 1 :
    print( "---> Error: API GetIntResults" )
    assert False, "---> Error: API GetIntResults"

int_arr = GetIntResults( res_id, "Test_Int", 1 )

if  int_arr[0] != 2 :
    print( "---> Error: API GetIntResults" )
    assert False, "---> Error: API GetIntResults"
Parameters:
  • [in] – results_id string Result ID

  • [in] – data_name string Data name

Return type:

int

Returns:

int Number of data values

openvsp.vsp.GetNumDesignVars()

Get the number of design variables :rtype: int :return: int Number of design variables

openvsp.vsp.GetNumExcrescences()

Delete an Excresence from the Parasite Drag Tool

AddExcrescence( "Miscellaneous", EXCRESCENCE_COUNT, 8.5 )

AddExcrescence( "Cowl Boattail", EXCRESCENCE_CD, 0.0003 )

AddExcrescence( "Percentage Example", EXCRESCENCE_PERCENT_GEOM, 5 )

DeleteExcrescence( 2 ) # Last Index

# Three were added and one was deleted, so index 2 no longer exists and
# asking for it again has to be rejected.  The error queue is reached through
# the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

DeleteExcrescence( 2 )

assert err_mgr.GetNumTotalErrors() > 0, "DeleteExcrescence accepted an index past the end"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()
Parameters:

[in] – index int Index of the Excressence to delete

Get the number of Excresences in the Parasite Drag Tool

assert GetNumExcrescences() == 0, "a new model starts with excrescences"

AddExcrescence( "Miscellaneous", EXCRESCENCE_COUNT, 8.5 )

AddExcrescence( "Cowl Boattail", EXCRESCENCE_CD, 0.0003 )

assert GetNumExcrescences() == 2, "GetNumExcrescences did not count what was added"

DeleteExcrescence( 1 )

assert GetNumExcrescences() == 1, "GetNumExcrescences did not follow DeleteExcrescence"

See also: AddExcrescence, DeleteExcrescence, DeleteAllExcrescences :rtype: int :return: int Number of excrescences

openvsp.vsp.GetNumGeometryAnalysisAzEl(geom_analysis_id)

Get the number of azimuth and elevation pairs in a Geometry Analysis case See also: AddGeometryAnalysisAzEl :param [in]: geom_analysis_id string Geometry Analysis case ID :rtype: int :return: int Number of az/el pairs

openvsp.vsp.GetNumMainSurfs(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 ====//
prop_id = AddGeom( "PROP" )

num_surf = 0

num_surf = GetNumMainSurfs( prop_id ) # Should be the same as the number of blades

assert num_surf == GetIntParmVal( FindParm( prop_id, "NumBlade", "Design" ) ), "GetNumMainSurfs does not match the blade count"

print( "Number of Propeller Surfaces: ", False )

print( num_surf )
Parameters:

[in] – geom_id string Geom ID

Return type:

int

Returns:

int Number of main surfaces

openvsp.vsp.GetNumModes()

Get number of Modes in model.

# Illustrating use of Modes requires substantial setup of the model including components, sets, and variable presets.
#
# Setup boiler plate.
pod1 = AddGeom( "POD", "" )
wing = AddGeom( "WING", pod1 )

SetParmVal( wing, "Trans_Attach_Flag", "Attach", ATTACH_TRANS_LMN )
SetParmVal( wing, "L_Attach_Location", "Attach", 0.35 )

SetSetName( SET_FIRST_USER, "NonLifting" )
SetSetName( SET_FIRST_USER + 1, "Lifting" )

SetSetFlag( pod1, SET_FIRST_USER, True )
SetSetFlag( wing, SET_FIRST_USER + 1, True )


gid = AddVarPresetGroup( "Tess" )

p1 = FindParm( pod1, "Tess_U", "Shape" )
AddVarPresetParm( gid, p1 )

p2 = FindParm( pod1, "Tess_W", "Shape" )
AddVarPresetParm( gid, p2 )

sid = AddVarPresetSetting( gid, "Default" )
SaveVarPresetParmVals( gid, sid )

sid1 = AddVarPresetSetting( gid, "Coarse" )
SetVarPresetParmVal( gid, sid1, p1, 3 )
SetVarPresetParmVal( gid, sid1, p2, 5 )

sid2 = AddVarPresetSetting( gid, "Fine" )
SetVarPresetParmVal( gid, sid2, p1, 35 )
SetVarPresetParmVal( gid, sid2, p2, 21 )


gid2 = AddVarPresetGroup( "Design" )

p3 = FindParm( pod1, "Length", "Design" )
AddVarPresetParm( gid2, p3 )

p4 = FindParm( pod1, "FineRatio", "Design" )
AddVarPresetParm( gid2, p4 )

sid3 = AddVarPresetSetting( gid2, "Normal" )
SaveVarPresetParmVals( gid2, sid3 )

sid4 = AddVarPresetSetting( gid2, "ShortFat" )
SetVarPresetParmVal( gid2, sid4, p3, 3.0 )
SetVarPresetParmVal( gid2, sid4, p4, 5.0 )

sid5 = AddVarPresetSetting( gid2, "LongThin" )
SetVarPresetParmVal( gid2, sid5, p3, 20.0 )
SetVarPresetParmVal( gid2, sid5, p4, 35.0 )

# End of setup boiler plate.

mid1 = CreateAndAddMode( "FatWetAreas", SET_ALL, SET_NONE )
ModeAddGroupSetting( mid1, gid, sid1 )
ModeAddGroupSetting( mid1, gid2, sid4 )

mid2 = CreateAndAddMode( "ThinAero", SET_FIRST_USER, SET_FIRST_USER + 1 )
ModeAddGroupSetting( mid2, gid, sid2 )
ModeAddGroupSetting( mid2, gid2, sid5 )

ApplyModeSettings( mid2 )
Update()

nmod = GetNumModes()

assert nmod == 2, "GetNumModes, two were created"
Return type:

int

Returns:

int Number of Modes in model.

Get the number of simple Parm Links in the model

pod1 = AddGeom( "POD", "" )
pod2 = AddGeom( "POD", "" )

assert GetNumParmLinks() == 0, "a new model starts with Parm Links"

AddParmLink( GetParm( pod1, "X_Rel_Location", "XForm" ), GetParm( pod2, "X_Rel_Location", "XForm" ) )
AddParmLink( GetParm( pod1, "Y_Rel_Location", "XForm" ), GetParm( pod2, "Y_Rel_Location", "XForm" ) )

assert GetNumParmLinks() == 2, "GetNumParmLinks did not count both links"

# Every link the count claims has to be findable.
for i in range( GetNumParmLinks() ):
    assert len( GetParmLinkID( i ) ) > 0, "a counted link cannot be found"

See also: AddParmLink, GetParmLinkID :rtype: int :return: int Number of Parm Links

openvsp.vsp.GetNumPredefinedUserParms()

Get the number of pre-defined user parameters

n = GetNumPredefinedUserParms()

assert n > 0, "GetNumPredefinedUserParms"
Return type:

int

Returns:

int Number of pre-defined user Parms

openvsp.vsp.GetNumResults(name)

Get the number of results for a particular result name

#==== Write Some Fake Test Results =====//
WriteTestResults()

if ( GetNumResults( "Test_Results" ) != 2 ):
    print( "---> Error: API GetNumResults" )
    assert False, "---> Error: API GetNumResults"
Parameters:

[in] – name string Input name

Return type:

int

Returns:

int Number of results

openvsp.vsp.GetNumRoutingPts(routing_id)

Get the number of routing points in a RoutingGeom

pod1 = vsp.AddGeom('POD', '')

pod2 = vsp.AddGeom('POD', '')
ypod2 = vsp.GetParm(pod2, 'Y_Rel_Location', 'XForm')
vsp.SetParmVal(ypod2, 2.0)

routing_geom = vsp.AddGeom('ROUTING', '')

rpt0 = vsp.AddRoutingPt(routing_geom, pod1, 0)
u0 = vsp.GetParm( rpt0, 'U', 'RoutePt')
vsp.SetParmVal(u0, 0.0)

rpt1 = vsp.AddRoutingPt(routing_geom, pod2, 0)

rpt2 = vsp.AddRoutingPt(routing_geom, pod1, 0)
u2 = vsp.GetParm( rpt2, 'U', 'RoutePt')
vsp.SetParmVal(u2, 1.0)

npt = vsp.GetNumRoutingPts(routing_geom)

# Three points were added, and the count has to match the ID list.
assert npt == 3, "GetNumRoutingPts did not count the points that were added"
assert npt == len( vsp.GetAllRoutingPtIds( routing_geom ) ), "GetNumRoutingPts disagrees with GetAllRoutingPtIds"

# Deleting one has to move the count.
vsp.DelRoutingPt( routing_geom, 1 )

assert vsp.GetNumRoutingPts( routing_geom ) == npt - 1, "GetNumRoutingPts did not follow DelRoutingPt"

See also: AddRoutingPt, DelRoutingPt :param [in]: routing_id string RoutingGeom Geom ID :rtype: int :return: int Number of routing points in specified RoutingGeom

openvsp.vsp.GetNumSets()

Get the total number of defined sets. Named sets are used to group components and read/write on them. The number of named sets will be 10 for OpenVSP versions up to 3.17.1 and 20 for later versions.

if  GetNumSets() <= 0 :
    print( "---> Error: API GetNumSets " )
    assert False, "---> Error: API GetNumSets"
Return type:

int

Returns:

int Number of sets

openvsp.vsp.GetNumSubSurf(geom_id)

Get the number of sub-surfaces for the specified Geom

wid = AddGeom( "WING", "" )                             # Add Wing

ss_line_id = AddSubSurf( wid, SS_LINE )                      # Add Sub Surface Line
ss_rec_id = AddSubSurf( wid, SS_RECTANGLE )                        # Add Sub Surface Rectangle

num_ss = GetNumSubSurf( wid )

assert num_ss == 2, "GetNumSubSurf, two were added"

num_str = "Number of SubSurfaces: {num_ss}"

print( num_str )
Parameters:

[in] – geom_id string Geom ID

Return type:

int

Returns:

int Number of Sub-surfaces

openvsp.vsp.GetNumUnsteadyGroups()

Get the number of unsteady groups in the current VSPAERO set. Each propeller is placed in its own unsteady group. All symmetric copies of propellers are also placed in an unsteady group. All other component types are placed in a single fixed component unsteady group.

# Set VSPAERO set index to SET_ALL
SetParmVal( FindParm( FindContainer( "VSPAEROSettings", 0 ), "GeomSet", "VSPAERO" ), SET_ALL )

# Add a propeller
prop_id = AddGeom( "PROP" )
SetParmValUpdate( prop_id, "PropMode", "Design", PROP_DISK )

num_group = GetNumUnsteadyGroups() # Should be 0

assert num_group == 0, "an actuator disk counts as an unsteady group"

SetParmValUpdate( prop_id, "PropMode", "Design", PROP_BLADES )

num_group = GetNumUnsteadyGroups() # Should be 1

assert num_group == 1, "the bladed propeller was not counted"

wing_id = AddGeom( "WING" )

num_group = GetNumUnsteadyGroups() # Should be 2 (includes fixed component group)

assert num_group == 2, "the fixed component group was not counted"

# Only the propeller is a rotor group; the wing shares the fixed group.
assert GetNumUnsteadyRotorGroups() == 1, "GetNumUnsteadyGroups disagrees with GetNumUnsteadyRotorGroups"

See also: PROP_MODE, GetNumUnsteadyRotorGroups :rtype: int :return: int Number of unsteady groups in the current VSPAERO set

openvsp.vsp.GetNumUnsteadyRotorGroups()

Get the number of unsteady rotor groups in the current VSPAERO set. This is equivalent to the total number of propeller Geoms, including each symmetric copy, in the current VSPAERO set. While all fixed components (wings, fuseleage, etc.) are placed in their own unsteady group, this function does not consider them.

# Set VSPAERO set index to SET_ALL
SetParmVal( FindParm( FindContainer( "VSPAEROSettings", 0 ), "GeomSet", "VSPAERO" ), SET_ALL )

# Add a propeller
prop_id = AddGeom( "PROP" )
SetParmValUpdate( prop_id, "PropMode", "Design", PROP_DISK )

num_group = GetNumUnsteadyRotorGroups() # Should be 0

assert num_group == 0, "an actuator disk counts as a rotor group"

SetParmValUpdate( prop_id, "PropMode", "Design", PROP_BLADES )

num_group = GetNumUnsteadyRotorGroups() # Should be 1

assert num_group == 1, "the bladed propeller was not counted"

wing_id = AddGeom( "WING" )

num_group = GetNumUnsteadyRotorGroups() # Should be 1 still (fixed group not included)

assert num_group == 1, "the wing was counted as a rotor group"

# The wing does add a fixed component group, which the total counts.
assert GetNumUnsteadyGroups() == num_group + 1, "the fixed component group was not counted"

See also: PROP_MODE, GetNumUnsteadyGroups :rtype: int :return: int Number of unsteady rotor groups in the current VSPAERO set

openvsp.vsp.GetNumUserParms()

Get the number of user parameters

n = GetNumUserParms()

# A fresh model already carries the predefined user Parms, and the count has
# to match the list.
assert n == GetNumPredefinedUserParms(), "GetNumUserParms does not match the predefined count"
assert n == len( GetAllUserParms() ), "GetNumUserParms disagrees with the user Parm list"

# Adding one has to move the count.
AddUserParm( PARM_DOUBLE_TYPE, "ExampleParm", "ExampleGroup" )

assert GetNumUserParms() == n + 1, "GetNumUserParms did not follow AddUserParm"
Return type:

int

Returns:

int Number of user Parms

openvsp.vsp.GetNumXSec(xsec_surf_id)

Get number of XSecs in an XSecSurf

# Add Stack
sid = AddGeom( "STACK", "" )

# Get First (and Only) XSec Surf
xsec_surf = GetXSecSurf( sid, 0 )

# Flatten ends
num_xsecs = GetNumXSec( xsec_surf )

# A Stack starts with five sections, and every index below the count has to
# name a real XSec.
assert num_xsecs == 5, "GetNumXSec did not report the sections of a new Stack"

for i in range(num_xsecs):

    xsec = GetXSec( xsec_surf, i )

    assert len( xsec ) > 0, "GetNumXSec counted a section that GetXSec cannot find"

    SetXSecTanAngles( xsec, XSEC_BOTH_SIDES, 0, -1.0e12, -1.0e12, -1.0e12 )       # Set Tangent Angles At Cross Section

    SetXSecTanStrengths( xsec, XSEC_BOTH_SIDES, 0.0, -1.0e12, -1.0e12, -1.0e12 )  # Set Tangent Strengths At Cross Section

# Inserting a section has to move the count.
InsertXSec( sid, 1, XS_ROUNDED_RECTANGLE )

assert GetNumXSec( xsec_surf ) == num_xsecs + 1, "GetNumXSec did not follow InsertXSec"
Parameters:

[in] – xsec_surf_id string XSecSurf ID

Return type:

int

Returns:

int Number of XSecs

openvsp.vsp.GetNumXSecSurfs(geom_id)

Get the number of XSecSurfs for the specified Geom

#==== Add Fuselage Geometry ====//
fuseid = AddGeom( "FUSELAGE", "" )

num_xsec_surfs = GetNumXSecSurfs( fuseid )

if  num_xsec_surfs != 1 :
    print( "---> Error: API GetNumXSecSurfs  " )
    assert False, "---> Error: API GetNumXSecSurfs"
Parameters:

[in] – geom_id string Geom ID

Return type:

int

Returns:

int Number of XSecSurfs

openvsp.vsp.GetObjectName(attachID)

Get the name of an OpenVSP Entity by ID

##==== Attributes: GetObjectName ====##
AttachIDs = FindAttributedObjects()
for AttachID in AttachIDs:
    ObjName = GetObjectName( AttachID )
    assert len( ObjName ) > 0, "GetObjectName returned nothing"
    print( ObjName )
Return type:

string

Returns:

string return string of object name

Parameters:

[in] – attachID string ID of an OpenVSP object

openvsp.vsp.GetObjectParent(id)

Get the string ID of the entity’s parent Attributes -> Attribute Collections Attribute Collections -> Objects that contain attribute Collections Geoms->Parent Geoms Parms->ParmContainers etc.

##==== Attributes: GetObjectParent ====##

WingID = AddGeom( "WING" )
PodID = AddGeom( "POD", WingID )
ParentID = GetObjectParent( PodID )
assert len( ParentID ) > 0, "GetObjectParent returned nothing"

if ParentID == WingID:
    print( "Parent of Pod is Wing")

#Get first attribute in vehicle as an example
AttrID = FindAllAttributes()[0]
CollID = GetObjectParent( AttrID )
CollParentObjID = GetObjectParent( CollID )
print( CollParentObjID )
Return type:

string

Returns:

string ID of object parent

openvsp.vsp.GetObjectType(attachID)

Get the type of an OpenVSP Entity by ID

##==== Attributes: GetObjectType ====##
AttachIDs = FindAttributedObjects()

assert len( AttachIDs ) > 0, "FindAttributedObjects found nothing"

for AttachID in AttachIDs:
    ObjType = GetObjectType( AttachID )
    print( ObjType )

    # Every object that carries attributes has to be a recognized kind, and
    # the enum has to agree with the name form.
    assert ObjType != ATTROBJ_FREE, "GetObjectType did not recognize " + AttachID
    assert len( GetObjectTypeName( AttachID ) ) > 0, "GetObjectTypeName returned nothing for " + AttachID
Return type:

int

Returns:

int return string of object name

Parameters:

[in] – attachID string ID of an OpenVSP object

openvsp.vsp.GetObjectTypeName(attachID)

Get the named type of an OpenVSP Entity by ID

AttachIDs = FindAttributedObjects()
for AttachID in AttachIDs:
    ObjTypeName = GetObjectTypeName( AttachID )
    assert len( ObjTypeName ) > 0, "GetObjectTypeName returned nothing"
    print( ObjTypeName )
Return type:

string

Returns:

string return string of object name

Parameters:

[in] – attachID string ID of an OpenVSP object

openvsp.vsp.GetParm(geom_id, name, group)

Get Parm ID

#==== Add Pod Geometry ====//
pid = AddGeom( "POD" )

lenid = GetParm( pid, "Length", "Design" )

if  not ValidParm( lenid ) :
    print( "---> Error: API GetParm  " )
    assert False, "---> Error: API GetParm"
Parameters:
  • [in] – geom_id string Geom ID

  • [in] – name string Parm name

  • [in] – group string Parm group name

Return type:

string

Returns:

string Parm ID

openvsp.vsp.GetParmContainer(parm_id)

Get Parm Container ID for the specified Parm

# Add Fuselage Geom
fuseid = AddGeom( "FUSELAGE", "" )

xsec_surf = GetXSecSurf( fuseid, 0 )

ChangeXSecShape( xsec_surf, GetNumXSec( xsec_surf ) - 1, XS_ROUNDED_RECTANGLE )

xsec = GetXSec( xsec_surf, GetNumXSec( xsec_surf ) - 1 )

wid = GetXSecParm( xsec, "RoundedRect_Width" )

cid = GetParmContainer( wid )

if  len(cid) == 0 :
    print( "---> Error: API GetParmContainer " )
    assert False, "---> Error: API GetParmContainer"
Parameters:

[in] – parm_id string Parm ID

Return type:

string

Returns:

string Parm Container ID

openvsp.vsp.GetParmDescript(parm_id)

Get the description of the specified Parm

pod_id = AddGeom( "POD" )

length = FindParm( pod_id, "Length", "Design" )

SetParmValLimits( length, 10.0, 0.001, 1.0e12 )

desc = GetParmDescript( length )
assert len( desc ) > 0, "GetParmDescript returned nothing"
print( desc )
Parameters:

[in] – parm_id string Parm ID

Return type:

string

Returns:

string desc Parm description

openvsp.vsp.GetParmDisplayGroupName(parm_id)

Get the display group name for the specified Parm

veh_id = FindContainer( "Vehicle", 0 )

#==== Get and List All Parms in the Container ====//
parm_ids = FindContainerParmIDs( veh_id )

print( "Parm Group Display Names and IDs in Vehicle Parm Container: " )

for i in range(len(parm_ids)):

    group_str = GetParmDisplayGroupName( parm_ids[i] ) + ": " + parm_ids[i] + "\n"
    assert len( group_str ) > 0, "GetParmDisplayGroupName returned nothing"

    print( group_str )
Parameters:

[in] – parm_id string Parm ID

Return type:

string

Returns:

string Parm display group name

openvsp.vsp.GetParmGroupName(parm_id)

Get the group name for the specified Parm

veh_id = FindContainer( "Vehicle", 0 )

#==== Get and List All Parms in the Container ====//
parm_ids = FindContainerParmIDs( veh_id )

print( "Parm Groups and IDs in Vehicle Parm Container: " )

for i in range(len(parm_ids)):

    group_str = GetParmGroupName( parm_ids[i] ) + ": " + parm_ids[i] + "\n"
    assert len( group_str ) > 0, "GetParmGroupName returned nothing"

    print( group_str )
Parameters:

[in] – parm_id string Parm ID

Return type:

string

Returns:

string Parm group name

openvsp.vsp.GetParmLinkAParm(link_id)

Get the driving Parm of a Parm Link

pod1 = AddGeom( "POD", "" )
pod2 = AddGeom( "POD", "" )

xa = GetParm( pod1, "X_Rel_Location", "XForm" )
xb = GetParm( pod2, "X_Rel_Location", "XForm" )

link_id = AddParmLink( xa, xb )

assert GetParmLinkAParm( link_id ) == xa, "the link does not report the Parms it was given"
assert GetParmLinkBParm( link_id ) == xb, "the link does not report the Parms it was given"

# Pointing A at a different Parm has to take.
ya = GetParm( pod1, "Y_Rel_Location", "XForm" )

SetParmLinkAParm( link_id, ya )

assert GetParmLinkAParm( link_id ) == ya, "SetParmLinkAParm did not take"

# A Parm that does not exist has to be rejected.  The error queue is reached
# through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

SetParmLinkAParm( link_id, "NOSUCHPARM" )

assert err_mgr.GetNumTotalErrors() > 0, "SetParmLinkAParm accepted a bad Parm ID"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: AddParmLink, GetParmLinkBParm, SetParmLinkAParm :param [in]: link_id string Parm Link ID :rtype: string :return: string Parm ID of the driving Parm

openvsp.vsp.GetParmLinkBParm(link_id)

Get the driven Parm of a Parm Link

pod1 = AddGeom( "POD", "" )
pod2 = AddGeom( "POD", "" )

xa = GetParm( pod1, "X_Rel_Location", "XForm" )
xb = GetParm( pod2, "X_Rel_Location", "XForm" )

link_id = AddParmLink( xa, xb )

assert GetParmLinkBParm( link_id ) == xb, "GetParmLinkBParm did not report the driven Parm"

# The two ends are different Parms.
assert GetParmLinkBParm( link_id ) != GetParmLinkAParm( link_id ), "both ends of the link report the same Parm"

See also: AddParmLink, GetParmLinkAParm, SetParmLinkBParm :param [in]: link_id string Parm Link ID :rtype: string :return: string Parm ID of the driven Parm

openvsp.vsp.GetParmLinkID(index)

Get the ID of the Parm Link at the specified index

pod1 = AddGeom( "POD", "" )
pod2 = AddGeom( "POD", "" )

first = AddParmLink( GetParm( pod1, "X_Rel_Location", "XForm" ), GetParm( pod2, "X_Rel_Location", "XForm" ) )
second = AddParmLink( GetParm( pod1, "Y_Rel_Location", "XForm" ), GetParm( pod2, "Y_Rel_Location", "XForm" ) )

# Links come back in the order they were added.
assert GetParmLinkID( 0 ) == first, "GetParmLinkID did not report the links in order"
assert GetParmLinkID( 1 ) == second, "GetParmLinkID did not report the links in order"

# An index past the end has to be rejected.  The error queue is reached
# through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

GetParmLinkID( GetNumParmLinks() )

assert err_mgr.GetNumTotalErrors() > 0, "GetParmLinkID accepted an index past the end"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: AddParmLink, GetNumParmLinks :param [in]: index int Parm Link index :rtype: string :return: string Parm Link ID

openvsp.vsp.GetParmLinkLowerLimitFlag(link_id)

Get whether a Parm Link applies its lower limit

pod1 = AddGeom( "POD", "" )
pod2 = AddGeom( "POD", "" )

xa = GetParm( pod1, "X_Rel_Location", "XForm" )
xb = GetParm( pod2, "X_Rel_Location", "XForm" )

link_id = AddParmLink( xa, xb )

# A new link comes up with its offset on and the rest off.
assert GetParmLinkLowerLimitFlag( link_id ) == False, "the lower limit flag did not start where a new link starts"

SetParmLinkLowerLimitFlag( link_id, not GetParmLinkLowerLimitFlag( link_id ) )

assert GetParmLinkLowerLimitFlag( link_id ) != False, "GetParmLinkLowerLimitFlag did not follow the setter"

See also: SetParmLinkLowerLimitFlag, AddParmLink :param [in]: link_id string Parm Link ID :rtype: boolean :return: bool True if the lower limit is applied

openvsp.vsp.GetParmLinkOffsetFlag(link_id)

Get whether a Parm Link applies its offset

pod1 = AddGeom( "POD", "" )
pod2 = AddGeom( "POD", "" )

xa = GetParm( pod1, "X_Rel_Location", "XForm" )
xb = GetParm( pod2, "X_Rel_Location", "XForm" )

link_id = AddParmLink( xa, xb )

# A new link comes up with its offset on and the rest off.
assert GetParmLinkOffsetFlag( link_id ) == True, "the offset flag did not start where a new link starts"

SetParmLinkOffsetFlag( link_id, not GetParmLinkOffsetFlag( link_id ) )

assert GetParmLinkOffsetFlag( link_id ) != True, "GetParmLinkOffsetFlag did not follow the setter"

See also: SetParmLinkOffsetFlag, AddParmLink :param [in]: link_id string Parm Link ID :rtype: boolean :return: bool True if the offset is applied

openvsp.vsp.GetParmLinkScaleFlag(link_id)

Get whether a Parm Link applies its scale

pod1 = AddGeom( "POD", "" )
pod2 = AddGeom( "POD", "" )

xa = GetParm( pod1, "X_Rel_Location", "XForm" )
xb = GetParm( pod2, "X_Rel_Location", "XForm" )

link_id = AddParmLink( xa, xb )

# A new link comes up with its offset on and the rest off.
assert GetParmLinkScaleFlag( link_id ) == False, "the scale flag did not start where a new link starts"

SetParmLinkScaleFlag( link_id, not GetParmLinkScaleFlag( link_id ) )

assert GetParmLinkScaleFlag( link_id ) != False, "GetParmLinkScaleFlag did not follow the setter"

See also: SetParmLinkScaleFlag, AddParmLink :param [in]: link_id string Parm Link ID :rtype: boolean :return: bool True if the scale is applied

openvsp.vsp.GetParmLinkUpperLimitFlag(link_id)

Get whether a Parm Link applies its upper limit

pod1 = AddGeom( "POD", "" )
pod2 = AddGeom( "POD", "" )

xa = GetParm( pod1, "X_Rel_Location", "XForm" )
xb = GetParm( pod2, "X_Rel_Location", "XForm" )

link_id = AddParmLink( xa, xb )

# A new link comes up with its offset on and the rest off.
assert GetParmLinkUpperLimitFlag( link_id ) == False, "the upper limit flag did not start where a new link starts"

SetParmLinkUpperLimitFlag( link_id, not GetParmLinkUpperLimitFlag( link_id ) )

assert GetParmLinkUpperLimitFlag( link_id ) != False, "GetParmLinkUpperLimitFlag did not follow the setter"

See also: SetParmLinkUpperLimitFlag, AddParmLink :param [in]: link_id string Parm Link ID :rtype: boolean :return: bool True if the upper limit is applied

openvsp.vsp.GetParmLowerLimit(parm_id)

Get the lower limit value for the specified Parm

#==== Add Prop Geometry ====//
prop_id = AddGeom( "PROP" )

num_blade_id = GetParm( prop_id, "NumBlade", "Design" )

min_blade = GetParmLowerLimit( num_blade_id )

# A propeller needs at least one blade, and the limits have to bracket the
# current value.
assert min_blade >= 1.0, "GetParmLowerLimit allows a propeller with no blades"
assert min_blade <= GetParmVal( num_blade_id ), "the lower limit is above the value"
assert min_blade <= GetParmUpperLimit( num_blade_id ), "the lower limit is above the upper limit"

# Asking for less than the limit allows has to clamp to it.
SetParmVal( num_blade_id, min_blade - 10.0 )

assert abs( GetParmVal( num_blade_id ) - min_blade ) < 1e-9, "the lower limit did not hold"
Parameters:

[in] – parm_id string Parm ID

Return type:

float

Returns:

double Parm lower limit

openvsp.vsp.GetParmName(parm_id)

Get the name for the specified Parm

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

#==== Add FeaStructure to Pod ====//
struct_ind = AddFeaStruct( pod_id )

#==== Get Structure Name and Parm Container ID ====//
parm_container_name = GetFeaStructName( pod_id, struct_ind )

parm_container_id = FindContainer( parm_container_name, struct_ind )

#==== Get and List All Parms in the Container ====//
parm_ids = FindContainerParmIDs( parm_container_id )

for i in range(len(parm_ids)):

    name_id = GetParmName( parm_ids[i] ) + ": " + parm_ids[i] + "\n"
    assert len( name_id ) > 0, "GetParmName returned nothing"

    print( name_id )
Parameters:

[in] – parm_id string Parm ID

Return type:

string

Returns:

string Parm name

openvsp.vsp.GetParmType(parm_id)

Get the data type for the specified Parm

# Add Fuselage Geom
fuseid = AddGeom( "FUSELAGE", "" )

xsec_surf = GetXSecSurf( fuseid, 0 )

ChangeXSecShape( xsec_surf, GetNumXSec( xsec_surf ) - 1, XS_ROUNDED_RECTANGLE )

xsec = GetXSec( xsec_surf, GetNumXSec( xsec_surf ) - 1 )

wid = GetXSecParm( xsec, "RoundedRect_Width" )

if  GetParmType( wid ) != PARM_DOUBLE_TYPE :
    print( "---> Error: API GetParmType " )
    assert False, "---> Error: API GetParmType"

See also: PARM_TYPE :param [in]: parm_id string Parm ID :rtype: int :return: int Parm data type enum (i.e. PARM_BOOL_TYPE)

openvsp.vsp.GetParmUpperLimit(parm_id)

Get the upper limit value for the specified Parm

#==== Add Prop Geometry ====//
prop_id = AddGeom( "PROP" )

num_blade_id = GetParm( prop_id, "NumBlade", "Design" )

max_blade = GetParmUpperLimit( num_blade_id )
Parameters:

[in] – parm_id string Parm ID

Return type:

float

Returns:

double Parm upper limit

openvsp.vsp.GetParmVal(*args)

Overload 1:

Get the value of the specified Parm. The data type of the Parm value will be cast to a double

# Add Fuselage Geom
fuseid = AddGeom( "FUSELAGE", "" )

xsec_surf = GetXSecSurf( fuseid, 0 )

ChangeXSecShape( xsec_surf, GetNumXSec( xsec_surf ) - 1, XS_ROUNDED_RECTANGLE )

xsec = GetXSec( xsec_surf, GetNumXSec( xsec_surf ) - 1 )

wid = GetXSecParm( xsec, "RoundedRect_Width" )

SetParmVal( wid, 23.0 )

if  abs( GetParmVal( wid ) - 23 ) > 1e-6 :
    print( "---> Error: API Parm Val Set/Get " )
    assert False, "---> Error: API Parm Val Set/Get"
Parameters:

[in] – parm_id string Parm ID

Return type:

float

Returns:

double Parm value


Overload 2:

Get the value of the specified Parm. The data type of the Parm value will be cast to a double

# Add Fuselage Geom
fuseid = AddGeom( "FUSELAGE", "" )

xsec_surf = GetXSecSurf( fuseid, 0 )

ChangeXSecShape( xsec_surf, GetNumXSec( xsec_surf ) - 1, XS_ROUNDED_RECTANGLE )

xsec = GetXSec( xsec_surf, GetNumXSec( xsec_surf ) - 1 )

wid = GetXSecParm( xsec, "RoundedRect_Width" )

SetParmVal( wid, 23.0 )

if  abs( GetParmVal( wid ) - 23 ) > 1e-6 :
    print( "---> Error: API Parm Val Set/Get " )
    assert False, "---> Error: API Parm Val Set/Get"
Parameters:
  • [in] – geom_id string Geom ID

  • [in] – name string Parm name

  • [in] – group string Parm group name

Return type:

float

Returns:

double Parm value

openvsp.vsp.GetPtCloudPnts(geom_id)

Get the points of a Point Cloud Geom

pid = AddGeom( "POD" )

mesh_id = ExportFile( "Example_Mesh.msh", SET_ALL, EXPORT_GMSH )

cloud_id = CreatePtCloudGeom( mesh_id )

pnts = GetPtCloudPnts( cloud_id )

assert len( pnts ) > 0, "GetPtCloudPnts returned nothing"

# A Geom that is not a point cloud has to be rejected.
err_mgr = ErrorMgrSingleton.getInstance()

GetPtCloudPnts( pid )

assert err_mgr.GetNumTotalErrors() > 0, "GetPtCloudPnts accepted a Geom that is not a point cloud"

while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: CreatePtCloudGeom, CreateConvexHull :param [in]: geom_id string Point Cloud Geom ID :rtype: std::vector< vec3d,std::allocator< vec3d > > :return: vector<vec3d> Array of point cloud points

openvsp.vsp.GetResultsEntryDoc(std: :string const & results_id, std: :string const & data_name) std::string
openvsp.vsp.GetResultsName(results_id)

Get the name of a result given its ID

#==== Analysis: VSPAero Compute Geometry ====//
analysis_name = "VSPAEROComputeGeometry"

# Set defaults
SetAnalysisInputDefaults( analysis_name )

res_id = ( ExecAnalysis( analysis_name ) )

print( "Results Name: ", False )

print( GetResultsName( res_id ) )

# The name is the Results Manager's handle for this result, so looking the
# name back up has to lead to the same result.
assert len( GetResultsName( res_id ) ) > 0, "GetResultsName returned nothing"
assert FindLatestResultsID( GetResultsName( res_id ) ) == res_id, "GetResultsName does not round trip through FindLatestResultsID"
Parameters:

[in] – results_id string Result ID

Return type:

string

Returns:

string Result name

openvsp.vsp.GetResultsSetDoc(results_id)

Get the documentation string for a result given its ID

#==== Analysis: VSPAero Compute Geometry ====//
analysis_name = "VSPAEROComputeGeometry"

# Set defaults
SetAnalysisInputDefaults( analysis_name )

res_id = ( ExecAnalysis( analysis_name ) )

print( "Results doc: ", False )

print( GetResultsSetDoc( res_id ) )

assert len( GetResultsSetDoc( res_id ) ) > 0, "the result carries no documentation"

# Every entry in the result has to be documented too.
data_names = GetAllDataNames( res_id )

for data_name in data_names:
    assert len( GetResultsEntryDoc( res_id, data_name ) ) > 0, data_name + " carries no documentation"
Parameters:

[in] – results_id string Result ID

Return type:

string

Returns:

string Result documentation string

openvsp.vsp.GetResultsType(results_id, data_name)

Get the data type for a given result ID and data name

#==== Write Some Fake Test Results =====//
WriteTestResults()

res_id = FindResultsID( "Test_Results" )

res_array = GetAllDataNames( res_id )

assert len( res_array ) > 0, "GetAllDataNames returned nothing"

for j in range(int( len(res_array) )):

    typ = GetResultsType( res_id, res_array[j] )

    # Every entry the result lists has to report a real data type.
    assert typ != INVALID_TYPE, "GetResultsType returned INVALID_TYPE for " + res_array[j]

# The fake results are written with known types.
assert GetResultsType( res_id, "Test_Int" ) == INT_DATA, "GetResultsType reported the wrong type"
assert GetResultsType( res_id, "Test_Double" ) == DOUBLE_DATA, "GetResultsType reported the wrong type"
assert GetResultsType( res_id, "Test_String" ) == STRING_DATA, "GetResultsType reported the wrong type"

# An entry that does not exist has to report INVALID_TYPE.
assert GetResultsType( res_id, "NoSuchEntry" ) == INVALID_TYPE, "GetResultsType accepted an unknown entry"

# That lookup failure was raised deliberately, so take it back off the queue.
err_mgr = ErrorMgrSingleton.getInstance()

while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: RES_DATA_TYPE :param [in]: results_id string Result ID :param [in]: data_name string Data name :rtype: int :return: int Data type enum (i.e. DOUBLE_DATA)

openvsp.vsp.GetRoutingCurve(routing_id, symm_index)

Get points along a RoutingGeom. These points will follow the curve of a RoutingGeom with radiused routing points. The main copy is symm_index = 0.

pod1 = vsp.AddGeom('POD', '')

pod2 = vsp.AddGeom('POD', '')
ypod2 = vsp.GetParm(pod2, 'Y_Rel_Location', 'XForm')
vsp.SetParmVal(ypod2, 2.0)

routing_geom = vsp.AddGeom('ROUTING', '')

rpt0 = vsp.AddRoutingPt(routing_geom, pod1, 0)
u0 = vsp.GetParm( rpt0, 'U', 'RoutePt')
vsp.SetParmVal(u0, 0.0)

rpt1 = vsp.AddRoutingPt(routing_geom, pod2, 0)

rpt2 = vsp.AddRoutingPt(routing_geom, pod1, 0)
u2 = vsp.GetParm( rpt2, 'U', 'RoutePt')
vsp.SetParmVal(u2, 1.0)

vsp.Update()
pvec = vsp.GetRoutingCurve(routing_geom, 0)

# The curve is tessellated, so it carries at least as many points as there
# are routing points, and it has to start and end on them.
rpts = vsp.GetAllRoutingPtCoords(routing_geom, 0)

assert len( pvec ) >= len( rpts ), "GetRoutingCurve returned too few points"
assert vsp.dist( pvec[0], rpts[0] ) < 1e-6, "GetRoutingCurve does not start on the first routing point"
assert vsp.dist( pvec[-1], rpts[-1] ) < 1e-6, "GetRoutingCurve does not end on the last routing point"

See also: AddRoutingPt, DelRoutingPt, GetMainRoutingPtCoord, GetRoutingPtCoord, GetAllRoutingPtCoords :param [in]: routing_id string RoutingGeom Geom ID :param [in]: symm_index int Symmetry index to get coordinate of :rtype: std::vector< vec3d,std::allocator< vec3d > > :return: vector < vec3d > coordinate of points along RoutingGeom curve

openvsp.vsp.GetRoutingPtCoord(routing_id, index, symm_index)

Get the coordinate location a routing point in a RoutingGeom. The main location is symm_index = 0.

pod1 = vsp.AddGeom('POD', '')

pod2 = vsp.AddGeom('POD', '')
ypod2 = vsp.GetParm(pod2, 'Y_Rel_Location', 'XForm')
vsp.SetParmVal(ypod2, 2.0)

routing_geom = vsp.AddGeom('ROUTING', '')

rpt0 = vsp.AddRoutingPt(routing_geom, pod1, 0)
u0 = vsp.GetParm( rpt0, 'U', 'RoutePt')
vsp.SetParmVal(u0, 0.0)

rpt1 = vsp.AddRoutingPt(routing_geom, pod2, 0)

rpt2 = vsp.AddRoutingPt(routing_geom, pod1, 0)
u2 = vsp.GetParm( rpt2, 'U', 'RoutePt')
vsp.SetParmVal(u2, 1.0)

vsp.Update()
p1 = vsp.GetRoutingPtCoord(routing_geom, 1, 0)

# rpt1 rides on pod2, which was moved two units out in Y.
assert abs( p1.y() - 2.0 ) < 1e-6, "GetRoutingPtCoord did not follow the parent Geom"

# The indexed point has to be the second of the three that were added.
pvec = vsp.GetAllRoutingPtCoords(routing_geom, 0)

assert len( pvec ) == 3, "GetAllRoutingPtCoords returned the wrong number of points"
assert vsp.dist( p1, pvec[1] ) < 1e-6, "GetRoutingPtCoord disagrees with GetAllRoutingPtCoords"

See also: AddRoutingPt, DelRoutingPt, GetMainRoutingPtCoord, GetAllRoutingPtCoords, GetRoutingCurve :param [in]: routing_id string RoutingGeom Geom ID :param [in]: index int Index of routing point to get cordinate of :param [in]: symm_index int Symmetry index to get coordinate of :rtype: vec3d :return: vec3d coordinate of routing point

openvsp.vsp.GetRoutingPtID(routing_id, index)

Get the ParmContainer ID of a routing point within a RoutingGeom.

pod1 = vsp.AddGeom('POD', '')

pod2 = vsp.AddGeom('POD', '')
ypod2 = vsp.GetParm(pod2, 'Y_Rel_Location', 'XForm')
vsp.SetParmVal(ypod2, 2.0)

routing_geom = vsp.AddGeom('ROUTING', '')

rpt0 = vsp.AddRoutingPt(routing_geom, pod1, 0)
u0 = vsp.GetParm( rpt0, 'U', 'RoutePt')
vsp.SetParmVal(u0, 0.0)

rpt1 = vsp.AddRoutingPt(routing_geom, pod2, 0)

rpt2 = vsp.AddRoutingPt(routing_geom, pod1, 0)
u2 = vsp.GetParm( rpt2, 'U', 'RoutePt')
vsp.SetParmVal(u2, 1.0)

rid = vsp.GetRoutingPtID(routing_geom, 2)

See also: AddRoutingPt, DelAllRoutingPt, GetAllRoutingPtIds :param [in]: routing_id string RoutingGeom Geom ID :param [in]: index int Index of routing point to ID to retreive :rtype: string :return: string ParmContainer ID for the specified routing point

openvsp.vsp.GetRoutingPtParentID(pt_id)

Get the Geom ID of the geom a routing point is anchored to.

pod1 = vsp.AddGeom('POD', '')

pod2 = vsp.AddGeom('POD', '')
ypod2 = vsp.GetParm(pod2, 'Y_Rel_Location', 'XForm')
vsp.SetParmVal(ypod2, 2.0)

routing_geom = vsp.AddGeom('ROUTING', '')

rpt0 = vsp.AddRoutingPt(routing_geom, pod1, 0)
u0 = vsp.GetParm( rpt0, 'U', 'RoutePt')
vsp.SetParmVal(u0, 0.0)

rpt1 = vsp.AddRoutingPt(routing_geom, pod2, 0)

rpt2 = vsp.AddRoutingPt(routing_geom, pod1, 0)
u2 = vsp.GetParm( rpt2, 'U', 'RoutePt')
vsp.SetParmVal(u2, 1.0)

gid = vsp.GetRoutingPtParentID(rpt1)

See also: AddRoutingPt, DelAllRoutingPt, GetAllRoutingPtIds :param [in]: pt_id string ParmContainer ID of desired routing point :rtype: string :return: string Geom ID for the geom the routing point is anchored to

openvsp.vsp.GetScaleIndependentBBoxSet(set)

Get the corners of the scale independent bounding box of the specified Set.

#==== Add Pod Geometry ====//
pid = AddGeom( "POD" )

Update()

sethasmembers, xmin, ymin, zmin, xlen, ylen, zlen = GetScaleIndependentBBoxSet( SET_ALL )

# A pod was added above, so the set is populated and the box has real size.
assert sethasmembers, "GetScaleIndependentBBoxSet"
assert xlen > 0.0 and ylen > 0.0 and zlen > 0.0, "GetScaleIndependentBBoxSet extent"
Parameters:
  • [in] – set int Desired Set

  • [out] – xmin_out double Minimum bounding box X coordinate

  • [out] – ymin_out double Minimum bounding box Y coordinate

  • [out] – zmin_out double Minimum bounding box Z coordinate

  • [out] – xlen_out double Maximum bounding box X length

  • [out] – ylen_out double Maximum bounding box Y length

  • [out] – zlen_out double Maximum bounding box Z length

Return type:

boolean

Returns:

bool Flag indicating whether the set has members (is non-empty)

openvsp.vsp.GetSetFlag(geom_id, set_index)

Check if a Geom is in the set at the specified set index

# Add Fuselage Geom
fuseid = AddGeom( "FUSELAGE", "" )

SetSetFlag( fuseid, 3, True )

if not GetSetFlag(fuseid, 3):
    print("---> Error: API Set/Get Set Flag")
    assert False, "---> Error: API Set/Get Set Flag"
Parameters:
  • [in] – geom_id string Geom ID

  • [in] – set_index int Set index

Return type:

boolean

Returns:

bool True if geom is in the set, false otherwise

openvsp.vsp.GetSetIndex(name)

Get the set index for the specified set name

SetSetName( 3, "SetFromScript" )

if GetSetIndex("SetFromScript") != 3:
    print("ERROR: GetSetIndex")
    assert False, "ERROR: GetSetIndex"
Parameters:

[in] – name string Set name

Return type:

int

Returns:

int Set index

openvsp.vsp.GetSetName(index)

Get the name of a set at specified index

SetSetName( 3, "SetFromScript" )

if GetSetName(3) != "SetFromScript":
    print("---> Error: API Get/Set Set Name")
    assert False, "---> Error: API Get/Set Set Name"

See also: SET_TYPE :param [in]: index int Set index :rtype: string :return: string Set name

openvsp.vsp.GetSettingName(setting_id)

Get Variable Preset Setting name

# Add Pod Geom
pod1 = AddGeom( "POD", "" )

gid = AddVarPresetGroup( "Tess" )

sid = AddVarPresetSetting( gid, "Coarse" )

name = GetSettingName( sid )
assert len( name ) > 0, "GetSettingName returned nothing"
Parameters:

[in] – setting_id string Var Preset Setting ID

Return type:

string

Returns:

string Var Preset Setting name

openvsp.vsp.GetStringAnalysisInput(analysis, name, index=0)

Get the current string values for the particular analysis, input, and data index

fileNameInput = GetStringAnalysisInput( "ParasiteDrag", "FileName" )
assert len( fileNameInput ) > 0, "GetStringAnalysisInput returned nothing"

fileNameInput = ["ParasiteDragExample"]

SetStringAnalysisInput( "ParasiteDrag", "FileName", fileNameInput )

See also: RES_DATA_TYPE, SetStringAnalysisInput :param [in]: analysis string Analysis name :param [in]: name string Input name :param [in]: index int Data index :rtype: std::vector< std::string,std::allocator< std::string > > :return: vector<string> Array of analysis input values

openvsp.vsp.GetStringResults(id, name, index=0)

Get all string values for a particular result, name, and index

#==== Write Some Fake Test Results =====//
WriteTestResults()

res_id = FindResultsID( "Test_Results" )

str_arr = GetStringResults( res_id, "Test_String" )

if ( str_arr[0] != "This Is A Test" ):
    print( "---> Error: API GetStringResults" )
    assert False, "---> Error: API GetStringResults"
Parameters:
  • [in] – id string Result ID

  • [in] – name string Data name

  • [in] – index int Data index

Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<string> Array of data values

openvsp.vsp.GetSubSurf(*args)

Overload 1:

Get the ID of the specified sub-surface

wid = AddGeom( "WING", "" ) # Add Wing

ss_rec_1 = AddSubSurf( wid, SS_RECTANGLE ) # Add Sub Surface Rectangle #1

ss_rec_2 = AddSubSurf( wid, SS_RECTANGLE ) # Add Sub Surface Rectangle #2

print( ss_rec_2, False )

print( " = ", False )

print( GetSubSurf( wid, 1 ) )

# Sub-surfaces come back in the order they were added.
assert GetSubSurf( wid, 0 ) == ss_rec_1, "GetSubSurf did not report the sub-surfaces in order"
assert GetSubSurf( wid, 1 ) == ss_rec_2, "GetSubSurf did not report the sub-surfaces in order"

# The index form and the ID vector have to agree.
id_vec = GetSubSurfIDVec( wid )

assert len( id_vec ) == 2, "GetSubSurf disagrees with GetSubSurfIDVec"
assert id_vec[1] == GetSubSurf( wid, 1 ), "GetSubSurf disagrees with GetSubSurfIDVec"

# An index past the end has to be rejected.  The error queue is reached
# through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

GetSubSurf( wid, 2 )

assert err_mgr.GetNumTotalErrors() > 0, "GetSubSurf accepted an index past the end"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()
Parameters:
  • [in] – geom_id string Geom ID

  • [in] – index int Sub-surface index

Return type:

string

Returns:

string Sub-surface ID


Overload 2:

Get the ID of the specified sub-surface

wid = AddGeom( "WING", "" ) # Add Wing

ss_rec_1 = AddSubSurf( wid, SS_RECTANGLE ) # Add Sub Surface Rectangle #1

ss_rec_2 = AddSubSurf( wid, SS_RECTANGLE ) # Add Sub Surface Rectangle #2

print( ss_rec_2, False )

print( " = ", False )

print( GetSubSurf( wid, 1 ) )

# Sub-surfaces come back in the order they were added.
assert GetSubSurf( wid, 0 ) == ss_rec_1, "GetSubSurf did not report the sub-surfaces in order"
assert GetSubSurf( wid, 1 ) == ss_rec_2, "GetSubSurf did not report the sub-surfaces in order"

# The index form and the ID vector have to agree.
id_vec = GetSubSurfIDVec( wid )

assert len( id_vec ) == 2, "GetSubSurf disagrees with GetSubSurfIDVec"
assert id_vec[1] == GetSubSurf( wid, 1 ), "GetSubSurf disagrees with GetSubSurfIDVec"

# An index past the end has to be rejected.  The error queue is reached
# through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

GetSubSurf( wid, 2 )

assert err_mgr.GetNumTotalErrors() > 0, "GetSubSurf accepted an index past the end"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()
Parameters:
  • [in] – geom_id string Geom ID

  • [in] – name string Sub surface name

Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<string> Vector of sub-surface ID

openvsp.vsp.GetSubSurfIDVec(geom_id)

Get a vector of all sub-surface IDs for the specified geometry

wid = AddGeom( "WING", "" )                             # Add Wing

ss_line_id = AddSubSurf( wid, SS_LINE )                      # Add Sub Surface Line
ss_rec_id = AddSubSurf( wid, SS_RECTANGLE )                        # Add Sub Surface Rectangle

id_vec = GetSubSurfIDVec( wid )
assert len( id_vec ) > 0, "GetSubSurfIDVec returned nothing"

id_type_str = "SubSurface IDs and Type Indexes -> "

for i in range(len(id_vec)):

    id_type_str += id_vec[i]

    id_type_str += ": "

    id_type_str += f'{GetSubSurfType(id_vec[i])}'

    id_type_str += "\t"

id_type_str += "\n"

print( id_type_str )
Parameters:

[in] – geom_id string Geom ID

Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<int> Array of sub-surface IDs

openvsp.vsp.GetSubSurfIndex(sub_id)

Get the index of the specified sub-surface in its parent Geom’s sub-surface vector

wid = AddGeom( "WING", "" )                             # Add Wing

ss_line_id = AddSubSurf( wid, SS_LINE )                      # Add Sub Surface Line
ss_rec_id = AddSubSurf( wid, SS_RECTANGLE )                        # Add Sub Surface Rectangle

ind = GetSubSurfIndex( ss_rec_id )

ind_str = f"Index of SS_Rectangle: {ind}"

print( ind_str )

# The rectangle was added second, so it sits at index 1.
assert ind == 1, "GetSubSurfIndex did not report the order they were added"
assert GetSubSurfIndex( ss_line_id ) == 0, "GetSubSurfIndex did not report the order they were added"

# The index has to lead back to the same sub-surface.
assert GetSubSurf( wid, ind ) == ss_rec_id, "GetSubSurfIndex disagrees with GetSubSurf"
Parameters:

[in] – sub_id string Sub-surface ID

Return type:

int

Returns:

int Sub-surface index

openvsp.vsp.GetSubSurfName(*args)

Overload 1:

Get the name of the specified sub-surface

wid = AddGeom( "WING", "" )                             # Add Wing

ss_rec_id = AddSubSurf( wid, SS_RECTANGLE )                        # Add Sub Surface Rectangle

rec_name = GetSubSurfName( wid, ss_rec_id )
assert len( rec_name ) > 0, "GetSubSurfName returned nothing"

name_str = "Current Name of SS_Rectangle: " + rec_name + "\n"

print( name_str )
Parameters:
  • [in] – geom_id string Geom ID

  • [in] – sub_id string Sub-surface ID

Return type:

string

Returns:

string Sub-surface name


Overload 2:

Get the name of the specified sub-surface

wid = AddGeom( "WING", "" )                             # Add Wing

ss_rec_id = AddSubSurf( wid, SS_RECTANGLE )                        # Add Sub Surface Rectangle

rec_name = GetSubSurfName( wid, ss_rec_id )
assert len( rec_name ) > 0, "GetSubSurfName returned nothing"

name_str = "Current Name of SS_Rectangle: " + rec_name + "\n"

print( name_str )
Parameters:

[in] – sub_id string Sub-surface ID

Return type:

string

Returns:

string Sub-surface name

openvsp.vsp.GetSubSurfParmIDs(sub_id)

Get the vector of Parm IDs for specified sub-surface

wid = AddGeom( "WING", "" )                             # Add Wing

ss_line_id = AddSubSurf( wid, SS_LINE )                      # Add Sub Surface Line

# Get and list all Parm info for SS_Line
parm_id_vec = GetSubSurfParmIDs( ss_line_id )
assert len( parm_id_vec ) > 0, "GetSubSurfParmIDs returned nothing"

for i in range(len(parm_id_vec)):

    id_name_str = "\tName: " + GetParmName(parm_id_vec[i]) + ", Group: " + GetParmDisplayGroupName(parm_id_vec[i]) + ", ID: " + str(parm_id_vec[i]) + "\n"


    print( id_name_str )
Parameters:

[in] – sub_id string Sub-surface ID

Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<string> Vector of Parm IDs

openvsp.vsp.GetSubSurfType(sub_id)

Get the type for the specified sub-surface (i.e. SS_RECTANGLE)

wid = AddGeom( "WING", "" )                             # Add Wing

ss_line_id = AddSubSurf( wid, SS_LINE )                      # Add Sub Surface Line
ss_rec_id = AddSubSurf( wid, SS_RECTANGLE )                        # Add Sub Surface Rectangle

id_vec = GetSubSurfIDVec( wid )

# Each sub-surface has to report the type it was created as.
assert GetSubSurfType( ss_line_id ) == SS_LINE, "GetSubSurfType did not report the type that was added"
assert GetSubSurfType( ss_rec_id ) == SS_RECTANGLE, "GetSubSurfType did not report the type that was added"

id_type_str = "SubSurface IDs and Type Indexes -> "

for i in range(len(id_vec)):

    id_type_str += id_vec[i]

    id_type_str += ": "

    id_type_str += f'{GetSubSurfType(id_vec[i])}'

    id_type_str += "\t"

id_type_str += "\n"

print( id_type_str )

See also: SUBSURF_TYPE :param [in]: sub_id string Sub-surface ID :rtype: int :return: int Sub-surface type enum (i.e. SS_RECTANGLE)

openvsp.vsp.GetTotalNumSurfs(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 ====//
wing_id = AddGeom( "WING" )

num_surf = 0

num_surf = GetTotalNumSurfs( wing_id ) # Wings default with XZ symmetry on -> 2 surfaces

assert num_surf == 2, "GetTotalNumSurfs, expected 2 for a symmetric wing"

print( "Total Number of Wing Surfaces: ", False )

print( num_surf )
Parameters:

[in] – geom_id string Geom ID

Return type:

int

Returns:

int Number of main surfaces

openvsp.vsp.GetUWTess01(geom_id, surf_indx)

Get the surface coordinate point of each intersection of the tessellated wireframe for a particular surface

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

utess, wtess = GetUWTess01( geom_id, surf_indx )

# The wireframe spans the whole surface and never runs backwards.
assert len( utess ) >= 2, "GetUWTess01 returned too few stations"
assert len( wtess ) >= 2, "GetUWTess01 returned too few stations"

assert abs( utess[0] ) < 1e-9 and abs( utess[-1] - 1.0 ) < 1e-9, "GetUWTess01 does not span the surface"
assert abs( wtess[0] ) < 1e-9 and abs( wtess[-1] - 1.0 ) < 1e-9, "GetUWTess01 does not span the surface"

for i in range( 1, len( utess ) ):
    assert utess[i] > utess[i - 1], "the U stations are not increasing at " + str( i )

for i in range( 1, len( wtess ) ):
    assert wtess[i] > wtess[i - 1], "the W stations are not increasing at " + str( i )
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – surf_indx int Main surface index from the parent Geom

  • [out] – u_out_vec vector<double> Output vector of U (0 - 1) surface coordinates

  • [out] – w_out_vec vector<double> Output vector of W (0 - 1) surface coordinates

openvsp.vsp.GetUnsteadyGroupCompIDs(group_index)

Get an array of IDs for all components in the unsteady group at the specified index.

# Add a pod and wing
pod_id = AddGeom( "POD", "" )
wing_id = AddGeom( "WING", pod_id ) # Default with symmetry on -> 2 surfaces

SetParmVal( wing_id, "X_Rel_Location", "XForm", 2.5 )
Update()

comp_ids = GetUnsteadyGroupCompIDs( 0 )

if  len(comp_ids) != 3 :
    print( "ERROR: GetUnsteadyGroupCompIDs" )
    assert False, "ERROR: GetUnsteadyGroupCompIDs"

See also: GetUnsteadyGroupSurfIndexes :param [in]: group_index int Unsteady group index for the current VSPAERO set :rtype: std::vector< std::string,std::allocator< std::string > > :return: vector <string> Array of component IDs

openvsp.vsp.GetUnsteadyGroupName(group_index)

Get the name of the unsteady group at the specified index. The name is derived from the group contents – a rotor group takes the name of its propeller and every other group is the fixed component group – so there is no matching setter.

# Add a pod and wing
pod_id = AddGeom( "POD", "" )
wing_id = AddGeom( "WING", pod_id )

SetParmVal( wing_id, "X_Rel_Location", "XForm", 2.5 )
Update()

print( GetUnsteadyGroupName( 0 ) )

# The pod and wing are fixed components, so they share the one fixed group.
assert GetUnsteadyGroupName( 0 ) == "Fixed_Group", "GetUnsteadyGroupName did not name the fixed component group"

# That group holds the pod and both wing surfaces.
assert len( GetUnsteadyGroupCompIDs( 0 ) ) == 3, "the fixed group does not hold the components"

# A group index past the end has to be rejected.  The error queue is reached
# through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

GetUnsteadyGroupName( GetNumUnsteadyGroups() )

assert err_mgr.GetNumTotalErrors() > 0, "GetUnsteadyGroupName accepted an index past the end"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()
Parameters:

[in] – group_index int Unsteady group index for the current VSPAERO set

Return type:

string

Returns:

string Unsteady group name

openvsp.vsp.GetUnsteadyGroupSurfIndexes(group_index)

Get an array of surface indexes for all components in the unsteady group at the specified index.

# Add a pod and wing
pod_id = AddGeom( "POD", "" )
wing_id = AddGeom( "WING", pod_id ) # Default with symmetry on -> 2 surfaces

SetParmVal( wing_id, "X_Rel_Location", "XForm", 2.5 )
Update()

surf_indexes = GetUnsteadyGroupSurfIndexes( 0 )

if  len(surf_indexes) != 3 :
    print( "ERROR: GetUnsteadyGroupSurfIndexes" )
    assert False, "ERROR: GetUnsteadyGroupSurfIndexes"

See also: GetUnsteadyGroupCompIDs :param [in]: group_index int Unsteady group index for the current VSPAERO set :rtype: std::vector< int,std::allocator< int > > :return: vector <int> Array of surface indexes

openvsp.vsp.GetUpperCSTCoefs(xsec_id)

Get the CST coefficients for the upper surface of an airfoil. The XSec must be of type XS_CST_AIRFOIL See also: SetUpperCST :param [in]: xsec_id string XSec ID :rtype: std::vector< double,std::allocator< double > > :return: vector<double> Vector of CST coefficients for the upper airfoil surface

openvsp.vsp.GetUpperCSTDegree(xsec_id)

Get the CST degree for the upper surface of an airfoil. The XSec must be of type XS_CST_AIRFOIL See also: SetUpperCST :param [in]: xsec_id string XSec ID :rtype: int :return: int CST Degree for upper airfoil surface

openvsp.vsp.GetUserParmContainer()

Get the user parm container ID

up_id = GetUserParmContainer()
assert len( up_id ) > 0, "GetUserParmContainer returned nothing"
Return type:

string

Returns:

string User parm container ID

openvsp.vsp.GetVKTAirfoilCpDist(alpha, epsilon, kappa, tau, xyz_data)

Get the pressure coefficient (Cp) along a Von Kármán-Trefftz airfoil of specified shape at specified points along the airfoil

pi = 3.14159265358979323846

npts = 122

alpha = 0.0

epsilon = 0.1

kappa = 0.1

tau = 10

xyz_airfoil = GetVKTAirfoilPnts(npts, alpha, epsilon, kappa, tau*(pi/180) )

cp_dist = GetVKTAirfoilCpDist( alpha, epsilon, kappa, tau*(pi/180), xyz_airfoil )
assert len( cp_dist ) > 0, "GetVKTAirfoilCpDist returned nothing"

See also: GetVKTAirfoilPnts :param [in]: alpha double Airfoil angle of attack (Radians) :param [in]: epsilon double Airfoil thickness :param [in]: kappa double Airfoil camber :param [in]: tau double Airfoil trailing edge angle (Radians) :param [in]: xyz_data vector<vec3d> Vector of points on the airfoil to evaluate :rtype: std::vector< double,std::allocator< double > > :return: vector<double> Vector of Cp values for each point in xydata

openvsp.vsp.GetVKTAirfoilPnts(npts, alpha, epsilon, kappa, tau)

Get the 2D coordinates an input number of points along a Von K�rm�n-Trefftz airfoil of specified shape

pi = 3.14159265358979323846

npts = 122

alpha = 0.0

epsilon = 0.1

kappa = 0.1

tau = 10

xyz_airfoil = GetVKTAirfoilPnts(npts, alpha, epsilon, kappa, tau*(pi/180) )
assert len( xyz_airfoil ) > 0, "GetVKTAirfoilPnts returned nothing"

cp_dist = GetVKTAirfoilCpDist( alpha, epsilon, kappa, tau*(pi/180), xyz_airfoil )
Parameters:
  • [in] – npts int Number of points along the airfoil to return

  • [in] – alpha double Airfoil angle of attack (Radians)

  • [in] – epsilon double Airfoil thickness

  • [in] – kappa double Airfoil camber

  • [in] – tau double Airfoil trailing edge angle (Radians)

Return type:

std::vector< vec3d,std::allocator< vec3d > >

Returns:

vector<vec3d> Array of points on the VKT airfoil (size = npts)

openvsp.vsp.GetVSPAEROControlGroupName(CSGroupIndex)

Get the name of the control surface group at the specified index

wid = AddGeom( "WING", "" ) # Add Wing

aileron_id = AddSubSurf( wid, SS_CONTROL ) # Add Control Surface Sub-Surface

group_index = CreateVSPAEROControlSurfaceGroup() # Empty control surface group

SetVSPAEROControlGroupName( "Example_CS_Group", group_index )

assert GetVSPAEROControlGroupName( group_index ) == "Example_CS_Group", "SetVSPAEROControlGroupName did not take"

print( "CS Group name: ", False )

print( GetVSPAEROControlGroupName( group_index ) )
Parameters:

[in] – CSGroupIndex int Index of the control surface group

openvsp.vsp.GetVSPAEROPath()

Get the path that OpenVSP will use to look for all VSPAERO executables (Solver, Slicer, and Viewer) when attempting to execute VSPAERO. If the VSPAERO executables are not in this location, they must either be copied there or the VSPAERO path must be set using SetVSPAEROPath.

if  not CheckForVSPAERO( GetVSPAEROPath() ) :
    print( "VSPAERO is not where OpenVSP thinks it is. I should move the VSPAERO executable or call SetVSPAEROPath." )

assert len( GetVSPAEROPath() ) > 0, "GetVSPAEROPath returned an empty path"

See also: GetVSPExePath, CheckForVSPAERO, SetVSPAEROPath :rtype: string :return: string Path OpenVSP will look for VSPAERO

openvsp.vsp.GetVSPAERORefWingID()

Get ID of the current VSPAERO reference Geom :rtype: string :return: string Reference Geom ID

openvsp.vsp.GetVSPExePath()

Get the path to the OpenVSP executable. OpenVSP will assume that the VSPAERO, VSPSLICER, and VSPVIEWER are in the same directory unless instructed otherwise.

print( "The current VSP executable path is: ", False )

exe_path = GetVSPExePath()

print( exe_path )

assert len( exe_path ) > 0, "GetVSPExePath returned an empty path"

See also: SetVSPAEROPath, CheckForVSPAERO, GetVSPAEROPath :rtype: string :return: string Path to the OpenVSP executable

openvsp.vsp.GetVSPFileName()

Get the file name of the current OpenVSP project

fid = AddGeom( "FUSELAGE", "" )             # Add Fuselage

fname = "example_fuse.vsp3"

SetVSP3FileName( fname )

# A relative name is resolved against the working directory, so ask for the
# resolved name rather than assuming it comes back verbatim.
full_name = GetVSPFileName()

Update()

#==== Save Vehicle to File ====//
print( "\tSaving vehicle file to: ", False )

print( fname )

WriteVSPFile( GetVSPFileName(), SET_ALL )

assert GetVSPFileName() == full_name and full_name.endswith( fname ), "GetVSPFileName did not report the name that was set"
Return type:

string

Returns:

string File name for the current OpenVSP project

openvsp.vsp.GetVSPHelpPath()

Get the path that OpenVSP will use to look for all OpenVSP help files. If the OpenVSP help files are not in this location, they must either be copied there or the VSPHelp path must be set using SetVSPHelpPath.

if  not CheckForVSPHelp( GetVSPHelpPath() ) :
    print( "OpenVSP help is not where OpenVSP thinks it is. I should move the help files or call SetVSPHelpPath." )

assert len( GetVSPHelpPath() ) > 0, "GetVSPHelpPath returned an empty path"

See also: GetVSPExePath, CheckForVSPHelp, SetVSPHelpPath :rtype: string :return: string Path OpenVSP will look for help files

openvsp.vsp.GetVSPVersion()

Get the version of the OpenVSP instance currently running

print( "The current OpenVSP version is: ", False )

ver = GetVSPVersion()

print( ver )

# The string form has to agree with the numeric accessors.
num = f"{GetVSPVersionMajor()}.{GetVSPVersionMinor()}.{GetVSPVersionChange()}"

assert num in ver, "GetVSPVersion does not contain " + num
Return type:

string

Returns:

string OpenVSP version string (i.e. “OpenVSP 3.17.1”)

openvsp.vsp.GetVSPVersionChange()

Get the change version of the OpenVSP instance currently running as an integer

print( "The current OpenVSP version is: ", False )

major = GetVSPVersionMajor()
minor = GetVSPVersionMinor()
change = GetVSPVersionChange()

print( f"{major}.{minor}.{change}" )

# OpenVSP 3 and later.  Negative pieces would mean the version was never
# filled in.
assert major >= 3 and minor >= 0 and change >= 0, "implausible version number"

# The pieces have to add back up to the string form.
num = f"{major}.{minor}.{change}"

assert num in GetVSPVersion(), "version pieces disagree with GetVSPVersion"
Return type:

int

Returns:

int OpenVSP change version number (i.e. Y in 3.X.Y)

openvsp.vsp.GetVSPVersionMajor()

Get the major version of the OpenVSP instance currently running as an integer

print( "The current OpenVSP version is: ", False )

major = GetVSPVersionMajor()
minor = GetVSPVersionMinor()
change = GetVSPVersionChange()

print( f"{major}.{minor}.{change}" )

# OpenVSP 3 and later.  Negative pieces would mean the version was never
# filled in.
assert major >= 3 and minor >= 0 and change >= 0, "implausible version number"

# The pieces have to add back up to the string form.
num = f"{major}.{minor}.{change}"

assert num in GetVSPVersion(), "version pieces disagree with GetVSPVersion"
Return type:

int

Returns:

int OpenVSP major version number (i.e. 3 in 3.X.Y)

openvsp.vsp.GetVSPVersionMinor()

Get the minor version of the OpenVSP instance currently running as an integer

print( "The current OpenVSP version is: ", False )

major = GetVSPVersionMajor()
minor = GetVSPVersionMinor()
change = GetVSPVersionChange()

print( f"{major}.{minor}.{change}" )

# OpenVSP 3 and later.  Negative pieces would mean the version was never
# filled in.
assert major >= 3 and minor >= 0 and change >= 0, "implausible version number"

# The pieces have to add back up to the string form.
num = f"{major}.{minor}.{change}"

assert num in GetVSPVersion(), "version pieces disagree with GetVSPVersion"
Return type:

int

Returns:

int OpenVSP minor version number (i.e. X in 3.X.Y)

openvsp.vsp.GetVarPresetGroups()

Get group_ids for Variable Preset Groups

# Add Pod Geom
pod1 = AddGeom( "POD", "" )

gid = AddVarPresetGroup( "Tess" )

sid = AddVarPresetSetting( gid, "Coarse" )

p1 = FindParm( pod1, "Tess_U", "Shape" )

AddVarPresetParm( gid, p1 )

group_ids = GetVarPresetGroups()
assert len( group_ids ) > 0, "GetVarPresetGroups returned nothing"
Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

array<string> Array of Variable Preset Group IDs

openvsp.vsp.GetVarPresetParmIDs(group_id)

Get ParmIDs for Variable Preset Group

# Add Pod Geom
pod1 = AddGeom( "POD", "" )

gid = AddVarPresetGroup( "Tess" )

sid = AddVarPresetSetting( gid, "Coarse" )

p1 = FindParm( pod1, "Tess_U", "Shape" )

AddVarPresetParm( gid, p1 )

parmids = GetVarPresetParmIDs( gid )
assert len( parmids ) > 0, "GetVarPresetParmIDs returned nothing"
Parameters:

[in] – group_id string Var Preset Group ID

Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

array<string> Array of Variable Preset Group ParmIDs

openvsp.vsp.GetVarPresetParmVal(group_id, setting_id, parm_id)

Get value for Parm in Var Preset Setting

# Add Pod Geom
pod1 = AddGeom( "POD", "" )

gid = AddVarPresetGroup( "Tess" )

sid = AddVarPresetSetting( gid, "Coarse" )

p1 = FindParm( pod1, "Tess_U", "Shape" )

AddVarPresetParm( gid, p1 )

val = GetVarPresetParmVal( gid, sid, p1 )

# A Parm joins the group at its current value.
assert abs( val - GetParmVal( p1 ) ) < 1e-9, "GetVarPresetParmVal does not match the Parm"

# Storing a different value has to be what comes back, without disturbing the
# Parm itself.
SetVarPresetParmVal( gid, sid, p1, val + 3.0 )

assert abs( GetVarPresetParmVal( gid, sid, p1 ) - ( val + 3.0 ) ) < 1e-9, "GetVarPresetParmVal did not follow SetVarPresetParmVal"
assert abs( GetParmVal( p1 ) - val ) < 1e-9, "storing a preset value changed the Parm"
Parameters:
  • [in] – group_id string Var Preset Group ID

  • [in] – setting_id string Var Preset Setting ID

  • [in] – parm_id string Var Parm ID

Return type:

float

Returns:

double Var Preset Parm value

openvsp.vsp.GetVarPresetParmVals(setting_id)

Get Parm values for Variable Preset Setting

# Add Pod Geom
pod1 = AddGeom( "POD", "" )

gid = AddVarPresetGroup( "Tess" )

sid = AddVarPresetSetting( gid, "Coarse" )

p1 = FindParm( pod1, "Tess_U", "Shape" )

AddVarPresetParm( gid, p1 )

parmval_vec = GetVarPresetParmVals( sid )
assert len( parmval_vec ) > 0, "GetVarPresetParmVals returned nothing"
Parameters:

[in] – setting_id string Var Preset Setting ID

Return type:

std::vector< double,std::allocator< double > >

Returns:

array<double> Var Preset Parm values for Setting

openvsp.vsp.GetVarPresetSettings(group_id)

Get Setting IDs for Variable Preset Group

# Add Pod Geom
pod1 = AddGeom( "POD", "" )

gid = AddVarPresetGroup( "Tess" )

sid = AddVarPresetSetting( gid, "Coarse" )

p1 = FindParm( pod1, "Tess_U", "Shape" )

AddVarPresetParm( gid, p1 )

settingds = GetVarPresetSettings( gid )
assert len( settingds ) > 0, "GetVarPresetSettings returned nothing"
Parameters:

[in] – group_id string Var Preset Group ID

Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

array<string> Array of Variable Preset Group ParmIDs

openvsp.vsp.GetVec3dAnalysisInput(analysis, name, index=0)

Get the current vec3d values for the particular analysis, input, and data index

# PlanarSlice
norm = GetVec3dAnalysisInput( "PlanarSlice", "Norm" )
assert len( norm ) > 0, "GetVec3dAnalysisInput returned nothing"

norm[0].set_xyz( 0.23, 0.6, 0.15 )

SetVec3dAnalysisInput( "PlanarSlice", "Norm", norm )

See also: RES_DATA_TYPE, SetVec3dAnalysisInput :param [in]: analysis string Analysis name :param [in]: name string Input name :param [in]: index int Data index :rtype: std::vector< vec3d,std::allocator< vec3d > > :return: vector<vec3d> Array of analysis input values

openvsp.vsp.GetVec3dResults(id, name, index=0)

Get all vec3d values for a particular result, name, and index

#==== Write Some Fake Test Results =====//

tol = 0.00001

WriteTestResults()

res_id = FindLatestResultsID( "Test_Results" )

vec3d_vec = GetVec3dResults( res_id, "Test_Vec3d" )
assert len( vec3d_vec ) > 0, "GetVec3dResults returned nothing"

print( "X: ", False )
print( vec3d_vec[0].x(), False )

print( "\tY: ", False )
print( vec3d_vec[0].y(), False )

print( "\tZ: ", False )
print( vec3d_vec[0].z() )
Parameters:
  • [in] – id string Result ID

  • [in] – name string Data name

  • [in] – index int Data index

Return type:

std::vector< vec3d,std::allocator< vec3d > >

Returns:

vector<vec3d> Array of data values

openvsp.vsp.GetVehicleID()

Get the ID of the Vehicle Parm Container

#===== Get Vehicle Parm Container ID ====//
veh_id = GetVehicleID()
assert len( veh_id ) > 0, "GetVehicleID returned nothing"
Return type:

string

Returns:

string Vehicle ID

openvsp.vsp.GetXSec(xsec_surf_id, xsec_index)

Get Xsec ID for a particular XSecSurf at given index

# Add Stack
sid = AddGeom( "STACK", "" )

# Get First (and Only) XSec Surf
xsec_surf = GetXSecSurf( sid, 0 )

# Identify XSec 1
xsec_1 = GetXSec( xsec_surf, 1 )
assert len( xsec_1 ) > 0, "GetXSec returned nothing"
Parameters:
  • [in] – xsec_surf_id string XSecSurf ID

  • [in] – xsec_index int Xsec index

Return type:

string

Returns:

string Xsec ID

openvsp.vsp.GetXSecAlias(id)

Get XSec Alias by ID

# Add Stack
sid = AddGeom( "STACK", "" )

# Get First (and Only) XSec Surf
xsec_surf = GetXSecSurf( sid, 0 )

# Identify XSec 1
xsec_1 = GetXSec( xsec_surf, 1 )

# Set Alias and verify alias match
alias = "XSec_One_Alias"

SetXSecAlias( xsec_1, alias )

get_alias = GetXSecAlias( xsec_1 )

if alias != get_alias:
    print("SetXSecAlias/GetXSecAlias error!")
    assert False, "SetXSecAlias/GetXSecAlias error!"
Parameters:

[in] – id string XSec ID

Return type:

string

Returns:

string Xsec alias

openvsp.vsp.GetXSecContinuity(xsec_id)

Set C-type continuity enforcement for a particular XSec

fid = AddGeom( "FUSELAGE", "" )             # Add Fuselage

xsec_surf = GetXSecSurf( fid, 0 )           # Get First (and Only) XSec Surf

num_xsecs = GetNumXSec( xsec_surf )

for i in range(num_xsecs):

    xsec = GetXSec( xsec_surf, i )

    SetXSecContinuity( xsec, 1 )                       # Set Continuity At Cross Section

    # The setter is shorthand for the section's continuity Parm.
    assert abs( GetParmVal( GetXSecParm( xsec, "ContinuityTop" ) ) - 1.0 ) < 1e-12, "SetXSecContinuity did not set section " + str( i )

    SetXSecContinuity( xsec, 0 )

    assert abs( GetParmVal( GetXSecParm( xsec, "ContinuityTop" ) ) ) < 1e-12, "SetXSecContinuity did not clear section " + str( i )

    SetXSecContinuity( xsec, 1 )
Parameters:
  • [in] – xsec_id string XSec ID

  • [in] – cx int Continuity level (0, 1, or 2)

Get the C-type continuity enforcement for a particular XSec

fid = AddGeom( "FUSELAGE", "" )             # Add Fuselage

xsec_surf = GetXSecSurf( fid, 0 )           # Get First (and Only) XSec Surf

xsec = GetXSec( xsec_surf, 1 )

SetXSecContinuity( xsec, 1 )

assert GetXSecContinuity( xsec ) == 1, "GetXSecContinuity did not report the level that was set"

SetXSecContinuity( xsec, 0 )

assert GetXSecContinuity( xsec ) == 0, "GetXSecContinuity did not follow a second set"

# The level is the section's continuity Parm, so the two have to agree.
assert abs( GetParmVal( GetXSecParm( xsec, "ContinuityTop" ) ) - GetXSecContinuity( xsec ) ) < 1e-12, "the continuity level disagrees with its Parm"

See also: SetXSecContinuity :param [in]: xsec_id string XSec ID :rtype: int :return: int Continuity level (0, 1, or 2)

openvsp.vsp.GetXSecCurvatures(xsec_id, side)

Set curvatures for the specified XSec

# Add Stack
sid = AddGeom( "STACK", "" )

# Get First (and Only) XSec Surf
xsec_surf = GetXSecSurf( sid, 0 )

# Flatten ends
num_xsecs = GetNumXSec( xsec_surf )

for i in range(num_xsecs):

    xsec = GetXSec( xsec_surf, i )

    SetXSecCurvatures( xsec, XSEC_BOTH_SIDES, 0.2, -1.0e12, -1.0e12, -1.0e12 )  # Set Curvatures At Cross Section

    # The setter is shorthand for the skin Parms, so the value has to show up
    # on both sides of the section.
    assert abs( GetParmVal( GetXSecParm( xsec, "TopLCurve" ) ) - 0.2 ) < 1e-6, "SetXSecCurvatures did not set the top of section " + str( i )
    assert abs( GetParmVal( GetXSecParm( xsec, "TopRCurve" ) ) - 0.2 ) < 1e-6, "SetXSecCurvatures did not set the top of section " + str( i )

See also: XSEC_SIDES_TYPE :param [in]: xsec_id string XSec ID :param [in]: side int Side type enum (i.e. XSEC_BOTH_SIDES) :param [in]: top double Top curvature :param [in]: right double Right curvature :param [in]: bottom double Bottom curvature :param [in]: left double Left curvature

Get the curvatures for one side of the specified XSec. The four values come back in the order the setter takes them: top, right, bottom and left. The two sides can hold different values, so XSEC_BOTH_SIDES is not accepted here.

# Add Stack
sid = AddGeom( "STACK", "" )

# Get First (and Only) XSec Surf
xsec_surf = GetXSecSurf( sid, 0 )

xsec = GetXSec( xsec_surf, 1 )

SetXSecCurvatures( xsec, XSEC_BOTH_SIDES, 0.2, -1.0e12, -1.0e12, -1.0e12 )

vals = GetXSecCurvatures( xsec, XSEC_LEFT_SIDE )

# Setting both sides at once sets all four positions of each.
assert len( vals ) == 4, "GetXSecCurvatures did not report four values"

for v in vals:
    assert abs( v - 0.2 ) < 1e-6, "GetXSecCurvatures did not report the value that was set"

# Both sides were set, so they agree, and each matches its Parm.
right_vals = GetXSecCurvatures( xsec, XSEC_RIGHT_SIDE )

assert len( right_vals ) == 4, "the two sides disagree after setting both"
assert abs( right_vals[0] - vals[0] ) < 1e-9, "the two sides disagree after setting both"
assert abs( vals[0] - GetParmVal( GetXSecParm( xsec, "TopLCurve" ) ) ) < 1e-9, "GetXSecCurvatures disagrees with its Parm"

# XSEC_BOTH_SIDES names no single answer, so it has to be rejected.  The
# error queue is reached through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

GetXSecCurvatures( xsec, XSEC_BOTH_SIDES )

assert err_mgr.GetNumTotalErrors() > 0, "GetXSecCurvatures accepted XSEC_BOTH_SIDES"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: XSEC_SIDES_TYPE, SetXSecCurvatures :param [in]: xsec_id string XSec ID :param [in]: side int Side type enum (XSEC_LEFT_SIDE or XSEC_RIGHT_SIDE) :rtype: std::vector< double,std::allocator< double > > :return: vector<double> Top, right, bottom and left values for that side

openvsp.vsp.GetXSecCurveAlias(id)

Get XSecCurve Alias by XSec ID

# Add Stack
sid = AddGeom( "STACK", "" )

# Get First (and Only) XSec Surf
xsec_surf = GetXSecSurf( sid, 0 )

# Identify XSec 1
xsec_1 = GetXSec( xsec_surf, 1 )

# Set Alias and verify alias match
alias = "XSecCurve_One_Alias"

SetXSecCurveAlias( xsec_1, alias )

get_alias = GetXSecCurveAlias( xsec_1 )

if alias != get_alias:
    print("SetXSecCurveAlias/GetXSecCurveAlias error!")
    assert False, "SetXSecCurveAlias/GetXSecCurveAlias error!"
Parameters:

[in] – id string XSec ID

openvsp.vsp.GetXSecHeight(xsec_id)

Get the height of an XSec. Note that POINT type XSecs have a width and height of 0, regardless of what width and height it is set to.

# Add Fuselage Geom
fuseid = AddGeom( "FUSELAGE", "" )

xsec_surf = GetXSecSurf( fuseid, 0 )

xsec = GetXSec( xsec_surf, GetNumXSec( xsec_surf ) - 2 ) # Get 2nd to last XSec

SetXSecWidthHeight( xsec, 3.0, 6.0 )

if  abs( GetXSecHeight( xsec ) - 6.0 ) > 1e-6 :
    print( "---> Error: API Get/Set Width " )
    assert False, "---> Error: API Get/Set Width"

See also: SetXSecHeight :param [in]: xsec_id string XSec ID :rtype: float :return: double Xsec height

openvsp.vsp.GetXSecParm(xsec_id, name)

Get a specific Parm ID from an Xsec

# Add Fuselage Geom
fuseid = AddGeom( "FUSELAGE", "" )

xsec_surf = GetXSecSurf( fuseid, 0 )

ChangeXSecShape( xsec_surf, GetNumXSec( xsec_surf ) - 1, XS_ROUNDED_RECTANGLE )

xsec = GetXSec( xsec_surf, GetNumXSec( xsec_surf ) - 1 )

wid = GetXSecParm( xsec, "RoundedRect_Width" )

if  not ValidParm( wid ) :
    print( "---> Error: API GetXSecParm " )
    assert False, "---> Error: API GetXSecParm"
Parameters:
  • [in] – xsec_id string XSec ID

  • [in] – name string Parm name

Return type:

string

Returns:

string Parm ID

openvsp.vsp.GetXSecParmIDs(xsec_id)

Get all Parm IDs for specified XSec Parm Container

# Add Fuselage Geom
fuseid = AddGeom( "FUSELAGE", "" )

xsec_surf = GetXSecSurf( fuseid, 0 )

xsec = GetXSec( xsec_surf, GetNumXSec( xsec_surf ) - 1 )

parm_array = GetXSecParmIDs( xsec )

if  len(parm_array) < 1 :
    print( "---> Error: API GetXSecParmIDs " )
    assert False, "---> Error: API GetXSecParmIDs"
Parameters:

[in] – xsec_id string XSec ID

Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<string> Array of Parm IDs

openvsp.vsp.GetXSecPnts(xsec_id)

Set the coordinate points for a specific XSec. The XSec must be of type XS_FILE_FUSE.

# Add Fuselage Geom
fuseid = AddGeom( "FUSELAGE", "" )

xsec_surf = GetXSecSurf( fuseid, 0 )

ChangeXSecShape( xsec_surf, 2, XS_FILE_FUSE )

xsec = GetXSec( xsec_surf, 2 )

# ReadFileXSec hands back a tuple, so copy it into a list to edit it.
vec_array = list( ReadFileXSec(xsec, "TestXSec.fxs") )

assert len( vec_array ) > 0, "ReadFileXSec returned no points"

# The Python vec3d carries no arithmetic operators, so scale by component.
vec_array[1] = vec3d( vec_array[1].x() * 2.0, vec_array[1].y() * 2.0, vec_array[1].z() * 2.0 )
vec_array[3] = vec3d( vec_array[3].x() * 2.0, vec_array[3].y() * 2.0, vec_array[3].z() * 2.0 )

# A file XSec takes its width and height from the extents of the points it
# was given, in X and Y respectively.
wmin = min( [ p.x() for p in vec_array ] )
wmax = max( [ p.x() for p in vec_array ] )
hmin = min( [ p.y() for p in vec_array ] )
hmax = max( [ p.y() for p in vec_array ] )

SetXSecPnts( xsec, vec_array )

Update()

assert abs( GetXSecWidth( xsec ) - ( wmax - wmin ) ) < 1e-6, "SetXSecPnts did not set the section width"
assert abs( GetXSecHeight( xsec ) - ( hmax - hmin ) ) < 1e-6, "SetXSecPnts did not set the section height"
Parameters:
  • [in] – xsec_id string XSec ID

  • [in] – pnt_vec vector<vec3d> Vector of XSec coordinate points

Get the coordinate points for a specific XSec. The XSec must be of type XS_FILE_FUSE. The points are returned normalized to the section’s width and height.

# Add Fuselage Geom
fuseid = AddGeom( "FUSELAGE", "" )

xsec_surf = GetXSecSurf( fuseid, 0 )

ChangeXSecShape( xsec_surf, 2, XS_FILE_FUSE )

xsec = GetXSec( xsec_surf, 2 )

vec_array = list( ReadFileXSec( xsec, "TestXSec.fxs" ) )

# The points that were read are the points the section is carrying.
check_array = GetXSecPnts( xsec )

assert len( check_array ) > 0, "GetXSecPnts returned nothing"

# The stored points are normalized, so they fit in the unit box.
for p in check_array:
    assert abs( p.x() ) <= 0.5 + 1e-9, "GetXSecPnts returned a point outside the unit box"
    assert abs( p.y() ) <= 0.5 + 1e-9, "GetXSecPnts returned a point outside the unit box"

# The curve closes on itself.
assert dist( check_array[0], check_array[-1] ) < 1e-8, "GetXSecPnts returned an open curve"

# Setting points has to be what comes back.
SetXSecPnts( xsec, vec_array )

after_array = GetXSecPnts( xsec )

assert len( after_array ) == len( check_array ), "GetXSecPnts did not follow SetXSecPnts"

See also: SetXSecPnts, ReadFileXSec :param [in]: xsec_id string XSec ID :rtype: std::vector< vec3d,std::allocator< vec3d > > :return: vector<vec3d> Vector of XSec coordinate points

openvsp.vsp.GetXSecShape(xsec_id)

Get the shape of an XSec

# Add Stack
sid = AddGeom( "STACK", "" )

# Get First (and Only) XSec Surf
xsec_surf = GetXSecSurf( sid, 0 )

ChangeXSecShape( xsec_surf, 1, XS_EDIT_CURVE )

xsec = GetXSec( xsec_surf, 1 )

if  GetXSecShape( xsec ) != XS_EDIT_CURVE :
    print( "ERROR: GetXSecShape" )
    assert False, "ERROR: GetXSecShape"

See also: XSEC_CRV_TYPE :param [in]: xsec_id string XSec ID :rtype: int :return: int XSec type enum (i.e. XS_ELLIPSE)

openvsp.vsp.GetXSecSurf(geom_id, index)

Get the XSecSurf ID for a particular Geom and XSecSurf index

# Add Stack
sid = AddGeom( "STACK", "" )

# Get First (and Only) XSec Surf
xsec_surf = GetXSecSurf( sid, 0 )
assert len( xsec_surf ) > 0, "GetXSecSurf returned nothing"
Parameters:
  • [in] – geom_id string Geom ID

  • [in] – index int XSecSurf index

Return type:

string

Returns:

string XSecSurf ID

openvsp.vsp.GetXSecSurfGlobalXForm(xsec_surf_id)

Get the global surface transform matrix for given XSecSurf :param [in]: xsec_surf_id string XSecSurf ID :rtype: Matrix4d :return: Matrix4d Transformation matrix

openvsp.vsp.GetXSecTanAngles(xsec_id, side)

Set the tangent angles for the specified XSec

# Add Stack
sid = AddGeom( "STACK", "" )

# Get First (and Only) XSec Surf
xsec_surf = GetXSecSurf( sid, 0 )

num_xsecs = GetNumXSec( xsec_surf )

for i in range(num_xsecs):

    xsec = GetXSec( xsec_surf, i )

    SetXSecTanAngles( xsec, XSEC_BOTH_SIDES, 10.0, -1.0e12, -1.0e12, -1.0e12 )       # Set Tangent Angles At Cross Section

    # The setter is shorthand for the skin Parms, so the value has to show up
    # on both sides of the section.
    assert abs( GetParmVal( GetXSecParm( xsec, "TopLAngle" ) ) - 10.0 ) < 1e-6, "SetXSecTanAngles did not set the top of section " + str( i )
    assert abs( GetParmVal( GetXSecParm( xsec, "TopRAngle" ) ) - 10.0 ) < 1e-6, "SetXSecTanAngles did not set the top of section " + str( i )

See also: XSEC_SIDES_TYPE :param [in]: xsec_id string XSec ID :param [in]: side int Side type enum (i.e. XSEC_BOTH_SIDES) :param [in]: top double Top angle (degrees) :param [in]: right double Right angle (degrees) :param [in]: bottom double Bottom angle (degrees) :param [in]: left double Left angle (degrees)

Get the tangent angles for one side of the specified XSec. The four values come back in the order the setter takes them: top, right, bottom and left. The two sides can hold different values, so XSEC_BOTH_SIDES is not accepted here.

# Add Stack
sid = AddGeom( "STACK", "" )

# Get First (and Only) XSec Surf
xsec_surf = GetXSecSurf( sid, 0 )

xsec = GetXSec( xsec_surf, 1 )

SetXSecTanAngles( xsec, XSEC_BOTH_SIDES, 10.0, -1.0e12, -1.0e12, -1.0e12 )

vals = GetXSecTanAngles( xsec, XSEC_LEFT_SIDE )

# Setting both sides at once sets all four positions of each.
assert len( vals ) == 4, "GetXSecTanAngles did not report four values"

for v in vals:
    assert abs( v - 10.0 ) < 1e-6, "GetXSecTanAngles did not report the value that was set"

# Both sides were set, so they agree, and each matches its Parm.
right_vals = GetXSecTanAngles( xsec, XSEC_RIGHT_SIDE )

assert len( right_vals ) == 4, "the two sides disagree after setting both"
assert abs( right_vals[0] - vals[0] ) < 1e-9, "the two sides disagree after setting both"
assert abs( vals[0] - GetParmVal( GetXSecParm( xsec, "TopLAngle" ) ) ) < 1e-9, "GetXSecTanAngles disagrees with its Parm"

# XSEC_BOTH_SIDES names no single answer, so it has to be rejected.  The
# error queue is reached through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

GetXSecTanAngles( xsec, XSEC_BOTH_SIDES )

assert err_mgr.GetNumTotalErrors() > 0, "GetXSecTanAngles accepted XSEC_BOTH_SIDES"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: XSEC_SIDES_TYPE, SetXSecTanAngles :param [in]: xsec_id string XSec ID :param [in]: side int Side type enum (XSEC_LEFT_SIDE or XSEC_RIGHT_SIDE) :rtype: std::vector< double,std::allocator< double > > :return: vector<double> Top, right, bottom and left values for that side

openvsp.vsp.GetXSecTanSlews(xsec_id, side)

Set the tangent slew angles for the specified XSec

# Add Stack
sid = AddGeom( "STACK", "" )

# Get First (and Only) XSec Surf
xsec_surf = GetXSecSurf( sid, 0 )

num_xsecs = GetNumXSec( xsec_surf )

for i in range(num_xsecs):

    xsec = GetXSec( xsec_surf, i )

    SetXSecTanSlews( xsec, XSEC_BOTH_SIDES, 5.0, -1.0e12, -1.0e12, -1.0e12 )       # Set Tangent Slews At Cross Section

    # The setter is shorthand for the skin Parms, so the value has to show up
    # on both sides of the section.
    assert abs( GetParmVal( GetXSecParm( xsec, "TopLSlew" ) ) - 5.0 ) < 1e-6, "SetXSecTanSlews did not set the top of section " + str( i )
    assert abs( GetParmVal( GetXSecParm( xsec, "TopRSlew" ) ) - 5.0 ) < 1e-6, "SetXSecTanSlews did not set the top of section " + str( i )

See also: XSEC_SIDES_TYPE :param [in]: xsec_id string XSec ID :param [in]: side int Side type enum (i.e. XSEC_BOTH_SIDES) :param [in]: top double Top angle (degrees) :param [in]: right double Right angle (degrees) :param [in]: bottom double Bottom angle (degrees) :param [in]: left double Left angle (degrees)

Get the tangent slew angles for one side of the specified XSec. The four values come back in the order the setter takes them: top, right, bottom and left. The two sides can hold different values, so XSEC_BOTH_SIDES is not accepted here.

# Add Stack
sid = AddGeom( "STACK", "" )

# Get First (and Only) XSec Surf
xsec_surf = GetXSecSurf( sid, 0 )

xsec = GetXSec( xsec_surf, 1 )

SetXSecTanSlews( xsec, XSEC_BOTH_SIDES, 5.0, -1.0e12, -1.0e12, -1.0e12 )

vals = GetXSecTanSlews( xsec, XSEC_LEFT_SIDE )

# Setting both sides at once sets all four positions of each.
assert len( vals ) == 4, "GetXSecTanSlews did not report four values"

for v in vals:
    assert abs( v - 5.0 ) < 1e-6, "GetXSecTanSlews did not report the value that was set"

# Both sides were set, so they agree, and each matches its Parm.
right_vals = GetXSecTanSlews( xsec, XSEC_RIGHT_SIDE )

assert len( right_vals ) == 4, "the two sides disagree after setting both"
assert abs( right_vals[0] - vals[0] ) < 1e-9, "the two sides disagree after setting both"
assert abs( vals[0] - GetParmVal( GetXSecParm( xsec, "TopLSlew" ) ) ) < 1e-9, "GetXSecTanSlews disagrees with its Parm"

# XSEC_BOTH_SIDES names no single answer, so it has to be rejected.  The
# error queue is reached through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

GetXSecTanSlews( xsec, XSEC_BOTH_SIDES )

assert err_mgr.GetNumTotalErrors() > 0, "GetXSecTanSlews accepted XSEC_BOTH_SIDES"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: XSEC_SIDES_TYPE, SetXSecTanSlews :param [in]: xsec_id string XSec ID :param [in]: side int Side type enum (XSEC_LEFT_SIDE or XSEC_RIGHT_SIDE) :rtype: std::vector< double,std::allocator< double > > :return: vector<double> Top, right, bottom and left values for that side

openvsp.vsp.GetXSecTanStrengths(xsec_id, side)

Set the tangent strengths for the specified XSec

# Add Stack
sid = AddGeom( "STACK", "" )

# Get First (and Only) XSec Surf
xsec_surf = GetXSecSurf( sid, 0 )

# Flatten ends
num_xsecs = GetNumXSec( xsec_surf )

for i in range(num_xsecs):

    xsec = GetXSec( xsec_surf, i )

    SetXSecTanStrengths( xsec, XSEC_BOTH_SIDES, 0.8, -1.0e12, -1.0e12, -1.0e12 )  # Set Tangent Strengths At Cross Section

    # The setter is shorthand for the skin Parms, so the value has to show up
    # on both sides of the section.
    assert abs( GetParmVal( GetXSecParm( xsec, "TopLStrength" ) ) - 0.8 ) < 1e-6, "SetXSecTanStrengths did not set the top of section " + str( i )
    assert abs( GetParmVal( GetXSecParm( xsec, "TopRStrength" ) ) - 0.8 ) < 1e-6, "SetXSecTanStrengths did not set the top of section " + str( i )

See also: XSEC_SIDES_TYPE :param [in]: xsec_id string XSec ID :param [in]: side int Side type enum (i.e. XSEC_BOTH_SIDES) :param [in]: top double Top strength :param [in]: right double Right strength :param [in]: bottom double Bottom strength :param [in]: left double Left strength

Get the tangent strengths for one side of the specified XSec. The four values come back in the order the setter takes them: top, right, bottom and left. The two sides can hold different values, so XSEC_BOTH_SIDES is not accepted here.

# Add Stack
sid = AddGeom( "STACK", "" )

# Get First (and Only) XSec Surf
xsec_surf = GetXSecSurf( sid, 0 )

xsec = GetXSec( xsec_surf, 1 )

SetXSecTanStrengths( xsec, XSEC_BOTH_SIDES, 0.8, -1.0e12, -1.0e12, -1.0e12 )

vals = GetXSecTanStrengths( xsec, XSEC_LEFT_SIDE )

# Setting both sides at once sets all four positions of each.
assert len( vals ) == 4, "GetXSecTanStrengths did not report four values"

for v in vals:
    assert abs( v - 0.8 ) < 1e-6, "GetXSecTanStrengths did not report the value that was set"

# Both sides were set, so they agree, and each matches its Parm.
right_vals = GetXSecTanStrengths( xsec, XSEC_RIGHT_SIDE )

assert len( right_vals ) == 4, "the two sides disagree after setting both"
assert abs( right_vals[0] - vals[0] ) < 1e-9, "the two sides disagree after setting both"
assert abs( vals[0] - GetParmVal( GetXSecParm( xsec, "TopLStrength" ) ) ) < 1e-9, "GetXSecTanStrengths disagrees with its Parm"

# XSEC_BOTH_SIDES names no single answer, so it has to be rejected.  The
# error queue is reached through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

GetXSecTanStrengths( xsec, XSEC_BOTH_SIDES )

assert err_mgr.GetNumTotalErrors() > 0, "GetXSecTanStrengths accepted XSEC_BOTH_SIDES"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: XSEC_SIDES_TYPE, SetXSecTanStrengths :param [in]: xsec_id string XSec ID :param [in]: side int Side type enum (XSEC_LEFT_SIDE or XSEC_RIGHT_SIDE) :rtype: std::vector< double,std::allocator< double > > :return: vector<double> Top, right, bottom and left values for that side

openvsp.vsp.GetXSecWidth(xsec_id)

Get the width of an XSec. Note that POINT type XSecs have a width and height of 0, regardless of what width and height it is set to.

# Add Fuselage Geom
fuseid = AddGeom( "FUSELAGE", "" )

xsec_surf = GetXSecSurf( fuseid, 0 )

xsec = GetXSec( xsec_surf, GetNumXSec( xsec_surf ) - 2 ) # Get 2nd to last XSec

SetXSecWidthHeight( xsec, 3.0, 6.0 )

if  abs( GetXSecWidth( xsec ) - 3.0 ) > 1e-6 :
    print( "---> Error: API Get/Set Width " )
    assert False, "---> Error: API Get/Set Width"

See also: SetXSecWidth :param [in]: xsec_id string XSec ID :rtype: float :return: double Xsec width

openvsp.vsp.HEIGHT_XSEC_DRIVER = 2

Height driver

openvsp.vsp.HINGE_GEOM_SCREEN = 10

Hinge geom screen

openvsp.vsp.HUMAN_GEOM_SCREEN = 16

Human geom screen

openvsp.vsp.HWRATIO_XSEC_DRIVER = 3

Height/width ratio driver

openvsp.vsp.HideAllBackground3Ds()

Hide all Background3Ds in model

# Add Background3D
AddBackground3D()
AddBackground3D()
AddBackground3D()

assert GetNumBackground3Ds() == 3, "the three Background3Ds were not all added"
assert len( GetAllBackground3Ds() ) == 3, "the three Background3Ds were not all added"

HideAllBackground3Ds()

DelAllBackground3Ds()

assert GetNumBackground3Ds() == 0, "DelAllBackground3Ds left something behind"
assert len( GetAllBackground3Ds() ) == 0, "DelAllBackground3Ds left something behind"
openvsp.vsp.HideAllProbes()

Hide every Probe in the Measure Tool. See also: ShowAllProbes

openvsp.vsp.HideAllProtractors()

Hide every Protractor in the Measure Tool. See also: ShowAllProtractors

openvsp.vsp.HideAllRSTProbes()

Hide every RST Probe in the Measure Tool. See also: ShowAllRSTProbes

openvsp.vsp.HideAllRulers()

Hide every Ruler in the Measure Tool. See also: ShowAllRulers

openvsp.vsp.HideScreen(s)

Hide an OpenVSP GUI screen

HideScreen( VSP_CFD_MESH_SCREEN )
Parameters:

[in] – s int GUI_VSP_SCREEN enum for screen

openvsp.vsp.ID_LENGTH_ATTR = 8

ID for Attributes are length 8

openvsp.vsp.ID_LENGTH_ATTRCOLL = 9

ID for Attribute Collections are length 9

openvsp.vsp.ID_LENGTH_PARM = 11

ID for Parms are length 11

openvsp.vsp.ID_LENGTH_PARMCONTAINER = 10

ID for Parm Containers are length 10

openvsp.vsp.ID_LENGTH_PRESET_GROUP = 5

ID for Var Preset Groups are length 5

openvsp.vsp.ID_LENGTH_PRESET_SETTING = 6

ID for Var Preset Settings are length 6

openvsp.vsp.IMPORT_BEM = 6

Blade Element (*.bem) import

openvsp.vsp.IMPORT_CART3D_TRI = 2

Cart3D (*.try) import

openvsp.vsp.IMPORT_NASCART = 1

NASCART (*.dat) import

openvsp.vsp.IMPORT_P3D_WIRE = 8

Plot3D as Wireframe (*.p3d) import

openvsp.vsp.IMPORT_PTS = 4

Point Cloud (*.pts) import

openvsp.vsp.IMPORT_STL = 0

Stereolith (*.stl) import

openvsp.vsp.IMPORT_V2 = 5

OpenVSP v2 (*.vsp) import

openvsp.vsp.IMPORT_XSEC_MESH = 3

XSec as Tri Mesh (*.hrm) import

openvsp.vsp.IMPORT_XSEC_WIRE = 7

XSec as Wireframe (*.hrm) import

openvsp.vsp.INSIDE = 0

The interior of the sub-surface is its surface

openvsp.vsp.INTERMEDIATE_FRAGMENT = 1

Intermediate rotor fragment

openvsp.vsp.INTERSECT_CURV_FILE_NAME = 1

CURV intersection file type

openvsp.vsp.INTERSECT_IGES_FILE_NAME = 3

IGES intersection file type

openvsp.vsp.INTERSECT_NUM_FILE_NAMES = 5

Number of surface intersection file types

openvsp.vsp.INTERSECT_PLOT3D_FILE_NAME = 2

PLOT3D intersection file type

openvsp.vsp.INTERSECT_SRF_FILE_NAME = 0

SRF intersection file type

openvsp.vsp.INTERSECT_STEP_FILE_NAME = 4

STEP intersection file type

openvsp.vsp.INT_DATA = 1

Integer data type

openvsp.vsp.INT_MATRIX_DATA = 5

Int matrix data type

openvsp.vsp.INVALID_TYPE = -1

Invalid data type

openvsp.vsp.ImportFile(file_name, file_type, 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 :param [in]: file_name string Import file name :param [in]: file_type int File type enum (i.e. IMPORT_PTS) :param [in]: parent string Parent Geom ID (ignored with empty string)

openvsp.vsp.IndividualizeFeaPart(geom_id, fea_struct_ind, part_id)

Replace an FEA array part with the individual parts it stands for, the way the Individualize buttons on the array panels do. A rib array, slice array or SSLine array is a compact way of laying down a regular set of parts; individualizing turns it into that set, so each one can then be edited on its own. The array part itself goes away.

pod_id = AddGeom( "POD", "" )

struct_ind = AddFeaStruct( pod_id )
struct_id = GetFeaStructID( pod_id, struct_ind )

array_id = AddFeaPart( pod_id, struct_ind, FEA_SLICE_ARRAY )

SetParmVal( FindParm( array_id, "SliceRelSpacing", "FeaSliceArray" ), 0.25 )

Update()

num_before = NumFeaParts( struct_id )

IndividualizeFeaPart( pod_id, struct_ind, array_id )

# The array is replaced by the slices it stood for, so the part count goes up.
assert NumFeaParts( struct_id ) > num_before, "IndividualizeFeaPart did not expand the array"

See also: AddFeaPart, AddFeaSubSurf, NumFeaParts :param [in]: geom_id string Geom ID :param [in]: fea_struct_ind int FEA Structure index :param [in]: part_id string FEA Part or FEA Sub-Surface ID of an array part

openvsp.vsp.InitGUI()

Low level routine that should be called to set up GUI before running StartGUI()

InitGUI()
openvsp.vsp.InitStackPreset(geom_id, preset)

Replace every XSec of a StackGeom with a preset starting point. Most of the presets lay out a nacelle; which one you want depends on whether the model needs the inlet, the outlet, the external surface, the internal flowpath, or some combination. This discards the existing cross sections, so it belongs right after the StackGeom is created.

stack_id = AddGeom( "STACK", "" )

InitStackPreset( stack_id, STACK_PRESET_FLOWTHRU_MID_ORIG )

Update()

# Each preset lays down its own set of XSecs, replacing the default five.
xsec_surf = GetXSecSurf( stack_id, 0 )

assert GetNumXSec( xsec_surf ) == 7, "InitStackPreset did not rebuild the XSecs"
Parameters:
  • [in] – geom_id string StackGeom Geom ID

  • [in] – preset int Preset enum (see STACK_PRESETS)

openvsp.vsp.InsertFeaPolySparPt(pspar_id, index)

Insert a point into an FEA Poly Spar before the given index and return its ID.

wing_id = AddGeom( "WING" )

struct_ind = AddFeaStruct( wing_id )

pspar_id = AddFeaPart( wing_id, struct_ind, FEA_POLY_SPAR )

# Insert a new intermediate point between the two default endpoints
pt_id = InsertFeaPolySparPt( pspar_id, 1 )

if GetFeaPolySparNumPt( pspar_id ) != 3:
    print( "Error: InsertFeaPolySparPt" )
    assert False, "Error: InsertFeaPolySparPt"

See also: AddFeaPolySparPt, DelFeaPolySparPt, GetFeaPolySparNumPt :param [in]: pspar_id string FEA Poly Spar part ID :param [in]: index int Index before which the new point is inserted :rtype: string :return: string ID of the newly inserted Poly Spar point

openvsp.vsp.InsertRoutingPt(routing_id, index, geom_id, surf_index)

Add a routing point to a RoutingGeom. The new point will be inserted before the specified index. The new point will be anchored to the specified geom and surface.

pod1 = vsp.AddGeom('POD', '')

pod2 = vsp.AddGeom('POD', '')
ypod2 = vsp.GetParm(pod2, 'Y_Rel_Location', 'XForm')
vsp.SetParmVal(ypod2, 2.0)

routing_geom = vsp.AddGeom('ROUTING', '')

rpt0 = vsp.AddRoutingPt(routing_geom, pod1, 0)
u0 = vsp.GetParm( rpt0, 'U', 'RoutePt')
vsp.SetParmVal(u0, 0.0)

rpt1 = vsp.AddRoutingPt(routing_geom, pod2, 0)

rpt2 = vsp.AddRoutingPt(routing_geom, pod1, 0)
u2 = vsp.GetParm( rpt2, 'U', 'RoutePt')
vsp.SetParmVal(u2, 1.0)

npt = vsp.GetNumRoutingPts(routing_geom)
rptPre2 = vsp.InsertRoutingPt(routing_geom, 2, pod2, 0)
uPre2 = vsp.GetParm( rptPre2, 'U', 'RoutePt')
vsp.SetParmVal(uPre2, 0.)

See also: AddRoutingPt, DelRoutingPt :param [in]: routing_id string RoutingGeom Geom ID :param [in]: index int Index of routing point to insert new point before :param [in]: geom_id string Geom ID of geom to anchor new routing point to :param [in]: surf_index int Index of surf to anchor new routing point to :rtype: string :return: string ParmContainer ID for the newly added routing point

openvsp.vsp.InsertVSPFile(file_name, parent_geom_id)

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. :param [in]: file_name string *.vsp3 filename :param [in]: parent_geom_id string Parent geom ID (ignored with empty string)

openvsp.vsp.InsertXSec(geom_id, index, type)

Insert a cross-section of particular type to the specified geometry after the given index

wing_id = AddGeom( "WING" )

xsec_surf = GetXSecSurf( wing_id, 0 )

num_start = GetNumXSec( xsec_surf )

#===== Add XSec ====//
InsertXSec( wing_id, 1, XS_SIX_SERIES )

Update()

# The new section lands after the given index.
assert GetNumXSec( xsec_surf ) == num_start + 1, "InsertXSec did not add a section"
assert GetXSecShape( GetXSec( xsec_surf, 2 ) ) == XS_SIX_SERIES, "InsertXSec did not insert the requested shape"

See also: XSEC_CRV_TYPE :param [in]: geom_id string Geom ID :param [in]: index int XSec index :param [in]: type int XSec type enum (i.e. XS_GENERAL_FUSE)

openvsp.vsp.InsideSurf(geom_id, surf_indx, pt)

Test whether a given point is inside a specified surface.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

r = 0.12
s = 0.68
t = 0.56

pnt = CompPntRST( geom_id, surf_indx, r, s, t )

res = InsideSurf( geom_id, surf_indx, pnt )

# pnt was built by CompPntRST at r = 0.12, which is inside the surface.
assert res, "InsideSurf says an interior point is outside"

if  res :
    print( "Inside" )
else:
    print( "Outside" )

See also: VecInsideSurf :param [in]: geom_id string Parent Geom ID :param [in]: surf_indx int Main surface index from the parent Geom :param [in]: pt vec3d Input 3D coordinate point :rtype: boolean :return: bool Boolean true if the point is inside the surface, false otherwise.

class openvsp.vsp.IntVecVec(*args)

Bases: object

Proxy of C++ std::vector< std::vector< int > > class.

append(IntVecVec self, IntVector x)
assign(IntVecVec self, std: :vector< std::vector< int > >::size_type n, IntVector x)
back(IntVecVec self) IntVector
begin(IntVecVec self) std::vector< std::vector< int > >::iterator
capacity(IntVecVec self) std::vector< std::vector< int > >::size_type
clear(IntVecVec self)
empty(IntVecVec self) bool
end(IntVecVec self) std::vector< std::vector< int > >::iterator
erase(IntVecVec self, std: :vector< std::vector< int > >::iterator pos) std::vector< std::vector< int > >::iterator
erase(IntVecVec self, std: :vector< std::vector< int > >::iterator first, std: :vector< std::vector< int > >::iterator last) std::vector< std::vector< int > >::iterator
front(IntVecVec self) IntVector
get_allocator(IntVecVec self) std::vector< std::vector< int > >::allocator_type
insert(IntVecVec self, std: :vector< std::vector< int > >::iterator pos, IntVector x) std::vector< std::vector< int > >::iterator
insert(IntVecVec self, std: :vector< std::vector< int > >::iterator pos, std: :vector< std::vector< int > >::size_type n, IntVector x)
iterator(IntVecVec self) SwigPyIterator
pop(IntVecVec self) IntVector
pop_back(IntVecVec self)
push_back(IntVecVec self, IntVector x)
rbegin(IntVecVec self) std::vector< std::vector< int > >::reverse_iterator
rend(IntVecVec self) std::vector< std::vector< int > >::reverse_iterator
reserve(IntVecVec self, std: :vector< std::vector< int > >::size_type n)
resize(IntVecVec self, std: :vector< std::vector< int > >::size_type new_size)
resize(IntVecVec self, std: :vector< std::vector< int > >::size_type new_size, IntVector x)
size(IntVecVec self) std::vector< std::vector< int > >::size_type
swap(IntVecVec self, IntVecVec v)
property thisown

The membership flag

class openvsp.vsp.IntVector(*args)

Bases: object

Proxy of C++ std::vector< int > class.

append(IntVector self, std: :vector< int >::value_type const & x)
assign(IntVector self, std: :vector< int >::size_type n, std: :vector< int >::value_type const & x)
back(IntVector self) std::vector< int >::value_type const &
begin(IntVector self) std::vector< int >::iterator
capacity(IntVector self) std::vector< int >::size_type
clear(IntVector self)
empty(IntVector self) bool
end(IntVector self) std::vector< int >::iterator
erase(IntVector self, std: :vector< int >::iterator pos) std::vector< int >::iterator
erase(IntVector self, std: :vector< int >::iterator first, std: :vector< int >::iterator last) std::vector< int >::iterator
front(IntVector self) std::vector< int >::value_type const &
get_allocator(IntVector self) std::vector< int >::allocator_type
insert(IntVector self, std: :vector< int >::iterator pos, std: :vector< int >::value_type const & x) std::vector< int >::iterator
insert(IntVector self, std: :vector< int >::iterator pos, std: :vector< int >::size_type n, std: :vector< int >::value_type const & x)
iterator(IntVector self) SwigPyIterator
pop(IntVector self) std::vector< int >::value_type
pop_back(IntVector self)
push_back(IntVector self, std: :vector< int >::value_type const & x)
rbegin(IntVector self) std::vector< int >::reverse_iterator
rend(IntVector self) std::vector< int >::reverse_iterator
reserve(IntVector self, std: :vector< int >::size_type n)
resize(IntVector self, std: :vector< int >::size_type new_size)
resize(IntVector self, std: :vector< int >::size_type new_size, std: :vector< int >::value_type const & x)
size(IntVector self) std::vector< int >::size_type
swap(IntVector self, IntVector v)
property thisown

The membership flag

openvsp.vsp.IntegrateEllipsoidFlow(vec3d abc_rad, int const & abc_index) double
openvsp.vsp.IntersectSubSurf(sub_id)

Trigger intersection for SS_INTERSECT type subsurfaces

pid = AddGeom( "POD", "" )
p2id = AddGeom( "POD", "" )

xpod2 = GetParm( p2id, "X_Rel_Location", "XForm" )
SetParmVal( xpod2, 4.0 )

zrotpod2 = GetParm( p2id, "Z_Rel_Rotation", "XForm" )
SetParmVal( zrotpod2, 60.0 )

sub_id = AddSubSurf( pid, SS_INTERSECT )

Update()

SetIntersectSubSurfGeomID( sub_id, p2id )

IntersectSubSurf( sub_id )

Update()

# The sub-surface is an intersection of the two Pods, and it belongs to the
# first one.
assert GetSubSurfType( sub_id ) == SS_INTERSECT, "the sub-surface is not an intersection"

sub_ids = GetSubSurfIDVec( pid )

assert len( sub_ids ) == 1, "the intersection sub-surface is not on the Geom it was added to"
assert sub_ids[0] == sub_id, "the intersection sub-surface is not on the Geom it was added to"

# Naming a Geom that does not exist has to be rejected.  The error queue is
# reached through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

SetIntersectSubSurfGeomID( sub_id, "NOSUCHGEOM" )

IntersectSubSurf( sub_id )

assert err_mgr.GetNumTotalErrors() > 0, "a bad Geom ID was accepted for the intersection"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()
Parameters:

[in] – sub_id string Sub-surface ID

openvsp.vsp.IsEventLoopRunning()

Test if the OpenVSP GUI event loop is running.

StartGUI()

if ( IsEventLoopRunning() ):
    print( "Event loop is running." )
Return type:

boolean

Returns:

bool True if the OpenVSP GUI event loop is running. False otherwise.

openvsp.vsp.IsFacade()

Returns True if the facade API is in use.

is_facade = IsFacade()
openvsp.vsp.IsGUIBuild()

Test if the current OpenVSP build includes graphics capabilities.

if ( IsGUIBuild() ):
    print( "OpenVSP build is graphics capable." )
else:
    print( "OpenVSP build is not graphics capable." )
Return type:

boolean

Returns:

bool True if the current OpenVSP build includes graphics capabilities. False otherwise.

openvsp.vsp.IsGUIRunning()

Returns True if the GUI event loop is running.

is_gui_active = IsGUIRunning()
openvsp.vsp.J_PROP_DRIVER = 5

Advance ratio driver

openvsp.vsp.LEN_CM = 1

Centimeter

openvsp.vsp.LEN_FT = 4

Feet

openvsp.vsp.LEN_IN = 3

Inch

openvsp.vsp.LEN_M = 2

Meter

openvsp.vsp.LEN_MM = 0

Millimeter

openvsp.vsp.LEN_UNITLESS = 6

Unitless

openvsp.vsp.LEN_YD = 5

Yard

openvsp.vsp.LE_NORMAL = 1

FEA Rib or Rib Array is set perpendicular to the leading edge

openvsp.vsp.LINEAR = 0

Linear curve type

openvsp.vsp.LINEAR_SWEPT_VOLUME_ANALYSIS = 12

Interference with linear swept volume

openvsp.vsp.LINE_SOURCE = 1

Line source

openvsp.vsp.L_TRIM = 1

Trim by L coordinate

openvsp.vsp.LimitedIntersectSurfaces(StringVector geomvec, std: :vector< std::vector< vec3d, std: :allocator< vec3d > >, std: :allocator< std::vector< vec3d, std: :allocator< vec3d > > > > & ptchains, std: :vector< std::vector< vec3d, std: :allocator< vec3d > >, std: :allocator< std::vector< vec3d, std: :allocator< vec3d > > > > & uwchains)
openvsp.vsp.LinkAllComp(parm_a_id, parm_b_id)

Link every Parm of the container holding the first Parm to the matching Parm of the container holding the second. This is the Link screen’s “Link All Comp” button.

pod1 = AddGeom( "POD", "" )
pod2 = AddGeom( "POD", "" )

LinkAllComp( GetParm( pod1, "X_Rel_Location", "XForm" ), GetParm( pod2, "X_Rel_Location", "XForm" ) )

# A Pod carries many Parms, so this makes many links at once.
assert GetNumParmLinks() >= 2, "LinkAllComp did not link the containers"

# Every link it made joins two real Parms.
for i in range( GetNumParmLinks() ):
    lid = GetParmLinkID( i )
    assert len( GetParmLinkAParm( lid ) ) > 0, "LinkAllComp made a link with no Parms"
    assert len( GetParmLinkBParm( lid ) ) > 0, "LinkAllComp made a link with no Parms"

See also: AddParmLink, LinkAllGroup :param [in]: parm_a_id string Parm ID naming the driving container :param [in]: parm_b_id string Parm ID naming the driven container :rtype: boolean :return: bool True if any link was made

openvsp.vsp.LinkAllGroup(parm_a_id, parm_b_id)

Link every Parm of the group holding the first Parm to the matching Parm of the group holding the second. This is the Link screen’s “Link All Group” button.

pod1 = AddGeom( "POD", "" )
pod2 = AddGeom( "POD", "" )

LinkAllGroup( GetParm( pod1, "X_Rel_Location", "XForm" ), GetParm( pod2, "X_Rel_Location", "XForm" ) )

# The XForm group carries several Parms, so this makes several links.
num_group = GetNumParmLinks()

assert num_group >= 2, "LinkAllGroup did not link the groups"

# A group is part of the container, so linking the whole container makes at
# least as many links.
DelAllParmLinks()

LinkAllComp( GetParm( pod1, "X_Rel_Location", "XForm" ), GetParm( pod2, "X_Rel_Location", "XForm" ) )

assert GetNumParmLinks() >= num_group, "LinkAllGroup linked more than LinkAllComp"

See also: AddParmLink, LinkAllComp :param [in]: parm_a_id string Parm ID naming the driving group :param [in]: parm_b_id string Parm ID naming the driven group :rtype: boolean :return: bool True if any link was made

openvsp.vsp.ListAnalysis()

Get the name of every available analysis in the Analysis Manager

analysis_array = ListAnalysis()

print( "List of Available Analyses: " )

for i in range(int( len(analysis_array) )):

    print( "    " + analysis_array[i] )

    assert len( analysis_array[i] ) > 0, "ListAnalysis returned an unnamed analysis"

assert len( analysis_array ) == GetNumAnalysis(), "ListAnalysis disagrees with GetNumAnalysis"

# The analyses the rest of these examples lean on have to be there.
assert "VSPAEROComputeGeometry" in analysis_array, "VSPAEROComputeGeometry is not registered"
Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<string> Array of analysis names

openvsp.vsp.Lock()

Obtain the lock on the OpenVSP GUI event loop. This will prevent the interactive GUI from updating or accepting user input until the lock is released – thereby allowing longer-time commands including analyses to execute without the chance of the OpenVSP state changing during execution.

StartGUI()

pod_id = AddGeom( "POD" )

Lock()
rid = ExecAnalysis( "CompGeom" )

mesh_id_vec = GetStringResults( rid, "Mesh_GeomID" )

DeleteGeomVec( mesh_id_vec )
Unlock()

See also: Unlock

openvsp.vsp.MALE = 0

Male Human component

openvsp.vsp.MANUAL_REF = 0

Manually specify the reference areas and lengths

openvsp.vsp.MASS_LBFSEC2IN = 5

lbf*sec^2/in

openvsp.vsp.MASS_PROP = 18

Calculate mass properties

openvsp.vsp.MASS_UNIT_G = 0

Gram

openvsp.vsp.MASS_UNIT_KG = 1

Kilogram

openvsp.vsp.MASS_UNIT_LBM = 3

Pound-mass

openvsp.vsp.MASS_UNIT_SLUG = 4

Slug

openvsp.vsp.MASS_UNIT_TONNE = 2

Tonne

openvsp.vsp.MAX_CAMB = 0

Input maximum camber, calculate ideal lift coefficient

openvsp.vsp.MAX_LEN_CONSTRAINT = 1

Maximum edge length.

openvsp.vsp.MAX_NUM_SETS = 1000

Maximum possible number of sets

openvsp.vsp.MESH_GEOM_SCREEN = 4

Mesh geom screen

openvsp.vsp.MESH_INDEXED_TRI = 0

Indexed triangulated mesh Geom type

openvsp.vsp.MESH_INDEX_AND_SLICE_TRI = 3

Both indexed and sliced triangulated mesh Geom type

openvsp.vsp.MESH_SLICE_TRI = 1

Sliced Triangulated mesh Geom type

openvsp.vsp.MIN_GROW_LIMIT = 10

Reason marker for minimum reason to apply growth limit.

openvsp.vsp.MIN_LEN_CONSTRAINT = 5

Minimum edge length.

openvsp.vsp.MIN_LEN_CONSTRAINT_CURV_GAP = 6

Maximum gap constrained by minimum length.

openvsp.vsp.MIN_LEN_CONSTRAINT_CURV_NCIRCSEG = 7

Number of segments to define a circle constrained by minimum length.

openvsp.vsp.MIN_LEN_CONSTRAINT_SOURCES = 8

Mesh sources constrained by minimum length (not applied).

openvsp.vsp.MIN_LEN_INCREMENT = 4

Reason increment when adding minimum length constraint.

openvsp.vsp.MIN_NUM_USER = 20

Minimum number of user sets

openvsp.vsp.MODE_TARGET = 2

Mode target type

openvsp.vsp.MOTION_NUM_EXTENT_TYPES = 7

Number of swept volume extent types.

openvsp.vsp.MPA_UNIT = 2

FEA Files output in (mm, tonne)

openvsp.vsp.MS_WING_GEOM_SCREEN = 2

Wing geom screen

openvsp.vsp.MULT_GEOM_SCREEN = 11

Multiple geom screen

openvsp.vsp.MakeMeshGeom(ga_id)

Create a MeshGeom from the results of the specified Geometry Analysis case and return the new Geom’s ID. The case must have been evaluated first (run the “GeometryAnalysis” analysis for the case) so that its result meshes exist. The resulting MeshGeom is added to the model and made the active Geom.

#==== Add a Geom for the case to work on ====//
pod_id = AddGeom( "POD" )
Update()

ga_id = AddGeometryAnalysis()

#==== Configure the case.  Without a primary target the analysis has
#==== nothing to mesh and reports an empty primary mesh.
SetParmVal( FindParm( ga_id, "PrimaryType", "InterferenceCase" ), SET_TARGET )
SetParmVal( FindParm( ga_id, "PrimarySet", "InterferenceCase" ), SET_ALL )
SetParmVal( FindParm( ga_id, "SecondaryType", "InterferenceCase" ), SET_TARGET )
SetParmVal( FindParm( ga_id, "SecondarySet", "InterferenceCase" ), SET_ALL )
Update()

# Evaluate the case through the Analysis framework so that its result meshes exist.
SetAnalysisInputDefaults( "GeometryAnalysis" )

SetStringAnalysisInput( "GeometryAnalysis", "CaseID", [ga_id] )

ExecAnalysis( "GeometryAnalysis" )

# Turn the case's result meshes into a MeshGeom.
mesh_id = MakeMeshGeom( ga_id )
assert len( mesh_id ) > 0, "MakeMeshGeom returned no id"

See also: AddGeometryAnalysis, SetActiveGeometryAnalysis :param [in]: ga_id string Geometry Analysis case ID :rtype: string :return: string Geom ID of the newly created MeshGeom

openvsp.vsp.MapFromPlane(vec2d uw, vec3d planeOrig, vec3d planeVec1, vec3d planeVec2) vec3d
openvsp.vsp.MapToPlane(vec3d p, vec3d planeOrig, vec3d planeVec1, vec3d planeVec2) vec2d
class openvsp.vsp.Matrix4d

Bases: object

Matrix4d is typically used to perform rotations, translations, scaling, projections, and other transformations in 3D space.

affineInverse()

Perform an affine transform on the Matrix4d

    #==== Test Matrix4d ====//
Matrix4d m()                            # Default Constructor

m.loadIdentity()

m.rotateY( 10.0 )
m.rotateX( 20.0 )
m.rotateZ( 30.0 )

vec3d c = m.xform( vec3d( 1.0, 1.0, 1.0 ) )

m.affineInverse()
buildXForm(pos, rot, cent_rot)

Translate the Matrix4d to a given position and rotate it a about a given center of rotation :param [in]: pos Position to translate to :param [in]: rot Angle of rotation (degrees) :param [in]: cent_rot Center of rotation

const_data(Matrix4d self) double const *
data(Matrix4d self) double *
flipx(Matrix4d self)
getAngles()

Calculate the Matrix4d’s angles between the X, Y and Z axes

    Matrix4d mat
PI = 3.14

mat.loadIdentity()

m.rotate( PI / 4, vec3d( 0.0, 0.0, 1.0 ) )      # Radians

vec3d angles = mat.getAngles()
Return type:

vec3d

Returns:

Angle measurement between each axis (degrees)

getArcballAngles(Matrix4d self) vec3d
getBasis(Matrix4d self, vec3d xdir, vec3d ydir, vec3d zdir)
getMat(Matrix4d self, double * m)
getRotationAxis(Matrix4d self, vec3d axis_dir, vec3d axis_pnt, double & angle)
getTranslation(Matrix4d self) vec3d
initMat(Matrix4d self, double const * m)
initMat(Matrix4d self, Matrix4d m)
loadIdentity()

Create a 4x4 identity matrix

    #==== Test Matrix4d ====//
Matrix4d m()                            # Default Constructor
m.loadIdentity()
loadXYRef()

Load an identy Matrix4d and set the Z coordinate of the diagonal (index 10) to -1

    #==== Test Matrix4d ====//
Matrix4d m()                            # Default Constructor

m.loadXYRef()

vec3d b = m.xform( vec3d( 1, 2, 3 ) )
loadXZRef()

Load an identy Matrix4d and set the Y coordinate of the diagonal (index 5) to -1

    #==== Test Matrix4d ====//
Matrix4d m()                            # Default Constructor

m.loadXZRef()

vec3d b = m.xform( vec3d( 1, 2, 3 ) )
loadYZRef()

Load an identy Matrix4d and set the X coordinate of the diagonal (index 0) to -1

    #==== Test Matrix4d ====//
Matrix4d m()                            # Default Constructor

m.loadYZRef()

vec3d b = m.xform( vec3d( 1, 2, 3 ) )
matMult(Matrix4d self, double const * m)
matMult(Matrix4d self, Matrix4d m)
mirrory()

Transform the Matrix4d by the given vector

    #==== Test Matrix4d ====//
Matrix4d m()                            # Default Constructor

m.loadIdentity()

vec3d a = m.xform( vec3d( 1.0, 2.0, 3.0 ) )
mult(Matrix4d self, double const [4] _in, double [4] out)
postMult(Matrix4d self, double const * m)
postMult(Matrix4d self, Matrix4d m)
rotate(angle, axis)

Rotate the Matrix4d about an arbitrary axis

    #==== Test Matrix4d ====//
Matrix4d m()                            # Default Constructor
PI = 3.14

m.loadIdentity()

m.rotate( PI / 4, vec3d( 0.0, 0.0, 1.0 ) )      # Radians
Parameters:
  • [in] – angle Angle of rotation (rad)

  • [in] – axis Vector to rotate about

rotateX(ang)

Rotate the Matrix4d about the X axis

    #==== Test Matrix4d ====//
Matrix4d m()                            # Default Constructor

m.loadIdentity()

m.rotateX( 90.0 )
Parameters:

[in] – ang Angle of rotation (degrees)

rotateY(ang)

Rotate the Matrix4d about the Y axis

    #==== Test Matrix4d ====//
Matrix4d m()                            # Default Constructor

m.loadIdentity()

m.rotateY( 90.0 )
Parameters:

[in] – ang Angle of rotation (degrees)

rotateZ(ang)

Rotate the Matrix4d about the Z axis

    #==== Test Matrix4d ====//
Matrix4d m()                            # Default Constructor

m.loadIdentity()

m.rotateZ( 90.0 )
Parameters:

[in] – ang Angle of rotation (degrees)

rotatealongX(Matrix4d self, vec3d dir1)
scale(scale)

Multiply the Matrix4d by a scalar value

    #==== Test Matrix4d ====//
Matrix4d m()                            # Default Constructor

m.loadXZRef()

m.scale( 10.0 )
Parameters:

[in] – scale Value to scale by

scalex(Matrix4d self, double const & scalex)
scaley(Matrix4d self, double const & scaley)
scalez(Matrix4d self, double const & scalez)
setBasis(Matrix4d self, vec3d xdir, vec3d ydir, vec3d zdir)
static setIdentity(double * m)
property thisown

The membership flag

toQuat(Matrix4d self, double & qw, double & qx, double & qy, double & qz, double & tx, double & ty, double & tz)
translatef(x, y, z)

Translate the Matrix4d along the given axes values

    #==== Test Matrix4d ====//
Matrix4d m()                            # Default Constructor

m.loadIdentity()

m.translatef( 1.0, 0.0, 0.0 )
Parameters:
  • [in] – x Translation along the X axis

  • [in] – y Translation along the Y axis

  • [in] – z Translation along the Z axis

translatev(Matrix4d self, vec3d v)
xform(Matrix4d self, vec3d _in) vec3d
xformmat(Matrix4d self, std: :vector< std::vector< vec3d, std: :allocator< vec3d > >, std: :allocator< std::vector< vec3d, std: :allocator< vec3d > > > > & _in)
xformnorm(Matrix4d self, vec3d _in) vec3d
xformnormmat(Matrix4d self, std: :vector< std::vector< vec3d, std: :allocator< vec3d > >, std: :allocator< std::vector< vec3d, std: :allocator< vec3d > > > > & _in)
xformnormvec(Matrix4d self, Vec3dVec _in)
xformvec(Matrix4d self, Vec3dVec _in)
zeroTranslations(Matrix4d self)
class openvsp.vsp.Matrix4dVec(*args)

Bases: object

Proxy of C++ std::vector< Matrix4d > class.

append(Matrix4dVec self, Matrix4d x)
assign(Matrix4dVec self, std: :vector< Matrix4d >::size_type n, Matrix4d x)
back(Matrix4dVec self) Matrix4d
begin(Matrix4dVec self) std::vector< Matrix4d >::iterator
capacity(Matrix4dVec self) std::vector< Matrix4d >::size_type
clear(Matrix4dVec self)
empty(Matrix4dVec self) bool
end(Matrix4dVec self) std::vector< Matrix4d >::iterator
erase(Matrix4dVec self, std: :vector< Matrix4d >::iterator pos) std::vector< Matrix4d >::iterator
erase(Matrix4dVec self, std: :vector< Matrix4d >::iterator first, std: :vector< Matrix4d >::iterator last) std::vector< Matrix4d >::iterator
front(Matrix4dVec self) Matrix4d
get_allocator(Matrix4dVec self) std::vector< Matrix4d >::allocator_type
insert(Matrix4dVec self, std: :vector< Matrix4d >::iterator pos, Matrix4d x) std::vector< Matrix4d >::iterator
insert(Matrix4dVec self, std: :vector< Matrix4d >::iterator pos, std: :vector< Matrix4d >::size_type n, Matrix4d x)
iterator(Matrix4dVec self) SwigPyIterator
pop(Matrix4dVec self) Matrix4d
pop_back(Matrix4dVec self)
push_back(Matrix4dVec self, Matrix4d x)
rbegin(Matrix4dVec self) std::vector< Matrix4d >::reverse_iterator
rend(Matrix4dVec self) std::vector< Matrix4d >::reverse_iterator
reserve(Matrix4dVec self, std: :vector< Matrix4d >::size_type n)
resize(Matrix4dVec self, std: :vector< Matrix4d >::size_type new_size)
resize(Matrix4dVec self, std: :vector< Matrix4d >::size_type new_size, Matrix4d x)
size(Matrix4dVec self) std::vector< Matrix4d >::size_type
swap(Matrix4dVec self, Matrix4dVec v)
property thisown

The membership flag

openvsp.vsp.ModeAddGroupSetting(mid, gid, sid)

Add a variable preset group and setting to a mode.

# Illustrating use of Modes requires substantial setup of the model including components, sets, and variable presets.
#
# Setup boiler plate.
pod1 = AddGeom( "POD", "" )
wing = AddGeom( "WING", pod1 )

SetParmVal( wing, "Trans_Attach_Flag", "Attach", ATTACH_TRANS_LMN )
SetParmVal( wing, "L_Attach_Location", "Attach", 0.35 )

SetSetName( SET_FIRST_USER, "NonLifting" )
SetSetName( SET_FIRST_USER + 1, "Lifting" )

SetSetFlag( pod1, SET_FIRST_USER, True )
SetSetFlag( wing, SET_FIRST_USER + 1, True )


gid = AddVarPresetGroup( "Tess" )

p1 = FindParm( pod1, "Tess_U", "Shape" )
AddVarPresetParm( gid, p1 )

p2 = FindParm( pod1, "Tess_W", "Shape" )
AddVarPresetParm( gid, p2 )

sid = AddVarPresetSetting( gid, "Default" )
SaveVarPresetParmVals( gid, sid )

sid1 = AddVarPresetSetting( gid, "Coarse" )
SetVarPresetParmVal( gid, sid1, p1, 3 )
SetVarPresetParmVal( gid, sid1, p2, 5 )

sid2 = AddVarPresetSetting( gid, "Fine" )
SetVarPresetParmVal( gid, sid2, p1, 35 )
SetVarPresetParmVal( gid, sid2, p2, 21 )


gid2 = AddVarPresetGroup( "Design" )

p3 = FindParm( pod1, "Length", "Design" )
AddVarPresetParm( gid2, p3 )

p4 = FindParm( pod1, "FineRatio", "Design" )
AddVarPresetParm( gid2, p4 )

sid3 = AddVarPresetSetting( gid2, "Normal" )
SaveVarPresetParmVals( gid2, sid3 )

sid4 = AddVarPresetSetting( gid2, "ShortFat" )
SetVarPresetParmVal( gid2, sid4, p3, 3.0 )
SetVarPresetParmVal( gid2, sid4, p4, 5.0 )

sid5 = AddVarPresetSetting( gid2, "LongThin" )
SetVarPresetParmVal( gid2, sid5, p3, 20.0 )
SetVarPresetParmVal( gid2, sid5, p4, 35.0 )

# End of setup boiler plate.

mid1 = CreateAndAddMode( "FatWetAreas", SET_ALL, SET_NONE )
ModeAddGroupSetting( mid1, gid, sid1 )
ModeAddGroupSetting( mid1, gid2, sid4 )

mid2 = CreateAndAddMode( "ThinAero", SET_FIRST_USER, SET_FIRST_USER + 1 )
ModeAddGroupSetting( mid2, gid, sid2 )
ModeAddGroupSetting( mid2, gid2, sid5 )

ApplyModeSettings( mid2 )
Update()

# Each Mode carries the pairings it was given, in order.
gids = ModeGetAllGroups( mid1 )
sids = ModeGetAllSettings( mid1 )

assert len( gids ) == 2 and gids[0] == gid and gids[1] == gid2, "the Mode did not record the pairings it was given"
assert len( sids ) == 2 and sids[0] == sid1 and sids[1] == sid4, "the Mode did not record the pairings it was given"
assert len( ModeGetAllGroups( mid2 ) ) == 2, "the second Mode did not record its pairings"

# ThinAero carries the Fine tessellation and the LongThin design, so applying
# it has to drive all four Parms to those stored values.
assert abs( GetParmVal( p1 ) - 35 ) < 1e-9, "the tessellation group was not applied"
assert abs( GetParmVal( p2 ) - 21 ) < 1e-9, "the tessellation group was not applied"
assert abs( GetParmVal( p3 ) - 20.0 ) < 1e-9, "the design group was not applied"
assert abs( GetParmVal( p4 ) - 35.0 ) < 1e-9, "the design group was not applied"

# The other Mode holds different values, so switching has to move them.
ApplyModeSettings( mid1 )
Update()

assert abs( GetParmVal( p1 ) - 3 ) < 1e-9, "switching Modes did not change the Parms"
assert abs( GetParmVal( p3 ) - 3.0 ) < 1e-9, "switching Modes did not change the Parms"
Parameters:
  • [in] – mid string Mode ID to add variable preset to

  • [in] – gid string Variable preset group ID to add to mode

  • [in] – sid string Variable preset setting ID to add to mode

openvsp.vsp.ModeGetAllGroups(mid)

Get all var preset group IDs in model.

# Illustrating use of Modes requires substantial setup of the model including components, sets, and variable presets.
#
# Setup boiler plate.
pod1 = AddGeom( "POD", "" )
wing = AddGeom( "WING", pod1 )

SetParmVal( wing, "Trans_Attach_Flag", "Attach", ATTACH_TRANS_LMN )
SetParmVal( wing, "L_Attach_Location", "Attach", 0.35 )

SetSetName( SET_FIRST_USER, "NonLifting" )
SetSetName( SET_FIRST_USER + 1, "Lifting" )

SetSetFlag( pod1, SET_FIRST_USER, True )
SetSetFlag( wing, SET_FIRST_USER + 1, True )


gid = AddVarPresetGroup( "Tess" )

p1 = FindParm( pod1, "Tess_U", "Shape" )
AddVarPresetParm( gid, p1 )

p2 = FindParm( pod1, "Tess_W", "Shape" )
AddVarPresetParm( gid, p2 )

sid = AddVarPresetSetting( gid, "Default" )
SaveVarPresetParmVals( gid, sid )

sid1 = AddVarPresetSetting( gid, "Coarse" )
SetVarPresetParmVal( gid, sid1, p1, 3 )
SetVarPresetParmVal( gid, sid1, p2, 5 )

sid2 = AddVarPresetSetting( gid, "Fine" )
SetVarPresetParmVal( gid, sid2, p1, 35 )
SetVarPresetParmVal( gid, sid2, p2, 21 )


gid2 = AddVarPresetGroup( "Design" )

p3 = FindParm( pod1, "Length", "Design" )
AddVarPresetParm( gid2, p3 )

p4 = FindParm( pod1, "FineRatio", "Design" )
AddVarPresetParm( gid2, p4 )

sid3 = AddVarPresetSetting( gid2, "Normal" )
SaveVarPresetParmVals( gid2, sid3 )

sid4 = AddVarPresetSetting( gid2, "ShortFat" )
SetVarPresetParmVal( gid2, sid4, p3, 3.0 )
SetVarPresetParmVal( gid2, sid4, p4, 5.0 )

sid5 = AddVarPresetSetting( gid2, "LongThin" )
SetVarPresetParmVal( gid2, sid5, p3, 20.0 )
SetVarPresetParmVal( gid2, sid5, p4, 35.0 )

# End of setup boiler plate.

mid1 = CreateAndAddMode( "FatWetAreas", SET_ALL, SET_NONE )
ModeAddGroupSetting( mid1, gid, sid1 )
ModeAddGroupSetting( mid1, gid2, sid4 )

mid2 = CreateAndAddMode( "ThinAero", SET_FIRST_USER, SET_FIRST_USER + 1 )
ModeAddGroupSetting( mid2, gid, sid2 )
ModeAddGroupSetting( mid2, gid2, sid5 )

ApplyModeSettings( mid2 )
Update()

gids = ModeGetAllGroups( mid1 )

# Two group settings were added to this Mode, in this order.
assert len( gids ) == 2, "ModeGetAllGroups did not report the groups that were added"
assert gids[0] == gid, "ModeGetAllGroups did not report the groups that were added"
assert gids[1] == gid2, "ModeGetAllGroups did not report the groups that were added"

# The groups and the settings line up one for one.
assert len( gids ) == len( ModeGetAllSettings( mid1 ) ), "ModeGetAllGroups disagrees with ModeGetAllSettings"
Parameters:

[in] – mid string Mode ID to return all group IDs

Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

array<string> array of Group IDs

openvsp.vsp.ModeGetAllSettings(mid)

Get all var preset setting IDs in model.

# Illustrating use of Modes requires substantial setup of the model including components, sets, and variable presets.
#
# Setup boiler plate.
pod1 = AddGeom( "POD", "" )
wing = AddGeom( "WING", pod1 )

SetParmVal( wing, "Trans_Attach_Flag", "Attach", ATTACH_TRANS_LMN )
SetParmVal( wing, "L_Attach_Location", "Attach", 0.35 )

SetSetName( SET_FIRST_USER, "NonLifting" )
SetSetName( SET_FIRST_USER + 1, "Lifting" )

SetSetFlag( pod1, SET_FIRST_USER, True )
SetSetFlag( wing, SET_FIRST_USER + 1, True )


gid = AddVarPresetGroup( "Tess" )

p1 = FindParm( pod1, "Tess_U", "Shape" )
AddVarPresetParm( gid, p1 )

p2 = FindParm( pod1, "Tess_W", "Shape" )
AddVarPresetParm( gid, p2 )

sid = AddVarPresetSetting( gid, "Default" )
SaveVarPresetParmVals( gid, sid )

sid1 = AddVarPresetSetting( gid, "Coarse" )
SetVarPresetParmVal( gid, sid1, p1, 3 )
SetVarPresetParmVal( gid, sid1, p2, 5 )

sid2 = AddVarPresetSetting( gid, "Fine" )
SetVarPresetParmVal( gid, sid2, p1, 35 )
SetVarPresetParmVal( gid, sid2, p2, 21 )


gid2 = AddVarPresetGroup( "Design" )

p3 = FindParm( pod1, "Length", "Design" )
AddVarPresetParm( gid2, p3 )

p4 = FindParm( pod1, "FineRatio", "Design" )
AddVarPresetParm( gid2, p4 )

sid3 = AddVarPresetSetting( gid2, "Normal" )
SaveVarPresetParmVals( gid2, sid3 )

sid4 = AddVarPresetSetting( gid2, "ShortFat" )
SetVarPresetParmVal( gid2, sid4, p3, 3.0 )
SetVarPresetParmVal( gid2, sid4, p4, 5.0 )

sid5 = AddVarPresetSetting( gid2, "LongThin" )
SetVarPresetParmVal( gid2, sid5, p3, 20.0 )
SetVarPresetParmVal( gid2, sid5, p4, 35.0 )

# End of setup boiler plate.

mid1 = CreateAndAddMode( "FatWetAreas", SET_ALL, SET_NONE )
ModeAddGroupSetting( mid1, gid, sid1 )
ModeAddGroupSetting( mid1, gid2, sid4 )

mid2 = CreateAndAddMode( "ThinAero", SET_FIRST_USER, SET_FIRST_USER + 1 )
ModeAddGroupSetting( mid2, gid, sid2 )
ModeAddGroupSetting( mid2, gid2, sid5 )

ApplyModeSettings( mid2 )
Update()

sids = ModeGetAllSettings( mid1 )

# The settings come back paired with the groups they were added under.
assert len( sids ) == 2, "ModeGetAllSettings did not report the settings that were added"
assert sids[0] == sid1, "ModeGetAllSettings did not report the settings that were added"
assert sids[1] == sid4, "ModeGetAllSettings did not report the settings that were added"
Parameters:

[in] – mid string Mode ID to return all group IDs

Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

array<string> array of Group IDs

openvsp.vsp.ModeGetGroup(mid, indx)

Get the group ID of var preset indx from a mode.

# Illustrating use of Modes requires substantial setup of the model including components, sets, and variable presets.
#
# Setup boiler plate.
pod1 = AddGeom( "POD", "" )
wing = AddGeom( "WING", pod1 )

SetParmVal( wing, "Trans_Attach_Flag", "Attach", ATTACH_TRANS_LMN )
SetParmVal( wing, "L_Attach_Location", "Attach", 0.35 )

SetSetName( SET_FIRST_USER, "NonLifting" )
SetSetName( SET_FIRST_USER + 1, "Lifting" )

SetSetFlag( pod1, SET_FIRST_USER, True )
SetSetFlag( wing, SET_FIRST_USER + 1, True )


gid = AddVarPresetGroup( "Tess" )

p1 = FindParm( pod1, "Tess_U", "Shape" )
AddVarPresetParm( gid, p1 )

p2 = FindParm( pod1, "Tess_W", "Shape" )
AddVarPresetParm( gid, p2 )

sid = AddVarPresetSetting( gid, "Default" )
SaveVarPresetParmVals( gid, sid )

sid1 = AddVarPresetSetting( gid, "Coarse" )
SetVarPresetParmVal( gid, sid1, p1, 3 )
SetVarPresetParmVal( gid, sid1, p2, 5 )

sid2 = AddVarPresetSetting( gid, "Fine" )
SetVarPresetParmVal( gid, sid2, p1, 35 )
SetVarPresetParmVal( gid, sid2, p2, 21 )


gid2 = AddVarPresetGroup( "Design" )

p3 = FindParm( pod1, "Length", "Design" )
AddVarPresetParm( gid2, p3 )

p4 = FindParm( pod1, "FineRatio", "Design" )
AddVarPresetParm( gid2, p4 )

sid3 = AddVarPresetSetting( gid2, "Normal" )
SaveVarPresetParmVals( gid2, sid3 )

sid4 = AddVarPresetSetting( gid2, "ShortFat" )
SetVarPresetParmVal( gid2, sid4, p3, 3.0 )
SetVarPresetParmVal( gid2, sid4, p4, 5.0 )

sid5 = AddVarPresetSetting( gid2, "LongThin" )
SetVarPresetParmVal( gid2, sid5, p3, 20.0 )
SetVarPresetParmVal( gid2, sid5, p4, 35.0 )

# End of setup boiler plate.

mid1 = CreateAndAddMode( "FatWetAreas", SET_ALL, SET_NONE )
ModeAddGroupSetting( mid1, gid, sid1 )
ModeAddGroupSetting( mid1, gid2, sid4 )

mid2 = CreateAndAddMode( "ThinAero", SET_FIRST_USER, SET_FIRST_USER + 1 )
ModeAddGroupSetting( mid2, gid, sid2 )
ModeAddGroupSetting( mid2, gid2, sid5 )

ApplyModeSettings( mid2 )
Update()

gid3 = ModeGetGroup( mid1, 0 )
assert len( gid3 ) > 0, "ModeGetGroup returned no id"
Parameters:
  • [in] – mid string Mode ID to return GroupID

  • [in] – indx int Index of Variable preset to return GroupID

Return type:

string

Returns:

string Group ID for Mode Variable preset indx

openvsp.vsp.ModeGetSetting(mid, indx)

Get the setting ID of var preset indx from a mode.

# Illustrating use of Modes requires substantial setup of the model including components, sets, and variable presets.
#
# Setup boiler plate.
pod1 = AddGeom( "POD", "" )
wing = AddGeom( "WING", pod1 )

SetParmVal( wing, "Trans_Attach_Flag", "Attach", ATTACH_TRANS_LMN )
SetParmVal( wing, "L_Attach_Location", "Attach", 0.35 )

SetSetName( SET_FIRST_USER, "NonLifting" )
SetSetName( SET_FIRST_USER + 1, "Lifting" )

SetSetFlag( pod1, SET_FIRST_USER, True )
SetSetFlag( wing, SET_FIRST_USER + 1, True )


gid = AddVarPresetGroup( "Tess" )

p1 = FindParm( pod1, "Tess_U", "Shape" )
AddVarPresetParm( gid, p1 )

p2 = FindParm( pod1, "Tess_W", "Shape" )
AddVarPresetParm( gid, p2 )

sid = AddVarPresetSetting( gid, "Default" )
SaveVarPresetParmVals( gid, sid )

sid1 = AddVarPresetSetting( gid, "Coarse" )
SetVarPresetParmVal( gid, sid1, p1, 3 )
SetVarPresetParmVal( gid, sid1, p2, 5 )

sid2 = AddVarPresetSetting( gid, "Fine" )
SetVarPresetParmVal( gid, sid2, p1, 35 )
SetVarPresetParmVal( gid, sid2, p2, 21 )


gid2 = AddVarPresetGroup( "Design" )

p3 = FindParm( pod1, "Length", "Design" )
AddVarPresetParm( gid2, p3 )

p4 = FindParm( pod1, "FineRatio", "Design" )
AddVarPresetParm( gid2, p4 )

sid3 = AddVarPresetSetting( gid2, "Normal" )
SaveVarPresetParmVals( gid2, sid3 )

sid4 = AddVarPresetSetting( gid2, "ShortFat" )
SetVarPresetParmVal( gid2, sid4, p3, 3.0 )
SetVarPresetParmVal( gid2, sid4, p4, 5.0 )

sid5 = AddVarPresetSetting( gid2, "LongThin" )
SetVarPresetParmVal( gid2, sid5, p3, 20.0 )
SetVarPresetParmVal( gid2, sid5, p4, 35.0 )

# End of setup boiler plate.

mid1 = CreateAndAddMode( "FatWetAreas", SET_ALL, SET_NONE )
ModeAddGroupSetting( mid1, gid, sid1 )
ModeAddGroupSetting( mid1, gid2, sid4 )

mid2 = CreateAndAddMode( "ThinAero", SET_FIRST_USER, SET_FIRST_USER + 1 )
ModeAddGroupSetting( mid2, gid, sid2 )
ModeAddGroupSetting( mid2, gid2, sid5 )

ApplyModeSettings( mid2 )
Update()

sid6 = ModeGetSetting( mid1, 0 )
assert len( sid6 ) > 0, "ModeGetSetting returned no id"
Parameters:
  • [in] – mid string Mode ID to return settingID

  • [in] – indx int Index of Variable preset to return SettingID

Return type:

string

Returns:

string Setting ID for Mode Variable preset indx

openvsp.vsp.MoveEditXSecPnt(xsec_id, indx, new_pnt)

Move an EditCurveXSec control point. The XSec points are nondimensionalized by m_Width and m_Height and defined in 2D, so the Z value of the new coordinate point will be ignored.

# Add Stack
sid = AddGeom( "STACK", "" )

# Get First (and Only) XSec Surf
xsec_surf = GetXSecSurf( sid, 0 )

ChangeXSecShape( xsec_surf, 1, XS_EDIT_CURVE )

# Identify XSec 1
xsec_1 = GetXSec( xsec_surf, 1 )

# Turn off R/L symmetry
SetParmVal( GetXSecParm( xsec_1, "SymType"), SYM_NONE )

# Get the control points for the default shape
xsec1_pts = GetEditXSecCtrlVec( xsec_1, True ) # The returned control points will not be scaled by width and height

# Identify a control point that lies on the curve and shift it in Y
move_pnt_ind = 3

new_pnt = vec3d( xsec1_pts[move_pnt_ind].x(), 2 * xsec1_pts[move_pnt_ind].y(), 0.0 )

# Move the control point
MoveEditXSecPnt( xsec_1, move_pnt_ind, new_pnt )

new_pnts = GetEditXSecCtrlVec( xsec_1, True ) # The returned control points will not be scaled by width and height

if  dist( new_pnt, new_pnts[move_pnt_ind] ) > 1e-6 :
    print( "Error: MoveEditXSecPnt" )
    assert False, "Error: MoveEditXSecPnt"
Parameters:
  • [in] – xsec_id string XSec ID

  • [in] – indx int Control point index

  • [in] – new_pnt vec3d Coordinate of the new point

openvsp.vsp.MoveFeaPolySparPt(pspar_id, index, reorder_type)

Move a point within an FEA Poly Spar using a reorder type and return the new index of the moved point.

wing_id = AddGeom( "WING" )

struct_ind = AddFeaStruct( wing_id )

pspar_id = AddFeaPart( wing_id, struct_ind, FEA_POLY_SPAR )

AddFeaPolySparPt( pspar_id )

# Move point at index 2 up one position
new_index = MoveFeaPolySparPt( pspar_id, 2, REORDER_MOVE_UP )

if new_index != 1:
    print( "Error: MoveFeaPolySparPt" )
    assert False, "Error: MoveFeaPolySparPt"

See also: REORDER_TYPE, AddFeaPolySparPt, GetFeaPolySparNumPt :param [in]: pspar_id string FEA Poly Spar part ID :param [in]: index int Index of the point to move :param [in]: reorder_type int Reorder type enum (i.e. REORDER_MOVE_UP, REORDER_MOVE_DOWN, REORDER_MOVE_TOP, REORDER_MOVE_BOTTOM) :rtype: int :return: int New index of the moved point

openvsp.vsp.MoveRoutingPt(routing_id, index, reorder_type)

Move a specified routing point within the route of a RoutingGeom.

pod1 = vsp.AddGeom('POD', '')

pod2 = vsp.AddGeom('POD', '')
ypod2 = vsp.GetParm(pod2, 'Y_Rel_Location', 'XForm')
vsp.SetParmVal(ypod2, 2.0)

routing_geom = vsp.AddGeom('ROUTING', '')

rpt0 = vsp.AddRoutingPt(routing_geom, pod1, 0)
u0 = vsp.GetParm( rpt0, 'U', 'RoutePt')
vsp.SetParmVal(u0, 0.0)

rpt1 = vsp.AddRoutingPt(routing_geom, pod2, 0)

rpt2 = vsp.AddRoutingPt(routing_geom, pod1, 0)
u2 = vsp.GetParm( rpt2, 'U', 'RoutePt')
vsp.SetParmVal(u2, 1.0)

before_ids = vsp.GetAllRoutingPtIds( routing_geom )

newindx = vsp.MoveRoutingPt( routing_geom, 1, vsp.REORDER_MOVE_DOWN )

# The point that was at index 1 is now at index 2, and its neighbour has
# taken its place.
after_ids = vsp.GetAllRoutingPtIds( routing_geom )

assert newindx == 2, "MoveRoutingPt did not move the point down"
assert len( after_ids ) == len( before_ids ), "MoveRoutingPt changed the number of points"
assert after_ids[2] == before_ids[1], "MoveRoutingPt did not swap the two points"
assert after_ids[1] == before_ids[2], "MoveRoutingPt did not swap the two points"

See also: AddRoutingPt, DelRoutingPt, REORDER_TYPE :param [in]: routing_id string RoutingGeom Geom ID :param [in]: index int Index of routing point to move :param [in]: reorder_type int Enum specifying reordering type (i.e. REORDER_MOVE_UP, REORDER_MOVE_DOWN, REORDER_MOVE_TOP, REORDER_MOVE_BOTTOM)

openvsp.vsp.NGON_MESH_GEOM_SCREEN = 5

NGon Mesh geom screen

openvsp.vsp.NGON_MESH_TYPE = 2

N-gon mesh

openvsp.vsp.NOISE_ENGLISH = 1

Assume geometry and VSPAERO inputs in english (ft lbf slug s) units, will convert to SI (m N kg s) for PSU-WOPWOP

openvsp.vsp.NOISE_FLYBY = 0

Set up fly by noise analysis in VSPAERO for PSU-WOPWOP

openvsp.vsp.NOISE_FOOTPRINT = 1

Set up footprint noise analysis in VSPAERO for PSU-WOPWOP

openvsp.vsp.NOISE_SI = 0

Assume geometry and VSPAERO inputs in SI (m N kg s) for PSU-WOPWOP

openvsp.vsp.NOISE_STEADY = 2

Set up steady state noise analysis in VSPAERO for PSU-WOPWOP

openvsp.vsp.NONE = 2

No part of the parent surface belongs to the sub-surface

openvsp.vsp.NORMAL_SURF = 0

Normal VSP surface

openvsp.vsp.NO_BOUNDARY = 0

No boundary

openvsp.vsp.NO_END_CAP = 0

No end cap

openvsp.vsp.NO_FILE_TYPE = 0

No export file type

openvsp.vsp.NO_NORMAL = 0

FEA Rib or Rib Array has no set perpendicular edge

openvsp.vsp.NO_REASON = 0

No reason determined.

openvsp.vsp.NUM_ALIGN_TYPE = 7

Number of alignment types

openvsp.vsp.NUM_ANG = 4

Number of angle choices

openvsp.vsp.NUM_ATTR_EVENT_GROUPS = 1

Number attribute event groups

openvsp.vsp.NUM_AUX_GEOM_MODES = 12

Number of auxiliary geom modes.

openvsp.vsp.NUM_BOGIE_SPACING_TYPE = 4

Number of bogie spacing control modes

openvsp.vsp.NUM_DEPTH_TYPE = 3

Number of depth types

openvsp.vsp.NUM_END_CAP_OPTIONS = 10

Number of end cap options

openvsp.vsp.NUM_FILE_CHOOSER_MODES = 2

Number of file chooser modes

openvsp.vsp.NUM_FILE_CHOOSER_TYPES = 2

Number of file chooser types

openvsp.vsp.NUM_FRAGMENT_MODES = 6

Number of auxiliary geom modes.

openvsp.vsp.NUM_GDEV_TYPES = 31

Number of GDEV types

openvsp.vsp.NUM_GEAR_CONFIGURATION_MODES = 5

Number of gear configuration choices

openvsp.vsp.NUM_GEAR_RETRACT_MODES = 2

Number of gear retract choices

openvsp.vsp.NUM_GEAR_SUSPENSION_MODES = 3

Number of gear suspension choices

openvsp.vsp.NUM_GEOM_SCREENS = 21

Number of geom screens

openvsp.vsp.NUM_INIT_EDIT_XSEC_TYPES = 3

Number of initializable edit curve types

openvsp.vsp.NUM_INTERFERENCE_TYPES = 20

Number of interference check types

openvsp.vsp.NUM_LEN_UNIT = 7

Number of length unit types

openvsp.vsp.NUM_MASS_UNIT = 6

Number of mass unit types

openvsp.vsp.NUM_MESH_REASON = 17

Number of reasons that can set the mesh local minimum edge length.

openvsp.vsp.NUM_MESH_TYPE = 3

Number of mesh types

openvsp.vsp.NUM_PCURV_TYPE = 4

Number of curve types

openvsp.vsp.NUM_POLY_SPAR_POINT_TYPES = 3

Number of poly spar point types

openvsp.vsp.NUM_PRES_UNIT = 11

Number of pressure unit choices

openvsp.vsp.NUM_PROJ_BNDY_OPTIONS = 3

Number of projected area boundary options

openvsp.vsp.NUM_PROJ_DIR_OPTIONS = 5

Number of Projected Area direction types

openvsp.vsp.NUM_PROJ_TGT_OPTIONS = 5

Number of Projected Area target types

openvsp.vsp.NUM_PROP_AZI = 3

Number of propeller blade azimuth modes

openvsp.vsp.NUM_PROP_BLADE_MODES = 2

Number of propeller blade modes

openvsp.vsp.NUM_PROP_DRIVER = 9

Number of actuator disk drivers

openvsp.vsp.NUM_PROP_PCURVE = 9

Number of propeller blade curve parameterization options

openvsp.vsp.NUM_REF_TYPES = 2

Number of wing reference types

openvsp.vsp.NUM_REORDER_TYPES = 4

Number reordering instructions

openvsp.vsp.NUM_RHO_UNIT = 7

Number of density unit options

openvsp.vsp.NUM_SCALE_TYPES = 6

Number of ways to scale 3D background image.

openvsp.vsp.NUM_SOURCE_TYPES = 5

Number of CFD Mesh source types

openvsp.vsp.NUM_SURF_TYPES = 3

Number of VSP surface types

openvsp.vsp.NUM_TEMP_UNIT = 4

Number of temperature unit choices

openvsp.vsp.NUM_TIRE_CLEARANCE_MODES = 3

Number of tire clearance modes

openvsp.vsp.NUM_TIRE_CONTACT_MODES = 4

Number of tire radius modes

openvsp.vsp.NUM_TIRE_DIM_MODES = 3

Number of tire dimension choices

openvsp.vsp.NUM_TIRE_MODES = 6

Number of tire choices

openvsp.vsp.NUM_TRIM_TYPES = 3

Number of conformal component trim types

openvsp.vsp.NUM_WHEEL_TIRE_FAILURE_MODES = 6

Number of wheel and tire failure modes

openvsp.vsp.NUM_WSECT_DRIVER = 8

Number of wing section drivers

openvsp.vsp.NUM_XSEC_DRIVER = 4

Number of XSec drivers

openvsp.vsp.NoShowSet(set_index)

Hide every Geom in a set, leaving the rest of the model as it is. See also: ShowSet, ShowOnlySet :param [in]: set_index int Set index

openvsp.vsp.NumFeaAssemblies()

Get the number of FEA Assemblies in the model

assert NumFeaAssemblies() == 0, "a new model starts with FEA Assemblies"

AddFeaAssembly()
AddFeaAssembly()

assert NumFeaAssemblies() == 2, "NumFeaAssemblies did not count both assemblies"
assert NumFeaAssemblies() == len( GetFeaAssemblyIDVec() ), "NumFeaAssemblies disagrees with GetFeaAssemblyIDVec"

See also: AddFeaAssembly, GetFeaAssemblyIDVec :rtype: int :return: int Number of FEA Assemblies

openvsp.vsp.NumFeaAssemblyConnections(assembly_id)

Get the number of connections in an FEA Assembly See also: AddFeaAssemblyConnection, DeleteFeaAssemblyConnection :param [in]: assembly_id string FEA Assembly ID :rtype: int :return: int Number of connections

openvsp.vsp.NumFeaBCs(fea_struct_id)

Return number of FEA BC’s in a structure

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

#==== Add FeaStructure to Pod ====//
struct_ind = AddFeaStruct( pod_id )

struct_id = GetFeaStructID( pod_id, struct_ind );

#==== Add BC ====//
bc_id = AddFeaBC( struct_id, FEA_BC_STRUCTURE )

nbc = NumFeaBCs( struct_id )

# The count has to match the list of IDs, and follow another add.
assert nbc == 1, "NumFeaBCs did not count the boundary condition"
assert nbc == len( GetFeaBCIDVec( struct_id ) ), "NumFeaBCs disagrees with GetFeaBCIDVec"

AddFeaBC( struct_id, FEA_BC_STRUCTURE )

assert NumFeaBCs( struct_id ) == nbc + 1, "NumFeaBCs did not follow AddFeaBC"
Parameters:

[in] – fea_struct_id string FEA Structure ID

Return type:

int

Returns:

int Number of FEA BCs

openvsp.vsp.NumFeaLayers(material_id)

Get the number of layers in an FEA laminate material See also: AddFeaLayer, GetFeaLayerIDVec :param [in]: material_id string FEA Material ID of a laminate :rtype: int :return: int Number of layers

openvsp.vsp.NumFeaParts(fea_struct_id)

Get the number of FEA Parts for a particular FEA Structure

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

#==== Add FeaStructure to Pod ====//
struct_ind = AddFeaStruct( pod_id )

struct_id = GetFeaStructID( pod_id, struct_ind )

#==== Add FEA Parts ====//
slice_id = AddFeaPart( pod_id, struct_ind, FEA_SLICE )
dome_id = AddFeaPart( pod_id, struct_ind, FEA_DOME )

if  NumFeaParts( struct_id ) != 3 : # Includes FeaSkin

    print( "Error: NumFeaParts" )
    assert False, "Error: NumFeaParts"

See also: GetFeaPartIDVec :param [in]: fea_struct_id string FEA Structure ID :rtype: int :return: int Number of FEA Parts

openvsp.vsp.NumFeaStructures() int
openvsp.vsp.NumFeaSubSurfs(fea_struct_id)

Get the number of FEA Subsurfaces for a particular FEA Structure

#==== Add Pod Geometry ====//
wing_id = AddGeom( "WING" )

#==== Add FeaStructure to Pod ====//
struct_ind = AddFeaStruct( wing_id )

struct_id = GetFeaStructID( wing_id, struct_ind )

#==== Add SubSurfaces ====//
line_array_id = AddFeaSubSurf( wing_id, struct_ind, SS_LINE_ARRAY )
rectangle_id = AddFeaSubSurf( wing_id, struct_ind, SS_RECTANGLE )

if  NumFeaSubSurfs( struct_id ) != 2 :
    print( "Error: NumFeaSubSurfs" )
    assert False, "Error: NumFeaSubSurfs"

See also: GetFeaSubSurfIDVec :param [in]: fea_struct_id string FEA Structure ID :rtype: int :return: int Number of FEA SubSurfaces

openvsp.vsp.ONE_THIRD_ROTOR_FRAGMENT = 0

One third rotor fragment

openvsp.vsp.OPEN = 0

Browse files that already exist

openvsp.vsp.OUTSIDE = 1

The exterior of the sub-surface is its surface

openvsp.vsp.PACKAGING_INTERFERENCE = 1

Interference when one body is internal to another

openvsp.vsp.PARM_BOOL_TYPE = 2

Bool Parm type (BoolParm)

openvsp.vsp.PARM_DOUBLE_TYPE = 0

Double Parm type (Parm)

openvsp.vsp.PARM_FRACTION_TYPE = 3

Fraction Parm type (FractionParm)

openvsp.vsp.PARM_INT_TYPE = 1

Integer Parm type (IntParm)

openvsp.vsp.PARM_LIMITED_INT_TYPE = 4

Limited integer Parm type (LimIntParm)

openvsp.vsp.PARM_NOTEQ_TYPE = 5

Not equal Parm type (NotEqParm)

openvsp.vsp.PARM_POWER_INT_TYPE = 6

Power integer Parm type (PowIntParm)

openvsp.vsp.PARM_REFERENCE_DATA = 9

Parm reference data type

openvsp.vsp.PATCH_COPY = 3

Copy patch type

openvsp.vsp.PATCH_HALFWAY = 4

Halfway patch type

openvsp.vsp.PATCH_LINE = 2

Line patch type

openvsp.vsp.PATCH_NONE = 0

No patch

openvsp.vsp.PATCH_NUM_TYPES = 5

Number of patch types

openvsp.vsp.PATCH_POINT = 1

Point patch type

openvsp.vsp.PCHIP = 1

Piecewise Cubic Hermite Interpolating Polynomial curve type

openvsp.vsp.PCurveConvertTo(geom_id, pcurveid, newtype)

Change the type of a propeller blade curve (P Curve) See also: PCURV_TYPE :param [in]: geom_id string Parent Geom ID :param [in]: pcurveid int P Curve index :param [in]: newtype int Curve type enum (i.e. CEDIT)

openvsp.vsp.PCurveDeletePt(geom_id, pcurveid, indx)

Delete a propeller blade curve (P Curve) point :param [in]: geom_id string Parent Geom ID :param [in]: pcurveid int P Curve index :param [in]: indx int Point index

openvsp.vsp.PCurveGetTVec(geom_id, pcurveid)

Get the parameters of a propeller blade curve (P Curve). Each parameter is a fraction of propeller radius. :param [in]: geom_id string Parent Geom ID :param [in]: pcurveid int P Curve index :rtype: std::vector< double,std::allocator< double > > :return: vector <double> Array of parameters

openvsp.vsp.PCurveGetType(geom_id, pcurveid)

Get the type of a propeller blade curve (P Curve) See also: PCURV_TYPE :param [in]: geom_id string Parent Geom ID :param [in]: pcurveid int P Curve index :rtype: int :return: int Curve type enum (i.e. CEDIT)

openvsp.vsp.PCurveGetValVec(geom_id, pcurveid)

Get the values of a propeller blade curve (P Curve). What the values represent id dependent on the curve type (i.e. twist, chord, etc.). :param [in]: geom_id string Parent Geom ID :param [in]: pcurveid int P Curve index :rtype: std::vector< double,std::allocator< double > > :return: vector <double> Array of values

openvsp.vsp.PCurveSplit(geom_id, pcurveid, tsplit)

Split a propeller blade curve (P Curve) at the specified 1D parameter :param [in]: geom_id string Parent Geom ID :param [in]: pcurveid int P Curve index :param [in]: tsplit double 1D parameter split location :rtype: int :return: int Index of new control point

openvsp.vsp.PD_UNITS_IMPERIAL = 0

Imperial unit system

openvsp.vsp.PD_UNITS_METRIC = 1

Metric unit system

openvsp.vsp.PLANAR_SLICE = 16

Calculate planar slices and area distribution

openvsp.vsp.PLANE_1PT_ANGLE_INTERFERENCE = 6

Interference roll angle between surfaces and a plane

openvsp.vsp.PLANE_2PT_ANGLE_INTERFERENCE = 4

Interference angle between surfaces and a plane

openvsp.vsp.PLANE_STATIC_DISTANCE_INTERFERENCE = 3

Interference between surfaces and a plane

openvsp.vsp.POD_GEOM_SCREEN = 0

Pod geom screen

openvsp.vsp.POINT_END_CAP = 5

Point end cap

openvsp.vsp.POINT_SOURCE = 0

Point source

openvsp.vsp.POLY_SPAR_POINT_ETA = 2

Spar points span specified in eta

openvsp.vsp.POLY_SPAR_POINT_U01 = 0

Spar points span specified in U01

openvsp.vsp.POLY_SPAR_POINT_U0N = 1

Spar points span specified in U0N

openvsp.vsp.PRES_UNIT_ATM = 10

Atmosphere

openvsp.vsp.PRES_UNIT_BA = 2

Barye

openvsp.vsp.PRES_UNIT_INCHHG = 6

Inch of mercury

openvsp.vsp.PRES_UNIT_KPA = 4

Kilopascal

openvsp.vsp.PRES_UNIT_MB = 9

Millibar

openvsp.vsp.PRES_UNIT_MMH20 = 8

Millimeter of water

openvsp.vsp.PRES_UNIT_MMHG = 7

Millimeter of mercury

openvsp.vsp.PRES_UNIT_MPA = 5

Megapascal

openvsp.vsp.PRES_UNIT_PA = 3

Pascal

openvsp.vsp.PRES_UNIT_PSF = 0

Pounds per square foot

openvsp.vsp.PRES_UNIT_PSI = 1

Pounds per square inch

openvsp.vsp.PROJ_AREA = 17

Calculate projected area

openvsp.vsp.PROP_AXIAL = 7

Axial parameterization

openvsp.vsp.PROP_AZI_BALANCED = 2

Propeller blade balance is enforced

openvsp.vsp.PROP_AZI_FREE = 1

Propeller blades are free to spaced arbitrarially

openvsp.vsp.PROP_AZI_UNIFORM = 0

Propeller blades are uniformly spaced

openvsp.vsp.PROP_BLADES = 0

Propeller Geom is defined by individual propeller blades

openvsp.vsp.PROP_BLADE_NONTRADITIONAL = 1

Non-traditional blades

openvsp.vsp.PROP_BLADE_TRADITIONAL = 0

Traditional straight blades

openvsp.vsp.PROP_BOTH = 1

Propeller Geom is defined by blades and a disk together

openvsp.vsp.PROP_CHORD = 0

Chord parameterization

openvsp.vsp.PROP_CLI = 6

Induced lift coefficient parameterization

openvsp.vsp.PROP_DISK = 2

Propeller Geom is defined by a flat circular disk

openvsp.vsp.PROP_GEOM_SCREEN = 9

Propeller geom screen

openvsp.vsp.PROP_RAKE = 2

Rake parameterization

openvsp.vsp.PROP_SKEW = 3

Skew parameterization

openvsp.vsp.PROP_SWEEP = 4

Sweep parameterization

openvsp.vsp.PROP_TANGENTIAL = 8

Tangential parameterization

openvsp.vsp.PROP_THICK = 5

Thickness parameterization

openvsp.vsp.PROP_TWIST = 1

Twist parameterization

openvsp.vsp.PT_CLOUD_GEOM_SCREEN = 8

Point cloud geom screen

openvsp.vsp.P_PROP_DRIVER = 6

Power driver

openvsp.vsp.PasteAirfoil(geom_id, index)

Paste the airfoil clipboard onto a wing section See also: CopyAirfoil, PasteXSec :param [in]: geom_id string Wing Geom ID :param [in]: index int Wing section index

openvsp.vsp.PasteAttribute(coll_id)

Paste the attribute clipboard to the specified objectID ObjectID can be any OpenVSP entity that contains a AttributeCollection or simply the attributeCollectionID Returns a vector of pasted attributes IDs, if any

##==== Attribute: PasteAttribute  =====##

VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
AttrName = 'Example_String_Attr'
StringValue = 'Example_String_Attr_DataVal'
AttrID = AddAttributeString( CollID, AttrName, StringValue )
CutAttribute( AttrID )

NewCollID = GetChildCollection( "_AttrWMGroup" )
NewAttrIDs = PasteAttribute( NewCollID )

MatchIDs = NewAttrIDs[0] == AttrID
Attr_Cut_Check = AttrID not in FindAttributesInCollection( CollID )
Attr_Paste_Check = AttrID in FindAttributesInCollection( NewCollID )
if MatchIDs and Attr_Cut_Check and Attr_Paste_Check:
    print("Successfully pasted Attribute")
else:
    print("PasteAttribute Error!")
    assert False, "PasteAttribute Error!"
Parameters:

[in] – coll_id string ID of destination for pasting attribute into

openvsp.vsp.PasteGeomClipboard(*args)

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 ====//
pid1 = AddGeom( "POD", "" )
pid2 = AddGeom( "POD", "" )

CutGeomToClipboard( pid1 )

PasteGeomClipboard( pid2 ) # Paste Pod 1 as child of Pod 2

geom_ids = FindGeoms()

if  len(geom_ids) != 2 :
    print( "---> Error: API Cut/Paste Geom  " )
    assert False, "---> Error: API Cut/Paste Geom"
Parameters:

[in] – parent string Parent Geom ID

Return type:

std::vector< std::string,std::allocator< std::string > >

Returns:

vector<string> Vector of pasted Geom IDs

openvsp.vsp.PasteXSec(geom_id, index)

Paste the cross-section currently held in memory to the specified geometry

# Add Stack
sid = AddGeom( "STACK", "" )

xsec_surf = GetXSecSurf( sid, 0 )

# Give XSec 1 a shape that XSec 3 does not have.
ChangeXSecShape( xsec_surf, 1, XS_ROUNDED_RECTANGLE )

Update()

num_start = GetNumXSec( xsec_surf )

# Copy XSec To Clipboard
CopyXSec( sid, 1 )

# Paste To XSec 3
PasteXSec( sid, 3 )

Update()

# Pasting replaces the target section, so the count is unchanged and XSec 3
# now carries the shape that was copied.
assert GetNumXSec( xsec_surf ) == num_start, "PasteXSec changed the number of sections"
assert GetXSecShape( GetXSec( xsec_surf, 3 ) ) == XS_ROUNDED_RECTANGLE, "PasteXSec did not paste the copied section"

# The section that was copied has to be left alone.
assert GetXSecShape( GetXSec( xsec_surf, 1 ) ) == XS_ROUNDED_RECTANGLE, "CopyXSec disturbed the section it copied"

See also: CutXSec, CopyXSec :param [in]: geom_id string Geom ID :param [in]: index int XSec index

openvsp.vsp.PasteXSecCurve(geom_id, index)

Paste the XSecCurve clipboard onto a cross section

# A body of revolution holds one XSecCurve, so its index is ignored.
sid = AddGeom( "STACK", "" )

xsec_surf = GetXSecSurf( sid, 0 )

ChangeXSecShape( xsec_surf, 1, XS_ROUNDED_RECTANGLE )

Update()

CopyXSecCurve( sid, 1 )

bor_id = AddGeom( "BODYOFREVOLUTION", "" )

PasteXSecCurve( bor_id, 0 )

Update()

assert GetBORXSecShape( bor_id ) == XS_ROUNDED_RECTANGLE, "the XSecCurve did not paste onto the body of revolution"

# An index past the end has to be rejected.
err_mgr = ErrorMgrSingleton.getInstance()

PasteXSecCurve( sid, 100 )

assert err_mgr.GetNumTotalErrors() > 0, "PasteXSecCurve accepted an index past the end"

while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: CopyXSecCurve, PasteXSec, PasteAirfoil :param [in]: geom_id string Geom ID :param [in]: index int XSec index, ignored for a body of revolution

openvsp.vsp.PointInPolygon(vec2d R, std: :vector< vec2d, std: :allocator< vec2d > > const & pnts) bool
openvsp.vsp.PopupMsg(msg)

Cause OpenVSP to display a popup message.

StartGUI()

PopupMsg( "This is a popup message." )
Parameters:

[in] – msg string Message to display.

openvsp.vsp.PrintAnalysisDocs(analysis_name)

Print to stdout all current input documentation for a specific analysis

#==== Analysis: VSPAero Compute Geometry ====//
analysis_name = "VSPAEROComputeGeometry"

# list inputs, type, and documentation
PrintAnalysisDocs( analysis_name )

# The analysis itself has to carry documentation to print.
assert len( GetAnalysisDoc( analysis_name ) ) > 0, "the analysis carries no documentation"

# Printing an analysis that does not exist has to be rejected.  The error
# queue is reached through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

PrintAnalysisDocs( "NoSuchAnalysis" )

assert err_mgr.GetNumTotalErrors() > 0, "PrintAnalysisDocs accepted an unknown analysis"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()
Parameters:

[in] – analysis_name string Name of analysis

openvsp.vsp.PrintAnalysisInputs(analysis_name)

Print to stdout all current input values for a specific analysis

#==== Analysis: VSPAero Compute Geometry ====//
analysis_name = "VSPAEROComputeGeometry"

# list inputs, type, and current values
PrintAnalysisInputs( analysis_name )

# There has to be something to list.
inp_array = GetAnalysisInputNames( analysis_name )

assert len( inp_array ) > 0, "the analysis reports no inputs to print"

# Printing an analysis that does not exist has to be rejected.  The error
# queue is reached through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

PrintAnalysisInputs( "NoSuchAnalysis" )

assert err_mgr.GetNumTotalErrors() > 0, "PrintAnalysisInputs accepted an unknown analysis"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()
Parameters:

[in] – analysis_name string Name of analysis

openvsp.vsp.PrintResults(results_id)

Print a result’s name value pairs to stdout

# Add Pod Geom
pid = AddGeom( "POD" )

analysis_name = "VSPAEROComputeGeometry"

rid = ExecAnalysis( analysis_name )

# Get & Display Results
PrintResults( rid )

# There has to be something to display.
assert len( GetAllDataNames( rid ) ) > 0, "the result carries no data to print"

# Every entry that gets printed has to have a value behind it.
data_names = GetAllDataNames( rid )

for data_name in data_names:
    assert GetNumData( rid, data_name ) >= 1, data_name + " has no data to print"
Parameters:

[in] – results_id string Result ID

openvsp.vsp.PrintResultsDocs(results_id)

Print a result’s names and documentation to stdout

# Add Pod Geom
pid = AddGeom( "POD" )

analysis_name = "VSPAEROComputeGeometry"

rid = ExecAnalysis( analysis_name )

# Get & Display Results Docs
PrintResultsDocs( rid )

# There has to be documentation to display.
assert len( GetResultsSetDoc( rid ) ) > 0, "the result carries no documentation to print"

# Every entry that gets printed has to carry documentation of its own.
data_names = GetAllDataNames( rid )

for data_name in data_names:
    assert len( GetResultsEntryDoc( rid, data_name ) ) > 0, data_name + " carries no documentation"
Parameters:

[in] – results_id string Result ID

openvsp.vsp.ProjPnt01(geom_id, surf_indx, pt)

Determine the nearest surface coordinate for an input 3D coordinate point and calculate the distance between the 3D point and the closest point of the surface.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

u = 0.12345
w = 0.67890

pnt = CompPnt01( geom_id, surf_indx, u, w )

norm = CompNorm01( geom_id, surf_indx, u, w )


# Offset point from surface
pnt.set_xyz( pnt.x() + norm.x(), pnt.y() + norm.y(), pnt.z() + norm.z() )

d, uout, wout = ProjPnt01( geom_id, surf_indx, pnt )

# pnt sits one unit off the surface along its own normal, so the
# projection comes back to where it started at a distance of one.
assert abs( d - 1.0 ) < 1e-6, "ProjPnt01 distance"
assert abs( uout - u ) < 1e-6 and abs( wout - w ) < 1e-6, "ProjPnt01 u, w"

print( f"Dist {d} u {uout} w {wout}" )

See also: ProjPnt01Guess, ProjPnt01I :param [in]: geom_id string Parent Geom ID :param [in]: surf_indx int Main surface index from the parent Geom :param [in]: pt vec3d Input 3D coordinate point :param [out]: u_out double Output closest U (0 - 1) surface coordinate :param [out]: w_out double Output closest W (0 - 1) surface coordinate :rtype: float :return: double Distance between the 3D point and the closest point of the surface

openvsp.vsp.ProjPnt01Guess(geom_id, surf_indx, pt, u0, w0)

Determine the nearest surface coordinate for an input 3D coordinate point and calculate the distance between the 3D point and the closest point of the surface. This function takes an input surface coordinate guess for, offering a potential decrease in computation time compared to ProjPnt01.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

u = 0.12345
w = 0.67890

d = 0

pnt = CompPnt01( geom_id, surf_indx, u, w )

norm = CompNorm01( geom_id, surf_indx, u, w )


# Offset point from surface
pnt.set_xyz( pnt.x() + norm.x(), pnt.y() + norm.y(), pnt.z() + norm.z() )

d, uout, wout = ProjPnt01Guess( geom_id, surf_indx, pnt, u + 0.1, w + 0.1 )

# pnt sits one unit off the surface along its own normal, so the
# projection comes back to where it started at a distance of one.
assert abs( d - 1.0 ) < 1e-6, "ProjPnt01Guess distance"
assert abs( uout - u ) < 1e-6 and abs( wout - w ) < 1e-6, "ProjPnt01Guess u, w"

print( f"Dist {d} u {uout} w {wout}" )

See also: ProjPnt01, ProjPnt01I :param [in]: geom_id string Parent Geom ID :param [in]: surf_indx int Main surface index from the parent Geom :param [in]: pt vec3d Input 3D coordinate point :param [in]: u0 double Input U (0 - 1) surface coordinate guess :param [in]: w0 double Input W (0 - 1) surface coordinate guess :param [out]: u_out double Output closest U (0 - 1) surface coordinate :param [out]: w_out double Output closest W (0 - 1) surface coordinate :rtype: float :return: double Distance between the 3D point and the closest point of the surface

openvsp.vsp.ProjPnt01I(geom_id, pt)

Determine the nearest surface coordinate and corresponding parent Geom main surface index for an input 3D coordinate point. Return the distance between the closest point and the input.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

u = 0.12345
w = 0.67890

d = 0

pnt = CompPnt01( geom_id, surf_indx, u, w )

norm = CompNorm01( geom_id, surf_indx, u, w )



# Offset point from surface
pnt.set_xyz( pnt.x() + norm.x(), pnt.y() + norm.y(), pnt.z() + norm.z() )

d, surf_indx_out, uout, wout = ProjPnt01I( geom_id, pnt )

# pnt sits one unit off the surface along its own normal, so the
# projection comes back to where it started at a distance of one.
assert abs( d - 1.0 ) < 1e-6, "ProjPnt01I distance"
assert abs( uout - u ) < 1e-6 and abs( wout - w ) < 1e-6, "ProjPnt01I u, w"

print( f"Dist {d} u {uout} w {wout} surf_index {surf_indx_out}" )

See also: ProjPnt01, ProjPnt01Guess :param [in]: geom_id string Parent Geom ID :param [in]: pt vec3d Input 3D coordinate point :param [out]: surf_indx_out int Output main surface index from the parent Geom :param [out]: u_out double Output closest U (0 - 1) surface coordinat :param [out]: w_out double Output closest W (0 - 1) surface coordinat :rtype: float :return: double Distance between the 3D point and the closest point of the surface

openvsp.vsp.ProjVecPnt01(geom_id, surf_indx, pts)

Determine the nearest surface coordinates for an input array of 3D coordinate points and calculate the distance between each 3D point and the closest point of the surface.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

n = 5

uvec = [0]*n
wvec = [0]*n

for i in range(n):

    uvec[i] = (i+1)*1.0/(n+1)

    wvec[i] = (n-i)*1.0/(n+1)

ptvec = CompVecPnt01( geom_id, 0, uvec, wvec )

normvec = CompVecNorm01( geom_id, 0, uvec, wvec )

for i in range(n):

    ptvec[i].set_xyz( ptvec[i].x() + normvec[i].x(), ptvec[i].y() + normvec[i].y(), ptvec[i].z() + normvec[i].z() )

uoutv, woutv, doutv = ProjVecPnt01( geom_id, 0, ptvec )

See also: ProjVecPnt01Guess :param [in]: geom_id string Parent Geom ID :param [in]: surf_indx int Main surface index from the parent Geom :param [in]: pts vector<vec3d> Input vector of 3D coordinate points :param [out]: u_out_vec vector<double> Output vector of the closest U (0 - 1) surface coordinate for each 3D input point :param [out]: w_out_vec vector<double> Output vector of the closest W (0 - 1) surface coordinate for each 3D input point :param [out]: d_out_vec vector<double> Output vector of distances for each 3D point and the closest point of the surface

openvsp.vsp.ProjVecPnt01Guess(geom_id, surf_indx, pts, u0s, w0s)

Determine the nearest surface coordinates for an input array of 3D coordinate points and calculate the distance between each 3D point and the closest point of the surface. This function takes an input array of surface coordinate guesses for each 3D coordinate, offering a potential decrease in computation time compared to ProjVecPnt01.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

n = 5

uvec = [0]*n
wvec = [0]*n

for i in range(n):

    uvec[i] = (i+1)*1.0/(n+1)

    wvec[i] = (n-i)*1.0/(n+1)

ptvec = CompVecPnt01( geom_id, 0, uvec, wvec )

normvec = CompVecNorm01( geom_id, 0, uvec, wvec )

for i in range(n):

    ptvec[i].set_xyz( ptvec[i].x() + normvec[i].x(), ptvec[i].y() + normvec[i].y(), ptvec[i].z() + normvec[i].z() )

u0v = [0]*n
w0v = [0]*n

for i in range(n):

    u0v[i] = uvec[i] + 0.01234

    w0v[i] = wvec[i] - 0.05678

uoutv, woutv, doutv = ProjVecPnt01Guess( geom_id, 0, ptvec, u0v,  w0v )

# Each point was pushed one unit along its own normal, so each projects back
# to where it came from at a distance of one.  Starting from a guess must not
# change that.
uv_ng, wv_ng, dv_ng = ProjVecPnt01( geom_id, 0, ptvec )

for i in range(n):
    assert abs( doutv[i] - 1.0 ) < 1e-6, "ProjVecPnt01Guess did not recover point " + str( i )
    assert abs( uoutv[i] - uvec[i] ) < 1e-6, "ProjVecPnt01Guess did not recover point " + str( i )
    assert abs( woutv[i] - wvec[i] ) < 1e-6, "ProjVecPnt01Guess did not recover point " + str( i )

    assert abs( uoutv[i] - uv_ng[i] ) < 1e-6, "the guess changed the answer at " + str( i )
    assert abs( woutv[i] - wv_ng[i] ) < 1e-6, "the guess changed the answer at " + str( i )
    assert abs( doutv[i] - dv_ng[i] ) < 1e-6, "the guess changed the answer at " + str( i )

See also: ProjVecPnt01, :param [in]: geom_id string Parent Geom ID :param [in]: surf_indx int Main surface index from the parent Geom :param [in]: pts vector<vec3d> Input vector of 3D coordinate points :param [in]: u0s vector<double> Input vector of U (0 - 1) surface coordinate guesses :param [in]: w0s vector<double> Input vector of W (0 - 1) surface coordinate guesses :param [out]: u_out_vec vector<double> Output vector of the closest U (0 - 1) surface coordinate for each 3D input point :param [out]: w_out_vec vector<double> Output vector of the closest W (0 - 1) surface coordinate for each 3D input point :param [out]: d_out_vec vector<double> Output array of distances for each 3D point and the closest point of the surface

openvsp.vsp.ProjectPtCloudPts(geom_id, target_geom_id, surf_index, dir_index)

Project the points of a point cloud onto a surface of another Geom, the way the Project button on the Point Cloud screen does. Each point is moved along the chosen axis until it lands on the target surface; a point that does not hit the surface is left where it is.

pid = AddGeom( "POD" )

# Mesh the Pod, then make a point cloud out of the mesh vertices.
mesh_id = ExportFile( "ProjectExample.msh", SET_ALL, EXPORT_GMSH )

cloud_id = CreatePtCloudGeom( mesh_id )

# Lift the cloud above the Pod so the points have somewhere to fall from.
SetParmVal( cloud_id, "Z_Rel_Location", "XForm", 5.0 )

Update()

before = GetPtCloudPnts( cloud_id )

ProjectPtCloudPts( cloud_id, pid, 0, Z_DIR )

Update()

after = GetPtCloudPnts( cloud_id )

# Projection moves points; it never adds or removes any.
assert len( after ) == len( before ), "ProjectPtCloudPts changed the point count"

See also: CreatePtCloudGeom, CreateConvexHull :param [in]: geom_id string Point cloud Geom ID :param [in]: target_geom_id string Geom ID of the Geom to project onto :param [in]: surf_index int Surface index on the target Geom :param [in]: dir_index int Direction to project along, X_DIR, Y_DIR or Z_DIR (see DIR_INDEX)

openvsp.vsp.PromoteBORCSTLower(bor_id)

Promote the CST for the lower airfoil surface of a BOR. The XSecCurve must be of type XS_CST_AIRFOIL See also: GetLowerCSTDegree :param [in]: bor_id string Body of revolution Geom ID

openvsp.vsp.PromoteBORCSTUpper(bor_id)

Promote the CST for the upper airfoil surface of a BOR. The XSecCurve must be of type XS_CST_AIRFOIL See also: GetUpperCSTDegree :param [in]: bor_id string Body of revolution Geom ID

openvsp.vsp.PromoteCSTLower(xsec_id)

Promote the CST for the lower airfoil surface. The XSec must be of type XS_CST_AIRFOIL See also: GetLowerCSTDegree :param [in]: xsec_id string XSec ID

openvsp.vsp.PromoteCSTUpper(xsec_id)

Promote the CST for the upper airfoil surface. The XSec must be of type XS_CST_AIRFOIL See also: GetUpperCSTDegree :param [in]: xsec_id string XSec ID

openvsp.vsp.PtInTri(vec3d v0, vec3d v1, vec3d v2, vec3d p) bool
openvsp.vsp.QUAD_MESH_TYPE = 1

Quadrilateral mesh

openvsp.vsp.Q_PROP_DRIVER = 8

Torque driver

openvsp.vsp.REASON = 1

Color mesh by local edge length reason

openvsp.vsp.REL = 1

Relative position

openvsp.vsp.REORDER_MOVE_BOTTOM = 3

Move to bottom

openvsp.vsp.REORDER_MOVE_DOWN = 1

Move down one position

openvsp.vsp.REORDER_MOVE_TOP = 2

Move to top

openvsp.vsp.REORDER_MOVE_UP = 0

Move up one position

openvsp.vsp.RHO_UNIT_G_CM3 = 1

Gram per cubic centimeter

openvsp.vsp.RHO_UNIT_KG_M3 = 2

Kilogram per cubic meter

openvsp.vsp.RHO_UNIT_LBFSEC2_IN4 = 5

Pound-force-second squared per inch to the fourth

openvsp.vsp.RHO_UNIT_LBM_FT3 = 4

Pound-mass per cubic foot

openvsp.vsp.RHO_UNIT_LBM_IN3 = 6

Pound-mass per cubic inch

openvsp.vsp.RHO_UNIT_SLUG_FT3 = 0

Slug per cubic foot

openvsp.vsp.RHO_UNIT_TONNE_MM3 = 3

Tonne per cubic millimeter

openvsp.vsp.RISK_ANGLE = 14

Calculate risk angle for thrown debris

openvsp.vsp.ROOTC_WSECT_DRIVER = 5

Root chord driver

openvsp.vsp.ROT_0 = 0

No rotation

openvsp.vsp.ROT_180 = 2

180 degree rotation

openvsp.vsp.ROT_270 = 3

270 degree rotation

openvsp.vsp.ROT_90 = 1

90 degree rotation

openvsp.vsp.ROUND_END_CAP = 2

Round end cap

openvsp.vsp.ROUND_EXT_END_CAP_BOTH = 9

Extended round end cap, extend both

openvsp.vsp.ROUND_EXT_END_CAP_LE = 7

Extended round end cap, extend LE

openvsp.vsp.ROUND_EXT_END_CAP_NONE = 6

Extended round end cap, but not extended

openvsp.vsp.ROUND_EXT_END_CAP_TE = 8

Extended round end cap, extend TE

openvsp.vsp.ROUTE_PT_COMP = 0

Routing point relative to parent body axes

openvsp.vsp.ROUTE_PT_DELTA_COMP = 1

Routing point offset in parent body frame

openvsp.vsp.ROUTE_PT_DELTA_NUM_TYPES = 3

Number of routing point offset coordinate types

openvsp.vsp.ROUTE_PT_DELTA_UVN = 2

Routing point offset in parent surface coordinate frame

openvsp.vsp.ROUTE_PT_DELTA_XYZ = 0

Routing point ofset in global axes

openvsp.vsp.ROUTE_PT_EtaMN = 4

Routing point relative to wing parent uniform eta volume coordinate frame

openvsp.vsp.ROUTE_PT_LMN = 3

Routing point relative to parent uniform volume coordinate frame

openvsp.vsp.ROUTE_PT_NUM_TYPES = 5

Number of routing point coordinate types

openvsp.vsp.ROUTE_PT_RST = 2

Routing point relative to parent per-section volume coordinate frame

openvsp.vsp.ROUTE_PT_UV = 1

Routing point relative to parent surface coordinate frame

openvsp.vsp.ROUTING_GEOM_SCREEN = 17

Routing geom screen

openvsp.vsp.RPM_PROP_DRIVER = 0

RPM driver

openvsp.vsp.ReadAdvLinkCodeFile(index, file_name)

Read the code of an advanced link in from a text file, the way the File Read button on the Advanced Link screen does. The link is rebuilt from the new code, so any variable the file refers to must already have been declared as an input or an output.

pod = AddGeom( "POD", "" )
length = FindParm( pod, "Length", "Design" )
x_pos = GetParm( pod, "X_Rel_Location", "XForm" )

AddAdvLink( "ExampleLink" )
indx = GetLinkIndex( "ExampleLink" )
AddAdvLinkInput( indx, length, "len" )
AddAdvLinkOutput( indx, x_pos, "x" )

SetAdvLinkCode( indx, "x = 10.0 - len;" )
WriteAdvLinkCodeFile( indx, "ExampleLink.vspscript" )

# A second link can pick up the same code, so long as it declares len and x.
AddAdvLink( "SecondLink" )
indx2 = GetLinkIndex( "SecondLink" )
AddAdvLinkInput( indx2, length, "len" )
AddAdvLinkOutput( indx2, GetParm( pod, "Y_Rel_Location", "XForm" ), "x" )

ReadAdvLinkCodeFile( indx2, "ExampleLink.vspscript" )

assert GetAdvLinkCode( indx2 ) == GetAdvLinkCode( indx ), "ReadAdvLinkCodeFile did not load the code"

See also: WriteAdvLinkCodeFile, SetAdvLinkCode :param [in]: index int Index for advanced link :param [in]: file_name string Name of the file to read

openvsp.vsp.ReadApplyDESFile(file_name)

Read in and apply a design file (*.des) to the current OpenVSP project :param [in]: file_name string *.des input file

openvsp.vsp.ReadApplyXDDMFile(file_name)

Read in and apply a Cart3D XDDM file (*.xddm) to the current OpenVSP project :param [in]: file_name string *.xddm input file

openvsp.vsp.ReadAuxiliaryGeomCCEFile(geom_id, file_name)

Read a composite clearance envelope (*.cce) file into an AuxiliaryGeom. The file holds the envelope profile as a list of X and Z coordinate pairs, one pair per line, which the AUX_GEOM_THREE_PT_CCE mode sweeps around the aircraft.

gear_id = AddGeom( "GEAR", "" )

CreateAndAddBogie( gear_id )

aux_id = AddGeom( "AUXILIARY", gear_id )

SetParmVal( aux_id, "AuxiliaryGeomType", "Design", AUX_GEOM_THREE_PT_CCE )

ReadAuxiliaryGeomCCEFile( aux_id, "CCE/SD-24L.cce" )

Update()
Parameters:
  • [in] – geom_id string AuxiliaryGeom Geom ID

  • [in] – file_name string Name of the *.cce file to read

openvsp.vsp.ReadBORFileAirfoil(bor_id, file_name)

Read in shape from airfoil file and set to the specified BOR XSecCurve. The XSecCurve must be of type XS_FILE_AIRFOIL. Airfoil files may be in Lednicer or Selig format with *.af or *.dat extensions.

# Add Body of Recolution
bor_id = AddGeom( "BODYOFREVOLUTION", "" )

ChangeBORXSecShape( bor_id, XS_FILE_AIRFOIL )

ReadBORFileAirfoil( bor_id, "airfoil/N0012_VSP.af" )

up_array = GetBORAirfoilUpperPnts( bor_id )
low_array = GetBORAirfoilLowerPnts( bor_id )

assert len( up_array ) > 0, "ReadBORFileAirfoil did not read matching surfaces"
assert len( up_array ) == len( low_array ), "ReadBORFileAirfoil did not read matching surfaces"

# The points run from the leading edge to the trailing edge on a unit chord,
# and a NACA 0012 is symmetric top to bottom.
assert abs( up_array[0].x() ) < 1e-6, "ReadBORFileAirfoil did not normalize the chord"
assert abs( up_array[-1].x() - 1.0 ) < 1e-6, "ReadBORFileAirfoil did not normalize the chord"

for i in range( len( up_array ) ):
    assert abs( low_array[i].y() + up_array[i].y() ) < 1e-6, "ReadBORFileAirfoil did not read a symmetric section"

max_up = max( [ p.y() for p in up_array ] )

assert abs( 2.0 * max_up - 0.12 ) < 1e-3, "ReadBORFileAirfoil did not read a twelve percent section"
Parameters:
  • [in] – bor_id string Body of revolution Geom ID

  • [in] – file_name string Airfoil XSec file name

openvsp.vsp.ReadBORFileXSec(bor_id, file_name)

Set the coordinate points for a specific BOR. The BOR XSecCurve must be of type XS_FILE_FUSE.

# Add Body of Recolution
bor_id = AddGeom( "BODYOFREVOLUTION", "" )

ChangeBORXSecShape( bor_id, XS_FILE_FUSE )

vec_array = ReadBORFileXSec( bor_id, "TestXSec.fxs" )

Update()

# The file holds a closed curve, and the section it produced is the one the
# body is now built on.
assert len( vec_array ) >= 3, "ReadBORFileXSec returned too few points"
assert dist( vec_array[0], vec_array[-1] ) < 1e-8, "ReadBORFileXSec returned an open curve"
assert GetBORXSecShape( bor_id ) == XS_FILE_FUSE, "ReadBORFileXSec changed the section type"

# The section curve closes on itself.
assert dist( ComputeBORXSecPnt( bor_id, 0.0 ), ComputeBORXSecPnt( bor_id, 1.0 ) ) < 1e-6, "the BOR section does not close"
Parameters:
  • [in] – bor_id string Body of revolution Geom ID

  • [in] – file_name string Fuselage XSec file name

Return type:

std::vector< vec3d,std::allocator< vec3d > >

Returns:

vector<vec3d> Array of coordinate points read from the file and set to the XSec

openvsp.vsp.ReadFileAirfoil(xsec_id, file_name)

Read in XSec shape from airfoil file and set to the specified XSec. The XSec must be of type XS_FILE_AIRFOIL. Airfoil files may be in Lednicer or Selig format with *.af or *.dat extensions.

# Add Fuselage Geom
fuseid = AddGeom( "FUSELAGE", "" )

xsec_surf = GetXSecSurf( fuseid, 0 )

ChangeXSecShape( xsec_surf, 1, XS_FILE_AIRFOIL )

xsec = GetXSec( xsec_surf, 1 )

ReadFileAirfoil( xsec, "airfoil/N0012_VSP.af" )

up_array = GetAirfoilUpperPnts( xsec )
low_array = GetAirfoilLowerPnts( xsec )

assert len( up_array ) > 0, "ReadFileAirfoil did not read matching surfaces"
assert len( up_array ) == len( low_array ), "ReadFileAirfoil did not read matching surfaces"

# The points run from the leading edge to the trailing edge on a unit chord.
assert abs( up_array[0].x() ) < 1e-6, "ReadFileAirfoil did not normalize the chord"
assert abs( up_array[-1].x() - 1.0 ) < 1e-6, "ReadFileAirfoil did not normalize the chord"
assert abs( low_array[0].x() ) < 1e-6, "ReadFileAirfoil did not normalize the chord"

# A NACA 0012 is symmetric, so the lower surface mirrors the upper, and the
# section is twelve percent thick.
for i in range( len( up_array ) ):
    assert abs( low_array[i].y() + up_array[i].y() ) < 1e-6, "ReadFileAirfoil did not read a symmetric section"

max_up = max( [ p.y() for p in up_array ] )

assert abs( 2.0 * max_up - 0.12 ) < 1e-3, "ReadFileAirfoil did not read a twelve percent section"
Parameters:
  • [in] – xsec_id string XSec ID

  • [in] – file_name string Airfoil XSec file name

openvsp.vsp.ReadFileXSec(xsec_id, file_name)

Read in XSec shape from fuselage (*.fsx) file and set to the specified XSec. The XSec must be of type XS_FILE_FUSE.

# Add Fuselage Geom
fuseid = AddGeom( "FUSELAGE", "" )

xsec_surf = GetXSecSurf( fuseid, 0 )

ChangeXSecShape( xsec_surf, 2, XS_FILE_FUSE )

xsec = GetXSec( xsec_surf, 2 )

vec_array = ReadFileXSec(xsec, "TestXSec.fxs")

Update()

# The file holds a closed diamond, so the first and last points coincide and
# the section takes its size from their extents.
assert len( vec_array ) >= 3, "ReadFileXSec returned too few points"
assert dist( vec_array[0], vec_array[-1] ) < 1e-8, "ReadFileXSec returned an open curve"

# The shape is normalized on the way in and then scaled by the section's own
# width and height, so the curve has to fit inside them.
w = GetXSecWidth( xsec )
h = GetXSecHeight( xsec )

for i in range( 11 ):
    p = ComputeXSecPnt( xsec, i * 0.1 )

    assert abs( p.y() ) <= 0.5 * w + 1e-6, "ReadFileXSec left the curve outside the section"
    assert abs( p.z() ) <= 0.5 * h + 1e-6, "ReadFileXSec left the curve outside the section"
Parameters:
  • [in] – xsec_id string XSec ID

  • [in] – file_name string Fuselage XSec file name

Return type:

std::vector< vec3d,std::allocator< vec3d > >

Returns:

vector<vec3d> Array of coordinate points read from the file and set to the XSec

openvsp.vsp.ReadVSPFile(file_name)

Load an OpenVSP project from a VSP3 file

fid = AddGeom( "FUSELAGE", "" )             # Add Fuselage

fname = "example_fuse.vsp3"

SetVSP3FileName( fname )

# A relative name is resolved against the working directory, so ask for the
# resolved name rather than assuming it comes back verbatim.
full_name = GetVSPFileName()

Update()

#==== Save Vehicle to File ====//
print( "\tSaving vehicle file to: ", False )

print( fname )

WriteVSPFile( GetVSPFileName(), SET_ALL )

#==== Reset Geometry ====//
print( "--->Resetting VSP model to blank slate\n" )

ClearVSPModel()

assert len( FindGeoms() ) == 0, "ClearVSPModel left Geoms behind"

ReadVSPFile( fname )

# The Fuselage has to come back, and come back the same shape.
geoms = FindGeoms()

assert len( geoms ) == 1, "ReadVSPFile did not restore the model"
assert GetGeomTypeName( geoms[0] ) == "Fuselage", "ReadVSPFile restored the wrong Geom type"
assert GetVSPFileName() == full_name, "ReadVSPFile did not set the project file name"
Parameters:

[in] – file_name string *.vsp3 file name

openvsp.vsp.RegisterCFDMeshAnalyses()
openvsp.vsp.RemoveAllFromVSPAEROControlSurfaceGroup(CSGroupIndex)

Remove all used control surfaces from the control surface group at the specified index

wid = AddGeom( "WING", "" )                             # Add Wing

aileron_id = AddSubSurf( wid, SS_CONTROL )                      # Add Control Surface Sub-Surface

group_index = CreateVSPAEROControlSurfaceGroup() # Empty control surface group

AddAllToVSPAEROControlSurfaceGroup( group_index )

num_active = len( GetActiveCSNameVec( group_index ) )

assert num_active >= 1, "nothing was added to the group to remove"

RemoveAllFromVSPAEROControlSurfaceGroup( group_index ) # Empty control surface group

# Everything that was active goes back to being available.
assert len( GetActiveCSNameVec( group_index ) ) == 0, "RemoveAllFromVSPAEROControlSurfaceGroup left surfaces in the group"
assert len( GetAvailableCSNameVec( group_index ) ) == num_active, "the removed surfaces did not become available again"
Parameters:

[in] – CSGroupIndex int Index of the control surface group

openvsp.vsp.RemoveAllGroupSettings(mid)

Remove all variable preset groups and settings from mode.

# Illustrating use of Modes requires substantial setup of the model including components, sets, and variable presets.
#
# Setup boiler plate.
pod1 = AddGeom( "POD", "" )
wing = AddGeom( "WING", pod1 )

SetParmVal( wing, "Trans_Attach_Flag", "Attach", ATTACH_TRANS_LMN )
SetParmVal( wing, "L_Attach_Location", "Attach", 0.35 )

SetSetName( SET_FIRST_USER, "NonLifting" )
SetSetName( SET_FIRST_USER + 1, "Lifting" )

SetSetFlag( pod1, SET_FIRST_USER, True )
SetSetFlag( wing, SET_FIRST_USER + 1, True )


gid = AddVarPresetGroup( "Tess" )

p1 = FindParm( pod1, "Tess_U", "Shape" )
AddVarPresetParm( gid, p1 )

p2 = FindParm( pod1, "Tess_W", "Shape" )
AddVarPresetParm( gid, p2 )

sid = AddVarPresetSetting( gid, "Default" )
SaveVarPresetParmVals( gid, sid )

sid1 = AddVarPresetSetting( gid, "Coarse" )
SetVarPresetParmVal( gid, sid1, p1, 3 )
SetVarPresetParmVal( gid, sid1, p2, 5 )

sid2 = AddVarPresetSetting( gid, "Fine" )
SetVarPresetParmVal( gid, sid2, p1, 35 )
SetVarPresetParmVal( gid, sid2, p2, 21 )


gid2 = AddVarPresetGroup( "Design" )

p3 = FindParm( pod1, "Length", "Design" )
AddVarPresetParm( gid2, p3 )

p4 = FindParm( pod1, "FineRatio", "Design" )
AddVarPresetParm( gid2, p4 )

sid3 = AddVarPresetSetting( gid2, "Normal" )
SaveVarPresetParmVals( gid2, sid3 )

sid4 = AddVarPresetSetting( gid2, "ShortFat" )
SetVarPresetParmVal( gid2, sid4, p3, 3.0 )
SetVarPresetParmVal( gid2, sid4, p4, 5.0 )

sid5 = AddVarPresetSetting( gid2, "LongThin" )
SetVarPresetParmVal( gid2, sid5, p3, 20.0 )
SetVarPresetParmVal( gid2, sid5, p4, 35.0 )

# End of setup boiler plate.

mid1 = CreateAndAddMode( "FatWetAreas", SET_ALL, SET_NONE )
ModeAddGroupSetting( mid1, gid, sid1 )
ModeAddGroupSetting( mid1, gid2, sid4 )

mid2 = CreateAndAddMode( "ThinAero", SET_FIRST_USER, SET_FIRST_USER + 1 )
ModeAddGroupSetting( mid2, gid, sid2 )
ModeAddGroupSetting( mid2, gid2, sid5 )

ApplyModeSettings( mid2 )
Update()

RemoveAllGroupSettings( mid1 )

# Every pairing on this Mode goes, and the other Mode is left alone.
assert len( ModeGetAllGroups( mid1 ) ) == 0, "RemoveAllGroupSettings left pairings behind"
assert len( ModeGetAllSettings( mid1 ) ) == 0, "RemoveAllGroupSettings left pairings behind"
assert len( ModeGetAllGroups( mid2 ) ) == 2, "RemoveAllGroupSettings reached the other Mode"
Parameters:

[in] – mid string Mode ID to remove all variable presets from

openvsp.vsp.RemoveGeomTexture(geom_id, texture_id)

Remove a texture from a Geom, the way the Delete button on the Texture screen does.

pod_id = AddGeom( "POD", "" )

tex_id = AttachGeomTexture( pod_id, "textures/nasa-logo.tga" )

RemoveGeomTexture( pod_id, tex_id )

assert len( GetGeomTextureIDVec( pod_id ) ) == 0, "RemoveGeomTexture left the texture behind"

See also: AttachGeomTexture, GetGeomTextureIDVec :param [in]: geom_id string Geom ID :param [in]: texture_id string Texture ParmContainer ID

openvsp.vsp.RemoveGroupSetting(mid, indx)

Remove the indx’th variable preset group and setting from the specified mode.

# Illustrating use of Modes requires substantial setup of the model including components, sets, and variable presets.
#
# Setup boiler plate.
pod1 = AddGeom( "POD", "" )
wing = AddGeom( "WING", pod1 )

SetParmVal( wing, "Trans_Attach_Flag", "Attach", ATTACH_TRANS_LMN )
SetParmVal( wing, "L_Attach_Location", "Attach", 0.35 )

SetSetName( SET_FIRST_USER, "NonLifting" )
SetSetName( SET_FIRST_USER + 1, "Lifting" )

SetSetFlag( pod1, SET_FIRST_USER, True )
SetSetFlag( wing, SET_FIRST_USER + 1, True )


gid = AddVarPresetGroup( "Tess" )

p1 = FindParm( pod1, "Tess_U", "Shape" )
AddVarPresetParm( gid, p1 )

p2 = FindParm( pod1, "Tess_W", "Shape" )
AddVarPresetParm( gid, p2 )

sid = AddVarPresetSetting( gid, "Default" )
SaveVarPresetParmVals( gid, sid )

sid1 = AddVarPresetSetting( gid, "Coarse" )
SetVarPresetParmVal( gid, sid1, p1, 3 )
SetVarPresetParmVal( gid, sid1, p2, 5 )

sid2 = AddVarPresetSetting( gid, "Fine" )
SetVarPresetParmVal( gid, sid2, p1, 35 )
SetVarPresetParmVal( gid, sid2, p2, 21 )


gid2 = AddVarPresetGroup( "Design" )

p3 = FindParm( pod1, "Length", "Design" )
AddVarPresetParm( gid2, p3 )

p4 = FindParm( pod1, "FineRatio", "Design" )
AddVarPresetParm( gid2, p4 )

sid3 = AddVarPresetSetting( gid2, "Normal" )
SaveVarPresetParmVals( gid2, sid3 )

sid4 = AddVarPresetSetting( gid2, "ShortFat" )
SetVarPresetParmVal( gid2, sid4, p3, 3.0 )
SetVarPresetParmVal( gid2, sid4, p4, 5.0 )

sid5 = AddVarPresetSetting( gid2, "LongThin" )
SetVarPresetParmVal( gid2, sid5, p3, 20.0 )
SetVarPresetParmVal( gid2, sid5, p4, 35.0 )

# End of setup boiler plate.

mid1 = CreateAndAddMode( "FatWetAreas", SET_ALL, SET_NONE )
ModeAddGroupSetting( mid1, gid, sid1 )
ModeAddGroupSetting( mid1, gid2, sid4 )

mid2 = CreateAndAddMode( "ThinAero", SET_FIRST_USER, SET_FIRST_USER + 1 )
ModeAddGroupSetting( mid2, gid, sid2 )
ModeAddGroupSetting( mid2, gid2, sid5 )

ApplyModeSettings( mid2 )
Update()

RemoveGroupSetting( mid1, 0 )

# Only the indexed pairing goes; the other one stays and slides down.
gids = ModeGetAllGroups( mid1 )
sids = ModeGetAllSettings( mid1 )

assert len( gids ) == 1 and gids[0] == gid2, "RemoveGroupSetting removed the wrong pairing"
assert len( sids ) == 1 and sids[0] == sid4, "RemoveGroupSetting removed the wrong pairing"
Parameters:
  • [in] – mid string Mode ID to remove varible preset group and setting from

  • [in] – indx int Index of Variable preset to remove

openvsp.vsp.RemoveSelectedFromCSGroup(selected, CSGroupIndex)

Remove each control surfaces in the array of control surface indexes from the control surface group at the specified index.

Warning: The indexes in input “selected” must be matched with active control surfaces identified by GetActiveCSNameVec. The “selected” input uses one-based indexing to associate available control surfaces.

wid = AddGeom( "WING", "" ) # Add Wing

aileron_id = AddSubSurf( wid, SS_CONTROL ) # Add Control Surface Sub-Surface

group_index = CreateVSPAEROControlSurfaceGroup() # Empty control surface group

cs_name_vec = GetAvailableCSNameVec( group_index )

cs_ind_vec = [0] * len(cs_name_vec)

for i in range(int( len(cs_name_vec) )):

    cs_ind_vec[i] = i + 1

AddSelectedToCSGroup( cs_ind_vec, group_index ) # Add the available control surfaces to the group

remove_cs_ind_vec = [1]

num_active = len( GetActiveCSNameVec( group_index ) )

assert num_active == len( cs_name_vec ), "not everything was added to the group"

RemoveSelectedFromCSGroup( remove_cs_ind_vec, group_index ) # Remove the first control surface

# One surface moved back from active to available.
assert len( GetActiveCSNameVec( group_index ) ) == num_active - 1, "RemoveSelectedFromCSGroup did not remove a surface"
assert len( GetAvailableCSNameVec( group_index ) ) == 1, "the removed surface did not become available again"

See also: GetActiveCSNameVec :param [in]: selected vector <int> Array of control surface indexes to remove from the group. Note, the integer values are one based. :param [in]: CSGroupIndex int Index of the control surface group

openvsp.vsp.ReorderAdvLinkInput(index, var_name, reorder_type)

Move an input variable within an advanced link’s input list, the way the move buttons beside the input browser do. The order is presentation only; it does not affect what the link computes.

pod = AddGeom( "POD", "" )

AddAdvLink( "ExampleLink" )
indx = GetLinkIndex( "ExampleLink" )

AddAdvLinkInput( indx, FindParm( pod, "Length", "Design" ), "len" )
AddAdvLinkInput( indx, FindParm( pod, "FineRatio", "Design" ), "fine" )

ReorderAdvLinkInput( indx, "fine", REORDER_MOVE_UP )

names = GetAdvLinkInputNames( indx )

assert names[0] == "fine", "ReorderAdvLinkInput did not move the variable"
assert names[1] == "len", "ReorderAdvLinkInput did not move the variable"

See also: SortAdvLinkInputsVar, ReorderAdvLinkOutput :param [in]: index int Index for advanced link :param [in]: var_name string Input variable name :param [in]: reorder_type int Reorder type enum (see REORDER_TYPE)

openvsp.vsp.ReorderAdvLinkOutput(index, var_name, reorder_type)

Move an output variable within an advanced link’s output list, the way the move buttons beside the output browser do. The order is presentation only; it does not affect what the link computes.

pod = AddGeom( "POD", "" )

AddAdvLink( "ExampleLink" )
indx = GetLinkIndex( "ExampleLink" )

AddAdvLinkOutput( indx, FindParm( pod, "X_Rel_Location", "XForm" ), "x" )
AddAdvLinkOutput( indx, FindParm( pod, "Y_Rel_Location", "XForm" ), "y" )

ReorderAdvLinkOutput( indx, "x", REORDER_MOVE_BOTTOM )

names = GetAdvLinkOutputNames( indx )

assert names[0] == "y", "ReorderAdvLinkOutput did not move the variable"
assert names[1] == "x", "ReorderAdvLinkOutput did not move the variable"

See also: SortAdvLinkOutputsVar, ReorderAdvLinkInput :param [in]: index int Index for advanced link :param [in]: var_name string Output variable name :param [in]: reorder_type int Reorder type enum (see REORDER_TYPE)

openvsp.vsp.ReorderFeaLayer(material_id, layer_id, reorder_type)

Move a layer within an FEA laminate’s stack, the way the move buttons on the material editor do. A laminate’s properties come from its layers in stacking order, so moving a layer changes the material.

mat_id = AddFeaMaterial()

SetParmVal( FindParm( mat_id, "FeaMaterialType", "FeaMaterial" ), FEA_LAMINATE )

Update()

first = AddFeaLayer( mat_id )
second = AddFeaLayer( mat_id )

layer_ids = GetFeaLayerIDVec( mat_id )
num_layers = len( layer_ids )

ReorderFeaLayer( mat_id, second, REORDER_MOVE_TOP )

moved_ids = GetFeaLayerIDVec( mat_id )

assert len( moved_ids ) == num_layers, "ReorderFeaLayer did not move the layer"
assert moved_ids[0] == second, "ReorderFeaLayer did not move the layer"

See also: AddFeaLayer, DeleteFeaLayer, GetFeaLayerIDVec :param [in]: material_id string FEA Material ID of a laminate :param [in]: layer_id string FEA Layer ID :param [in]: reorder_type int Reorder type enum (see REORDER_TYPE)

openvsp.vsp.ReorderFeaPart(geom_id, fea_struct_ind, part_id, reorder_type)

Move an FEA part within its structure’s part list, the way the move buttons on the Structure tab do. Parts are meshed in list order, so where a part sits decides which of two intersecting parts is trimmed by the other.

pod_id = AddGeom( "POD", "" )

struct_ind = AddFeaStruct( pod_id )
struct_id = GetFeaStructID( pod_id, struct_ind )

bulkhead = AddFeaPart( pod_id, struct_ind, FEA_SLICE )
skin = GetFeaPartID( struct_id, 0 )

ReorderFeaPart( pod_id, struct_ind, bulkhead, REORDER_MOVE_TOP )

assert GetFeaPartID( struct_id, 0 ) == bulkhead, "ReorderFeaPart did not move the part"

ReorderFeaPart( pod_id, struct_ind, bulkhead, REORDER_MOVE_BOTTOM )

assert GetFeaPartID( struct_id, 0 ) == skin, "ReorderFeaPart did not move the part back"

See also: AddFeaPart, DeleteFeaPart, GetFeaPartIDVec :param [in]: geom_id string Geom ID :param [in]: fea_struct_ind int FEA Structure index :param [in]: part_id string FEA Part ID :param [in]: reorder_type int Reorder type enum (see REORDER_TYPE)

openvsp.vsp.ReorderGeom(geom_id, reorder_type)

Move a Geom within the list of its siblings, the way the move buttons beside the Geom browser do. A Geom’s position among its siblings sets the order it is written, exported and drawn in; it does not change the Geom’s parent or its geometry.

pod1 = AddGeom( "POD", "" )
pod2 = AddGeom( "POD", "" )

# Both Pods sit at the top level, in the order they were added.
assert FindGeoms()[0] == pod1, "the Geoms did not start in creation order"

ReorderGeom( pod2, REORDER_MOVE_UP )

assert FindGeoms()[0] == pod2, "ReorderGeom did not move the Geom"

ReorderGeom( pod2, REORDER_MOVE_BOTTOM )

assert FindGeoms()[0] == pod1, "ReorderGeom did not move the Geom back"

See also: SetGeomParent :param [in]: geom_id string Geom ID :param [in]: reorder_type int Reorder type enum (see REORDER_TYPE)

openvsp.vsp.ReorderSubSurf(geom_id, sub_id, reorder_type)

Move a sub-surface within its parent Geom’s sub-surface list, the way the move buttons on the Sub-Surface tab do. Sub-surfaces are applied in list order, so where one sits decides which of two overlapping sub-surfaces tags a given piece of the surface.

wing_id = AddGeom( "WING", "" )

ss_line = AddSubSurf( wing_id, SS_LINE )
ss_rect = AddSubSurf( wing_id, SS_RECTANGLE )

assert GetSubSurf( wing_id, 0 ) == ss_line, "the sub-surfaces did not start in creation order"

ReorderSubSurf( wing_id, ss_rect, REORDER_MOVE_TOP )

assert GetSubSurf( wing_id, 0 ) == ss_rect, "ReorderSubSurf did not move the sub-surface"

See also: AddSubSurf, DeleteSubSurf :param [in]: geom_id string Geom ID :param [in]: sub_id string Sub-surface ID :param [in]: reorder_type int Reorder type enum (see REORDER_TYPE)

openvsp.vsp.ReparameterizeEditXSec(xsec_id)

Perform an equal arc length repareterization on an EditCurveXSec. The reparameterization is performed between specific U values if the Fixed U flag is true. This allows corners, such as at 0.25, 0.5, and 0.75 U, to be held constant while everything between them is reparameterized.

# Add Wing
wid = AddGeom( "WING" )

# Get First (and Only) XSec Surf
xsec_surf = GetXSecSurf( wid, 0 )

ChangeXSecShape( xsec_surf, 1, XS_EDIT_CURVE )

# Identify XSec 1
xsec_1 = GetXSec( xsec_surf, 1 )

fixed_u_vec = list(GetEditXSecFixedUVec( xsec_1 ))

fixed_u_vec[3] = True # change a flag

SetEditXSecFixedUVec( xsec_1, fixed_u_vec )

before_pts = GetEditXSecCtrlVec( xsec_1, True )

ReparameterizeEditXSec( xsec_1 )

Update()

# Reparameterizing redistributes U without changing the shape, so the same
# control points are still there.
after_pts = GetEditXSecCtrlVec( xsec_1, True )

assert len( after_pts ) == len( before_pts ), "ReparameterizeEditXSec changed the number of control points"

# The U values stay in order over the unit interval.
u_vec = GetEditXSecUVec( xsec_1 )

assert len( u_vec ) == len( after_pts ), "the U vector does not match the control points"
assert abs( u_vec[0] ) < 1e-9 and abs( u_vec[-1] - 1.0 ) < 1e-9, "the U vector does not span the curve"

for i in range( 1, len( u_vec ) ):
    assert u_vec[i] >= u_vec[i - 1], "the U vector is not increasing at " + str( i )

See also: SetEditXSecFixedUVec, GetEditXSecFixedUVec :param [in]: xsec_id string XSec ID

openvsp.vsp.ResetGeomScale(geom_id)

Discard a Geom’s pending scale and return it to its unscaled size. This is the Scale tab’s Reset button. Use AcceptGeomScale to keep the scaled size instead.

pid = AddGeom( "POD" )

Update()

before_max = GetGeomBBoxMax( pid, 0, False )

SetParmValUpdate( pid, "Scale", "XForm", 2.0 )

Update()

scaled_max = GetGeomBBoxMax( pid, 0, False )

assert abs( scaled_max.x() - 2.0 * before_max.x() ) < 1e-6, "the Geom was never scaled"

ResetGeomScale( pid )

Update()

# The scale factor comes back to one and the Geom returns to its base size.
assert abs( GetParmVal( pid, "Scale", "XForm" ) - 1.0 ) < 1e-9, "ResetGeomScale did not reset the scale factor"

after_max = GetGeomBBoxMax( pid, 0, False )

assert abs( after_max.x() - before_max.x() ) < 1e-6, "ResetGeomScale did not undo the scaling"
Parameters:

[in] – geom_id string Geom ID

openvsp.vsp.ResetPropellerThickness(geom_id)

Rebuild a propeller’s thickness curve from the airfoils actually on its cross sections, the way the Reset Thickness button on the Prop screen does. The thickness curve normally drives the sections; this runs the relationship the other way once, so a blade built up section by section gets a thickness curve that matches what it already is.

prop_id = AddGeom( "PROP", "" )

Update()

ResetPropellerThickness( prop_id )

# The thickness curve now carries one point per cross section.
tvec = PCurveGetTVec( prop_id, PROP_THICK )

xsec_surf = GetXSecSurf( prop_id, 0 )

assert len( tvec ) == GetNumXSec( xsec_surf ), "ResetPropellerThickness did not rebuild the curve"

See also: ApproximateAllPropellerPCurves, PCurveGetTVec :param [in]: geom_id string Propeller Geom ID

openvsp.vsp.ResetPropellerThicknessCurve(geom_id)

Reset propeller T/C curve to match basic thickness of file-type airfoils. Typically only used for a propeller that has been constructed with file-type airfoils across the blade. The new thickness curve will be a PCHIP curve with t/c matching the propeller’s XSecs – unless it is a file XSec, then the Base thickness is used.

# Add Propeller
prop = AddGeom( "PROP", "" )

ResetPropellerThicknessCurve( prop )

Update()

# The curve is rebuilt from the blade XSecs: one PCHIP station per XSec, each
# carrying that XSec's thickness to chord ratio.
tvec = PCurveGetTVec( prop, PROP_THICK )
vvec = PCurveGetValVec( prop, PROP_THICK )

xsec_surf = GetXSecSurf( prop, 0 )

num_xsec = GetNumXSec( xsec_surf )

assert PCurveGetType( prop, PROP_THICK ) == PCHIP, "ResetPropellerThicknessCurve did not make a PCHIP curve"
assert len( vvec ) == num_xsec, "ResetPropellerThicknessCurve did not follow the XSecs"
assert len( tvec ) == len( vvec ), "ResetPropellerThicknessCurve did not follow the XSecs"

for i in range( num_xsec ):
    tc = GetXSecParm( GetXSec( xsec_surf, i ), "ThickChord" )

    # A circular XSec carries no thickness Parm; its base thickness is used
    # instead.
    if len( tc ) > 0:
        assert abs( vvec[i] - GetParmVal( tc ) ) < 1e-6, "station " + str( i ) + " does not match its XSec"

# The stations run out along the blade.
for i in range( 1, len( tvec ) ):
    assert tvec[i] > tvec[i - 1], "the thickness stations are not increasing"

# Looking up the circular XSec's thickness raises an error on purpose, so take
# it back off the queue.
err_mgr = ErrorMgrSingleton.getInstance()

while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()
Parameters:

[in] – geom_id string Geom ID

openvsp.vsp.ResetViews()

Reset views of all viewports

ResetViews()
openvsp.vsp.ResetXSecSkinParms(xsec_id)

Reset all skinning Parms for a specified XSec. Set top, bottom, left, and right strengths, slew, angle, and curvature to 0. Set all symmetry and equality conditions to false.

fid = AddGeom( "FUSELAGE", "" )             # Add Fuselage

xsec_surf = GetXSecSurf( fid, 0 )           # Get First (and Only) XSec Surf

num_xsecs = GetNumXSec( xsec_surf )

xsec = GetXSec( xsec_surf, 1 )

SetXSecTanAngles( xsec, XSEC_BOTH_SIDES, 15.0, -1.0e12, -1.0e12, -1.0e12 )      # Set Tangent Angles At Cross Section
SetXSecContinuity( xsec, 1 )                       # Set Continuity At Cross Section

assert abs( GetParmVal( GetXSecParm( xsec, "TopLAngle" ) ) - 15.0 ) < 1e-6, "the skin Parms were never set"

ResetXSecSkinParms( xsec )

# Resetting zeroes every skin value on all four sides and turns the symmetry
# flags back on.  Continuity is left alone.
for skin_parm in [ "TopLAngle", "TopRAngle", "TopLSlew", "TopLStrength", "TopLCurve",
                   "RightLAngle", "BottomLAngle", "LeftLAngle" ]:
    assert abs( GetParmVal( GetXSecParm( xsec, skin_parm ) ) ) < 1e-6, "ResetXSecSkinParms did not zero " + skin_parm

assert abs( GetParmVal( GetXSecParm( xsec, "TBSym" ) ) - 1.0 ) < 1e-12, "ResetXSecSkinParms did not restore the symmetry flags"
assert abs( GetParmVal( GetXSecParm( xsec, "RLSym" ) ) - 1.0 ) < 1e-12, "ResetXSecSkinParms did not restore the symmetry flags"
Parameters:

[in] – xsec_id string XSec ID

openvsp.vsp.RotateArbAxis(vec3d p, double theta, vec3d r) vec3d
openvsp.vsp.RotateSet(set_index, x_rot_deg, y_rot_deg, z_rot_deg)

Rotate a set about the global X, Y, and Z axes

# Add Fuselage Geom
fuseid = AddGeom( "FUSELAGE" )

SetSetFlag( fuseid, 3, True )

Update()

before_max = GetGeomBBoxMax( fuseid, 0, True )
before_min = GetGeomBBoxMin( fuseid, 0, True )

# Rotate 90 degrees about Y
RotateSet( 3, 0, 90, 0 )

Update()

after_max = GetGeomBBoxMax( fuseid, 0, True )
after_min = GetGeomBBoxMin( fuseid, 0, True )

# Turning the Geom on its nose trades the X extent for the Z extent.
assert abs( ( after_max.z() - after_min.z() ) - ( before_max.x() - before_min.x() ) ) < 1e-6, "RotateSet did not rotate the geometry"
assert abs( ( after_max.x() - after_min.x() ) - ( before_max.z() - before_min.z() ) ) < 1e-6, "RotateSet did not rotate the geometry"
Parameters:
  • [in] – set_index int Set index

  • [in] – x_rot_deg double Rotation about the X axis (degrees)

  • [in] – y_rot_deg double Rotation about the Y axis (degrees)

  • [in] – z_rot_deg double Rotation about the Z axis (degrees)

openvsp.vsp.SAVE = 1

Browse file system and enter file name

openvsp.vsp.SCALE_HEIGHT = 1

Scale image to match desired height with 1:1 AR

openvsp.vsp.SCALE_HEIGHT_AR = 5

Scale image to match desired height with specified AR

openvsp.vsp.SCALE_RESOLUTION = 3

Scale image to specified resolution

openvsp.vsp.SCALE_WIDTH = 0

Scale image to match desired width with 1:1 AR

openvsp.vsp.SCALE_WIDTH_AR = 4

Scale image to match desired width with specified AR

openvsp.vsp.SCALE_WIDTH_HEIGHT = 2

Scale image to match desired width and height

openvsp.vsp.SECSWEEP_WSECT_DRIVER = 7

Section sweep driver

openvsp.vsp.SELIG_AF_EXPORT = 0

Selig airfoil file format

openvsp.vsp.SET_2D = 1

2D DXF export

openvsp.vsp.SET_3D = 0

3D DXF export (default)

openvsp.vsp.SET_ALL = 0

All set

openvsp.vsp.SET_BOUNDARY = 1

Set boundary

openvsp.vsp.SET_FIRST_USER = 3

First user-defined set

openvsp.vsp.SET_NONE = -1

None set

openvsp.vsp.SET_NOT_SHOWN = 2

Not shown set

openvsp.vsp.SET_SHOWN = 1

Shown set

openvsp.vsp.SET_TARGET = 0

Set target type

openvsp.vsp.SHARP_END_CAP = 4

Sharp end cap

openvsp.vsp.SI_UNIT = 0

FEA Files output in (m, kg)

openvsp.vsp.SMALL_FRAGMENT = 4

Small fragment

openvsp.vsp.SOURCES = 4

Mesh sources.

openvsp.vsp.SPAN_WSECT_DRIVER = 1

Span driver

openvsp.vsp.SPAR_NORMAL = 3

FEA Rib or Rib Array is set perpendicular to an FEA Spar

openvsp.vsp.SPINE_NORMAL = 6

Slice is perpendicular to thespine of the parent Geom

openvsp.vsp.SS_CONTROL = 3

Control sub-surface type

openvsp.vsp.SS_ELLIPSE = 2

Ellipse sub-surface type

openvsp.vsp.SS_FINITE_LINE = 5

Finite line sub-surface type

openvsp.vsp.SS_INC_SEPARATE_TREATMENT = 1

Treat the sub-surface separately from the parent

openvsp.vsp.SS_INC_TREAT_AS_PARENT = 0

Treat the sub-surface the same as the parent

openvsp.vsp.SS_INC_ZERO_DRAG = 2

No drag contribution for the sub-surface

openvsp.vsp.SS_INTERSECT = 7

Intersection derived sub-surface type

openvsp.vsp.SS_LINE = 0

Line sub-surface type

openvsp.vsp.SS_LINE_ARRAY = 4

Line array sub-surface type

openvsp.vsp.SS_NUM_TYPES = 8

Number of sub-surface types

openvsp.vsp.SS_RECTANGLE = 1

Rectangle sub-surface type

openvsp.vsp.SS_XSEC_CURVE = 6

XSecCurve based sub-surface type

openvsp.vsp.STABILITY_ADJOINT = 6

Steady 6DOF stability analysis using adjoint

openvsp.vsp.STABILITY_DEFAULT = 1

Steady 6DOF stability analysis

openvsp.vsp.STABILITY_NUM_TYPES = 7

Number of stability analysis types

openvsp.vsp.STABILITY_OFF = 0

No stability analysis (off)

openvsp.vsp.STABILITY_PITCH = 5

Simplified pitch stability analysis

openvsp.vsp.STABILITY_P_ANALYSIS = 2

Unsteady roll stability analysis

openvsp.vsp.STABILITY_Q_ANALYSIS = 3

Unsteady pitch stability analysis

openvsp.vsp.STABILITY_R_ANALYSIS = 4

Unsteady yaw stability analysis

openvsp.vsp.STACK_GEOM_SCREEN = 6

Stack geom screen

openvsp.vsp.STACK_PRESET_BOTHFACEFACE = 6

Nacelle from the inlet face around the outside to the outlet face

openvsp.vsp.STACK_PRESET_BOTHFACELIP = 8

Nacelle from the inlet face around the outside to the outlet lip

openvsp.vsp.STACK_PRESET_BOTHLIPFACE = 7

Nacelle from the inlet lip around the outside to the outlet face

openvsp.vsp.STACK_PRESET_BOTHLIPLIP = 9

Nacelle from the inlet lip around the outside to the outlet lip

openvsp.vsp.STACK_PRESET_CYLINDER_ENDCAPS = 2

Cylinder with end caps instead of points

openvsp.vsp.STACK_PRESET_CYLINDER_ENDPTS = 1

Cylinder with points as first/last XSec

openvsp.vsp.STACK_PRESET_DEFAULT = 0

Standard init type

openvsp.vsp.STACK_PRESET_FLOWPATH_BOTH = 14

Nacelle flowpath only, from inlet to outlet

openvsp.vsp.STACK_PRESET_FLOWPATH_IN = 15

Nacelle flowpath only, inlet lip to face

openvsp.vsp.STACK_PRESET_FLOWPATH_OUT = 16

Nacelle flowpath only, outlet face to lip

openvsp.vsp.STACK_PRESET_FLOWTHRU_INLIP_ORIG = 4

Flowthru nacelle starting/ending with inlet lip

openvsp.vsp.STACK_PRESET_FLOWTHRU_MID_ORIG = 5

Flowthru nacelle starting/ending with outlet face

openvsp.vsp.STACK_PRESET_FLOWTHRU_OUTLIP_ORIG = 3

Flowthru nacelle starting/ending with outlet lip

openvsp.vsp.STACK_PRESET_INFACE = 12

Nacelle from the inlet face, then closed out with no outlet

openvsp.vsp.STACK_PRESET_INLIP = 13

Nacelle from the inlet lip, then closed out with no outlet

openvsp.vsp.STACK_PRESET_OUTFACE = 10

Nacelle with no inlet, around the outside to the outlet face

openvsp.vsp.STACK_PRESET_OUTLIP = 11

Nacelle with no inlet, around the outside to the outlet lip

openvsp.vsp.STALL_OFF = 0

Stall modeling off

openvsp.vsp.STALL_ON = 1

Stall modeling on

openvsp.vsp.STEP_BREP = 1

Manifold solid BREP STEP file representation

openvsp.vsp.STEP_SHELL = 0

Manifold shell surface STEP file representation

openvsp.vsp.STRING_DATA = 3

String data type

openvsp.vsp.SYM_ALL = 3

All cross section symmetry.

openvsp.vsp.SYM_NONE = 0

No cross section symmetry.

openvsp.vsp.SYM_NUM_TYPES = 6

Number of symmetry types.

openvsp.vsp.SYM_PLANAR_TYPES = 3

Number of planar symmetry types.

openvsp.vsp.SYM_RL = 1

Right/left cross section symmetry.

openvsp.vsp.SYM_ROT_X = 8

X rotational symmetry.

openvsp.vsp.SYM_ROT_Y = 16

Y rotational symmetry.

openvsp.vsp.SYM_ROT_Z = 32

Z rotational symmetry.

openvsp.vsp.SYM_TB = 2

Top/bottom cross section symmetry.

openvsp.vsp.SYM_XY = 1

XY planar symmetry.

openvsp.vsp.SYM_XZ = 2

XZ planar symmetry.

openvsp.vsp.SYM_YZ = 4

YZ planar symmetry.

openvsp.vsp.SaveVarPresetParmVals(group_id, setting_id)

Save current Parm values to Variable Preset Setting

# Add Pod Geom
pod1 = AddGeom( "POD", "" )

gid = AddVarPresetGroup( "Tess" )

sid = AddVarPresetSetting( gid, "Coarse" )

p1 = FindParm( pod1, "Tess_U", "Shape" )

AddVarPresetParm( gid, p1 )

# Move the Parm away from whatever the setting holds, then save.
SetParmVal( p1, GetParmVal( p1 ) + 4.0 )

Update()

SaveVarPresetParmVals( gid, sid )

# The setting now holds the Parm's current value.
assert abs( GetVarPresetParmVal( gid, sid, p1 ) - GetParmVal( p1 ) ) < 1e-9, "SaveVarPresetParmVals did not capture the current value"
Parameters:
  • [in] – group_id string Var Preset Group ID

  • [in] – setting_id string Var Preset Setting ID

openvsp.vsp.ScaleSet(set_index, scale)

Apply a scale factor to a set

# Add Fuselage Geom
fuseid = AddGeom( "FUSELAGE" )

SetSetFlag( fuseid, 3, True )

# Scale by a factor of 2
Update()

before_max = GetGeomBBoxMax( fuseid, 0, False )
before_min = GetGeomBBoxMin( fuseid, 0, False )

ScaleSet( 3, 2.0 )

Update()

after_max = GetGeomBBoxMax( fuseid, 0, False )
after_min = GetGeomBBoxMin( fuseid, 0, False )

assert abs( ( after_max.x() - after_min.x() ) - 2.0 * ( before_max.x() - before_min.x() ) ) < 1e-6, "ScaleSet did not double the extent"
Parameters:
  • [in] – set_index int Set index

  • [in] – scale double Scale factor

openvsp.vsp.ScreenGrab(fname, w, h, transparentBG, autocrop=False)

Capture the specified screen and save to file. Note, VSP_USE_FLTK must be defined

screenw = 2000                                             # Set screenshot width and height
screenh = 2000

fname = "test_screen_grab.png"

ScreenGrab( fname, screenw, screenh, True, True )                # Take PNG screenshot
Parameters:
  • [in] – fname string Output file name

  • [in] – w int Width of screen grab

  • [in] – h int Height of screen grab

  • [in] – transparentBG bool Transparent background flag

  • [in] – autocrop bool Automatically crop transparent background flag

openvsp.vsp.SearchReplaceAdvLinkCode(index, _from, to)

Search and replace strings in the advanced link code

pod = AddGeom( "POD", "" )
length = FindParm( pod, "Length", "Design" )
x_pos = GetParm( pod, "X_Rel_Location", "XForm" )

AddAdvLink( "ExampleLink" )
indx = GetLinkIndex( "ExampleLink" )
AddAdvLinkInput( indx, length, "len" )
AddAdvLinkOutput( indx, x_pos, "x" )

SetAdvLinkCode( indx, "x = 10.0 - len;" )
SearchReplaceAdvLinkCode( indx, "10.0", "12.3" )

code = GetAdvLinkCode( indx )

print( code )

assert "12.3" in code and "10.0" not in code, "SearchReplaceAdvLinkCode did not replace"

BuildAdvLinkScript( indx )

# The link was named, so it has to be findable by that name and by that
# index, and it has to actually drive its output.  The replacement rewrote
# the code, so x is now 12.3 minus the Pod's length.
assert indx >= 0, "the advanced link was not registered under its name"
assert len( GetAdvLinkNames() ) == 1, "the advanced link was not registered under its name"
assert GetAdvLinkNames()[0] == "ExampleLink", "the advanced link was not registered under its name"

SetParmValUpdate( length, 6.0 )

Update()

assert abs( GetParmVal( x_pos ) - 6.3 ) < 1e-6, "the advanced link did not drive its output"
Parameters:
  • [in] – index int Index for advanced link

  • [in] – from string Search token

  • [in] – to string Replace token

openvsp.vsp.SetActiveGeometryAnalysis(id)

Set the active Geometry Analysis case. The active case is the one drawn in the Geometry Analysis GUI (and captured by ScreenGrab). Setting it does not require the GUI to be present.

ga_id = AddGeometryAnalysis()
SetActiveGeometryAnalysis( ga_id )
assert GetActiveGeometryAnalysis() == ga_id, "SetActiveGeometryAnalysis did not take"

See also: GetActiveGeometryAnalysis, AddGeometryAnalysis :param [in]: id string Geometry Analysis case ID (empty string for none)

openvsp.vsp.SetAdvLinkCode(index, code)

Get the code from an advanced link

pod = AddGeom( "POD", "" )
length = FindParm( pod, "Length", "Design" )
x_pos = GetParm( pod, "X_Rel_Location", "XForm" )

AddAdvLink( "ExampleLink" )
indx = GetLinkIndex( "ExampleLink" )
AddAdvLinkInput( indx, length, "len" )
AddAdvLinkOutput( indx, x_pos, "x" )

SetAdvLinkCode( indx, "x = 10.0 - len;" )

BuildAdvLinkScript( indx )

# The link was named, so it has to be findable by that name and by that
# index, and it has to actually drive its output: x is 10 minus the Pod's
# length, so changing the length has to move the Pod.
assert indx >= 0, "the advanced link was not registered under its name"
assert len( GetAdvLinkNames() ) == 1, "the advanced link was not registered under its name"
assert GetAdvLinkNames()[0] == "ExampleLink", "the advanced link was not registered under its name"

SetParmValUpdate( length, 6.0 )

Update()

assert abs( GetParmVal( x_pos ) - 4.0 ) < 1e-6, "the advanced link did not drive its output"
Parameters:
  • [in] – index int Index for advanced link

  • [in] – code string Code for advanced link

openvsp.vsp.SetAdvLinkName(index, name)

Set the name of an advanced link.

AddAdvLink( "ExampleLink" )

indx = GetLinkIndex( "ExampleLink" )

SetAdvLinkName( indx, "RenamedLink" )

assert GetAdvLinkName( indx ) == "RenamedLink", "SetAdvLinkName did not take"

# The link is now found under its new name and not its old one.
assert GetLinkIndex( "RenamedLink" ) == indx, "the renamed link cannot be found under its new name"
assert GetLinkIndex( "ExampleLink" ) < 0, "the renamed link is still found under its old name"

# Looking up the old name raised an error on purpose, so take it back off
# the queue.
err_mgr = ErrorMgrSingleton.getInstance()

while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: AddAdvLink, GetAdvLinkName, GetLinkIndex :param [in]: index int Advanced link index :param [in]: name string Advanced link name

openvsp.vsp.SetAirfoilLowerPnts(xsec_id, low_pnt_vec)

Set the lower points for an airfoil. The XSec must be of type XS_FILE_AIRFOIL.

# Add Fuselage Geom
fuseid = AddGeom( "FUSELAGE", "" )

xsec_surf = GetXSecSurf( fuseid, 0 )

ChangeXSecShape( xsec_surf, 1, XS_FILE_AIRFOIL )

xsec = GetXSec( xsec_surf, 1 )

ReadFileAirfoil( xsec, "airfoil/N0012_VSP.af" )

low_array = GetAirfoilLowerPnts( xsec )

for i in range(int( len(low_array) )):

    low_array[i].scale_y( 0.5 )

SetAirfoilLowerPnts( xsec, low_array )

check_array = GetAirfoilLowerPnts( xsec )

assert len( check_array ) == len( low_array ), "SetAirfoilLowerPnts point count"

# The halved lower surface has to come back halved, and the upper surface
# has to be left alone.
for i in range( len( low_array ) ):
    assert dist( check_array[i], low_array[i] ) < 1e-6, "SetAirfoilLowerPnts did not store point " + str( i )

up_array = GetAirfoilUpperPnts( xsec )

max_up = max( [ p.y() for p in up_array ] )
min_low = min( [ p.y() for p in check_array ] )

assert abs( 0.5 * max_up + min_low ) < 1e-6, "SetAirfoilLowerPnts did not leave the upper surface alone"
Parameters:
  • [in] – xsec_id string XSec ID

  • [in] – low_pnt_vec vector<vec3d> Array of points defining the lower surface of the airfoil

openvsp.vsp.SetAirfoilPnts(xsec_id, up_pnt_vec, low_pnt_vec)

Set the upper and lower points for an airfoil. The XSec must be of type XS_FILE_AIRFOIL.

# Add Fuselage Geom
fuseid = AddGeom( "FUSELAGE", "" )

xsec_surf = GetXSecSurf( fuseid, 0 )

ChangeXSecShape( xsec_surf, 1, XS_FILE_AIRFOIL )

xsec = GetXSec( xsec_surf, 1 )

ReadFileAirfoil( xsec, "airfoil/N0012_VSP.af" )

up_array = GetAirfoilUpperPnts( xsec )

low_array = GetAirfoilLowerPnts( xsec )

for i in range(int( len(up_array) )):

    up_array[i].scale_y( 2.0 )

    low_array[i].scale_y( 0.5 )

SetAirfoilPnts( xsec, up_array, low_array )

check_up = GetAirfoilUpperPnts( xsec )
check_low = GetAirfoilLowerPnts( xsec )

assert len( check_up ) == len( up_array ), "SetAirfoilPnts point count"
assert len( check_low ) == len( low_array ), "SetAirfoilPnts point count"

for i in range( len( up_array ) ):
    assert dist( check_up[i], up_array[i] ) < 1e-6, "SetAirfoilPnts did not store point " + str( i )
    assert dist( check_low[i], low_array[i] ) < 1e-6, "SetAirfoilPnts did not store point " + str( i )

# The section started symmetric; doubling the top and halving the bottom
# leaves the top four times as deep as the bottom.
max_up = max( [ p.y() for p in check_up ] )
min_low = min( [ p.y() for p in check_low ] )

assert abs( max_up + 4.0 * min_low ) < 1e-6, "SetAirfoilPnts did not scale the two surfaces apart"
Parameters:
  • [in] – xsec_id string XSec ID

  • [in] – up_pnt_vec vector<vec3d> Array of points defining the upper surface of the airfoil

  • [in] – low_pnt_vec vector<vec3d> Array of points defining the lower surface of the airfoil

openvsp.vsp.SetAirfoilUpperPnts(xsec_id, up_pnt_vec)

Set the upper points for an airfoil. The XSec must be of type XS_FILE_AIRFOIL.

# Add Fuselage Geom
fuseid = AddGeom( "FUSELAGE", "" )

xsec_surf = GetXSecSurf( fuseid, 0 )

ChangeXSecShape( xsec_surf, 1, XS_FILE_AIRFOIL )

xsec = GetXSec( xsec_surf, 1 )

ReadFileAirfoil( xsec, "airfoil/N0012_VSP.af" )

up_array = GetAirfoilUpperPnts( xsec )

for i in range(int( len(up_array) )):

    up_array[i].scale_y( 2.0 )

SetAirfoilUpperPnts( xsec, up_array )

check_array = GetAirfoilUpperPnts( xsec )

assert len( check_array ) == len( up_array ), "SetAirfoilUpperPnts point count"

# The doubled upper surface has to come back doubled, and the lower surface
# has to be left alone.
for i in range( len( up_array ) ):
    assert dist( check_array[i], up_array[i] ) < 1e-6, "SetAirfoilUpperPnts did not store point " + str( i )

low_array = GetAirfoilLowerPnts( xsec )

max_up = max( [ p.y() for p in check_array ] )
min_low = min( [ p.y() for p in low_array ] )

assert abs( max_up + 2.0 * min_low ) < 1e-6, "SetAirfoilUpperPnts did not leave the lower surface alone"
Parameters:
  • [in] – xsec_id string XSec ID

  • [in] – up_pnt_vec vector<vec3d> Array of points defining the upper surface of the airfoil

openvsp.vsp.SetAllViews(view)

Set the view of all viewports

SetAllViews( CAM_CENTER )
Parameters:

[in] – view int CAMERA_VIEW enum

openvsp.vsp.SetAnalysisInputDefaults(analysis)

Set all input values to their defaults for a specific analysis

#==== Analysis: VSPAero Compute Geometry ====//
analysis_name = "VSPAEROComputeGeometry"

# Change an input away from its default...
geom_set = GetIntAnalysisInput( analysis_name, "GeomSet" )

new_set = [ geom_set[0] + 1 ]

SetIntAnalysisInput( analysis_name, "GeomSet", new_set )

check_set = GetIntAnalysisInput( analysis_name, "GeomSet" )

assert check_set[0] == new_set[0], "SetIntAnalysisInput did not take"

# ...and set defaults, which has to put it back.
SetAnalysisInputDefaults( analysis_name )

check_set = GetIntAnalysisInput( analysis_name, "GeomSet" )

assert check_set[0] == geom_set[0], "SetAnalysisInputDefaults did not restore the default"
param [in]:

analysis string Analysis name

openvsp.vsp.SetAttributeBool(attrID, value)

Set the Bool value of a bool-type Attribute by ID

##==== Attribute: SetAttributeBool  =====##

VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
InitVal = True
AttrID = AddAttributeBool( CollID, "TestBoolAttr", InitVal )

SetVal = False
SetAttributeBool( AttrID, SetVal )

GetVal = GetAttributeBoolVal( AttrID )
if GetVal[0] == SetVal:
    print( "Set matching Bool Value from Attribute" )
else:
    print( "SetAttributeBoolVal error!" )
    assert False, "SetAttributeBoolVal error!"
Parameters:
  • [in] – attrID string of attribute ID

  • [in] – value bool boolean value for attribute

openvsp.vsp.SetAttributeDoc(attrID, doc)

Set the docstring of an Attribute by ID

##==== Attribute: SetAttributeDoc  =====##

VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
InitVal = "Hello_World_of_Attributes"
AttrID = AddAttributeString( CollID, "TestStringAttr", InitVal )

DocString = 'New_docstring_for_attribute'

SetAttributeDoc( AttrID, DocString )
NewDocString = GetAttributeDoc( AttrID )
if NewDocString == DocString:
    print( "Got matching DocString from Attribute")
else:
    print( "SetAttributeDoc error!" )
    assert False, "SetAttributeDoc error!"
Parameters:
  • [in] – attrID string of attribute ID

  • [in] – doc string of documentation for attribute

openvsp.vsp.SetAttributeDouble(attrID, value)

Set the Double value of a double-type Attribute by ID

##==== Attribute: SetAttributeDouble  =====##

VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
InitVal = 3.14159
AttrID = AddAttributeDouble( CollID, "TestDoubleAttr", InitVal )

DoubleVal = 3.15

SetAttributeDouble( AttrID, DoubleVal )

GetVal = GetAttributeDoubleVal( AttrID )
if GetVal[0] == DoubleVal:
    print( "Set matching Double Value from Attribute" )
else:
    print( "SetAttributeDoubleVal error!" )
    assert False, "SetAttributeDoubleVal error!"
Parameters:
  • [in] – attrID string of attribute ID

  • [in] – value double value for attribute

openvsp.vsp.SetAttributeDoubleMatrix(attrID, value)

Set the double matrix of a double-matrix-type Attribute by ID

##==== Attribute: SetAttributeDoubleMatrix  =====##

VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
InitVal = [[0., 1.,],[-4., -1000.]]
AttrID = AddAttributeDoubleMatrix( CollID, "TestDoubleMatrixAttr", InitVal )

NewDmatVal = [[0.,1.5],[8.4,1.1566]]
SetAttributeDoubleMatrix( AttrID, NewDmatVal )

DblMatrixVal = GetAttributeDoubleMatrixVal( AttrID )
DblMatrixVal = [list(row) for row in DblMatrixVal]

if DblMatrixVal == NewDmatVal:
    print( "Got matching Double Matrix Value from Attribute" )
else:
    print( "GetAttributeDoubleMatrixVal error!" )
    assert False, "GetAttributeDoubleMatrixVal error!"
Parameters:
  • [in] – attrID string of attribute ID

  • [in] – value double matrix value for attribute

openvsp.vsp.SetAttributeInt(attrID, value)

Set the Int value of an int-type Attribute by ID

##==== Attribute: SetAttributeInt  =====##

VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
InitVal = 55
AttrID = AddAttributeInt( CollID, "TestIntAttr", InitVal )

NewIntVal = -55

SetAttributeInt( AttrID, NewIntVal )
GetVal = GetAttributeIntVal( AttrID )
if GetVal[0] == NewIntVal:
    print( "Set matching Int Value from Attribute" )
else:
    print( "SetAttributeIntVal error!" )
    assert False, "SetAttributeIntVal error!"
Parameters:
  • [in] – attrID string of attribute ID

  • [in] – value int value for attribute

openvsp.vsp.SetAttributeIntMatrix(attrID, value)

Set the int matrix of a int-matrix-type Attribute by ID

##==== Attribute: SetAttributeIntMatrix  =====##

VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
InitVal = [[0, 1,],[-4, -1000]]
AttrID = AddAttributeIntMatrix( CollID, "TestIntMatrixAttr", InitVal )

ImatVal = [[1,5],[-8,0]]
SetAttributeIntMatrix( AttrID, ImatVal )

IntMatrixVal = GetAttributeIntMatrixVal( AttrID )
IntMatrixVal = [list(row) for row in IntMatrixVal]

if IntMatrixVal == ImatVal:
    print( "Set matching IntMatrix Value from Attribute" )
else:
    print( "SetAttributeIntMatrixVal error!" )
    assert False, "SetAttributeIntMatrixVal error!"
Parameters:
  • [in] – attrID string of attribute ID

  • [in] – value int matrix value for attribute

openvsp.vsp.SetAttributeName(attrID, name)

Set the name of an Attribute by ID

##==== Attribute: SetAttributeName  =====##

VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
InitVal = "Hello_World_of_Attributes"
AttrID = AddAttributeString( CollID, "TestStringAttr", InitVal )

NameString = 'NewName_Example'
SetAttributeName( AttrID, NameString )
AttrName = GetAttributeName( AttrID )
if NameString == AttrName:
    print( "Got matching name from Attribute")
else:
    print( "SetAttributeName error!" )
    assert False, "SetAttributeName error!"
Parameters:
  • [in] – attrID string of attribute ID

  • [in] – name string name for attribute

openvsp.vsp.SetAttributeParmID(attrID, value)

Set the ParmID value of a Parm-type Attribute by ID

##==== Attribute: SetAttributeParmID  =====##

VehID = GetVehicleID()
CollID = GetChildCollection( VehID )

PodID = AddGeom( "POD", "" )
print( "---> Test Get Parm Val" )
ParmArray = GetGeomParmIDs( PodID )

ParmID = ParmArray[0]
AttrID = AddAttributeParm( CollID, "TestParmAttr", ParmID )

NewParmID = ParmArray[1]
SetAttributeParmID( AttrID, NewParmID )
GetID = GetAttributeParmID( AttrID )

if GetID[0] == NewParmID:
    print( "Set matching Parm ID from Attribute" )
else:
    print( "SetAttributeParmID error!" )
    assert False, "SetAttributeParmID error!"
Parameters:
  • [in] – attrID string of attribute ID

  • [in] – value string value for attribute

openvsp.vsp.SetAttributeString(attrID, value)

Set the String value of a string-type Attribute by ID

##==== Attribute: SetAttributeString  =====##

VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
InitVal = "Hello_World_of_Attributes"
AttrID = AddAttributeString( CollID, "TestStringAttr", InitVal )

StringVal = "Du bist supergeil!"
SetAttributeString( AttrID, StringVal )

GetVal = GetAttributeStringVal( AttrID )
if GetVal[0] == StringVal:
    print( "Got matching String Value from Attribute" )
else:
    print( "GetAttributeStringVal error!" )
    assert False, "GetAttributeStringVal error!"
Parameters:
  • [in] – attrID string of attribute ID

  • [in] – value string value for attribute

openvsp.vsp.SetAttributeVec3d(attrID, value)

Set the Vec3d value of a Vec3d-type Attribute by ID

##==== Attribute: SetAttributeVec3d  =====##

VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
InitVal = vec3d([1., 0.5, -4.])
AttrID = AddAttributeVec3d( CollID, "TestVec3dAttr", [InitVal] )

Vec3dVal = vec3d([0.5, 0.75, -0.4])
SetAttributeVec3d( AttrID, [Vec3dVal] )

GetVal = GetAttributeVec3dVal( AttrID )
if ( GetVal[0].x() == Vec3dVal.x() ) and ( GetVal[0].y() == Vec3dVal.y() ) and ( GetVal[0].z() == Vec3dVal.z() ):
    print( "Set matching Vec3d Value from Attribute" )
else:
    print( "SetAttributeVec3dVal error!" )
    assert False, "SetAttributeVec3dVal error!"
Parameters:
  • [in] – attrID string of attribute ID

  • [in] – value vec3d value for attribute

openvsp.vsp.SetAuxiliaryGeomContactPtID(geom_id, index, bogie_id)

Assign the Bogie that serves as one of the contact points of an AuxiliaryGeom. The ground plane and clearance envelope AuxiliaryGeom modes rest the aircraft on one, two or three Bogies of the parent GearGeom; this picks which Bogie plays each role. Contact points beyond the ones the current mode uses are ignored, but they are remembered.

Any Bogie assigned here must belong to the AuxiliaryGeom’s parent GearGeom. An unrecognized Bogie is silently replaced by the GearGeom’s first Bogie on the next update.

gear_id = AddGeom( "GEAR", "" )

nose_id = CreateAndAddBogie( gear_id )
main_id = CreateAndAddBogie( gear_id )

SetParmVal( main_id, "Symmetrical", "Bogie", 1 )    # Left and right main gear

aux_id = AddGeom( "AUXILIARY", gear_id )

SetParmVal( aux_id, "AuxiliaryGeomType", "Design", AUX_GEOM_THREE_PT_GROUND )

SetAuxiliaryGeomContactPtID( aux_id, 0, nose_id )
SetAuxiliaryGeomContactPtID( aux_id, 1, main_id )
SetAuxiliaryGeomContactPtID( aux_id, 2, main_id )

Update()

assert GetAuxiliaryGeomContactPtID( aux_id, 0 ) == nose_id, "SetAuxiliaryGeomContactPtID did not take"

See also: GetAuxiliaryGeomContactPtID, CreateAndAddBogie :param [in]: geom_id string AuxiliaryGeom Geom ID :param [in]: index int Contact point index [0, 2] :param [in]: bogie_id string Bogie ParmContainer ID

openvsp.vsp.SetBEMPropID(std: :string const & prop_id)
openvsp.vsp.SetBORAirfoilLowerPnts(bor_id, low_pnt_vec)

Set the lower points for an airfoil on a BOR. The BOR XSecCurve must be of type XS_FILE_AIRFOIL.

# Add Body of Recolution
bor_id = AddGeom( "BODYOFREVOLUTION", "" )

ChangeBORXSecShape( bor_id, XS_FILE_AIRFOIL )

ReadBORFileAirfoil( bor_id, "airfoil/N0012_VSP.af" )

low_array = GetBORAirfoilLowerPnts( bor_id )

for i in range(int( len(low_array) )):

    low_array[i].scale_y( 0.5 )

SetBORAirfoilLowerPnts( bor_id, low_array )

# The halved lower surface has to come back halved, and the upper surface has
# to be left alone.
check_array = GetBORAirfoilLowerPnts( bor_id )
up_array = GetBORAirfoilUpperPnts( bor_id )

assert len( check_array ) == len( low_array ), "SetBORAirfoilLowerPnts point count"

for i in range( len( low_array ) ):
    assert dist( check_array[i], low_array[i] ) < 1e-6, "SetBORAirfoilLowerPnts did not store point " + str( i )

max_up = max( [ p.y() for p in up_array ] )
min_low = min( [ p.y() for p in check_array ] )

assert abs( 0.5 * max_up + min_low ) < 1e-6, "SetBORAirfoilLowerPnts did not leave the upper surface alone"
Parameters:
  • [in] – bor_id string Body of revolution Geom ID

  • [in] – low_pnt_vec vector<vec3d> Vector of points defining the lower surface of the airfoil

openvsp.vsp.SetBORAirfoilPnts(bor_id, up_pnt_vec, low_pnt_vec)

Set the upper and lower points for an airfoil on a BOR. The BOR XSecCurve must be of type XS_FILE_AIRFOIL.

# Add Body of Recolution
bor_id = AddGeom( "BODYOFREVOLUTION", "" )

ChangeBORXSecShape( bor_id, XS_FILE_AIRFOIL )

ReadBORFileAirfoil( bor_id, "airfoil/N0012_VSP.af" )

up_array = GetBORAirfoilUpperPnts( bor_id )

low_array = GetBORAirfoilLowerPnts( bor_id )

for i in range(int( len(up_array) )):

    up_array[i].scale_y( 2.0 )

    low_array[i].scale_y( 0.5 )

SetBORAirfoilPnts( bor_id, up_array, low_array )

check_up = GetBORAirfoilUpperPnts( bor_id )
check_low = GetBORAirfoilLowerPnts( bor_id )

assert len( check_up ) == len( up_array ), "SetBORAirfoilPnts point count"
assert len( check_low ) == len( low_array ), "SetBORAirfoilPnts point count"

for i in range( len( up_array ) ):
    assert dist( check_up[i], up_array[i] ) < 1e-6, "SetBORAirfoilPnts did not store point " + str( i )
    assert dist( check_low[i], low_array[i] ) < 1e-6, "SetBORAirfoilPnts did not store point " + str( i )

# The section started symmetric; doubling the top and halving the bottom
# leaves the top four times as deep as the bottom.
max_up = max( [ p.y() for p in check_up ] )
min_low = min( [ p.y() for p in check_low ] )

assert abs( max_up + 4.0 * min_low ) < 1e-6, "SetBORAirfoilPnts did not scale the two surfaces apart"
Parameters:
  • [in] – bor_id string Body of revolution Geom ID

  • [in] – up_pnt_vec vector<vec3d> Vector of points defining the upper surface of the airfoil

  • [in] – low_pnt_vec vector<_>vec3d> Vector of points defining the lower surface of the airfoil

openvsp.vsp.SetBORAirfoilUpperPnts(bor_id, up_pnt_vec)

Set the upper points for an airfoil on a BOR. The BOR XSecCurve must be of type XS_FILE_AIRFOIL.

# Add Body of Recolution
bor_id = AddGeom( "BODYOFREVOLUTION", "" )

ChangeBORXSecShape( bor_id, XS_FILE_AIRFOIL )

ReadBORFileAirfoil( bor_id, "airfoil/N0012_VSP.af" )

up_array = GetBORAirfoilUpperPnts( bor_id )

for i in range(int( len(up_array) )):

    up_array[i].scale_y( 2.0 )

SetBORAirfoilUpperPnts( bor_id, up_array )

# The doubled upper surface has to come back doubled, and the lower surface
# has to be left alone.
check_array = GetBORAirfoilUpperPnts( bor_id )
low_array = GetBORAirfoilLowerPnts( bor_id )

assert len( check_array ) == len( up_array ), "SetBORAirfoilUpperPnts point count"

for i in range( len( up_array ) ):
    assert dist( check_array[i], up_array[i] ) < 1e-6, "SetBORAirfoilUpperPnts did not store point " + str( i )

max_up = max( [ p.y() for p in check_array ] )
min_low = min( [ p.y() for p in low_array ] )

assert abs( max_up + 2.0 * min_low ) < 1e-6, "SetBORAirfoilUpperPnts did not leave the lower surface alone"
Parameters:
  • [in] – bor_id string Body of revolution Geom ID

  • [in] – up_pnt_vec vector<vec3d> Vector of points defining the upper surface of the airfoil

openvsp.vsp.SetBORLowerCST(bor_id, deg, coefs)

Set the CST degree and coefficients for the lower surface of an airfoil of a BOR. The number of coefficients should be one more than the CST degree. The XSecCurve must be of type XS_CST_AIRFOIL See also: GetLowerCSTDegree, GetLowerCSTCoefs :param [in]: bor_id string Body of revolution Geom ID :param [in]: deg int CST degree of lower airfoil surface :param [in]: coefs vector<double> Vector of CST coefficients for the lower airfoil surface

openvsp.vsp.SetBORUpperCST(bor_id, deg, coefs)

Set the CST degree and coefficients for the upper surface of an airfoil of a BOR. The number of coefficients should be one more than the CST degree. The XSecCurve must be of type XS_CST_AIRFOIL See also: GetUpperCSTDegree, GetUpperCSTCoefs :param [in]: bor_id string Body of revolution Geom ID :param [in]: deg int CST degree of upper airfoil surface :param [in]: coefs vector<double> Array of CST coefficients for the upper airfoil surface

openvsp.vsp.SetBORXSecPnts(std: :string const & bor_id, Vec3dVec pnt_vec)
openvsp.vsp.SetBackground(r, g, b)

Set the background color

SetBackground( 1.0, 1.0, 1.0 )                                 # Set background to bright white
Parameters:
  • [in] – r double Red 8-bit unsigned integer (range: 0-255)

  • [in] – g double Green 8-bit unsigned integer (range: 0-255)

  • [in] – b double Blue 8-bit unsigned integer (range: 0-255)

openvsp.vsp.SetBackground3DAbsolutePath(id, fname)

Set absolute path to specified Background3D’s image.

# Add Background3D
bg_id = AddBackground3D()

SetBackground3DAbsolutePath( bg_id, "front.png" )
bg_file = GetBackground3DAbsolutePath( bg_id )

print( bg_file )

# A relative name is resolved against the working directory, so the path that
# comes back ends with the name that was set.
assert bg_file.endswith( "front.png" ), "SetBackground3DAbsolutePath did not take"

DelAllBackground3Ds()
Parameters:
  • [in] – id string Background3D ID

  • [in] – fname string Absolute path to Background3D image file

openvsp.vsp.SetBackground3DRelativePath(id, fname)

Set relative path to specified Background3D’s image. Note that path is relative to the model’s *.vsp3 file. Consequently, if a file has not yet been saved or assigned a file name, the relative path is meaningless.

# Add Background3D
bg_id = AddBackground3D()

SetBackground3DRelativePath( bg_id, "front.png" )
assert GetBackground3DRelativePath( bg_id ) == "front.png", "SetBackground3DRelativePath did not take"

bg_file = GetBackground3DRelativePath( bg_id )

print( bg_file )

DelAllBackground3Ds()
Parameters:
  • [in] – id string Background3D ID

  • [in] – fname string Relative path to Background3D image file

openvsp.vsp.SetCFDMeshVal(int type, double val)
openvsp.vsp.SetCFDSourceName(geom_id, source_index, name)

Get the type of a CFD Mesh source on the specified Geom

#==== Add Pod Geom ====//
pid = AddGeom( "POD", "" )

AddCFDSource( POINT_SOURCE, pid, 0, 0.25, 2.0, 0.5, 0.5 )      # Add A Point Source

assert GetCFDSourceType( pid, 0 ) == POINT_SOURCE, "GetCFDSourceType did not report the type that was added"

# A source of a different type reports differently.
AddCFDSource( LINE_SOURCE, pid, 0, 0.25, 2.0, 0.5, 0.5, 0.25, 2.0, 0.75, 0.75 )

assert GetCFDSourceType( pid, 1 ) == LINE_SOURCE, "GetCFDSourceType did not report the second source"

# An index past the end has to be rejected.  The error queue is reached
# through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

GetCFDSourceType( pid, GetNumCFDSources( pid ) )

assert err_mgr.GetNumTotalErrors() > 0, "GetCFDSourceType accepted an index past the end"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: CFD_MESH_SOURCE_TYPE, GetNumCFDSources, GetCFDSourceName :param [in]: geom_id string Geom ID :param [in]: source_index int Source index :rtype: void :return: int CFD Mesh source type enum (i.e. POINT_SOURCE)

Set the name of a CFD Mesh source on the specified Geom

#==== Add Pod Geom ====//
pid = AddGeom( "POD", "" )

AddCFDSource( POINT_SOURCE, pid, 0, 0.25, 2.0, 0.5, 0.5 )      # Add A Point Source

SetCFDSourceName( pid, 0, "ExampleSource" )

assert GetCFDSourceName( pid, 0 ) == "ExampleSource", "SetCFDSourceName did not take"

# An index past the end has to be rejected.  The error queue is reached
# through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

SetCFDSourceName( pid, GetNumCFDSources( pid ), "ExampleSource" )

assert err_mgr.GetNumTotalErrors() > 0, "SetCFDSourceName accepted an index past the end"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: GetCFDSourceName, GetNumCFDSources :param [in]: geom_id string Geom ID :param [in]: source_index int Source index :param [in]: name string Source name

openvsp.vsp.SetCFDWakeFlag(std: :string const & geom_id, bool flag)
openvsp.vsp.SetComputationFileName(int file_type, std: :string const & file_name)
openvsp.vsp.SetContainerName(parm_container_id, name)

Get the name of the specified Parm Container

veh_id = FindContainer( "Vehicle", 0 )

if  GetContainerName( veh_id) != "Vehicle":
    print( "---> Error: API GetContainerName" )
    assert False, "---> Error: API GetContainerName"
Parameters:

[in] – parm_container_id string Parm Container ID

Return type:

void

Returns:

string Parm Container name

Set the name of the specified Parm Container. This is the general counterpart to GetContainerName and works on any container reached by ID. Containers that derive their name from what they hold, such as an unsteady group, will overwrite it on their next update.

#==== Add Pod Geometry ====//
pid = AddGeom( "POD" )

SetContainerName( pid, "ExampleContainerName" )

assert GetContainerName( pid ) == "ExampleContainerName", "SetContainerName did not take"

# A Geom's container name is its Geom name, so the two agree.
assert GetGeomName( pid ) == "ExampleContainerName", "SetContainerName disagrees with GetGeomName"

# A container that does not exist has to be rejected.  The error queue is
# reached through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

SetContainerName( "NOSUCHCONTAINER", "ExampleContainerName" )

assert err_mgr.GetNumTotalErrors() > 0, "SetContainerName accepted a bad container ID"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: GetContainerName, FindContainer :param [in]: parm_container_id string Parm Container ID :param [in]: name string Parm Container name

openvsp.vsp.SetDoubleAnalysisInput(analysis, name, indata, index=0)

Set the value of a particular analysis input of double type

#==== Analysis: CpSlicer ====//
analysis_name = "CpSlicer"

# Setup cuts
ycuts = []
ycuts.append( 2.0 )
ycuts.append( 4.5 )
ycuts.append( 8.0 )

SetDoubleAnalysisInput( analysis_name, "YSlicePosVec", ycuts, 0 )
assert list( GetDoubleAnalysisInput( analysis_name, "YSlicePosVec", 0 ) ) == list( ycuts ), "SetDoubleAnalysisInput did not take"

See also: GetDoubleAnalysisInput :param [in]: analysis string Analysis name :param [in]: name string Input name :param [in]: indata vector<double> Array of double values to set the input to :param [in]: index int Data index

openvsp.vsp.SetDriverGroup(std: :string const & geom_id, int section_index, int driver_0, int driver_1=-1, int driver_2=-1)
openvsp.vsp.SetEditXSecFixedUVec(xsec_id, fixed_u_vec)

Set the vector of fixed U flags for each control point in an EditCurveXSec. The fixed U flag is used to hold the U parameter of the control point constant when performing an equal arc length reparameterization of the curve.

# Add Wing
wid = AddGeom( "WING" )

# Get First (and Only) XSec Surf
xsec_surf = GetXSecSurf( wid, 0 )

ChangeXSecShape( xsec_surf, 1, XS_EDIT_CURVE )

# Identify XSec 1
xsec_1 = GetXSec( xsec_surf, 1 )

fixed_u_vec = list(GetEditXSecFixedUVec( xsec_1 ))

fixed_u_vec[3] = True # change a flag

SetEditXSecFixedUVec( xsec_1, fixed_u_vec )

assert len( GetEditXSecFixedUVec( xsec_1 ) ) == len( fixed_u_vec ), "SetEditXSecFixedUVec length"

before_pts = GetEditXSecCtrlVec( xsec_1, True )

ReparameterizeEditXSec( xsec_1 )

Update()

# Reparameterizing redistributes U without changing the shape, so the same
# control points are still there.
after_pts = GetEditXSecCtrlVec( xsec_1, True )

assert len( after_pts ) == len( before_pts ), "ReparameterizeEditXSec changed the number of control points"

# The U values stay in order over the unit interval.
u_vec = GetEditXSecUVec( xsec_1 )

assert len( u_vec ) == len( after_pts ), "the U vector does not match the control points"
assert abs( u_vec[0] ) < 1e-9 and abs( u_vec[-1] - 1.0 ) < 1e-9, "the U vector does not span the curve"

for i in range( 1, len( u_vec ) ):
    assert u_vec[i] >= u_vec[i - 1], "the U vector is not increasing at " + str( i )

See also: GetEditXSecFixedUVec, ReparameterizeEditXSec :param [in]: xsec_id string XSec ID :param [in]: fixed_u_vec vector <bool> Array of fixed U flags

openvsp.vsp.SetEditXSecPnts(xsec_id, u_vec, control_pts, r_vec)

Set the U parameter vector and the control point vector for an EditCurveXSec. The arrays must be of equal length, with the values for U defined in increasing order and range 0 - 1. The input control points to SetEditXSecPnts must be nondimensionalized in the approximate range of [-0.5, 0.5].

# Add Stack
sid = AddGeom( "STACK", "" )

# Get First (and Only) XSec Surf
xsec_surf = GetXSecSurf( sid, 0 )

ChangeXSecShape( xsec_surf, 2, XS_EDIT_CURVE )

# Identify XSec 2
xsec_2 = GetXSec( xsec_surf, 2 )

# Set XSec 2 to linear
EditXSecConvertTo( xsec_2, LINEAR )

# Turn off R/L symmetry
SetParmVal( GetXSecParm( xsec_2, "SymType"), SYM_NONE )

# Define a square
xsec2_pts = [vec3d(0.5, 0.5, 0.0),
         vec3d(0.5, -0.5, 0.0),
         vec3d(-0.5, -0.5, 0.0),
         vec3d(-0.5, 0.5, 0.0),
         vec3d(0.5, 0.5, 0.0)]

# u vec must start at 0.0 and end at 1.0
u_vec = [0.0, 0.25, 0.5, 0.75, 1.0]

r_vec = [0.0, 0.0, 0.0, 0.0, 0.0]

SetEditXSecPnts( xsec_2, u_vec, xsec2_pts, r_vec ) # Note: points are unscaled by the width and height parms

new_pnts = GetEditXSecCtrlVec( xsec_2, True ) # The returned control points will not be scaled by width and height

if  dist( new_pnts[3], xsec2_pts[3] ) > 1e-6 :
    print( "Error: SetEditXSecPnts")
    assert False, "Error: SetEditXSecPnts"
Parameters:
  • [in] – xsec_id string XSec ID

  • [in] – u_vec vector <double> Array of U parameter values

  • [in] – r_vec vector <double> Array of R parameter values

  • [in] – control_pts vector <vec3d> Nondimensionalized array of control points

openvsp.vsp.SetFeaAssemblyFileName(assembly_id, file_type, file_name)

Set the name of an FEA Assembly output file

assembly_id = AddFeaAssembly()

SetFeaAssemblyFileName( assembly_id, FEA_CALCULIX_FILE_NAME, "ExampleAssembly.inp" )

assert GetFeaAssemblyFileName( assembly_id, FEA_CALCULIX_FILE_NAME ) == "ExampleAssembly.inp", "SetFeaAssemblyFileName did not take"

# Each output type carries its own name.
assert GetFeaAssemblyFileName( assembly_id, FEA_NASTRAN_FILE_NAME ) != "ExampleAssembly.inp", "setting one output name disturbed another"

See also: GetFeaAssemblyFileName, ComputeFeaAssemblyMesh, FEA_EXPORT_TYPE :param [in]: assembly_id string FEA Assembly ID :param [in]: file_type int FEA output file type enum (i.e. FEA_CALCULIX_FILE_NAME) :param [in]: file_name string Name for the output file

openvsp.vsp.SetFeaAssemblyName(assembly_id, name)

Set the name of an FEA Assembly. The assembly’s export file names are rebuilt from the new name. See also: AddFeaAssembly, GetFeaAssemblyName :param [in]: assembly_id string FEA Assembly ID :param [in]: name string FEA Assembly name

openvsp.vsp.SetFeaMeshFileName(std: :string const & geom_id, int fea_struct_ind, int file_type, std: :string const & file_name)
openvsp.vsp.SetFeaMeshStructIndex(int struct_index)
openvsp.vsp.SetFeaMeshVal(std: :string const & geom_id, int fea_struct_ind, int type, double val)
openvsp.vsp.SetFeaPartName(part_id, name)

Set the name of an FEA Part

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

#==== Add FeaStructure to Pod ====//
struct_ind = AddFeaStruct( pod_id )

#==== Add Bulkead ====//
bulkhead_id = AddFeaPart( pod_id, struct_ind, FEA_SLICE )

SetFeaPartName( bulkhead_id, "Bulkhead" )
assert GetFeaPartName( bulkhead_id ) == "Bulkhead", "SetFeaPartName did not take"

See also: GetFeaPartName :param [in]: part_id string FEA Part ID :param [in]: name string New name for the FEA Part

openvsp.vsp.SetFeaPartPerpendicularSparID(part_id, perpendicular_spar_id)

Set the ID of the perpendicular spar for an FEA Rib or Rib Array. Note, the FEA Rib or Rib Array should have “SPAR_NORMAL” set for the “PerpendicularEdgeType” Parm. If it is not, the ID will still be set, but the orientation of the Rib or Rib Array will not change.

#==== Add Wing Geometry ====//
wing_id = AddGeom( "WING" )

#==== Add FeaStructure to Wing ====//
struct_ind = AddFeaStruct( wing_id )

#==== Add Rib ====//
rib_id = AddFeaPart( wing_id, struct_ind, FEA_RIB )

#==== Add Spars ====//
spar_id_1 = AddFeaPart( wing_id, struct_ind, FEA_SPAR )
spar_id_2 = AddFeaPart( wing_id, struct_ind, FEA_SPAR )

SetParmVal( FindParm( spar_id_1, "RelCenterLocation", "FeaPart" ), 0.25 )
SetParmVal( FindParm( spar_id_2, "RelCenterLocation", "FeaPart" ), 0.75 )

#==== Set Perpendicular Edge type to SPAR ====//
SetParmVal( FindParm( rib_id, "PerpendicularEdgeType", "FeaRib" ), SPAR_NORMAL )

SetFeaPartPerpendicularSparID( rib_id, spar_id_2 )

if  spar_id_2 != GetFeaPartPerpendicularSparID( rib_id ) :
    print( "Error: SetFeaPartPerpendicularSparID" )
    assert False, "Error: SetFeaPartPerpendicularSparID"

See also: FEA_RIB_NORMAL, GetFeaPartPerpendicularSparID :param [in]: part_id string FEA Part ID (Rib or Rib Array Type) :param [in]: perpendicular_spar_id string FEA Spar ID

openvsp.vsp.SetFeaPolySparPtName(pspar_id, index, name)

Set the name of a point in an FEA Poly Spar.

wing_id = AddGeom( "WING" )

struct_ind = AddFeaStruct( wing_id )

pspar_id = AddFeaPart( wing_id, struct_ind, FEA_POLY_SPAR )

SetFeaPolySparPtName( pspar_id, 0, "InboardPt" )
SetFeaPolySparPtName( pspar_id, 1, "OutboardPt" )

if GetFeaPolySparPtName( pspar_id, 0 ) != "InboardPt":
    print( "Error: SetFeaPolySparPtName" )
    assert False, "Error: SetFeaPolySparPtName"

See also: GetFeaPolySparPtName :param [in]: pspar_id string FEA Poly Spar part ID :param [in]: index int Index of the point :param [in]: name string New name for the point

openvsp.vsp.SetFeaStructName(geom_id, fea_struct_ind, name)

Set the name of an FEA Structure

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

#==== Add FeaStructure to Pod ====//
struct_ind = AddFeaStruct( pod_id )

#==== Change the Structure Name ====//
SetFeaStructName( pod_id, struct_ind, "Example_Struct" )
assert GetFeaStructName( pod_id, struct_ind ) == "Example_Struct", "SetFeaStructName did not take"


parm_container_id = FindContainer( "Example_Struct", struct_ind )

display_id = "New Structure Parm Container ID: " + parm_container_id + "\n"

print( display_id )

See also: GetFeaStructName :param [in]: geom_id string Parent Geom ID :param [in]: fea_struct_ind int FEA Structure index :param [in]: name string New name for the FEA Structure

openvsp.vsp.SetFeaSubSurfName(subsurf_id, name)

Set the name of an FEA SubSurface

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

#==== Add FeaStructure to Pod ====//
struct_ind = AddFeaStruct( pod_id )

#==== Add LineArray ====//
line_array_id = AddFeaSubSurf( pod_id, struct_ind, SS_LINE_ARRAY )

SetFeaSubSurfName( line_array_id, "Stiffener_array" )
assert GetFeaSubSurfName( line_array_id ) == "Stiffener_array", "SetFeaSubSurfName did not take"
Parameters:
  • [in] – subsurf_id string FEA SubSurface ID

  • [in] – name string New name for the FEA SubSurface

openvsp.vsp.SetGUIElementDisable(e, state)

Set whether all instances of GUI device type are disabled

SetGUIElementDisable( GDEV_INPUT, True )
Parameters:
  • [in] – e int GDEV enum for GUI device type

  • [in] – state bool True to disable GUI device type

openvsp.vsp.SetGUIScreenDisable(s, state)

Set whether screen is disabled

SetGUIScreenDisable( VSP_CFD_MESH_SCREEN, True )
Parameters:
  • [in] – s int GUI_VSP_SCREEN enum for screen

  • [in] – state bool True to disable screen

openvsp.vsp.SetGeomDisplayType(geom_id, type)

Set the display type of the specified geometry

pid = AddGeom( "POD" )                             # Add Pod for testing

SetGeomDisplayType( pid, DISPLAY_DEGEN_PLATE )                       # Make pod appear as Bezier plate (Degen Geom)

# The display type is display state rather than model state, so there is
# nothing to read back.  What has to hold is that a Geom which does not exist
# is rejected.  The error queue is reached through the error manager
# singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

SetGeomDisplayType( "NOSUCHGEOM", DISPLAY_DEGEN_PLATE )

assert err_mgr.GetNumTotalErrors() > 0, "SetGeomDisplayType accepted a bad Geom ID"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: DISPLAY_TYPE :param [in]: geom_id string Geom ID :param [in]: type int Display type enum (i.e. DISPLAY_BEZIER)

openvsp.vsp.SetGeomDrawType(geom_id, type)

Set the draw type of the specified geometry

pid = AddGeom( "POD", "" )                             # Add Pod for testing

SetGeomDrawType( pid, GEOM_DRAW_SHADE )                       # Make pod appear as shaded

# The draw type is display state rather than model state, so there is nothing
# to read back.  What has to hold is that a Geom which does not exist is
# rejected.  The error queue is reached through the error manager singleton
# in Python.
err_mgr = ErrorMgrSingleton.getInstance()

SetGeomDrawType( "NOSUCHGEOM", GEOM_DRAW_SHADE )

assert err_mgr.GetNumTotalErrors() > 0, "SetGeomDrawType accepted a bad Geom ID"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: DRAW_TYPE :param [in]: geom_id string Geom ID :param [in]: type int Draw type enum (i.e. GEOM_DRAW_SHADE)

openvsp.vsp.SetGeomMaterialName(std: :string const & geom_id, std: :string const & name)
openvsp.vsp.SetGeomName(geom_id, name)

Set the name of the specified Geom

#==== Add Pod Geometry ====//
pid = AddGeom( "POD", "" )

SetGeomName( pid, "ExamplePodName" )

geom_ids = FindGeomsWithName( "ExamplePodName" )

if  len(geom_ids) != 1 :
    print( "---> Error: API FindGeomsWithName " )
    assert False, "---> Error: API FindGeomsWithName"
Parameters:
  • [in] – geom_id string Geom ID

  • [in] – name string Geom name

openvsp.vsp.SetGeomParent(geom_id, parent_id)

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

#==== Reparent two PodGeoms ====#
pod1 = AddGeom( "POD" )
pod2 = AddGeom( "POD", pod1 )
pod3 = AddGeom ("POD" )

veh_id = GetVehicleID()

SetGeomParent( pod2, veh_id )
SetGeomParent( pod3, pod1 )

pod2_parent = GetGeomParent( pod2 )
pod3_parent = GetGeomParent( pod3 )

if ( pod2_parent != "NONE" or pod3_parent != pod1 ):
    print( "SetGeomParent error!" )
    assert False, "SetGeomParent error!"
Parameters:
  • [in] – geom_id string Geom ID

  • [in] – parent_id string Parent Geom ID

openvsp.vsp.SetGeomScreenDisable(s, state)

Set whether geom screen is disabled

SetGeomScreenDisable( ALL_GEOM_SCREENS, True )
Parameters:
  • [in] – s int GUI_GEOM_SCREEN enum for geom screen

  • [in] – state bool True to disable geom screen

openvsp.vsp.SetGeomWireColor(geom_id, r, g, b)

Set the wireframe color of the specified geometry

pid = AddGeom( "POD", "" )

SetGeomWireColor( pid, 0, 0, 255 )

# The colour is display state rather than model state, so there is nothing to
# read back.  What has to hold is that a Geom which does not exist is
# rejected.  The error queue is reached through the error manager singleton
# in Python.
err_mgr = ErrorMgrSingleton.getInstance()

SetGeomWireColor( "NOSUCHGEOM", 0, 0, 255 )

assert err_mgr.GetNumTotalErrors() > 0, "SetGeomWireColor accepted a bad Geom ID"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()
Parameters:
  • [in] – geom_id string Geom ID

  • [in] – r int Red component of color [0, 255]

  • [in] – g int Green component of color [0, 255]

  • [in] – b int Blue component of color [0, 255]

openvsp.vsp.SetGroupName(group_id, group_name)

Set Variable Preset group name

# Add Pod Geom
pod1 = AddGeom( "POD", "" )

gid = AddVarPresetGroup( "Tess" )

SetGroupName( gid, "Resolution" )
assert GetGroupName( gid ) == "Resolution", "SetGroupName did not take"
Parameters:
  • [in] – group_id string Var Preset Group ID

  • [in] – group_name string New Var Preset Group name

openvsp.vsp.SetIntAnalysisInput(analysis, name, indata, index=0)

Set the value of a particular analysis input of integer type

#==== Analysis: VSPAero Compute Geometry ====//
analysis_name = "VSPAEROComputeGeometry"

# Set to panel method
thick_set = GetIntAnalysisInput( analysis_name, "GeomSet" )
thin_set = GetIntAnalysisInput( analysis_name, "ThinGeomSet" )

thick_set = [vsp.SET_NONE]
thin_set = [vsp.SET_ALL]

SetIntAnalysisInput( analysis_name, "GeomSet", thick_set )
assert list( GetIntAnalysisInput( analysis_name, "GeomSet" ) ) == list( thick_set ), "SetIntAnalysisInput did not take"

SetIntAnalysisInput( analysis_name, "ThinGeomSet", thin_set )

See also: GetIntAnalysisInput :param [in]: analysis string Analysis name :param [in]: name string Input name :param [in]: indata vector<int> Array of integer values to set the input to :param [in]: index int Data index

openvsp.vsp.SetIntersectSubSurfGeomID(std: :string const & sub_id, std: :string const & geom_id)
openvsp.vsp.SetLowerCST(xsec_id, deg, coefs)

Set the CST degree and coefficients for the lower surface of an airfoil. The number of coefficients should be one more than the CST degree. The XSec must be of type XS_CST_AIRFOIL See also: GetLowerCSTDegree, GetLowerCSTCoefs :param [in]: xsec_id string XSec ID :param [in]: deg int CST degree of lower airfoil surface :param [in]: coefs vector<double> Vector of CST coefficients for the lower airfoil surface

openvsp.vsp.SetModeName(mid, name)

Set the name of a Mode.

mid = CreateAndAddMode( "FatWetAreas", SET_ALL, SET_NONE )

SetModeName( mid, "RenamedMode" )

assert GetModeName( mid ) == "RenamedMode", "SetModeName did not take"

# Renaming one Mode leaves the others alone.
mid2 = CreateAndAddMode( "ThinAero", SET_ALL, SET_NONE )

SetModeName( mid, "RenamedAgain" )

assert GetModeName( mid2 ) == "ThinAero", "renaming one Mode disturbed another"

See also: CreateAndAddMode, GetModeName :param [in]: mid string Mode ID :param [in]: name string Mode name

openvsp.vsp.SetPCurve(geom_id, pcurveid, tvec, valvec, newtype)

Set the parameters, values, and curve type of a propeller blade curve (P Curve) See also: PCURV_TYPE :param [in]: geom_id string Parent Geom ID :param [in]: pcurveid int P Curve index :param [in]: tvec vector <double> Array of parameter values :param [in]: valvec vector <double> Array of values :param [in]: newtype int Curve type enum (i.e. CEDIT)

openvsp.vsp.SetParmDescript(parm_id, desc)

Set the description of the specified Parm

pod_id = AddGeom( "POD" )

length = FindParm( pod_id, "Length", "Design" )

SetParmValLimits( length, 10.0, 0.001, 1.0e12 )

SetParmDescript( length, "Total Length of Geom" )
assert GetParmDescript( length ) == "Total Length of Geom", "SetParmDescript did not take"
Parameters:
  • [in] – parm_id string Parm ID

  • [in] – desc string Parm description

openvsp.vsp.SetParmLinkAParm(link_id, parm_id)

Set the driving Parm of a Parm Link

pod1 = AddGeom( "POD", "" )
pod2 = AddGeom( "POD", "" )

xa = GetParm( pod1, "X_Rel_Location", "XForm" )
xb = GetParm( pod2, "X_Rel_Location", "XForm" )

link_id = AddParmLink( xa, xb )

ya = GetParm( pod1, "Y_Rel_Location", "XForm" )

SetParmLinkAParm( link_id, ya )

assert GetParmLinkAParm( link_id ) == ya, "SetParmLinkAParm did not take"

# The driven end is left alone.
assert GetParmLinkBParm( link_id ) == xb, "SetParmLinkAParm disturbed the driven Parm"

See also: AddParmLink, GetParmLinkAParm :param [in]: link_id string Parm Link ID :param [in]: parm_id string Parm ID of the driving Parm

openvsp.vsp.SetParmLinkBParm(link_id, parm_id)

Set the driven Parm of a Parm Link

pod1 = AddGeom( "POD", "" )
pod2 = AddGeom( "POD", "" )

xa = GetParm( pod1, "X_Rel_Location", "XForm" )
xb = GetParm( pod2, "X_Rel_Location", "XForm" )

link_id = AddParmLink( xa, xb )

yb = GetParm( pod2, "Y_Rel_Location", "XForm" )

SetParmLinkBParm( link_id, yb )

assert GetParmLinkBParm( link_id ) == yb, "SetParmLinkBParm did not take"

# The driving end is left alone.
assert GetParmLinkAParm( link_id ) == xa, "SetParmLinkBParm disturbed the driving Parm"

See also: AddParmLink, GetParmLinkBParm :param [in]: link_id string Parm Link ID :param [in]: parm_id string Parm ID of the driven Parm

openvsp.vsp.SetParmLinkLowerLimitFlag(link_id, flag)

Set whether a Parm Link applies its lower limit. The value itself is the link’s LowerLimit Parm, reached with FindParm on the link ID.

pod1 = AddGeom( "POD", "" )
pod2 = AddGeom( "POD", "" )

link_id = AddParmLink( GetParm( pod1, "X_Rel_Location", "XForm" ), GetParm( pod2, "X_Rel_Location", "XForm" ) )

SetParmLinkLowerLimitFlag( link_id, True )

assert GetParmLinkLowerLimitFlag( link_id ), "the lower limit flag did not take"

SetParmLinkLowerLimitFlag( link_id, False )

assert not GetParmLinkLowerLimitFlag( link_id ), "the lower limit flag did not clear"

# The value it applies is a Parm on the link itself.
assert len( FindParm( link_id, "LowerLimit", "Link" ) ) > 0, "the link carries no LowerLimit Parm"

See also: GetParmLinkLowerLimitFlag, AddParmLink :param [in]: link_id string Parm Link ID :param [in]: flag bool True to apply the lower limit

openvsp.vsp.SetParmLinkOffsetFlag(link_id, flag)

Set whether a Parm Link applies its offset. The value itself is the link’s Offset Parm, reached with FindParm on the link ID.

pod1 = AddGeom( "POD", "" )
pod2 = AddGeom( "POD", "" )

link_id = AddParmLink( GetParm( pod1, "X_Rel_Location", "XForm" ), GetParm( pod2, "X_Rel_Location", "XForm" ) )

SetParmLinkOffsetFlag( link_id, True )

assert GetParmLinkOffsetFlag( link_id ), "the offset flag did not take"

SetParmLinkOffsetFlag( link_id, False )

assert not GetParmLinkOffsetFlag( link_id ), "the offset flag did not clear"

# The value it applies is a Parm on the link itself.
assert len( FindParm( link_id, "Offset", "Link" ) ) > 0, "the link carries no Offset Parm"

See also: GetParmLinkOffsetFlag, AddParmLink :param [in]: link_id string Parm Link ID :param [in]: flag bool True to apply the offset

openvsp.vsp.SetParmLinkScaleFlag(link_id, flag)

Set whether a Parm Link applies its scale. The value itself is the link’s Scale Parm, reached with FindParm on the link ID.

pod1 = AddGeom( "POD", "" )
pod2 = AddGeom( "POD", "" )

link_id = AddParmLink( GetParm( pod1, "X_Rel_Location", "XForm" ), GetParm( pod2, "X_Rel_Location", "XForm" ) )

SetParmLinkScaleFlag( link_id, True )

assert GetParmLinkScaleFlag( link_id ), "the scale flag did not take"

SetParmLinkScaleFlag( link_id, False )

assert not GetParmLinkScaleFlag( link_id ), "the scale flag did not clear"

# The value it applies is a Parm on the link itself.
assert len( FindParm( link_id, "Scale", "Link" ) ) > 0, "the link carries no Scale Parm"

See also: GetParmLinkScaleFlag, AddParmLink :param [in]: link_id string Parm Link ID :param [in]: flag bool True to apply the scale

openvsp.vsp.SetParmLinkUpperLimitFlag(link_id, flag)

Set whether a Parm Link applies its upper limit. The value itself is the link’s UpperLimit Parm, reached with FindParm on the link ID.

pod1 = AddGeom( "POD", "" )
pod2 = AddGeom( "POD", "" )

link_id = AddParmLink( GetParm( pod1, "X_Rel_Location", "XForm" ), GetParm( pod2, "X_Rel_Location", "XForm" ) )

SetParmLinkUpperLimitFlag( link_id, True )

assert GetParmLinkUpperLimitFlag( link_id ), "the upper limit flag did not take"

SetParmLinkUpperLimitFlag( link_id, False )

assert not GetParmLinkUpperLimitFlag( link_id ), "the upper limit flag did not clear"

# The value it applies is a Parm on the link itself.
assert len( FindParm( link_id, "UpperLimit", "Link" ) ) > 0, "the link carries no UpperLimit Parm"

See also: GetParmLinkUpperLimitFlag, AddParmLink :param [in]: link_id string Parm Link ID :param [in]: flag bool True to apply the upper limit

openvsp.vsp.SetParmLowerLimit(parm_id, val)

Set the lower limit value for the specified Parm

# Add Fuselage Geom
fuseid = AddGeom( "FUSELAGE", "" )

xsec_surf = GetXSecSurf( fuseid, 0 )

ChangeXSecShape( xsec_surf, GetNumXSec( xsec_surf ) - 1, XS_ROUNDED_RECTANGLE )

xsec = GetXSec( xsec_surf, GetNumXSec( xsec_surf ) - 1 )

wid = GetXSecParm( xsec, "RoundedRect_Width" )

SetParmVal( wid, 13.0 )

SetParmLowerLimit( wid, 15.0 )

if  abs( GetParmVal( wid ) - 15 ) > 1e-6 :
    print( "---> Error: API SetParmLowerLimit " )
    assert False, "---> Error: API SetParmLowerLimit"

See also: SetParmValLimits :param [in]: parm_id string Parm ID :param [in]: val double Parm lower limit

openvsp.vsp.SetParmUpperLimit(parm_id, val)

Set the upper limit value for the specified Parm

# Add Fuselage Geom
fuseid = AddGeom( "FUSELAGE", "" )

xsec_surf = GetXSecSurf( fuseid, 0 )

ChangeXSecShape( xsec_surf, GetNumXSec( xsec_surf ) - 1, XS_ROUNDED_RECTANGLE )

xsec = GetXSec( xsec_surf, GetNumXSec( xsec_surf ) - 1 )

wid = GetXSecParm( xsec, "RoundedRect_Width" )

SetParmVal( wid, 23.0 )

SetParmUpperLimit( wid, 13.0 )

if  abs( GetParmVal( wid ) - 13 ) > 1e-6 :
    print( "---> Error: API SetParmUpperLimit " )
    assert False, "---> Error: API SetParmUpperLimit"

See also: SetParmValLimits :param [in]: parm_id string Parm ID :param [in]: val double Parm upper limit

openvsp.vsp.SetParmVal(*args)

Overload 1:

Set the value of the specified Parm.

# Add Fuselage Geom
fuseid = AddGeom( "FUSELAGE", "" )

xsec_surf = GetXSecSurf( fuseid, 0 )

ChangeXSecShape( xsec_surf, GetNumXSec( xsec_surf ) - 1, XS_ROUNDED_RECTANGLE )

xsec = GetXSec( xsec_surf, GetNumXSec( xsec_surf ) - 1 )

wid = GetXSecParm( xsec, "RoundedRect_Width" )

SetParmVal( wid, 23.0 )

if  abs( GetParmVal( wid ) - 23 ) > 1e-6 :
    print( "---> Error: API Parm Val Set/Get " )
    assert False, "---> Error: API Parm Val Set/Get"

See also: SetParmValUpdate :param [in]: parm_id string Parm ID :param [in]: val double Parm value to set :rtype: float :return: double Value that the Parm was set to


Overload 2:

Set the value of the specified Parm.

# Add Fuselage Geom
fuseid = AddGeom( "FUSELAGE", "" )

xsec_surf = GetXSecSurf( fuseid, 0 )

ChangeXSecShape( xsec_surf, GetNumXSec( xsec_surf ) - 1, XS_ROUNDED_RECTANGLE )

xsec = GetXSec( xsec_surf, GetNumXSec( xsec_surf ) - 1 )

wid = GetXSecParm( xsec, "RoundedRect_Width" )

SetParmVal( wid, 23.0 )

if  abs( GetParmVal( wid ) - 23 ) > 1e-6 :
    print( "---> Error: API Parm Val Set/Get " )
    assert False, "---> Error: API Parm Val Set/Get"

See also: SetParmValUpdate :param [in]: geom_id string Geom ID :param [in]: name string Parm name :param [in]: group string Parm group name :param [in]: val double Parm value to set :rtype: float :return: double Value that the Parm was set to

openvsp.vsp.SetParmValLimits(parm_id, val, lower_limit, upper_limit)

Set the value along with the upper and lower limits of the specified Parm

pod_id = AddGeom( "POD" )

length = FindParm( pod_id, "Length", "Design" )

SetParmValLimits( length, 10.0, 0.001, 1.0e12 )

SetParmDescript( length, "Total Length of Geom" )

# The value and both limits have to take.
assert abs( GetParmVal( length ) - 10.0 ) < 1e-9, "SetParmValLimits did not take"
assert abs( GetParmLowerLimit( length ) - 0.001 ) < 1e-9, "SetParmValLimits did not take"
assert abs( GetParmUpperLimit( length ) - 1.0e12 ) < 1.0, "SetParmValLimits did not take"

assert GetParmDescript( length ) == "Total Length of Geom", "SetParmDescript did not take"

# The limits are limits, so a value outside them gets clamped.
SetParmVal( length, -1.0 )

assert abs( GetParmVal( length ) - 0.001 ) < 1e-9, "the lower limit did not hold"

See also: SetParmLowerLimit, SetParmUpperLimit :param [in]: parm_id string Parm ID :param [in]: val double Parm value to set :param [in]: lower_limit double Parm lower limit :param [in]: upper_limit double Parm upper limit :rtype: float :return: double Value that the Parm was set to

openvsp.vsp.SetParmValUpdate(*args)

Overload 1:

Set the value of the specified Parm and force an Update.

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

parm_id = GetParm( pod_id, "X_Rel_Location", "XForm" )

SetParmValUpdate( parm_id, 5.0 )

assert abs( GetParmVal( parm_id ) - 5.0 ) < 1e-9, "SetParmValUpdate"

See also: SetParmVal :param [in]: parm_id string Parm ID :param [in]: val double Parm value to set :rtype: float :return: double Value that the Parm was set to


Overload 2:

Set the value of the specified Parm and force an Update.

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

parm_id = GetParm( pod_id, "X_Rel_Location", "XForm" )

SetParmValUpdate( parm_id, 5.0 )

assert abs( GetParmVal( parm_id ) - 5.0 ) < 1e-9, "SetParmValUpdate"

See also: SetParmVal :param [in]: geom_id string Geom ID :param [in]: parm_name string Parm name :param [in]: parm_group_name string Parm group name :param [in]: val double Parm value to set :rtype: float :return: double Value that the Parm was set to

openvsp.vsp.SetRoutingPtParentID(pt_id, parent_id)

Set the Geom ID of the geom a routing point is anchored to.

pod1 = vsp.AddGeom('POD', '')

pod2 = vsp.AddGeom('POD', '')
ypod2 = vsp.GetParm(pod2, 'Y_Rel_Location', 'XForm')
vsp.SetParmVal(ypod2, 2.0)

routing_geom = vsp.AddGeom('ROUTING', '')

rpt0 = vsp.AddRoutingPt(routing_geom, pod1, 0)
u0 = vsp.GetParm( rpt0, 'U', 'RoutePt')
vsp.SetParmVal(u0, 0.0)

rpt1 = vsp.AddRoutingPt(routing_geom, pod2, 0)

rpt2 = vsp.AddRoutingPt(routing_geom, pod1, 0)
u2 = vsp.GetParm( rpt2, 'U', 'RoutePt')
vsp.SetParmVal(u2, 1.0)

vsp.SetRoutingPtParentID(rpt1, pod1)

See also: AddRoutingPt, DelAllRoutingPt, GetAllRoutingPtIds :param [in]: pt_id string ParmContainer ID of desired routing point :param [in]: parent_id string Geom ID for the geom to anchor the routing point to

openvsp.vsp.SetSetFlag(geom_id, set_index, flag)

Set whether or not a Geom is a member of the set at specified set index

# Add Fuselage Geom
fuseid = AddGeom( "FUSELAGE", "" )

SetSetFlag( fuseid, 3, True )

if not GetSetFlag(fuseid, 3):
    print("---> Error: API Set/Get Set Flag")
    assert False, "---> Error: API Set/Get Set Flag"
Parameters:
  • [in] – geom_id string Geom ID

  • [in] – set_index int Set index

  • [in] – flag bool Flag that indicates set membership

openvsp.vsp.SetSetName(index, name)

Set the name of a set at specified index

SetSetName( 3, "SetFromScript" )

if GetSetName(3) != "SetFromScript":
    print("---> Error: API Get/Set Set Name")
    assert False, "---> Error: API Get/Set Set Name"

See also: SET_TYPE :param [in]: index int Set index :param [in]: name string Set name

openvsp.vsp.SetSettingName(setting_id, setting_name)

Set Variable Preset Setting name

# Add Pod Geom
pod1 = AddGeom( "POD", "" )

gid = AddVarPresetGroup( "Tess" )

sid = AddVarPresetSetting( gid, "Coarse" )

SetSettingName( sid, "Low" )
assert GetSettingName( sid ) == "Low", "SetSettingName did not take"
Parameters:
  • [in] – setting_id string Var Preset Setting ID

  • [in] – setting_name string New Var Preset Setting name

openvsp.vsp.SetShowBorders(brdr)

Toggle viewing the border frame

SetShowBorders( False )                                        # Turn off red/black border on active window
Parameters:

[in] – brdr bool True to show the border frame, false to hide the border frame

openvsp.vsp.SetStringAnalysisInput(analysis, name, indata, index=0)

Set the value of a particular analysis input of string type

fileNameInput = GetStringAnalysisInput( "ParasiteDrag", "FileName" )

fileNameInput = ["ParasiteDragExample"]

SetStringAnalysisInput( "ParasiteDrag", "FileName", fileNameInput )
assert list( GetStringAnalysisInput( "ParasiteDrag", "FileName" ) ) == list( fileNameInput ), "SetStringAnalysisInput did not take"

See also: GetStringAnalysisInput :param [in]: analysis string Analysis name :param [in]: name string Input name :param [in]: indata vector<string> Array of string values to set the input to :param [in]: index int Data index

openvsp.vsp.SetSubSurfName(*args)

Overload 1:

Set the name of the specified sub-surface

wid = AddGeom( "WING", "" )                             # Add Wing

ss_rec_id = AddSubSurf( wid, SS_RECTANGLE )                        # Add Sub Surface Rectangle

new_name = "New_SS_Rec_Name"

SetSubSurfName( wid, ss_rec_id, new_name )
assert GetSubSurfName( wid, ss_rec_id ) == new_name, "SetSubSurfName did not take"
Parameters:
  • [in] – geom_id string Geom ID

  • [in] – sub_id string Sub-surface ID

  • [in] – name string Sub-surface name


Overload 2:

Set the name of the specified sub-surface

wid = AddGeom( "WING", "" )                             # Add Wing

ss_rec_id = AddSubSurf( wid, SS_RECTANGLE )                        # Add Sub Surface Rectangle

new_name = "New_SS_Rec_Name"

SetSubSurfName( ss_rec_id, new_name )
assert GetSubSurfName( ss_rec_id ) == new_name, "SetSubSurfName did not take"
Parameters:
  • [in] – sub_id string Sub-surface ID

  • [in] – name string Sub-surface name

openvsp.vsp.SetUpperCST(xsec_id, deg, coefs)

Set the CST degree and coefficients for the upper surface of an airfoil. The number of coefficients should be one more than the CST degree. The XSec must be of type XS_CST_AIRFOIL See also: GetUpperCSTDegree, GetUpperCSTCoefs :param [in]: xsec_id string XSec ID :param [in]: deg int CST degree of upper airfoil surface :param [in]: coefs vector<double> Vector of CST coefficients for the upper airfoil surface

openvsp.vsp.SetVSP3FileName(file_name)

Set the file name of a OpenVSP project

fid = AddGeom( "FUSELAGE", "" )             # Add Fuselage

fname = "example_fuse.vsp3"

SetVSP3FileName( fname )

# A relative name is resolved against the working directory, so ask for the
# resolved name rather than assuming it comes back verbatim.
full_name = GetVSPFileName()

Update()

#==== Save Vehicle to File ====//
print( "\tSaving vehicle file to: ", False )

print( fname )

WriteVSPFile( GetVSPFileName(), SET_ALL )

#==== Reset Geometry ====//
print( "--->Resetting VSP model to blank slate\n" )

ClearVSPModel()

assert len( FindGeoms() ) == 0, "ClearVSPModel left Geoms behind"

ReadVSPFile( fname )

# The Fuselage has to come back, and come back the same shape.
geoms = FindGeoms()

assert len( geoms ) == 1, "ReadVSPFile did not restore the model"
assert GetGeomTypeName( geoms[0] ) == "Fuselage", "ReadVSPFile restored the wrong Geom type"
assert GetVSPFileName() == full_name, "ReadVSPFile did not set the project file name"
Parameters:

[in] – file_name string File name

openvsp.vsp.SetVSPAEROControlGroupName(name, CSGroupIndex)

Set the name for the control surface group at the specified index

wid = AddGeom( "WING", "" ) # Add Wing

aileron_id = AddSubSurf( wid, SS_CONTROL ) # Add Control Surface Sub-Surface

group_index = CreateVSPAEROControlSurfaceGroup() # Empty control surface group

SetVSPAEROControlGroupName( "Example_CS_Group", group_index )

assert GetVSPAEROControlGroupName( group_index ) == "Example_CS_Group", "SetVSPAEROControlGroupName did not take"

print( "CS Group name: ", False )

print( GetVSPAEROControlGroupName( group_index ) )
Parameters:
  • [in] – name string Name to set for the control surface group

  • [in] – CSGroupIndex int Index of the control surface group

openvsp.vsp.SetVSPAEROPath(path)

Set the path to the VSPAERO executables (Solver, Viewer, and Slicer). By default, OpenVSP will assume that the VSPAERO executables are in the same directory as the VSP executable. However, this may need to be changed when using certain API languages like MATLAB and Python. For example, Python may treat the location of the Python executable as the VSP executable path, so either the VSPAERO executable needs to be moved to the same directory or this function can be called to tell Python where to look for VSPAERO.

orig_path = GetVSPAEROPath()

if  not CheckForVSPAERO( GetVSPExePath() ) :
    vspaero_path = "C:/Users/example_user/Documents/OpenVSP_3.4.5"
    SetVSPAEROPath( vspaero_path )

# A directory with no VSPAERO in it has to be rejected, and rejecting it
# must leave the stored path alone.
assert not SetVSPAEROPath( "/no/such/directory/anywhere" ), "SetVSPAEROPath accepted a nonexistent directory"

assert GetVSPAEROPath() == orig_path, "a rejected SetVSPAEROPath changed the stored path"

See also: GetVSPExePath, CheckForVSPAERO, GetVSPAEROPath :param [in]: path string Absolute path to directory containing VSPAERO executable :rtype: boolean :return: bool Flag that indicates whether or not the path was set correctly

openvsp.vsp.SetVSPAERORefWingID(geom_id)

Set the current VSPAERO reference Geom ID

#==== Add Wing Geom and set some parameters =====//
wing_id = AddGeom( "WING" )

SetGeomName( wing_id, "MainWing" )

#==== Add Vertical tail and set some parameters =====//
vert_id = AddGeom( "WING" )

SetGeomName( vert_id, "Vert" )

SetParmValUpdate( vert_id, "TotalArea", "WingGeom", 10.0 )
SetParmValUpdate( vert_id, "X_Rel_Location", "XForm", 8.5 )
SetParmValUpdate( vert_id, "X_Rel_Rotation", "XForm", 90 )

#==== Set VSPAERO Reference lengths & areas ====//
SetVSPAERORefWingID( wing_id ) # Set as reference wing for VSPAERO

print( "VSPAERO Reference Wing ID: ", False )

print( GetVSPAERORefWingID() )

assert GetVSPAERORefWingID() == wing_id, "SetVSPAERORefWingID did not take"

# Naming a Geom that does not exist has to be rejected.  The error queue is
# reached through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

SetVSPAERORefWingID( "NOSUCHGEOM" )

assert err_mgr.GetNumTotalErrors() > 0, "SetVSPAERORefWingID accepted a bad Geom ID"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()
Parameters:

[in] – geom_id string Reference Geom ID

openvsp.vsp.SetVSPHelpPath(path)

Set the path to the OpenVSP help files. By default, OpenVSP will assume that the OpenVSP help directory is in the same directory as the VSP executable. However, this may need to be changed when using certain API languages like MATLAB and Python. For example, Python may treat the location of the Python executable as the VSP executable path, so either the VSPAERO executable needs to be moved to the same directory or this function can be called to tell Python where to look for help.

orig_path = GetVSPHelpPath()

if  not CheckForVSPHelp( GetVSPExePath() ) :
    vsphelp_path = "C:/Users/example_user/Documents/OpenVSP_3.4.5/help"
    SetVSPHelpPath( vsphelp_path )

# A directory with no help files in it has to be rejected, and rejecting it
# must leave the stored path alone.
assert not SetVSPHelpPath( "/no/such/directory/anywhere" ), "SetVSPHelpPath accepted a nonexistent directory"

assert GetVSPHelpPath() == orig_path, "a rejected SetVSPHelpPath changed the stored path"

See also: GetVSPExePath, CheckForVSPHelp, GetVSPHelpPath :param [in]: path string Absolute path to directory containing OpenVSP help files :rtype: boolean :return: bool Flag that indicates whether or not the path was set correctly

openvsp.vsp.SetVarPresetParmVal(group_id, setting_id, parm_id, parm_val)

Set value for Parm in Var Preset Setting

# Add Pod Geom
pod1 = AddGeom( "POD", "" )

gid = AddVarPresetGroup( "Tess" )

sid = AddVarPresetSetting( gid, "Coarse" )

p1 = FindParm( pod1, "Tess_U", "Shape" )

AddVarPresetParm( gid, p1 )

SetVarPresetParmVal( gid, sid, p1, 51 )
assert abs( GetVarPresetParmVal( gid, sid, p1 ) - 51 ) < 1e-9, "SetVarPresetParmVal did not take"
Parameters:
  • [in] – group_id string Var Preset Group ID

  • [in] – setting_id string Var Preset Setting ID

  • [in] – parm_id string Var Parm ID

  • [in] – parm_val double Parm value

openvsp.vsp.SetVarPresetParmVals(setting_id, parm_vals)

Set Parm values for Variable Preset Setting

# Add Pod Geom
pod1 = AddGeom( "POD", "" )

gid = AddVarPresetGroup( "Tess" )

sid = AddVarPresetSetting( gid, "Coarse" )

p1 = FindParm( pod1, "Tess_U", "Shape" )

AddVarPresetParm( gid, p1 )

vals = [ 45 ]

SetVarPresetParmVals( sid, vals )

assert list( GetVarPresetParmVals( sid ) ) == list( vals ), "SetVarPresetParmVals did not take"
Parameters:
  • [in] – setting_id string Var Preset Setting ID

  • [in] – parm_vals array<double> Array of Variable Preset Group Parm values

openvsp.vsp.SetVec3dAnalysisInput(analysis, name, indata, index=0)

Set the value of a particular analysis input of vec3d type

# PlanarSlice
norm = GetVec3dAnalysisInput( "PlanarSlice", "Norm" )

norm[0].set_xyz( 0.23, 0.6, 0.15 )

SetVec3dAnalysisInput( "PlanarSlice", "Norm", norm )
# The Python binding does not expose vec3d equality, so compare components.
norm_back = GetVec3dAnalysisInput( "PlanarSlice", "Norm" )
assert len( norm_back ) == len( norm ), "SetVec3dAnalysisInput length"
for i in range( len( norm ) ):
    assert abs( norm_back[i].x() - norm[i].x() ) < 1e-9, "SetVec3dAnalysisInput x"
    assert abs( norm_back[i].y() - norm[i].y() ) < 1e-9, "SetVec3dAnalysisInput y"
    assert abs( norm_back[i].z() - norm[i].z() ) < 1e-9, "SetVec3dAnalysisInput z"

See also: GetVec3dAnalysisInput :param [in]: analysis string Analysis name :param [in]: name string Input name :param [in]: indata vector<vec3d> Array of vec3d values to set the input to :param [in]: index int Data index

openvsp.vsp.SetView(viewport, view)

Set the view of a particular viewports

SetView( 0, CAM_CENTER )
Parameters:
  • [in] – viewport int Viewport to set view

  • [in] – view int CAMERA_VIEW enum

openvsp.vsp.SetViewAxis(vaxis)

Toggle viewing the axis

SetViewAxis( False )                                           # Turn off axis marker in corner of viewscreen
Parameters:

[in] – vaxis bool True to show the axis, false to hide the axis

openvsp.vsp.SetWindowLayout(r, c)

Set the rows and columns of the window layout

SetWindowLayout( 2, 2 )
Parameters:
  • [in] – r int Number of viewport rows

  • [in] – c int Number of viewport columns

openvsp.vsp.SetXSecAlias(id, alias)

Set XSec Alias by ID

# Add Stack
sid = AddGeom( "STACK", "" )

# Get First (and Only) XSec Surf
xsec_surf = GetXSecSurf( sid, 0 )

# Identify XSec 1
xsec_1 = GetXSec( xsec_surf, 1 )

# Set Alias and verify alias match
alias = "XSec_One_Alias"

SetXSecAlias( xsec_1, alias )

get_alias = GetXSecAlias( xsec_1 )

if alias != get_alias:
    print("SetXSecAlias/GetXSecAlias error!")
    assert False, "SetXSecAlias/GetXSecAlias error!"
Parameters:
  • [in] – id string XSec ID

  • [in] – alias string Xsec alias

openvsp.vsp.SetXSecContinuity(std: :string const & xsec_id, int cx)
openvsp.vsp.SetXSecCurvatures(std: :string const & xsec_id, int side, double top, double right, double bottom, double left)
openvsp.vsp.SetXSecCurveAlias(id, alias)

Set XSecCurve Alias by XSec ID

# Add Stack
sid = AddGeom( "STACK", "" )

# Get First (and Only) XSec Surf
xsec_surf = GetXSecSurf( sid, 0 )

# Identify XSec 1
xsec_1 = GetXSec( xsec_surf, 1 )

# Set Alias and verify alias match
alias = "XSecCurve_One_Alias"

SetXSecCurveAlias( xsec_1, alias )

get_alias = GetXSecCurveAlias( xsec_1 )

if alias != get_alias:
    print("SetXSecCurveAlias/GetXSecCurveAlias error!")
    assert False, "SetXSecCurveAlias/GetXSecCurveAlias error!"
Parameters:
  • [in] – id string XSec ID

  • [in] – alias string XsecCurve alias

openvsp.vsp.SetXSecHeight(xsec_id, h)

Set the height of an XSec. Note that POINT type XSecs have a width and height of 0, regardless of what is input to SetXSecHeight.

# Add Stack
sid = AddGeom( "STACK", "" )

# Get First (and Only) XSec Surf
xsec_surf = GetXSecSurf( sid, 0 )

# Identify XSec 2
xsec_2 = GetXSec( xsec_surf, 2 )

SetXSecHeight( xsec_2, 1.5 )
assert abs( GetXSecHeight( xsec_2 ) - 1.5 ) < 1e-9, "SetXSecHeight did not take"

See also: GetXSecHeight :param [in]: xsec_id string XSec ID :param [in]: h double Xsec height

openvsp.vsp.SetXSecPnts(std: :string const & xsec_id, Vec3dVec pnt_vec)
openvsp.vsp.SetXSecSurfGlobalXForm(xsec_surf_id, mat)

Set the global surface transform matrix for given XSecSurf :param [in]: xsec_surf_id string XSecSurf ID :param [in]: mat Matrix4d Transformation matrix

openvsp.vsp.SetXSecTanAngles(std: :string const & xsec_id, int side, double top, double right, double bottom, double left)
openvsp.vsp.SetXSecTanSlews(std: :string const & xsec_id, int side, double top, double right, double bottom, double left)
openvsp.vsp.SetXSecTanStrengths(std: :string const & xsec_id, int side, double top, double right, double bottom, double left)
openvsp.vsp.SetXSecWidth(xsec_id, w)

Set the width of an XSec. Note that POINT type XSecs have a width and height of 0, regardless of what is input to SetXSecWidth.

# Add Stack
sid = AddGeom( "STACK", "" )

# Get First (and Only) XSec Surf
xsec_surf = GetXSecSurf( sid, 0 )

# Identify XSec 2
xsec_2 = GetXSec( xsec_surf, 2 )

SetXSecWidth( xsec_2, 1.5 )
assert abs( GetXSecWidth( xsec_2 ) - 1.5 ) < 1e-9, "SetXSecWidth did not take"

See also: GetXSecWidth :param [in]: xsec_id string XSec ID :param [in]: w double Xsec width

openvsp.vsp.SetXSecWidthHeight(xsec_id, w, h)

Set the width and height of an XSec. Note, if the XSec is an EDIT_CURVE type and PreserveARFlag is true, the input width value will be ignored and instead set from on the input height and aspect ratio. Use SetXSecWidth and SetXSecHeight directly to avoid this.

# Add Stack
sid = AddGeom( "STACK", "" )

# Get First (and Only) XSec Surf
xsec_surf = GetXSecSurf( sid, 0 )

# Identify XSec 2
xsec_2 = GetXSec( xsec_surf, 2 )

SetXSecWidthHeight( xsec_2, 1.5, 1.5 )

Update()

assert abs( GetXSecWidth( xsec_2 ) - 1.5 ) < 1e-6, "SetXSecWidthHeight did not take"
assert abs( GetXSecHeight( xsec_2 ) - 1.5 ) < 1e-6, "SetXSecWidthHeight did not take"

# The neighbouring sections have to be left alone.
xsec_1 = GetXSec( xsec_surf, 1 )

assert abs( GetXSecWidth( xsec_1 ) - 1.5 ) > 1e-6 or abs( GetXSecHeight( xsec_1 ) - 1.5 ) > 1e-6, "SetXSecWidthHeight reached a section it was not given"

See also: SetXSecWidth, SetXSecHeight :param [in]: xsec_id string XSec ID :param [in]: w double Xsec width :param [in]: h double Xsec height

openvsp.vsp.ShowAllBackground3Ds()

Show all Background3Ds in model

# Add Background3D
AddBackground3D()
AddBackground3D()
AddBackground3D()

assert GetNumBackground3Ds() == 3, "the three Background3Ds were not all added"
assert len( GetAllBackground3Ds() ) == 3, "the three Background3Ds were not all added"

ShowAllBackground3Ds()

DelAllBackground3Ds()

assert GetNumBackground3Ds() == 0, "DelAllBackground3Ds left something behind"
assert len( GetAllBackground3Ds() ) == 0, "DelAllBackground3Ds left something behind"
openvsp.vsp.ShowAllProbes()

Show every Probe in the Measure Tool. See also: HideAllProbes

openvsp.vsp.ShowAllProtractors()

Show every Protractor in the Measure Tool. See also: HideAllProtractors

openvsp.vsp.ShowAllRSTProbes()

Show every RST Probe in the Measure Tool. See also: HideAllRSTProbes

openvsp.vsp.ShowAllRulers()

Create a new Ruler and add it to the Measure Tool

pid1 = AddGeom( "POD", "" )

SetParmVal( pid1, "Y_Rel_Location", "XForm", 2.0 )

pid2 = AddGeom( "POD", "" )

SetParmVal( pid2, "Z_Rel_Location", "XForm", 4.0 )

rid = AddRuler( pid1, 1, 0.2, 0.3, pid2, 0, 0.2, 0.3, "Ruler 1" )

SetParmVal( FindParm( rid, "X_Offset", "Measure" ), 6.0 )
Parameters:
  • [in] – startgeomid string Start parent Geom ID

  • [in] – startsurfindx int Main surface index from the staring parent Geom

  • [in] – startu double Surface u (0 - 1) start coordinate

  • [in] – startw double Surface w (0 - 1) start coordinate

  • [in] – endgeomid string End parent Geom ID

  • [in] – endsurfindx int Main surface index on the end parent Geom

  • [in] – endu double Surface u (0 - 1) end coordinate

  • [in] – endw double Surface w (0 - 1) end coordinate

  • [in] – name string Ruler name

Return type:

void

Returns:

string Ruler ID

Create and add a Protractor object from three points on Geom surfaces. The angle is measured at the middle point, between the legs running out to the start and end points.

pod1 = AddGeom( "POD", "" )

pid = AddProtractor( pod1, 0, 0.2, 0.0, pod1, 0, 0.5, 0.0, pod1, 0, 0.8, 0.0, "Example_Protractor" )

assert len( pid ) > 0 and pid != "NONE", "AddProtractor returned no id"

# The new protractor is the only one in the model.
prot_array = GetAllProtractors()

assert len( prot_array ) == 1, "AddProtractor did not add the protractor"
assert prot_array[0] == pid, "AddProtractor did not add the protractor"

# Protractors are their own Parm Containers, so the name is readable.
assert GetContainerName( pid ) == "Example_Protractor", "AddProtractor did not name the protractor"

See also: GetAllProtractors, DelProtractor, DeleteAllProtractors, AddRuler :param [in]: startgeomid string Start parent Geom ID :param [in]: startsurfindx int Start surface index from the start parent Geom :param [in]: startu double Start U (0 - 1) surface coordinate :param [in]: startw double Start W (0 - 1) surface coordinate :param [in]: midgeomid string Middle parent Geom ID :param [in]: midsurfindx int Middle surface index from the middle parent Geom :param [in]: midu double Middle U (0 - 1) surface coordinate :param [in]: midw double Middle W (0 - 1) surface coordinate :param [in]: endgeomid string End parent Geom ID :param [in]: endsurfindx int End surface index from the end parent Geom :param [in]: endu double End U (0 - 1) surface coordinate :param [in]: endw double End W (0 - 1) surface coordinate :param [in]: name string Protractor name :rtype: void :return: string Protractor ID

Show every Ruler in the Measure Tool. This is the Measure screen’s Show All button for rulers.

pod1 = AddGeom( "POD", "" )

rid = AddRuler( pod1, 0, 0.2, 0.0, pod1, 0, 0.8, 0.0, "Example_Ruler" )

HideAllRulers()

# Visibility is a Parm on the ruler itself.
assert abs( GetParmVal( FindParm( rid, "Visible", "Measure" ) ) ) < 1e-12, "HideAllRulers did not hide the ruler"

ShowAllRulers()

assert abs( GetParmVal( FindParm( rid, "Visible", "Measure" ) ) - 1.0 ) < 1e-12, "ShowAllRulers did not show the ruler"

See also: HideAllRulers, AddRuler

openvsp.vsp.ShowOnlyMode(mid)

Show-only a mode in a model.

# Illustrating use of Modes requires substantial setup of the model including components, sets, and variable presets.
#
# Setup boiler plate.
pod1 = AddGeom( "POD", "" )
wing = AddGeom( "WING", pod1 )

SetParmVal( wing, "Trans_Attach_Flag", "Attach", ATTACH_TRANS_LMN )
SetParmVal( wing, "L_Attach_Location", "Attach", 0.35 )

SetSetName( SET_FIRST_USER, "NonLifting" )
SetSetName( SET_FIRST_USER + 1, "Lifting" )

SetSetFlag( pod1, SET_FIRST_USER, True )
SetSetFlag( wing, SET_FIRST_USER + 1, True )


gid = AddVarPresetGroup( "Tess" )

p1 = FindParm( pod1, "Tess_U", "Shape" )
AddVarPresetParm( gid, p1 )

p2 = FindParm( pod1, "Tess_W", "Shape" )
AddVarPresetParm( gid, p2 )

sid = AddVarPresetSetting( gid, "Default" )
SaveVarPresetParmVals( gid, sid )

sid1 = AddVarPresetSetting( gid, "Coarse" )
SetVarPresetParmVal( gid, sid1, p1, 3 )
SetVarPresetParmVal( gid, sid1, p2, 5 )

sid2 = AddVarPresetSetting( gid, "Fine" )
SetVarPresetParmVal( gid, sid2, p1, 35 )
SetVarPresetParmVal( gid, sid2, p2, 21 )


gid2 = AddVarPresetGroup( "Design" )

p3 = FindParm( pod1, "Length", "Design" )
AddVarPresetParm( gid2, p3 )

p4 = FindParm( pod1, "FineRatio", "Design" )
AddVarPresetParm( gid2, p4 )

sid3 = AddVarPresetSetting( gid2, "Normal" )
SaveVarPresetParmVals( gid2, sid3 )

sid4 = AddVarPresetSetting( gid2, "ShortFat" )
SetVarPresetParmVal( gid2, sid4, p3, 3.0 )
SetVarPresetParmVal( gid2, sid4, p4, 5.0 )

sid5 = AddVarPresetSetting( gid2, "LongThin" )
SetVarPresetParmVal( gid2, sid5, p3, 20.0 )
SetVarPresetParmVal( gid2, sid5, p4, 35.0 )

# End of setup boiler plate.

mid1 = CreateAndAddMode( "FatWetAreas", SET_ALL, SET_NONE )
ModeAddGroupSetting( mid1, gid, sid1 )
ModeAddGroupSetting( mid1, gid2, sid4 )

mid2 = CreateAndAddMode( "ThinAero", SET_FIRST_USER, SET_FIRST_USER + 1 )
ModeAddGroupSetting( mid2, gid, sid2 )
ModeAddGroupSetting( mid2, gid2, sid5 )

ApplyModeSettings( mid2 )
Update()

ShowOnlyMode( mid1 )

Update()

# FatWetAreas uses SET_ALL as its normal set, so both Geoms end up shown.
assert GetSetFlag( pod1, SET_SHOWN ), "ShowOnlyMode did not show the Mode's set"
assert GetSetFlag( wing, SET_SHOWN ), "ShowOnlyMode did not show the Mode's set"

# A Mode that does not exist has to be rejected.  The error queue is reached
# through the error manager singleton in Python.
err_mgr = ErrorMgrSingleton.getInstance()

ShowOnlyMode( "NOSUCHMODE" )

assert err_mgr.GetNumTotalErrors() > 0, "ShowOnlyMode accepted a bad Mode ID"

# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()
Parameters:

[in] – mid string Mode ID of mode to show-only

openvsp.vsp.ShowOnlySet(set_index)

Show every Geom in a set and hide everything else. This is the Geom browser’s Show Only Set button.

pod1 = AddGeom( "POD" )
pod2 = AddGeom( "POD" )

SetSetFlag( pod1, 3, True )

ShowOnlySet( 3 )

# The set is shown and everything outside it is hidden.
assert GetSetFlag( pod1, SET_SHOWN ), "ShowOnlySet did not show the set"
assert not GetSetFlag( pod2, SET_SHOWN ), "ShowOnlySet did not hide the rest of the model"

See also: ShowSet, NoShowSet :param [in]: set_index int Set index

openvsp.vsp.ShowScreen(s)

Show an OpenVSP GUI screen

ShowScreen( VSP_CFD_MESH_SCREEN )
Parameters:

[in] – s int GUI_VSP_SCREEN enum for screen

openvsp.vsp.ShowSet(set_index)

Show every Geom in a set, leaving the rest of the model as it is. This is the Geom browser’s Show Set button.

pid = AddGeom( "POD" )

SetSetFlag( pid, 3, True )

NoShowSet( 3 )

assert not GetSetFlag( pid, SET_SHOWN ), "NoShowSet did not hide the set"

ShowSet( 3 )

assert GetSetFlag( pid, SET_SHOWN ), "ShowSet did not show the set"

# A set index past the end has to be rejected.
err_mgr = ErrorMgrSingleton.getInstance()

ShowSet( GetNumSets() )

assert err_mgr.GetNumTotalErrors() > 0, "ShowSet accepted a set index past the end"

while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()

See also: NoShowSet, ShowOnlySet :param [in]: set_index int Set index

openvsp.vsp.SnapParm(*args)

Snap the specified Parm to input target minimum clearance distance

#Add Geoms
fid = AddGeom( "FUSELAGE", "" )             # Add Fuselage

pid = AddGeom( "POD", "" )                     # Add Pod

x = GetParm( pid, "X_Rel_Location", "XForm" )

SetParmVal( x, 3.0 )

Update()

min_dist = SnapParm( x, 0.1, True, SET_ALL )

Update()

# Snapping moves the Parm until the clearance reaches the target, so the Parm
# has to have moved and the clearance has to end up where it was asked for.
assert abs( GetParmVal( x ) - 3.0 ) > 1e-9, "SnapParm did not move the Parm"
assert abs( ComputeMinClearanceDistance( pid, SET_ALL ) - 0.1 ) < 1e-4, "SnapParm did not reach the target clearance"
assert abs( min_dist - ComputeMinClearanceDistance( pid, SET_ALL ) ) < 1e-4, "SnapParm reported a clearance it did not reach"
Parameters:
  • [in] – parm_id string Parm ID

  • [in] – target_min_dist double Target minimum clearance distance

  • [in] – inc_flag bool Direction indication flag. If true, upper parm limit is used and direction is set to positive

  • [in] – set int Collision set enum (i.e. SET_ALL)

  • [in] – useMode bool Flag determine if mode is used instead of sets

  • [in] – modeID string ID of Mode to use

Return type:

float

Returns:

double Minimum clearance distance

openvsp.vsp.SortAdvLinkInputsCGP(index)

Sort the input variables of an advanced link by the Parm they are attached to, ordering on container name, then group name, then Parm name. This gathers the inputs that come from the same Geom together, which is usually how a link is read.

pod = AddGeom( "POD", "" )

AddAdvLink( "ExampleLink" )
indx = GetLinkIndex( "ExampleLink" )

AddAdvLinkInput( indx, FindParm( pod, "Length", "Design" ), "a" )
AddAdvLinkInput( indx, FindParm( pod, "FineRatio", "Design" ), "b" )

SortAdvLinkInputsCGP( indx )

names = GetAdvLinkInputNames( indx )

# FineRatio sorts ahead of Length, so the variables come back swapped.
assert names[0] == "b", "SortAdvLinkInputsCGP did not sort by Parm"
assert names[1] == "a", "SortAdvLinkInputsCGP did not sort by Parm"

See also: SortAdvLinkInputsVar, SortAdvLinkOutputsCGP :param [in]: index int Index for advanced link

openvsp.vsp.SortAdvLinkInputsVar(index)

Sort the input variables of an advanced link into alphabetical order by variable name. Inputs are otherwise kept in the order they were added, which is rarely the order that reads well once a link has grown.

pod = AddGeom( "POD", "" )

AddAdvLink( "ExampleLink" )
indx = GetLinkIndex( "ExampleLink" )

AddAdvLinkInput( indx, FindParm( pod, "Length", "Design" ), "zlen" )
AddAdvLinkInput( indx, FindParm( pod, "FineRatio", "Design" ), "afine" )

SortAdvLinkInputsVar( indx )

names = GetAdvLinkInputNames( indx )

assert names[0] == "afine", "SortAdvLinkInputsVar did not sort by name"
assert names[1] == "zlen", "SortAdvLinkInputsVar did not sort by name"

See also: SortAdvLinkInputsCGP, SortAdvLinkOutputsVar :param [in]: index int Index for advanced link

openvsp.vsp.SortAdvLinkOutputsCGP(index)

Sort the output variables of an advanced link by the Parm they drive, ordering on container name, then group name, then Parm name.

pod = AddGeom( "POD", "" )

AddAdvLink( "ExampleLink" )
indx = GetLinkIndex( "ExampleLink" )

AddAdvLinkOutput( indx, FindParm( pod, "Y_Rel_Location", "XForm" ), "a" )
AddAdvLinkOutput( indx, FindParm( pod, "X_Rel_Location", "XForm" ), "b" )

SortAdvLinkOutputsCGP( indx )

names = GetAdvLinkOutputNames( indx )

# X_Rel_Location sorts ahead of Y_Rel_Location, so the variables come back swapped.
assert names[0] == "b", "SortAdvLinkOutputsCGP did not sort by Parm"
assert names[1] == "a", "SortAdvLinkOutputsCGP did not sort by Parm"

See also: SortAdvLinkOutputsVar, SortAdvLinkInputsCGP :param [in]: index int Index for advanced link

openvsp.vsp.SortAdvLinkOutputsVar(index)

Sort the output variables of an advanced link into alphabetical order by variable name.

pod = AddGeom( "POD", "" )

AddAdvLink( "ExampleLink" )
indx = GetLinkIndex( "ExampleLink" )

AddAdvLinkOutput( indx, FindParm( pod, "X_Rel_Location", "XForm" ), "zx" )
AddAdvLinkOutput( indx, FindParm( pod, "Y_Rel_Location", "XForm" ), "ay" )

SortAdvLinkOutputsVar( indx )

names = GetAdvLinkOutputNames( indx )

assert names[0] == "ay", "SortAdvLinkOutputsVar did not sort by name"
assert names[1] == "zx", "SortAdvLinkOutputsVar did not sort by name"

See also: SortAdvLinkOutputsCGP, SortAdvLinkInputsVar :param [in]: index int Index for advanced link

openvsp.vsp.SortParmLinksByA()

Sort the Parm links by the Parm each one reads from, ordering on container name, then group name, then Parm name. This is the Sort A button on the Parm Link screen.

pod = AddGeom( "POD", "" )

length = FindParm( pod, "Length", "Design" )
fine = FindParm( pod, "FineRatio", "Design" )
x_pos = FindParm( pod, "X_Rel_Location", "XForm" )
y_pos = FindParm( pod, "Y_Rel_Location", "XForm" )

# Add the links out of order, reading from Length first.
link1 = AddParmLink( length, x_pos )
link2 = AddParmLink( fine, y_pos )

SortParmLinksByA()

# FineRatio sorts ahead of Length, so its link comes first.
assert GetParmLinkID( 0 ) == link2, "SortParmLinksByA did not sort the links"

See also: SortParmLinksByB, AddParmLink

openvsp.vsp.SortParmLinksByB()

Sort the Parm links by the Parm each one drives, ordering on container name, then group name, then Parm name. This is the Sort B button on the Parm Link screen.

pod = AddGeom( "POD", "" )

length = FindParm( pod, "Length", "Design" )
fine = FindParm( pod, "FineRatio", "Design" )
x_pos = FindParm( pod, "X_Rel_Location", "XForm" )
y_pos = FindParm( pod, "Y_Rel_Location", "XForm" )

# Add the links so that the one driving Y_Rel_Location comes first.
link1 = AddParmLink( length, y_pos )
link2 = AddParmLink( fine, x_pos )

SortParmLinksByB()

# X_Rel_Location sorts ahead of Y_Rel_Location, so its link comes first.
assert GetParmLinkID( 0 ) == link2, "SortParmLinksByB did not sort the links"

See also: SortParmLinksByA, AddParmLink

openvsp.vsp.SplitWingXSec(wing_id, section_index)

Split a given wing section.

wing_id = AddGeom( "WING", "" )

xsec_surf = GetXSecSurf( wing_id, 0 )

num_start = GetNumXSec( xsec_surf )

span_start = GetParmVal( wing_id, "Span", "XSec_1" )

#==== Set Wing Section Controls ====//
SplitWingXSec( wing_id, 1 )

Update()

# Splitting a section turns one section into two, and the two halves span
# what the one section spanned.
assert GetNumXSec( xsec_surf ) == num_start + 1, "SplitWingXSec did not split the section"

span_1 = GetParmVal( wing_id, "Span", "XSec_1" )
span_2 = GetParmVal( wing_id, "Span", "XSec_2" )

assert abs( ( span_1 + span_2 ) - span_start ) < 1e-6, "SplitWingXSec changed the span of the wing"

See also: WING_DRIVERS, XSEC_DRIVERS :param [in]: wing_id string Geom ID :param [in]: section_index int Wing section index

openvsp.vsp.StartGUI()

Launch the interactive OpenVSP GUI. In a multi-threaded environment, this must be called from the main thread only. This starts the GUI event loop. It will also show the main screen and screens displayed when StopGUI() was previously called.

StartGUI()
openvsp.vsp.StopGUI()

Stop OpenVSP GUI event loop and hide screens. Keep OpenVSP running and in memory.

StartGUI()

StopGUI()

StartGUI()

See also: StartGUI

class openvsp.vsp.StringVecVec(*args)

Bases: object

Proxy of C++ std::vector< std::vector< std::string > > class.

append(StringVecVec self, StringVector x)
assign(StringVecVec self, std: :vector< std::vector< std::string > >::size_type n, StringVector x)
back(StringVecVec self) StringVector
begin(StringVecVec self) std::vector< std::vector< std::string > >::iterator
capacity(StringVecVec self) std::vector< std::vector< std::string > >::size_type
clear(StringVecVec self)
empty(StringVecVec self) bool
end(StringVecVec self) std::vector< std::vector< std::string > >::iterator
erase(StringVecVec self, std: :vector< std::vector< std::string > >::iterator pos) std::vector< std::vector< std::string > >::iterator
erase(StringVecVec self, std: :vector< std::vector< std::string > >::iterator first, std: :vector< std::vector< std::string > >::iterator last) std::vector< std::vector< std::string > >::iterator
front(StringVecVec self) StringVector
get_allocator(StringVecVec self) std::vector< std::vector< std::string > >::allocator_type
insert(StringVecVec self, std: :vector< std::vector< std::string > >::iterator pos, StringVector x) std::vector< std::vector< std::string > >::iterator
insert(StringVecVec self, std: :vector< std::vector< std::string > >::iterator pos, std: :vector< std::vector< std::string > >::size_type n, StringVector x)
iterator(StringVecVec self) SwigPyIterator
pop(StringVecVec self) StringVector
pop_back(StringVecVec self)
push_back(StringVecVec self, StringVector x)
rbegin(StringVecVec self) std::vector< std::vector< std::string > >::reverse_iterator
rend(StringVecVec self) std::vector< std::vector< std::string > >::reverse_iterator
reserve(StringVecVec self, std: :vector< std::vector< std::string > >::size_type n)
resize(StringVecVec self, std: :vector< std::vector< std::string > >::size_type new_size)
resize(StringVecVec self, std: :vector< std::vector< std::string > >::size_type new_size, StringVector x)
size(StringVecVec self) std::vector< std::vector< std::string > >::size_type
swap(StringVecVec self, StringVecVec v)
property thisown

The membership flag

class openvsp.vsp.StringVector(*args)

Bases: object

Proxy of C++ std::vector< std::string > class.

append(StringVector self, std: :vector< std::string >::value_type const & x)
assign(StringVector self, std: :vector< std::string >::size_type n, std: :vector< std::string >::value_type const & x)
back(StringVector self) std::vector< std::string >::value_type const &
begin(StringVector self) std::vector< std::string >::iterator
capacity(StringVector self) std::vector< std::string >::size_type
clear(StringVector self)
empty(StringVector self) bool
end(StringVector self) std::vector< std::string >::iterator
erase(StringVector self, std: :vector< std::string >::iterator pos) std::vector< std::string >::iterator
erase(StringVector self, std: :vector< std::string >::iterator first, std: :vector< std::string >::iterator last) std::vector< std::string >::iterator
front(StringVector self) std::vector< std::string >::value_type const &
get_allocator(StringVector self) std::vector< std::string >::allocator_type
insert(StringVector self, std: :vector< std::string >::iterator pos, std: :vector< std::string >::value_type const & x) std::vector< std::string >::iterator
insert(StringVector self, std: :vector< std::string >::iterator pos, std: :vector< std::string >::size_type n, std: :vector< std::string >::value_type const & x)
iterator(StringVector self) SwigPyIterator
pop(StringVector self) std::vector< std::string >::value_type
pop_back(StringVector self)
push_back(StringVector self, std: :vector< std::string >::value_type const & x)
rbegin(StringVector self) std::vector< std::string >::reverse_iterator
rend(StringVector self) std::vector< std::string >::reverse_iterator
reserve(StringVector self, std: :vector< std::string >::size_type n)
resize(StringVector self, std: :vector< std::string >::size_type new_size)
resize(StringVector self, std: :vector< std::string >::size_type new_size, std: :vector< std::string >::value_type const & x)
size(StringVector self) std::vector< std::string >::size_type
swap(StringVector self, StringVector v)
property thisown

The membership flag

openvsp.vsp.SummarizeAttributes()

Print a tab-delimited summary of all Attributes in the vehicle, denoting Name, Type, Data, Description, and path from Root of vehicle to Attribute

##==== Attributes: SummarizeAttributes ====##
SummaryText = SummarizeAttributes()
assert len( SummaryText ) > 0, "SummarizeAttributes returned no id"

print( SummaryText )
Return type:

string

Returns:

string Tab-delimited summary of all Attributes in vehicle

openvsp.vsp.SummarizeAttributesAsTree()

Print a plain-text tree summary of all Attribute in the vehicle, each branch node showing the name and ID of the VSP object in the path to the attribute

##==== Attributes: SummarizeAttributesAsTree ====##
SummaryTextTree = SummarizeAttributesAsTree();
assert len( SummaryTextTree ) > 0, "SummarizeAttributesAsTree returned no id"

print( SummaryTextTree )
Return type:

string

Returns:

string Plain-text attribute tree of vehicle

class openvsp.vsp.SwigPyIterator(*args, **kwargs)

Bases: object

Proxy of C++ swig::SwigPyIterator class.

advance(SwigPyIterator self, ptrdiff_t n) SwigPyIterator
copy(SwigPyIterator self) SwigPyIterator
decr(SwigPyIterator self, size_t n=1) SwigPyIterator
distance(SwigPyIterator self, SwigPyIterator x) ptrdiff_t
equal(SwigPyIterator self, SwigPyIterator x) bool
incr(SwigPyIterator self, size_t n=1) SwigPyIterator
next(SwigPyIterator self) PyObject *
previous(SwigPyIterator self) PyObject *
property thisown

The membership flag

value(SwigPyIterator self) PyObject *
openvsp.vsp.TAG = 0

Color mesh by tag value (component, subsurface, part, etc)

openvsp.vsp.TAPER_WSECT_DRIVER = 3

Taper driver

openvsp.vsp.TEMP_UNIT_C = 1

Celsius

openvsp.vsp.TEMP_UNIT_F = 2

Fahrenheit

openvsp.vsp.TEMP_UNIT_K = 0

Kelvin

openvsp.vsp.TEMP_UNIT_R = 3

Rankine

openvsp.vsp.TE_NORMAL = 2

FEA Rib or Rib Array is set perpendicular to the trailing edge

openvsp.vsp.TIPC_WSECT_DRIVER = 6

Tip chord driver

openvsp.vsp.TIRE_BALLOON = 3

Balloon tire

openvsp.vsp.TIRE_BALLOON_FAIR_WHEEL = 5

Balloon tire with faired wheel

openvsp.vsp.TIRE_BALLOON_WHEEL = 4

Balloon tire with wheel

openvsp.vsp.TIRE_CLEARANCE = 2

TRA clearance envelope

openvsp.vsp.TIRE_DIM_FRAC = 2

Tire dimensions as fractions

openvsp.vsp.TIRE_DIM_IN = 0

Tire dimensions in inches

openvsp.vsp.TIRE_DIM_MODEL = 1

Tire dimensions in model units

openvsp.vsp.TIRE_FAIR_FLANGE = 1

TRA with faired flange / flank

openvsp.vsp.TIRE_FAIR_WHEEL = 2

TRA with faired wheel

openvsp.vsp.TIRE_FLAT_CONTACT = 3

Tire flat tire radius

openvsp.vsp.TIRE_GROWTH_CLEARANCE = 1

Tire growth (spinning) clearance

openvsp.vsp.TIRE_GROWTH_CONTACT = 2

Tire growth (spinning) radius

openvsp.vsp.TIRE_NOMINAL_CLEARANCE = 0

Tire nominal shape

openvsp.vsp.TIRE_NOMINAL_CONTACT = 1

Tire nominal radius

openvsp.vsp.TIRE_STATIC_LODED_CONTACT = 0

Tire static loaded radius

openvsp.vsp.TIRE_TRA = 0

Full TRA model

openvsp.vsp.TRIM_NONE = 0

No trimming

openvsp.vsp.TRIM_NUM_TYPES = 3

Number of trimming types

openvsp.vsp.TRIM_THICK = 2

Trim XSec by thickness

openvsp.vsp.TRIM_X = 1

Trim XSec by X

openvsp.vsp.TRI_MESH_TYPE = 0

Triangle mesh

openvsp.vsp.T_PROP_DRIVER = 3

Thrust driver

openvsp.vsp.ToCartesian(vec3d v) vec3d
openvsp.vsp.ToSpherical(vec3d v) vec3d
openvsp.vsp.ToSpherical2(vec3d v, vec3d vdet) vec3d
openvsp.vsp.TransformSet(set_index, translation_vec, x_rot_deg, y_rot_deg, z_rot_deg, scale, scale_translations_flag)

Apply translation, rotation, and scale transformations to a set

# Add Fuselage Geom
fuseid = AddGeom( "FUSELAGE" )

SetSetFlag( fuseid, 3, True )

Update()

before_max = GetGeomBBoxMax( fuseid, 0, True )
before_min = GetGeomBBoxMin( fuseid, 0, True )

# Translate 2 units in X and 3 units in Y, rotate 90 degrees about Y, and scale by a factor of 2
TransformSet( 3, vec3d( 2, 3, 0 ), 0, 90, 0, 2.0, True )

Update()

after_max = GetGeomBBoxMax( fuseid, 0, True )
after_min = GetGeomBBoxMin( fuseid, 0, True )

# Turning the Geom on its nose trades the X extent for the Z, and the scale
# doubles both.
assert abs( ( after_max.z() - after_min.z() ) - 2.0 * ( before_max.x() - before_min.x() ) ) < 1e-6, "TransformSet did not rotate and scale the geometry"
assert abs( ( after_max.x() - after_min.x() ) - 2.0 * ( before_max.z() - before_min.z() ) ) < 1e-6, "TransformSet did not rotate and scale the geometry"

# The Y extent only scales.
assert abs( ( after_max.y() - after_min.y() ) - 2.0 * ( before_max.y() - before_min.y() ) ) < 1e-6, "TransformSet did not scale the geometry in Y"

See also: TranslateSet, RotateSet, ScaleSet :param [in]: set_index int Set index :param [in]: translation_vec vec3d Translation vector :param [in]: x_rot_deg double Rotation about the X axis (degrees) :param [in]: y_rot_deg double Rotation about the Y axis (degrees) :param [in]: z_rot_deg double Rotation about the Z axis (degrees) :param [in]: scale double Scale factor :param [in]: scale_translations_flag bool Flag to apply the scale factor to translations

openvsp.vsp.TranslateSet(set_index, translation_vec)

Translate a set along a given vector

# Add Fuselage Geom
fuseid = AddGeom( "FUSELAGE" )

SetSetFlag( fuseid, 3, True )

# Translate 2 units in X and 3 units in Y
Update()

# The bounding box has to be asked for in the absolute frame.  A body frame
# box travels with the Geom, so it would not see the translation at all.
before_min = GetGeomBBoxMin( fuseid, 0, True )

TranslateSet( 3, vec3d( 2, 3, 0 ) )

Update()

after_min = GetGeomBBoxMin( fuseid, 0, True )

assert abs( ( after_min.x() - before_min.x() ) - 2.0 ) < 1e-6 and abs( ( after_min.y() - before_min.y() ) - 3.0 ) < 1e-6, "TranslateSet did not move the geometry"
Parameters:
  • [in] – set_index int Set index

  • [in] – translation_vec vec3d Translation vector

openvsp.vsp.ULINE_SOURCE = 3

Constant U Line source

openvsp.vsp.U_TRIM = 0

Trim by U coordinate

openvsp.vsp.Unlock()

Release the lock on the OpenVSP GUI event loop.

StartGUI()

pod_id = AddGeom( "POD" )

Lock()
rid = ExecAnalysis( "CompGeom" )

mesh_id_vec = GetStringResults( rid, "Mesh_GeomID" )

DeleteGeomVec( mesh_id_vec )
Unlock()

See also: Lock

openvsp.vsp.Update(update_managers=True)

Update the entire vehicle and all lower level children. An input, which is true by default, is available to specify if managers should be updated as well. The managers are typically updated by their respective GUI, so must be updated through the API as well to avoid unexpected behavior.

fid = AddGeom( "FUSELAGE", "" )             # Add Fuselage

xsec_surf = GetXSecSurf( fid, 0 )           # Get First (and Only) XSec Surf

num_xsecs = GetNumXSec( xsec_surf )

Update()

before_max = GetGeomBBoxMax( fid, 0, False )

#==== Set Tan Angles At Nose/Tail
SetXSecTanAngles( GetXSec( xsec_surf, 0 ), XSEC_BOTH_SIDES, 90, -1.0e12, -1.0e12, -1.0e12 )
SetXSecTanAngles( GetXSec( xsec_surf, num_xsecs - 1 ), XSEC_BOTH_SIDES, -90, -1.0e12, -1.0e12, -1.0e12 )

Update()       # Force Surface Update

after_max = GetGeomBBoxMax( fid, 0, False )

# Blunting the nose and tail pushes the surface out, which only shows up in
# the bounding box once Update() has rebuilt it.
assert dist( before_max, after_max ) > 1e-9, "Update did not rebuild the surface"
Parameters:

update_managers (boolean, optional) – bool Flag to indicate if managers should be updated

openvsp.vsp.UpdateGUI()

Tell OpenVSP that the GUI needs to be updated.

StartGUI()

pod_id = AddGeom( "POD" )

length = FindParm( pod_id, "Length", "Design" )

SetParmVal( length, 13.0 )

UpdateGUI()

See also: StartGUI

openvsp.vsp.UpdateGeom(geom_id)

Perform an update for the specified Geom

#==== Add Wing Geometry ====//
wing_id = AddGeom( "WING" )

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

Update()

before_min = GetGeomBBoxMin( pod_id, 0, True )

SetParmVal( pod_id, "X_Rel_Location", "XForm", 5.0 )

UpdateGeom( pod_id ) # Faster than updating the whole vehicle

# Updating just this Geom has to move it, the same as a full Update would.
after_min = GetGeomBBoxMin( pod_id, 0, True )

assert abs( ( after_min.x() - before_min.x() ) - 5.0 ) < 1e-6, "UpdateGeom did not rebuild the Geom"

See also: Update() :param [in]: geom_id string Geom ID

openvsp.vsp.UpdateParasiteDrag()

Update any reference geometry, atmospheric properties, excressences, etc. in the Parasite Drag Tool

openvsp.vsp.VEC3D_DATA = 4

Vec3d data type

openvsp.vsp.VEC_PROJ = 4

Project along a 3D vector

openvsp.vsp.VIEW_1 = 0

One 2D view

openvsp.vsp.VIEW_2HOR = 1

Two horizontal 2D views

openvsp.vsp.VIEW_2VER = 2

Two vertical 2D views

openvsp.vsp.VIEW_4 = 3

Four 2D views

openvsp.vsp.VIEW_BOTTOM = 3

Bottom 2D view type

openvsp.vsp.VIEW_FRONT = 4

Front 2D view type

openvsp.vsp.VIEW_LEFT = 0

Left 2D view type

openvsp.vsp.VIEW_NONE = 6

No 2D view type

openvsp.vsp.VIEW_NUM_TYPES = 7

Number of 2D view types

openvsp.vsp.VIEW_REAR = 5

Rear 2D view type

openvsp.vsp.VIEW_RIGHT = 1

Right 2D view type

openvsp.vsp.VIEW_TOP = 2

Top 2D view type

openvsp.vsp.VISIBLE_AT_SURF_ANALYSIS = 13

Calculate visibility of a surface from a direction

openvsp.vsp.VISIBLE_FROM_POINT_ANALYSIS = 10

Calculate az,el domain visible from a point

openvsp.vsp.VSPAERO_PROP_NUM_MODES = 3

Number of ways to model propeller blades in VSPAERO

openvsp.vsp.VSPAERO_PROP_PSEUDO_STEADY = 2

Model propellers with pseudo steady model

openvsp.vsp.VSPAERO_PROP_STATIC = 0

Model propellers as static, non-rotating blades – i.e. used as a wing.

openvsp.vsp.VSPAERO_PROP_UNSTEADY = 1

Model propellers as unsteady rotating blades

openvsp.vsp.VSPCheckSetup()

Check if OpenVSP has been initialized successfully. If not, the OpenVSP instance will be exited. This call should be placed at the beginning of all API scripts.

VSPCheckSetup()

# A failed setup exits OpenVSP outright, so reaching this point is most of
# the test.  Confirm the model is actually usable.
type_array = GetGeomTypes()

assert len( type_array ) > 0, "VSPCheckSetup did not leave a usable model"

# Continue to do things...
openvsp.vsp.VSPCrash(crash_type)

Cause OpenVSP to crash in a variety of ways. :param [in]: crash_type int Type of crash to attempt.

openvsp.vsp.VSPExit(error_code)

Exit the program with a specific error code :param [in]: error_code int Error code

openvsp.vsp.VSPRenew()

Clear and reinitialize OpenVSP to all default settings

#==== Add Pod Geometry ====//
pod_id = AddGeom( "POD" )

SetParmVal( pod_id, "Y_Rel_Location", "XForm", 2.0 )

VSPRenew()

if  len(FindGeoms()) != 0 :
    print( "ERROR: VSPRenew" )
    assert False, "ERROR: VSPRenew"

Advanced link build failure

Advanced linking screen

Advanced link variable rename screen

openvsp.vsp.VSP_AERO_STRUCT_SCREEN = 2

Aero / structural analysis screen

openvsp.vsp.VSP_AIRFOIL_CURVES_EXPORT_SCREEN = 3

Airfoil curves export screen

openvsp.vsp.VSP_AIRFOIL_POINTS_EXPORT_SCREEN = 4

Airfoil points screen

openvsp.vsp.VSP_ALL_SCREENS = 66

Flag for all screens

openvsp.vsp.VSP_AMBIGUOUS_SUBSURF = 17

Ambiguous flow-through sub-surface error

openvsp.vsp.VSP_ATTRIBUTE_EXPLORER_SCREEN = 5

Attribute details screen

openvsp.vsp.VSP_BACKGROUND3D_PREVIEW_SCREEN = 8

Background3D preview screen

openvsp.vsp.VSP_BACKGROUND3D_SCREEN = 7

Background3D control screen

openvsp.vsp.VSP_BACKGROUND_SCREEN = 6

Background control screen

openvsp.vsp.VSP_BEM_OPTIONS_SCREEN = 9

Blade element method options screen

openvsp.vsp.VSP_CANT_FIND_NAME = 5

Can’t find name error

openvsp.vsp.VSP_CANT_FIND_PARM = 4

Can’t find parm error

openvsp.vsp.VSP_CANT_FIND_TYPE = 3

Can’t find type error

openvsp.vsp.VSP_CANT_SET_NOT_EQ_PARM = 16

Can’t set NotEqParm error

openvsp.vsp.VSP_CFD_MESH_SCREEN = 10

CFD Mesh screen

openvsp.vsp.VSP_CLIPPING_SCREEN = 11

Clipping screen

openvsp.vsp.VSP_COMP_GEOM_SCREEN = 12

CompGeom screen

openvsp.vsp.VSP_CONFORMAL_PARENT_UNSUPPORTED = 20

Unsupported Conformal Geom parent error

openvsp.vsp.VSP_COR_SCREEN = 13

Center of rotation screen

openvsp.vsp.VSP_COULD_NOT_CREATE_BACKGROUND3D = 31

Could not create and add Background3D

openvsp.vsp.VSP_CURVE_EDIT_SCREEN = 14

Curve edit screen

openvsp.vsp.VSP_DEGEN_GEOM_SCREEN = 15

Degen geom screen

openvsp.vsp.VSP_DEPRECATED = 26

This capability has been deprecated and is not longer supported

openvsp.vsp.VSP_DESIGN_VAR_SCREEN = 16

Design variables screen

openvsp.vsp.VSP_DUPLICATE_NAME = 29

A duplicate name has been provided

openvsp.vsp.VSP_DXF_OPTIONS_SCREEN = 17

DXF options screen

openvsp.vsp.VSP_EXPORT_CUSTOM_SCRIPT = 24

Custom geom export screen

openvsp.vsp.VSP_EXPORT_SCREEN = 18

Export screen

openvsp.vsp.VSP_FEA_PART_EDIT_SCREEN = 19

FEA Part edit screen

openvsp.vsp.VSP_FEA_XSEC_SCREEN = 20

FEA XSec screen

openvsp.vsp.VSP_FILE_DOES_NOT_EXIST = 7

File does not exist error

openvsp.vsp.VSP_FILE_READ_FAILURE = 9

File read failure error

openvsp.vsp.VSP_FILE_WRITE_FAILURE = 8

File write failure error

openvsp.vsp.VSP_FIT_MODEL_SCREEN = 21

Fit model screen

openvsp.vsp.VSP_GEOMETRY_ANALYSIS_SCREEN = 25

Geometry analysis screen

openvsp.vsp.VSP_GUI_DEVICE_DEACTIVATED = 30

A deactivated GUI device was touched

openvsp.vsp.VSP_IGES_OPTIONS_SCREEN = 22

IGES options screen

openvsp.vsp.VSP_IGES_STRUCTURE_OPTIONS_SCREEN = 23

IGES structure options screen

openvsp.vsp.VSP_IMPORT_SCREEN = 26

Import screen

openvsp.vsp.VSP_INDEX_OUT_RANGE = 13

Index out of range error

openvsp.vsp.VSP_INVALID_CF_EQN = 23

Invalid friction coefficient equation error

openvsp.vsp.VSP_INVALID_DRIVERS = 24

Invalid drivers for driver group

openvsp.vsp.VSP_INVALID_GEOM_ID = 6

Invalid Geom ID error

openvsp.vsp.VSP_INVALID_ID = 15

Invalid ID error

openvsp.vsp.VSP_INVALID_INPUT_VAL = 22

Invalid input value error

openvsp.vsp.VSP_INVALID_PTR = 1

Invalid pointer error

openvsp.vsp.VSP_INVALID_TYPE = 2

Invalid type error

openvsp.vsp.VSP_INVALID_VARPRESET_GROUPNAME = 19

Invalid Variable Preset group name error

openvsp.vsp.VSP_INVALID_VARPRESET_SETNAME = 18

Invalid Variable Preset set name error

openvsp.vsp.VSP_INVALID_XSEC_ID = 14

Invalid XSec ID error

openvsp.vsp.VSP_LIGHTING_SCREEN = 27

Lighting screen

A parameter link loop was detected and stopped

An output of a parameter link was not set

openvsp.vsp.VSP_MAIN_SCREEN = 64

Main screen

openvsp.vsp.VSP_MANAGE_GEOM_SCREEN = 28

Manage geom screen

openvsp.vsp.VSP_MANAGE_TEXTURE_SCREEN = 29

Texture mapping screen

openvsp.vsp.VSP_MASS_PROP_SCREEN = 30

Mass properties screen

openvsp.vsp.VSP_MATERIAL_EDIT_SCREEN = 31

Material edit screen

openvsp.vsp.VSP_MEASURE_SCREEN = 32

Measure screen

openvsp.vsp.VSP_MODE_EDITOR_SCREEN = 33

Mode editor screen

openvsp.vsp.VSP_NERF_MANAGE_GEOM_SCREEN = 34

NERF’ed (limited to make safe) Manage geom screen

openvsp.vsp.VSP_NUM_ERROR_CODE = 32

Total number of VSP error codes

openvsp.vsp.VSP_NUM_SCREENS = 65

Number of screens

openvsp.vsp.VSP_OK = 0

No error

openvsp.vsp.VSP_PARASITE_DRAG_SCREEN = 36

Parasite drg screen

openvsp.vsp.VSP_PARM_DEBUG_SCREEN = 37

Parameter debug screen

Parameter linking screen

openvsp.vsp.VSP_PARM_SCREEN = 39

Parameter screen

openvsp.vsp.VSP_PICK_SET_SCREEN = 40

Pick set screen

openvsp.vsp.VSP_PREFERENCES_SCREEN = 41

Preferences screen

openvsp.vsp.VSP_PROJECTION_SCREEN = 42

Projected area screen

openvsp.vsp.VSP_PSLICE_SCREEN = 43

Planar slicing screen

openvsp.vsp.VSP_RESULTS_VIEWER_SCREEN = 44

Results viewing screen

openvsp.vsp.VSP_SCREENSHOT_SCREEN = 45

Screenshot screen

openvsp.vsp.VSP_SELECT_FILE_SCREEN = 46

Select file screen

openvsp.vsp.VSP_SET_EDITOR_SCREEN = 47

Set editor screen

openvsp.vsp.VSP_SNAP_TO_SCREEN = 35

Snap to screen

openvsp.vsp.VSP_STEP_OPTIONS_SCREEN = 48

STEP options screen

openvsp.vsp.VSP_STEP_STRUCTURE_OPTIONS_SCREEN = 49

STEP structure options screen

openvsp.vsp.VSP_STL_OPTIONS_SCREEN = 50

STL options screen

openvsp.vsp.VSP_STRUCT_ASSEMBLY_SCREEN = 52

Structure assembly screen

openvsp.vsp.VSP_STRUCT_SCREEN = 51

Structure definition screen

openvsp.vsp.VSP_SURFACE_INTERSECTION_SCREEN = 53

Surface intersection screen

openvsp.vsp.VSP_SVG_OPTIONS_SCREEN = 54

SVG options screen

openvsp.vsp.VSP_UNEXPECTED_RESET_REMAP_ID = 21

Unexpected reset remap ID error

openvsp.vsp.VSP_UNKNOWN = -1

Unknown error

openvsp.vsp.VSP_USER_PARM_SCREEN = 55

User parameter screen

openvsp.vsp.VSP_VAR_PRESET_SCREEN = 56

Variable presets editor screen

openvsp.vsp.VSP_VEH_NOTES_SCREEN = 57

Vehicle notes screen

openvsp.vsp.VSP_VEH_SCREEN = 58

Veh geom screen

openvsp.vsp.VSP_VIEW_SCREEN = 59

Adjust viewpoint screen

openvsp.vsp.VSP_VSPAERO_PLOT_SCREEN = 60

VSPAERO results manager screen

openvsp.vsp.VSP_VSPAERO_SCREEN = 61

VSPAERO screen

openvsp.vsp.VSP_WAVEDRAG_SCREEN = 63

Wave drag screen

openvsp.vsp.VSP_WRONG_FILE_TYPE = 12

Wrong file type error

openvsp.vsp.VSP_WRONG_GEOM_TYPE = 10

Wrong Geom type error

openvsp.vsp.VSP_WRONG_XSEC_TYPE = 11

Wrong XSec type error

openvsp.vsp.VSP_XSEC_SCREEN = 62

XSec screen

openvsp.vsp.V_UNIT_FT_S = 0

Feet per second

openvsp.vsp.V_UNIT_KEAS = 4

Knots equivalent airspeed

openvsp.vsp.V_UNIT_KM_HR = 3

Kilometer per hour

openvsp.vsp.V_UNIT_KTAS = 5

Knots true airspeed

openvsp.vsp.V_UNIT_MACH = 6

Mach

openvsp.vsp.V_UNIT_MPH = 2

Mile per hour

openvsp.vsp.V_UNIT_M_S = 1

Meter per second

openvsp.vsp.ValidParm(id)

Check if given Parm is valid

#==== Add Pod Geometry ====//
pid = AddGeom( "POD" )

lenid = GetParm( pid, "Length", "Design" )

if  not ValidParm( lenid ) :
    print( "---> Error: API GetParm  " )
    assert False, "---> Error: API GetParm"
Parameters:

[in] – id string Parm ID

Return type:

boolean

Returns:

bool True if Parm ID is valid, false otherwise

openvsp.vsp.ValidateAdvLinkParms(index)

Validate the input and output parameters for an advanced link

pod = AddGeom( "POD", "" )
length = FindParm( pod, "Length", "Design" )
x_pos = GetParm( pod, "X_Rel_Location", "XForm" )

AddAdvLink( "ExampleLink" )
indx = GetLinkIndex( "ExampleLink" )
AddAdvLinkInput( indx, length, "len" )
AddAdvLinkOutput( indx, x_pos, "x" )

SetAdvLinkCode( indx, "x = 10.0 - len;" )

BuildAdvLinkScript( indx )

valid = ValidateAdvLinkParms( indx )

# The link built above is well formed, so this has to come back true.
assert valid, "ValidateAdvLinkParms did not report success"

if  valid :
    print( "Advanced link Parms are valid." )
else:
    print( "Advanced link Parms are not valid." )
Parameters:

[in] – index int Index for advanced link

Return type:

boolean

Returns:

bool Flag indicating whether parms are valid

class openvsp.vsp.Vec3dVec(*args)

Bases: object

Proxy of C++ std::vector< vec3d > class.

append(Vec3dVec self, vec3d x)
as_numpy()
assign(Vec3dVec self, std: :vector< vec3d >::size_type n, vec3d x)
back(Vec3dVec self) vec3d
begin(Vec3dVec self) std::vector< vec3d >::iterator
capacity(Vec3dVec self) std::vector< vec3d >::size_type
clear(Vec3dVec self)
empty(Vec3dVec self) bool
end(Vec3dVec self) std::vector< vec3d >::iterator
erase(Vec3dVec self, std: :vector< vec3d >::iterator pos) std::vector< vec3d >::iterator
erase(Vec3dVec self, std: :vector< vec3d >::iterator first, std: :vector< vec3d >::iterator last) std::vector< vec3d >::iterator
front(Vec3dVec self) vec3d
get_allocator(Vec3dVec self) std::vector< vec3d >::allocator_type
insert(Vec3dVec self, std: :vector< vec3d >::iterator pos, vec3d x) std::vector< vec3d >::iterator
insert(Vec3dVec self, std: :vector< vec3d >::iterator pos, std: :vector< vec3d >::size_type n, vec3d x)
iterator(Vec3dVec self) SwigPyIterator
pop(Vec3dVec self) vec3d
pop_back(Vec3dVec self)
push_back(Vec3dVec self, vec3d x)
rbegin(Vec3dVec self) std::vector< vec3d >::reverse_iterator
rend(Vec3dVec self) std::vector< vec3d >::reverse_iterator
reserve(Vec3dVec self, std: :vector< vec3d >::size_type n)
resize(Vec3dVec self, std: :vector< vec3d >::size_type new_size)
resize(Vec3dVec self, std: :vector< vec3d >::size_type new_size, vec3d x)
size(Vec3dVec self) std::vector< vec3d >::size_type
swap(Vec3dVec self, Vec3dVec v)
property thisown

The membership flag

openvsp.vsp.VecInsideSurf(geom_id, surf_indx, pts)

Test whether a vector of points are inside a specified surface.

# Add Pod Geom
geom_id = AddGeom( "POD", "" )

surf_indx = 0

n = 5

rvec = [0]*n
svec = [0]*n
tvec = [0]*n

for i in range(n):

    rvec[i] = (i+1)*1.0/(n+1)

    svec[i] = (n-i)*1.0/(n+1)

    tvec[i] = (i+1)*1.0/(n+1)

ptvec = CompVecPntRST( geom_id, 0, rvec, svec, tvec )


res = VecInsideSurf( geom_id, surf_indx, ptvec )

# Every point came from CompVecPntRST with r below one, so all are inside.
for i in range( len( res ) ):
    assert res[i], "VecInsideSurf says an interior point is outside"

See also: VecInsideSurf :param [in]: geom_id string Parent Geom ID :param [in]: surf_indx int Main surface index from the parent Geom :param [in]: pts vector<vec3d> Input vector of 3D coordinate points :rtype: std::vector< bool,std::allocator< bool > > :return: vector <bool> Boolean vector for each point. True if it is inside the surface, false otherwise.

openvsp.vsp.WHEEL_TIRE_1LG = 0

Large tire debris

openvsp.vsp.WHEEL_TIRE_1SM = 1

Small tire debris

openvsp.vsp.WHEEL_TIRE_2 = 2

Wheel flange debris

openvsp.vsp.WHEEL_TIRE_3E = 3

Flailing tire strip extended

openvsp.vsp.WHEEL_TIRE_3R = 4

Flailing tire strip retracted

openvsp.vsp.WHEEL_TIRE_4 = 5

Tire burst pressure (Not implemented)

openvsp.vsp.WIDTH_XSEC_DRIVER = 0

Width driver

openvsp.vsp.WING_SURF = 1

Wing VSP surface

openvsp.vsp.WIRE_FRAME_GEOM_SCREEN = 15

Wireframe geom screen

openvsp.vsp.WLINE_SOURCE = 4

Constant W Line source

openvsp.vsp.W_BOTTOM = 1

Chevron start/ends at bottom of cross section

openvsp.vsp.W_FREE = 5

Chevron start/ends at user specified point on cross section

openvsp.vsp.W_LEFT = 2

Chevron start/ends at left of cross section

openvsp.vsp.W_RIGHT_0 = 0

Chevron start/ends at right (W = 0) of cross section

openvsp.vsp.W_RIGHT_1 = 4

Chevron start/ends at right (W = 1) of cross section

openvsp.vsp.W_TOP = 3

Chevron start/ends at top of cross section

openvsp.vsp.WriteAdvLinkCodeFile(index, file_name)

Write the code of an advanced link out to a text file, the way the File Write button on the Advanced Link screen does. Only the code is written; the input and output variable lists are not, so a file written here can be read back into any link that declares the same variables.

pod = AddGeom( "POD", "" )
length = FindParm( pod, "Length", "Design" )
x_pos = GetParm( pod, "X_Rel_Location", "XForm" )

AddAdvLink( "ExampleLink" )
indx = GetLinkIndex( "ExampleLink" )
AddAdvLinkInput( indx, length, "len" )
AddAdvLinkOutput( indx, x_pos, "x" )

SetAdvLinkCode( indx, "x = 10.0 - len;" )

WriteAdvLinkCodeFile( indx, "ExampleLink.vspscript" )

# Overwrite the code, then bring the saved version back.
SetAdvLinkCode( indx, "x = 0.0;" )

ReadAdvLinkCodeFile( indx, "ExampleLink.vspscript" )

assert GetAdvLinkCode( indx ) == "x = 10.0 - len;", "the code did not survive the round trip"

See also: ReadAdvLinkCodeFile, GetAdvLinkCode :param [in]: index int Index for advanced link :param [in]: file_name string Name of the file to write

openvsp.vsp.WriteAtmosphereCSVFile(file_name, atmos_type)

Calculate the atmospheric properties determined by a specified model for a preset array of altitudes ranging from 0 to 90000 m and write the results to a CSV output file

print( "Starting USAF Atmosphere 1966 Table Creation. \n" )

WriteAtmosphereCSVFile( "USAFAtmosphere1966Data.csv", ATMOS_TYPE_HERRINGTON_1966 )
# The call above should have produced a file with content in it.
import os
assert os.path.getsize( "USAFAtmosphere1966Data.csv" ) > 0, "WriteAtmosphereCSVFile wrote no file"

See also: ATMOS_TYPE :param [in]: file_name string Output CSV file :param [in]: atmos_type int Atmospheric model enum (i.e. ATMOS_TYPE_HERRINGTON_1966)

openvsp.vsp.WriteBezierAirfoil(file_name, geom_id, foilsurf_u)

Write out the untwisted unit-length 2D Bezier curve for the specified airfoil in custom*.bz format. The output will describe the analytical shape of the airfoil. See BezierAirfoilExample.m and BezierCtrlToCoordPnts.m for examples of discretizing the Bezier curve and generating a Selig airfoil file.

#==== Add Wing Geometry and Set Parms ====//
wing_id = AddGeom( "WING", "" )

u = 0.5 # export airfoil at mid span location

#==== Write Bezier Airfoil File ====//
WriteBezierAirfoil( "Example_Bezier.bz", wing_id, u )
# The call above should have produced a file with content in it.
import os
assert os.path.getsize( "Example_Bezier.bz" ) > 0, "WriteBezierAirfoil wrote no file"
Parameters:
  • [in] – file_name string Airfoil (*.bz) output file name

  • [in] – geom_id string Geom ID

  • [in] – foilsurf_u double U location (range: 0 - 1) along the surface. The foil surface does not include root and tip caps (i.e. 2 section wing -> XSec0 @ u=0, XSec1 @ u=0.5, XSec2 @ u=1.0)

openvsp.vsp.WriteBodyFFCSVFile(file_name)

Calculate the form factor from each body FF equation (i.e. Hoerner Streamlined Body) and write the results to a CSV output file

print( "Starting Body Form Factor Data Creation. \n" )
WriteBodyFFCSVFile( "BodyFormFactorData.csv" )
# The call above should have produced a file with content in it.
import os
assert os.path.getsize( "BodyFormFactorData.csv" ) > 0, "WriteBodyFFCSVFile wrote no file"
Parameters:

[in] – file_name string Output CSV file

openvsp.vsp.WriteCfEqnCSVFile(file_name)

Calculate the coefficient of friction from each Cf equation (i.e. Power Law Blasius) and write the results to a CSV output file

print( "Starting Turbulent Friciton Coefficient Data Creation. \n" )
WriteCfEqnCSVFile( "FrictionCoefficientData.csv" )
# The call above should have produced a file with content in it.
import os
assert os.path.getsize( "FrictionCoefficientData.csv" ) > 0, "WriteCfEqnCSVFile wrote no file"
Parameters:

[in] – file_name string Output CSV file

openvsp.vsp.WriteDESFile(file_name)

Write all design variables to a design file (*.des) :param [in]: file_name string *.des output file

openvsp.vsp.WritePartialCfMethodCSVFile(file_name)

Calculate the partial coefficient of friction and write the results to a CSV output file

print( "Starting Partial Friction Method Data Creation. \n" )
WritePartialCfMethodCSVFile( "PartialFrictionMethodData.csv" )
# The call above should have produced a file with content in it.
import os
assert os.path.getsize( "PartialFrictionMethodData.csv" ) > 0, "WritePartialCfMethodCSVFile wrote no file"
Parameters:

[in] – file_name string Output CSV file

openvsp.vsp.WriteResultsCSVFile(id, file_name)

Export a result to CSV

# Add Pod Geom
pid = AddGeom( "POD" )

analysis_name = "VSPAEROComputeGeometry"

rid = ExecAnalysis( analysis_name )

WriteResultsCSVFile( rid, "CompGeomRes.csv" )
# The call above should have produced a file with content in it.
import os
assert os.path.getsize( "CompGeomRes.csv" ) > 0, "WriteResultsCSVFile wrote no file"
Parameters:
  • [in] – id string Rsult ID

  • [in] – file_name string CSV output file name

openvsp.vsp.WriteSeligAirfoil(file_name, geom_id, foilsurf_u)

Write out the untwisted unit-length 2D coordinate points for the specified airfoil in Selig format. Coordinate points follow the on-screen wire frame W tessellation.

#==== Add Wing Geometry and Set Parms ====//
wing_id = AddGeom( "WING", "" )

u = 0.5 # export airfoil at mid span location

#==== Write Selig Airfoil File ====//
WriteSeligAirfoil( "Example_Selig.dat", wing_id, u )
# The call above should have produced a file with content in it.
import os
assert os.path.getsize( "Example_Selig.dat" ) > 0, "WriteSeligAirfoil wrote no file"

See also: GetAirfoilCoordinates :param [in]: file_name string Airfoil (*.dat) output file name :param [in]: geom_id string Geom ID :param [in]: foilsurf_u double U location (range: 0 - 1) along the surface. The foil surface does not include root and tip caps (i.e. 2 section wing -> XSec0 @ u=0, XSec1 @ u=0.5, XSec2 @ u=1.0)

openvsp.vsp.WriteTestResults()

Generate some example results for testing.

#==== Write Some Fake Test Results =====//
WriteTestResults()

results_array = GetAllResultsNames()

for i in range( len( results_array ) ):
    resid = FindLatestResultsID( results_array[i] )
    PrintResults( resid )

# Two copies of Test_Results are written, carrying five named entries with
# known values.
assert GetNumResults( "Test_Results" ) == 2, "WriteTestResults did not write two results"

res_id = FindResultsID( "Test_Results" )

assert len( GetAllDataNames( res_id ) ) == 5, "WriteTestResults wrote the wrong number of entries"

int_arr = GetIntResults( res_id, "Test_Int", 0 )
dbl_arr = GetDoubleResults( res_id, "Test_Double", 0 )
str_arr = GetStringResults( res_id, "Test_String", 0 )

assert int_arr[0] == 1, "WriteTestResults wrote the wrong values"
assert abs( dbl_arr[0] - 0.1 ) < 1e-12, "WriteTestResults wrote the wrong values"
assert str_arr[0] == "This Is A Test", "WriteTestResults wrote the wrong values"

# The second copy carries the next set of values.
res_id_1 = FindResultsID( "Test_Results", 1 )

int_arr = GetIntResults( res_id_1, "Test_Int", 0 )

assert int_arr[0] == 2, "WriteTestResults did not vary the second result"
openvsp.vsp.WriteVSPFile(*args)

Save the current OpenVSP project to a VSP3 file

fid = AddGeom( "FUSELAGE", "" )             # Add Fuselage

fname = "example_fuse.vsp3"

SetVSP3FileName( fname )

# A relative name is resolved against the working directory, so ask for the
# resolved name rather than assuming it comes back verbatim.
full_name = GetVSPFileName()

Update()

#==== Save Vehicle to File ====//
print( "\tSaving vehicle file to: ", False )

print( fname )

WriteVSPFile( GetVSPFileName(), SET_ALL )

#==== Reset Geometry ====//
print( "--->Resetting VSP model to blank slate\n" )

ClearVSPModel()

assert len( FindGeoms() ) == 0, "ClearVSPModel left Geoms behind"

ReadVSPFile( fname )

# The Fuselage has to come back, and come back the same shape.
geoms = FindGeoms()

assert len( geoms ) == 1, "ReadVSPFile did not restore the model"
assert GetGeomTypeName( geoms[0] ) == "Fuselage", "ReadVSPFile restored the wrong Geom type"
assert GetVSPFileName() == full_name, "ReadVSPFile did not set the project file name"
Parameters:
  • [in] – file_name string *.vsp3 file name

  • [in] – set int Set index to write (i.e. SET_ALL)

openvsp.vsp.WriteWingFFCSVFile(file_name)

Calculate the form factor from each wing FF equation (i.e. Schemensky 4 Series Airfoil) and write the results to a CSV output file

print( "Starting Wing Form Factor Data Creation. \n" )
WriteWingFFCSVFile( "WingFormFactorData.csv" )
# The call above should have produced a file with content in it.
import os
assert os.path.getsize( "WingFormFactorData.csv" ) > 0, "WriteWingFFCSVFile wrote no file"
Parameters:

[in] – file_name string Output CSV file

openvsp.vsp.WriteXDDMFile(file_name)

Write all design variables to a Cart3D XDDM file (*.xddm) :param [in]: file_name string *.xddm output file

openvsp.vsp.XDDM_CONST = 1

Constant XDDM type

openvsp.vsp.XDDM_VAR = 0

Variable XDDM type

openvsp.vsp.XSEC_BOTH_SIDES = 0

Both sides

openvsp.vsp.XSEC_CUSTOM = 3

Custom XSec Geom

openvsp.vsp.XSEC_FUSE = 0

Fuselage XSec Geom

openvsp.vsp.XSEC_LEFT_SIDE = 1

Left side

openvsp.vsp.XSEC_NUM_TYPES = 5

Number of XSec types

openvsp.vsp.XSEC_PROP = 4

Propeller XSec Geom

openvsp.vsp.XSEC_RIGHT_SIDE = 2

Right side

openvsp.vsp.XSEC_STACK = 1

Stack XSec Geom

openvsp.vsp.XSEC_WING = 2

Wing XSec Geom

openvsp.vsp.XS_AC25_773 = 19

FAA AC 25.773 pilot view requirement

openvsp.vsp.XS_BICONVEX = 9

Biconvex XSec

openvsp.vsp.XS_CIRCLE = 1

Circle XSec

openvsp.vsp.XS_CST_AIRFOIL = 13

CST airfoil XSec

openvsp.vsp.XS_EDIT_CURVE = 11

Generic Edit Curve XSec

openvsp.vsp.XS_ELLIPSE = 2

Ellipse XSec

openvsp.vsp.XS_FILE_AIRFOIL = 12

Airfoil file XSec

openvsp.vsp.XS_FILE_FUSE = 6

Fuselage file XSec

openvsp.vsp.XS_FIVE_DIGIT = 16

Five digit XSec

openvsp.vsp.XS_FIVE_DIGIT_MOD = 17

Five digit modified XSec

openvsp.vsp.XS_FOUR_DIGIT_MOD = 15

Four digit modified XSec

openvsp.vsp.XS_FOUR_SERIES = 7

Four series XSec

openvsp.vsp.XS_GENERAL_FUSE = 5

General fuselage XSec

openvsp.vsp.XS_NUM_TYPES = 20

Number of XSec types

openvsp.vsp.XS_ONE_SIX_SERIES = 18

One six series XSec

openvsp.vsp.XS_POINT = 0

Point XSec

openvsp.vsp.XS_ROUNDED_RECTANGLE = 4

Rounded rectangle XSec

openvsp.vsp.XS_SHIFT_LE = 0

Shift leading edge

openvsp.vsp.XS_SIX_SERIES = 8

Six series XSec

openvsp.vsp.XS_SUPER_ELLIPSE = 3

Super ellipse XSec

openvsp.vsp.XS_VKT_AIRFOIL = 14

VKT airfoil XSec

openvsp.vsp.XS_WEDGE = 10

Wedge XSec

openvsp.vsp.XYZ_TARGET = 4

XYZ point target type

openvsp.vsp.XY_ABS = 3

Slice is parallel to absolute XY plane

openvsp.vsp.XY_BODY = 0

Slice is parallel to parent Geom body XY plane

openvsp.vsp.XZ_ABS = 5

Slice is parallel to absolute XZ plane

openvsp.vsp.XZ_BODY = 2

Slice is parallel to parent Geom body XZ plane

openvsp.vsp.X_DIR = 0

X direction

openvsp.vsp.X_PROJ = 0

Project in X axis direction

openvsp.vsp.YZ_ABS = 4

Slice is parallel to absolute YZ plane

openvsp.vsp.YZ_BODY = 1

Slice is parallel to parent Geom body YZ plane

openvsp.vsp.Y_PROJ = 1

Project in Y axis direction

openvsp.vsp.Z_PROJ = 2

Project in Z axis direction

openvsp.vsp.Z_TARGET = 3

Z plane target type

openvsp.vsp.angle(vec3d a, vec3d b) double
openvsp.vsp.angle(vec2d a, vec2d b) double
openvsp.vsp.angle_pnt_2_plane(vec3d ptplane, vec3d norm, vec3d ptaxis, vec3d axis, vec3d pt, int ccw, vec3d prot) double
openvsp.vsp.angle_pnt_2_plane(vec3d ptplane, vec3d norm, vec3d ptaxis, vec3d axis, vec3d pt, int ccw, vec3d prot1, vec3d prot2, double & theta1, double & theta2)
openvsp.vsp.area(vec3d A, vec3d B, vec3d C) double
openvsp.vsp.bi_lin_interp(vec2d p0, vec2d p1, vec2d p2, vec2d p3, double s, double t, vec2d p)
openvsp.vsp.center_of_circle(vec3d p1, vec3d p2, vec3d p3, vec3d center)
openvsp.vsp.clip_seg_rect(double x_min, double y_min, double x_max, double y_max, vec2d pnt1, vec2d pnt2, int & visible)
openvsp.vsp.compsum(Vec3dVec x) vec3d
openvsp.vsp.cos_angle(vec3d a, vec3d b) double
openvsp.vsp.cos_angle(vec2d a, vec2d b) double
openvsp.vsp.cross(vec3d a, vec3d b) vec3d
openvsp.vsp.cross(vec2d a, vec2d b) double
openvsp.vsp.det(vec2d p0, vec2d p1, vec2d offset) double
openvsp.vsp.dist(vec3d a, vec3d b) double
openvsp.vsp.dist(vec2d a, vec2d b) double
openvsp.vsp.dist3D_Segment_to_Segment(vec3d S1P0, vec3d S1P1, vec3d S2P0, vec3d S2P1) double
openvsp.vsp.dist3D_Segment_to_Segment(vec3d S1P0, vec3d S1P1, vec3d S2P0, vec3d S2P1, double * Lt, vec3d Ln, double * St, vec3d Sn) double
openvsp.vsp.dist_pnt_2_line(vec3d line_pt1, vec3d line_pt2, vec3d pnt) double
openvsp.vsp.dist_pnt_2_plane(vec3d org, vec3d norm, vec3d pnt) double
openvsp.vsp.dist_pnt_2_ray(vec3d line_pt1, vec3d dir_unit_vec, vec3d pnt) double
openvsp.vsp.dist_squared(vec3d a, vec3d b) double
openvsp.vsp.dist_squared(vec2d a, vec2d b) double
openvsp.vsp.dot(vec3d a, vec3d b) double
openvsp.vsp.dot(vec2d a, vec2d b) double
openvsp.vsp.encode(double x_min, double y_min, double x_max, double y_max, vec2d pnt, int [4] code)
openvsp.vsp.inverse_bi_lin_interp(vec2d p0, vec2d p1, vec2d p2, vec2d p3, vec2d p, double & s, double & t, double & s2, double & t2) int
openvsp.vsp.line_line_intersect(vec3d p1, vec3d p2, vec3d p3, vec3d p4, double * s, double * t) bool
openvsp.vsp.nearSegSeg(vec3d L0, vec3d L1, vec3d S0, vec3d S1, double * Lt, vec3d Ln, double * St, vec3d Sn) double
openvsp.vsp.orient2d(vec2d p0, vec2d p1, vec2d p) double
openvsp.vsp.plane_half_space(vec3d planeOrig, vec3d planeNorm, vec3d pnt) int
openvsp.vsp.plane_plane_intersection(vec3d p0, vec3d n0, vec3d p1, vec3d n1, vec3d p, vec3d v) bool
openvsp.vsp.plane_ray_intersect(vec3d A, vec3d B, vec3d C, vec3d D, vec3d E, double & t) int
openvsp.vsp.plane_ray_intersect(vec3d orig, vec3d norm, vec3d D, vec3d E, double & t) int
openvsp.vsp.pnt_tri_min_dist(vec3d v0, vec3d v1, vec3d v2, vec3d pnt, vec3d pnearest) double
openvsp.vsp.pointLineDistSquared(vec3d p, vec3d lp0, vec3d lp1, double & t, vec3d pon) double
openvsp.vsp.pointSegDistSquared(vec3d p, vec3d sp0, vec3d sp1, double & t, vec3d pon) double
openvsp.vsp.point_on_line(vec3d lp0, vec3d lp1, double const & t) vec3d
openvsp.vsp.poly_area(Vec3dVec pnt_vec) double
openvsp.vsp.poly_area(std: :vector< vec2d, std: :allocator< vec2d > > const & pnt_vec) double
openvsp.vsp.poly_centroid(std: :vector< vec2d, std: :allocator< vec2d > > const & pnt_vec) vec2d
openvsp.vsp.printpt(vec3d v)
openvsp.vsp.proj_pnt_on_line(vec3d line_pt1, vec3d line_pt2, vec3d pnt) vec3d
openvsp.vsp.proj_pnt_on_line_seg(vec3d line_pt1, vec3d line_pt2, vec3d pnt) vec3d
openvsp.vsp.proj_pnt_on_line_seg(vec2d line_A, vec2d line_B, vec2d pnt) vec2d
openvsp.vsp.proj_pnt_on_line_u(vec2d line_A, vec2d line_B, vec2d pnt) double
openvsp.vsp.proj_pnt_on_ray(vec3d line_pt1, vec3d line_dir, vec3d pnt) vec3d
openvsp.vsp.proj_pnt_on_ray(vec3d line_pt1, vec3d line_dir, vec3d pnt, double & t) vec3d
openvsp.vsp.proj_pnt_to_plane(vec3d org, vec3d plane_ln1, vec3d plane_ln2, vec3d pnt) vec3d
openvsp.vsp.proj_u_on_v(vec3d u, vec3d v) vec3d
openvsp.vsp.proj_vec_to_plane(vec3d vec, vec3d norm) vec3d
openvsp.vsp.radius_of_circle(vec3d p1, vec3d p2, vec3d p3) double
openvsp.vsp.raySphereIntersectionFromInside(vec3d p, vec3d v, vec3d c, double r, vec3d x) bool
openvsp.vsp.ray_ray_intersect(vec3d A, vec3d B, vec3d C, vec3d D, vec3d int_pnt1, vec3d int_pnt2) int
openvsp.vsp.seg_seg_intersect(vec2d pnt_A, vec2d pnt_B, vec2d pnt_C, vec2d pnt_D, vec2d int_pnt, double & t1, double & t2) int
openvsp.vsp.signed_angle(vec3d a, vec3d b, vec3d ref) double
openvsp.vsp.signed_dist_pnt_2_plane(vec3d org, vec3d norm, vec3d pnt) double
openvsp.vsp.slerp(vec3d a, vec3d b, double const & t) vec3d
openvsp.vsp.tetra_volume(vec3d A, vec3d B, vec3d C) double
openvsp.vsp.to_string(vec3d v) std::string
openvsp.vsp.tri_ray_intersect(vec3d A, vec3d B, vec3d C, vec3d D, vec3d E, double & u, double & w, double & t) int
openvsp.vsp.tri_seg_intersect(vec3d A, vec3d B, vec3d C, vec3d D, vec3d E, double & u, double & w, double & t) int
openvsp.vsp.tri_tri_min_dist(vec3d v0, vec3d v1, vec3d v2, vec3d v3, vec3d v4, vec3d v5, vec3d p1, vec3d p2) double
openvsp.vsp.triangle_plane_intersect_test(vec3d org, vec3d norm, vec3d p1, vec3d p2, vec3d p3) bool
openvsp.vsp.triangle_plane_maximum_dist(vec3d org, vec3d norm, vec3d p1, vec3d p2, vec3d p3, vec3d pa, vec3d pb) double
openvsp.vsp.triangle_plane_minimum_dist(vec3d org, vec3d norm, vec3d p1, vec3d p2, vec3d p3, vec3d pa, vec3d pb) double
class openvsp.vsp.vec2d(*args)

Bases: object

Proxy of C++ vec2d class.

data(vec2d self) double *
mag(vec2d self) double
normalize(vec2d self)
set_x(vec2d self, double xx) vec2d
set_xy(vec2d self, double xx, double yy) vec2d
set_y(vec2d self, double yy) vec2d
property thisown

The membership flag

transform(vec2d self, float [3][3] mat) vec2d
transform(vec2d self, double [3][3] mat) vec2d
property v

v : a(2).double

x(vec2d self) double
y(vec2d self) double
class openvsp.vsp.vec3d(*args)

Bases: object

vec3d is typically used to describe coordinate points and vectors in 3D space. All 3 elements in the vector are of type double.

FlipNormal(vec3d self)
Transform(vec3d self, Matrix4d m)
as_numpy()
as_vec2d_xy(vec3d self) vec2d
data(vec3d self) double *
get_pnt(vec3d self, double [3] pnt)
get_pnt(vec3d self, float [3] pnt)
get_pnt(vec3d self, threed_point_type & pnt)
isfinite(vec3d self) bool
isinf(vec3d self) bool
isnan(vec3d self) bool
mag()

Get the magnitude of a vec3d

import math
#==== Test Vec3d ====//
vec3d a()                                # Default Constructor

#==== Test Mag ====//
a.set_xyz( 1.0, 2.0, 3.0 )

if  abs( a.mag() - math.sqrt( 14 ) ) > 1e-6 : Print( "---> Error: Vec3d Mag " ); }
Return type:

float

Returns:

Magnitude

magsq(vec3d self) double
major_comp(vec3d self) int
minor_comp(vec3d self) int
normalize()

Normalize the vec3d

    #==== Test Vec3d ====//
vec3d a(), b(), c()                                # Default Constructor

#==== Test Cross ====//
a.set_xyz( 4.0, 0.0, 0.0 )
b.set_xyz( 0.0, 3.0, 0.0 )

c = cross( a, b )

c.normalize()
offset_i(vec3d self, double offset, int idir)
offset_x(offset)

Offset the X coordinate of the vec3d

    #==== Test Vec3d ====//
vec3d a()                                # Default Constructor

#===== Test Offset ====//
a.set_xyz( 2.0, 2.0, 2.0 )

a.offset_x( 10.0 )
Parameters:

[in] – offset Offset for the X value

offset_y(offset)

Offset the Y coordinate of the vec3d

    #==== Test Vec3d ====//
vec3d a()                                # Default Constructor

#===== Test Offset ====//
a.set_xyz( 2.0, 2.0, 2.0 )

a.offset_y( 10.0 )
Parameters:

[in] – offset Offset for the Y value

offset_z(offset)

Offset the Z coordinate of the vec3d

    #==== Test Vec3d ====//
vec3d a()                                # Default Constructor

#===== Test Offset ====//
a.set_xyz( 2.0, 2.0, 2.0 )

a.offset_z( 10.0 )
Parameters:

[in] – offset Offset for the Z value

reflect_xy()

Reflect the vec3d across the XY plane

    #==== Test Vec3d ====//
vec3d a(), b()                                # Default Constructor

#===== Test Reflect ====//
a.set_xyz( 1.0, 2.0, 3.0 )

b = a.reflect_xy()
Return type:

vec3d

Returns:

Reflected vec3d

reflect_xz()

Reflect the vec3d across the XZ plane

    #==== Test Vec3d ====//
vec3d a(), b()                                # Default Constructor

#===== Test Reflect ====//
a.set_xyz( 1.0, 2.0, 3.0 )

b = a.reflect_xz()
Return type:

vec3d

Returns:

Reflected vec3d

reflect_yz()

Reflect the vec3d across the YZ plane

    #==== Test Vec3d ====//
vec3d a(), b()                                # Default Constructor

#===== Test Reflect ====//
a.set_xyz( 1.0, 2.0, 3.0 )

b = a.reflect_yz()
Return type:

vec3d

Returns:

Reflected vec3d

rotate_x(theta)

Rotate the vec3d about the X axis.

import math
#==== Test Vec3d ====//
vec3d a()                                # Default Constructor
PI = 3.14

a.set_xyz( 1.0, 0.0, 0.0 )

a.rotate_x( 0.5 * PI )
Parameters:

[in] – theta double Rotation angle in radians

rotate_y(theta)

Rotate the vec3d about the Y axis.

import math
#==== Test Vec3d ====//
vec3d a()                                # Default Constructor
PI = 3.14

a.set_xyz( 1.0, 0.0, 0.0 )

a.rotate_y( 0.5 * PI )
Parameters:

[in] – theta double Rotation angle in radians

rotate_z(theta)

Rotate the vec3d about the Z axis.

import math
#==== Test Vec3d ====//
vec3d a()                                # Default Constructor
PI = 3.14

a.set_xyz( 1.0, 0.0, 0.0 )

a.rotate_z( 0.5 * PI )
Parameters:

[in] – theta double Rotation angle in radians

scale_x(scale)

Scale the X coordinate of the vec3d

    #==== Test Vec3d ====//
vec3d a()                                # Default Constructor

#===== Test Scale ====//
a.set_xyz( 2.0, 2.0, 2.0 )

a.scale_x( 2.0 )
Parameters:

[in] – scale Scaling factor for the X value

scale_y(scale)

Scale the Y coordinate of the vec3d

    #==== Test Vec3d ====//
vec3d a()                                # Default Constructor

#===== Test Scale ====//
a.set_xyz( 2.0, 2.0, 2.0 )

a.scale_y( 2.0 )
Parameters:

[in] – scale Scaling factor for the Y value

scale_z(scale)

Scale the Z coordinate of the vec3d

    #==== Test Vec3d ====//
vec3d a()                                # Default Constructor

#===== Test Scale ====//
a.set_xyz( 2.0, 2.0, 2.0 )

a.scale_z( 2.0 )
Parameters:

[in] – scale Scaling factor for the Z value

set_arr(vec3d self, double const [] a) vec3d
set_arr(vec3d self, float const [] a) vec3d
set_refx(vec3d self, vec3d a) vec3d
set_refy(vec3d self, vec3d a) vec3d
set_refz(vec3d self, vec3d a) vec3d
set_vec(vec3d self, DoubleVector a) vec3d
set_x(xx)

Set the X coordinate (index 0) of the vec3d

    #==== Test Vec3d ====//
vec3d a()                                # Default Constructor

a.set_x( 2.0 )
Parameters:

[in] – xx New X value

Return type:

vec3d

Returns:

Updated vec3d

set_xyz(xx, yy, zz)

Set all three elements of the vec3d vector

    #==== Test Vec3d ====//
vec3d a()                                # Default Constructor

a.set_xyz( 2.0, 4.0, 6.0 )
Parameters:
  • [in] – xx New X value

  • [in] – yy New Y value

  • [in] – zz New Z value

Return type:

vec3d

Returns:

Updated vec3d

set_y(yy)

Set the Y coordinate (index 1) of the vec3d

    #==== Test Vec3d ====//
vec3d a()                                # Default Constructor

a.set_y( 4.0 )
Parameters:

[in] – yy New Y value

Return type:

vec3d

Returns:

Updated vec3d

set_z(zz)

Set the z coordinate (index 2) of the vec3d

    #==== Test Vec3d ====//
vec3d a()                                # Default Constructor

a.set_z( 6.0 )
Parameters:

[in] – zz in double new z value

Return type:

vec3d

Returns:

vec3d result

swap_xy(vec3d self) vec3d
swap_xz(vec3d self) vec3d
swap_yz(vec3d self) vec3d
property thisown

The membership flag

property v

v : a(3).double

x()

Get the X coordinate (index 0) of the vec3d

    vec3d a()                                # Default Constructor

a.set_xyz( 2.0, 4.0, 6.0 )

Print( "a.x() = ", False )
Print( a.x() )

Print( "a[0]= ", False )
Print( a[0] )
Return type:

float

Returns:

X value

y()

Get the Y coordinate (index 1) of the vec3d

    vec3d a()                                # Default Constructor

a.set_xyz( 2.0, 4.0, 6.0 )

Print( "a.y() = ", False )
Print( a.y() )

Print( "a[1]= ", False )
Print( a[1] )
Return type:

float

Returns:

Y value

z()

Get the Z coordinate (index 2) of the vec3d

    vec3d a()                                # Default Constructor

a.set_xyz( 2.0, 4.0, 6.0 )

Print( "a.z() = ", False )
Print( a.z() )

Print( "a[2]= ", False )
Print( a[2] )
Return type:

float

Returns:

Z value