This functions grouped here are used to create and manipulate Custom Components. Custom components are defined in *.vsppart files included in the /"Custom Scripts/" directory. Examples of Custom Components are available in the directory for reference. OpenVSP looks in 3 locations for the /"Custom Scripts/" folder, where Custom Components are loaded: the root directory, the VSP executable direcotry, and the home directory. Note, these functions are specific to defining Custom Components and can't be called from standard API scripts (i.e. *.vspscript). However, a Custom Component can be created as a *.vsppart file and then accessed through secondary API scripts.
Click here to return to the main page.
More...
|
string | AddParm (int type, const string &in name, const string &in group) |
|
string | GetCurrCustomGeom () |
|
string | GetCustomParm (int index) |
|
int | AddGui (int type, const string &in label=string(), const string &in parm_name=string(), const string &in group_name=string(), double range=10.0) |
|
void | UpdateGui (int gui_id, const string &in parm_id) |
|
string | AddXSecSurf () |
|
void | RemoveXSecSurf (const string &in xsec_id) |
|
void | ClearXSecSurfs () |
|
void | SkinXSecSurf (bool closed_flag=false) |
|
void | CloneSurf (int index, Matrix4d &in mat) |
|
void | TransformSurf (int index, Matrix4d &in mat) |
|
void | SetVspSurfType (int type, int surf_index=- 1) |
|
void | SetVspSurfCfdType (int type, int surf_index=- 1) |
|
void | SetCustomXSecLoc (const string &in xsec_id, const vec3d &in loc) |
|
vec3d | GetCustomXSecLoc (const string &in xsec_id) |
|
void | SetCustomXSecRot (const string &in xsec_id, const vec3d &in rot) |
|
vec3d | GetCustomXSecRot (const string &in xsec_id) |
|
bool | CheckClearTriggerEvent (int gui_id) |
|
void | SetupCustomDefaultSource (int type, int surf_index, double l1, double r1, double u1, double w1, double l2=0, double r2=0, double u2=0, double w2=0) |
|
void | ClearAllCustomDefaultSources () |
|
void | SetCustomCenter (double x, double y, double z) |
|
string | AppendXSec (const string &in xsec_surf_id, int type) |
|
string | AppendCustomXSec (const string &in xsec_surf_id, int type) |
|
void | CutCustomXSec (const string &in xsec_surf_id, int index) |
|
void | CopyCustomXSec (const string &in xsec_surf_id, int index) |
|
void | PasteCustomXSec (const string &in xsec_surf_id, int index) |
|
string | InsertCustomXSec (const string &in xsec_surf_id, int type, int index) |
|
◆ AddGui()
Add a GUI element for the current custom Geom. Some inputs may not be used depending on the input type. The Parm name and group name are used to identify the Parm ID associated with the GUI element.
- See also
- GDEV
- Parameters
-
[in] | type | GUI element type enum (i.e. GDEV_SLIDER_ADJ_RANGE) |
[in] | label | Optional GUI device label |
[in] | parm_name | Optional Parm name |
[in] | group_name | Optional Parm group name |
[in] | range | Optional GUI element range |
- Returns
- GUI element index
◆ AddParm()
Function to add a new Parm of input type, name, and group for a custom Geom component
- See also
- PARM_TYPE
- Parameters
-
[in] | type | Parm type enum (i.e. PARM_DOUBLE_TYPE) |
[in] | name | Parm name |
[in] | group | Parm group |
- Returns
- Parm ID
◆ AddXSecSurf()
Add an XSecSurf to the current custom Geom
/code{.cpp}
==== Add Cross Sections =====// string seat_surf = AddXSecSurf();
AppendCustomXSec( seat_surf, XS_POINT);
AppendCustomXSec( seat_surf, XS_ROUNDED_RECTANGLE);
AppendCustomXSec( seat_surf, XS_ROUNDED_RECTANGLE);
AppendCustomXSec( seat_surf, XS_POINT); /endcode
- Returns
- XSecSurf ID
◆ AppendCustomXSec()
string AppendCustomXSec |
( |
const string &in |
xsec_surf_id, |
|
|
int |
type |
|
) |
| |
Append an XSec to the current custom Geom. This function is identical to AppendXSec.
- See also
- XSEC_CRV_TYPE, AppendXSec
- Parameters
-
[in] | xsec_surf_id | XSecSurf ID |
[in] | type | XSec type enum (i.e. XSEC_WEDGE) |
- Returns
- XSec ID
◆ AppendXSec()
string AppendXSec |
( |
const string &in |
xsec_surf_id, |
|
|
int |
type |
|
) |
| |
Append an XSec to the current custom Geom. This function is identical to AppendCustomXSec.
- See also
- XSEC_CRV_TYPE, AppendCustomXSec
- Parameters
-
[in] | xsec_surf_id | XSecSurf ID |
[in] | type | XSec type enum (i.e. XSEC_WEDGE) |
- Returns
- XSec ID
◆ CheckClearTriggerEvent()
bool CheckClearTriggerEvent |
( |
int |
gui_id | ) |
|
Check and clear a trigger event for a custom Geom GUI element
- Parameters
-
[in] | gui_id | GUI element index |
- Returns
- True if successful, false otherwise
◆ ClearAllCustomDefaultSources()
void ClearAllCustomDefaultSources |
( |
| ) |
|
Clear all default sources for the current custom Geom
◆ ClearXSecSurfs()
◆ CloneSurf()
void CloneSurf |
( |
int |
index, |
|
|
Matrix4d &in |
mat |
|
) |
| |
Make a copy of the current custom Geom's main surface at given index and apply a transformation
double x = 2.0;
double y = 5.0;
double z = 0.0;
- Parameters
-
[in] | index | Main surface index |
[in] | mat | Transformation matrix |
◆ CopyCustomXSec()
void CopyCustomXSec |
( |
const string &in |
xsec_surf_id, |
|
|
int |
index |
|
) |
| |
Copy an XSec from the current custom Geom and keep it in memory
- See also
- PasteCustomXSec
- Parameters
-
[in] | xsec_surf_id | XSecSurf ID |
[in] | index | XSec index |
◆ CutCustomXSec()
void CutCustomXSec |
( |
const string &in |
xsec_surf_id, |
|
|
int |
index |
|
) |
| |
Remove an XSec from the current custom Geom and keep it in memory
- See also
- PasteCustomXSec
- Parameters
-
[in] | xsec_surf_id | XSecSurf ID |
[in] | index | XSec index |
◆ GetCurrCustomGeom()
Get the Geom ID of the current custom Geom
for ( int i = 0 ; i < 4 ; i++ )
{
}
- Returns
- Geom ID
◆ GetCustomParm()
string GetCustomParm |
( |
int |
index | ) |
|
Get the Parm ID for the input Parm index of the current custom Geom
- Parameters
-
- Returns
- Parm ID
◆ GetCustomXSecLoc()
Get the location of an XSec for the current custom Geom
string xsec0 =
GetXSec( xsec_surf, 0 );
Print(
"Custom XSec Location: ",
false );
- Parameters
-
- Returns
- 3D location
◆ GetCustomXSecRot()
Get the rotation of an XSec for the current custom Geom
string xsec0 =
GetXSec( xsec_surf, 0 );
Print(
"Custom XSec Rotation: ",
false );
- Parameters
-
- Returns
- 3D rotation (degrees)
◆ InsertCustomXSec()
string InsertCustomXSec |
( |
const string &in |
xsec_surf_id, |
|
|
int |
type, |
|
|
int |
index |
|
) |
| |
Insert a new XSec at the given index for the currently selected custom Geom
- See also
- XSEC_CRV_TYPE
- Parameters
-
[in] | xsec_surf_id | XSecSurf ID |
[in] | type | XSec type enum (i.e. XSEC_WEDGE) |
[in] | index | XSec index |
◆ PasteCustomXSec()
void PasteCustomXSec |
( |
const string &in |
xsec_surf_id, |
|
|
int |
index |
|
) |
| |
Paste the XSec currently held in memory for the current custom Geom at given index
- See also
- CutCustomXSec, CopyCustomXSec
- Parameters
-
[in] | xsec_surf_id | XSecSurf ID |
[in] | index | XSec index |
◆ RemoveXSecSurf()
void RemoveXSecSurf |
( |
const string &in |
xsec_id | ) |
|
Remove an XSecSurf from the current custom Geom
- Parameters
-
◆ SetCustomCenter()
void SetCustomCenter |
( |
double |
x, |
|
|
double |
y, |
|
|
double |
z |
|
) |
| |
Set the center point of the current custom Geom
- Parameters
-
[in] | x | X coordinate |
[in] | y | Y coordinate |
[in] | z | Z coordinate |
◆ SetCustomXSecLoc()
void SetCustomXSecLoc |
( |
const string &in |
xsec_id, |
|
|
const vec3d &in |
loc |
|
) |
| |
Set the location of an XSec for the current custom Geom
string xsec0 =
GetXSec( xsec_surf, 0 );
- Parameters
-
[in] | xsec_id | XSec ID |
[in] | loc | 3D location |
◆ SetCustomXSecRot()
void SetCustomXSecRot |
( |
const string &in |
xsec_id, |
|
|
const vec3d &in |
rot |
|
) |
| |
Set the rotation of an XSec for the current custom Geom
- Parameters
-
[in] | xsec_id | XSec ID |
[in] | rot | Angle of rotation about the X, Y and Z axes (degrees) |
◆ SetupCustomDefaultSource()
void SetupCustomDefaultSource |
( |
int |
type, |
|
|
int |
surf_index, |
|
|
double |
l1, |
|
|
double |
r1, |
|
|
double |
u1, |
|
|
double |
w1, |
|
|
double |
l2 = 0 , |
|
|
double |
r2 = 0 , |
|
|
double |
u2 = 0 , |
|
|
double |
w2 = 0 |
|
) |
| |
Add a CFD Mesh default source for the current custom Geom. Note, certain input params may not be used depending on the source type.
- See also
- CFD_MESH_SOURCE_TYPE
- Parameters
-
[in] | type | CFD Mesh source type enum (i.e. BOX_SOURCE) |
[in] | surf_index | Main surface index |
[in] | l1 | Source first edge length |
[in] | r1 | Source first radius |
[in] | u1 | Source first U location |
[in] | w1 | Source first W location |
[in] | l2 | Source second edge length |
[in] | r2 | Source second radius |
[in] | u2 | Source second U location |
[in] | w2 | Source second W location |
◆ SetVspSurfCfdType()
void SetVspSurfCfdType |
( |
int |
type, |
|
|
int |
surf_index = - 1 |
|
) |
| |
Set the surface CFD type for the current custom Geom at given surface index
- See also
- VSP_SURF_CFD_TYPE
- Parameters
-
[in] | type | CFD surface type enum (i.e. CFD_TRANSPARENT) |
[in] | surf_index | Main surface index. The default value of -1 is used to indicate all main surfaces are the same type. |
◆ SetVspSurfType()
void SetVspSurfType |
( |
int |
type, |
|
|
int |
surf_index = - 1 |
|
) |
| |
Set the surface type for the current custom Geom at given surface index
- See also
- VSP_SURF_TYPE
- Parameters
-
[in] | type | Surface type enum (i.e DISK_SURF) |
[in] | surf_index | Main surface index. The default value of -1 is used to indicate all main surfaces are the same type. |
◆ SkinXSecSurf()
void SkinXSecSurf |
( |
bool |
closed_flag = false | ) |
|
Perform a skinning update for the current custom Geom. This is typically the last call in the UpdateSurf function that gets called every time the Geom is updated.
string xsec3 =
GetXSec( xsec_surf, 3 );
- Parameters
-
[in] | closed_flag | Flag to set the last XSec equal to the first |
◆ TransformSurf()
void TransformSurf |
( |
int |
index, |
|
|
Matrix4d &in |
mat |
|
) |
| |
Perform a transformation for the main surface at input index for the current custom Geom
- Parameters
-
[in] | index | Main surface index |
[in] | mat | Transformation matrix |
◆ UpdateGui()
void UpdateGui |
( |
int |
gui_id, |
|
|
const string &in |
parm_id |
|
) |
| |
Update the GUI element with an associated Parm
/code{.cpp}
==== UpdateGui Is Called Every Time The Gui is Updated ====//
string geom_id = GetCurrCustomGeom();
UpdateGui( WidthSlider, GetParm( geom_id, "Width", "Design" ) );
UpdateGui( SeatHeightSlider, GetParm( geom_id, "SeatHeight", "Design" ) );
UpdateGui( SeatLengthSlider, GetParm( geom_id, "SeatLength", "Design" ) );
UpdateGui( BackHeightSlider, GetParm( geom_id, "BackHeight", "Design" ) );
/endcode
\param [in] gui_id Index of the GUI element
\param [in] parm_id Parm ID