This is an old revision of the document!
Custom Component Tutorial
Custom components allow the user to add additional geometry types to OpenVSP. The custom type parameters, shape and GUI are all defined by a script written in AngelScript.
AngelScript is an embedded open source scripting language with a C/C++ syntax. Numerous OpenVSP functions and data types can be called from the script. For a complete list of exposed functions see http://www.openvsp.org/wiki/doku.php?id=api.
The script should be named with a .vsppart suffix and placed in the CustomScripts directory which should be located in the same directory as the vsp executable.
There are four functions required to define a custom component:
void Init() - This function is called once when the component is created. Use this function to create parameters and set up surfaces that will have a fixed number of cross-sections. You can also add default sources for CFD Meshing.
void InitGUI() - This function is called once at creation. Create the GUI needed to control the parameters of your component. Also associate the GUI with the parameters.
void UpdateGui() - Called every time the GUI is updated. This function can be used to disable/enable GUI or change associations with the parameters.
void UpdateSurf() - Called every time the geometry component is updated. Build, update and/or transform the surface geometry based on the current value of the parameters. You can also modify the surface skinning parameters.
The are two optional functions:
void Scale( float scale ) - Add code here to scale the geometry. If this function is not provided, the scale parameter will not do anything.