|
| void | vsp::SetGeomMaterialName (const std::string &geom_id, const std::string &name) |
| std::vector< std::string > | vsp::GetGeomTypes () |
| std::string | vsp::AddGeom (const std::string &type, const std::string &parent=std::string()) |
| void | vsp::UpdateGeom (const std::string &geom_id) |
| void | vsp::DeleteGeom (const std::string &geom_id, int clone_delete=CLONE_DELETE_LEAVE_EMPTY) |
| void | vsp::DeleteGeomVec (const std::vector< std::string > &del_vec, int clone_delete=CLONE_DELETE_LEAVE_EMPTY) |
| void | vsp::CutGeomToClipboard (const std::string &geom_id, int clone_delete=CLONE_DELETE_LEAVE_EMPTY) |
| void | vsp::CopyGeomToClipboard (const std::string &geom_id) |
| std::vector< std::string > | vsp::PasteGeomClipboard (const std::string &parent=std::string()) |
| std::string | vsp::ConvertFuselageToStack (const std::string &geom_id) |
| void | vsp::SetMdcPreset (const std::string &geom_id, int preset) |
| std::string | vsp::ConvertMdcBodToStack (const std::string &geom_id, bool replace_flag) |
| std::vector< std::string > | vsp::ConvertMdcFinToWing (const std::string &geom_id, bool replace_flag) |
| std::vector< std::string > | vsp::FindGeoms () |
| std::vector< std::string > | vsp::FindGeomsWithName (const std::string &name) |
| std::string | vsp::FindGeom (const std::string &name, int index) |
| void | vsp::SetGeomName (const std::string &geom_id, const std::string &name) |
| std::string | vsp::GetGeomName (const std::string &geom_id) |
| void | vsp::SetGeomCloneOriginal (const std::string &clone_id, const std::string &original_id) |
| std::string | vsp::GetGeomCloneOriginal (const std::string &clone_id) |
| std::vector< std::string > | vsp::CloneGeomVec (const std::vector< std::string > &geom_id_vec, const std::string &name_suffix="_Clone") |
| void | vsp::SetGeomCloneNameSuffix (const std::string &clone_id, const std::string &name_suffix) |
| std::string | vsp::GetGeomCloneNameSuffix (const std::string &clone_id) |
| std::string | vsp::ReplaceCloneGeom (const std::string &clone_id) |
| std::vector< std::string > | vsp::FindGeomClones (const std::vector< std::string > &geom_id_vec) |
| std::vector< std::string > | vsp::GetGeomParmIDs (const std::string &geom_id) |
| std::string | vsp::GetGeomTypeName (const std::string &geom_id) |
| void | vsp::SetGeomParent (const std::string &geom_id, const std::string &parent_id) |
| void | vsp::ReorderGeom (const std::string &geom_id, int reorder_type) |
| std::string | vsp::AttachGeomTexture (const std::string &geom_id, const std::string &file_name) |
| void | vsp::RemoveGeomTexture (const std::string &geom_id, const std::string &texture_id) |
| std::vector< std::string > | vsp::GetGeomTextureIDVec (const std::string &geom_id) |
| std::string | vsp::GetGeomTextureFileName (const std::string &geom_id, const std::string &texture_id) |
| std::string | vsp::GetGeomParent (const std::string &geom_id) |
| std::string | vsp::GetGeomSymAncestorID (const std::string &geom_id) |
| std::string | vsp::GetGeomIncorporatedAncestorID (const std::string &geom_id) |
| void | vsp::SetGeomSymAncestorID (const std::string &geom_id, const std::string &ancestor_id) |
| void | vsp::SetGeomIncorporatedAncestorID (const std::string &geom_id, const std::string &ancestor_id) |
| std::vector< std::string > | vsp::GetGeomChildren (const std::string &geom_id) |
| int | vsp::GetNumMainSurfs (const std::string &geom_id) |
| int | vsp::GetTotalNumSurfs (const std::string &geom_id) |
| int | vsp::GetGeomVSPSurfType (const std::string &geom_id, int main_surf_ind=0) |
| int | vsp::GetGeomVSPSurfCfdType (const std::string &geom_id, int main_surf_ind=0) |
| vec3d | vsp::GetGeomBBoxMax (const std::string &geom_id, int main_surf_ind=0, bool ref_frame_is_absolute=true) |
| vec3d | vsp::GetGeomBBoxMin (const std::string &geom_id, int main_surf_ind=0, bool ref_frame_is_absolute=true) |
| void | vsp::SplitWingXSec (const std::string &wing_id, int section_index) |
| std::vector< int > | vsp::GetDriverGroup (const std::string &geom_id, int section_index) |
| void | vsp::ResetPropellerThickness (const std::string &geom_id) |
| void | vsp::InitPropPreset (const std::string &geom_id, int preset) |
| Matrix4d | vsp::GetPropBladeXForm (const std::string &geom_id, int blade_index, int symm_index, double rotate) |
| Matrix4d | vsp::GetPropBladeMotionXForm (const std::string &geom_id, int blade_index, int symm_index, double rotate) |
| void | vsp::CopyAirfoil (const std::string &geom_id, int index) |
| void | vsp::PasteAirfoil (const std::string &geom_id, int index) |
| void | vsp::ClearSkinning (const std::string &geom_id, int index=-1) |
| void | vsp::ResetGeomScale (const std::string &geom_id) |
| void | vsp::AcceptGeomScale (const std::string &geom_id) |
| std::vector< vec3d > | vsp::GetPtCloudPnts (const std::string &geom_id) |
| std::string | vsp::CreateNGonMeshGeom (const std::string &geom_id) |
| std::string | vsp::CreateConvexHull (const std::string &geom_id) |
| void | vsp::ProjectPtCloudPts (const std::string &geom_id, const std::string &target_geom_id, int surf_index, int dir_index) |
| std::string vsp::ConvertFuselageToStack |
( |
const std::string & | geom_id | ) |
|
|
extern |
Replace a Fuselage with a Stack of the same shape. Each cross section is placed where the Fuselage put it, and its skinning is carried across, so the surface is unchanged. The Stack goes in the Fuselage's place in the model, under its name, with its children, subsurfaces, structures, mesh sources, textures and attributes.
The Stack takes over the Fuselage's identity: its Geom ID, the IDs of the Parms the two have in common, and the IDs of each cross section and its Parms. A link, a design variable or an advanced link on one of those Parms goes on naming the same thing, and the ID this returns is the ID that was passed in. Some Parms are paired with a counterpart that means something different: a cross section's rotation, which in a Stack is relative to the section before it, and its location fractions, which become the Stack's X, Y and Z deltas – lengths, and relative ones. Only the Fuselage's length has no counterpart at all; attributes on it, or on a cross section's copy of it, move to the Stack itself. Attributes elsewhere – on the Geom, a cross section, a subsurface, a Parm – stay with the ID they were on.
CompareGeomSurfaces measures how closely the Stack's surfaces match a copy of the Fuselage kept for the purpose.
string fid =
AddGeom(
"FUSELAGE" );
string pid =
AddGeom(
"POD", fid );
if ( GetErrorLastCallFlag() ) {
Print(
"---> Error: API ConvertFuselageToStack reported an error " ); __failure++; }
if ( sid != fid ) {
Print(
"---> Error: API ConvertFuselageToStack did not keep the ID " ); __failure++; }
if (
GetGeomTypeName( sid ) !=
"Stack" ) {
Print(
"---> Error: API ConvertFuselageToStack did not make a Stack " ); __failure++; }
if (
dist( before,
CompPnt01( sid, 0, 0.3, 0.2 ) ) > 1e-9 ) {
Print(
"---> Error: API ConvertFuselageToStack moved the surface " ); __failure++; }
if (
dist( pod_before,
CompPnt01( pid, 0, 0.5, 0.5 ) ) > 1e-9 ) {
Print(
"---> Error: API ConvertFuselageToStack moved a child " ); __failure++; }
std::string ConvertFuselageToStack(const std::string &geom_id)
vec3d CompPnt01(const std::string &geom_id, const int &surf_indx, const double &u, const double &w)
double dist(const vec3d &a, const vec3d &b)
- Parameters
-
| [in] | geom_id | string Fuselage Geom ID |
- Returns
- string ID of the Stack, which is the Fuselage's own ID
| std::string vsp::ConvertMdcBodToStack |
( |
const std::string & | geom_id, |
|
|
bool | replace_flag ) |
|
extern |
Make a Stack of the same shape as an MDC_BOD. The Stack is skinned through a copy of each of the MDC_BOD's cross sections, each placed where the MDC_BOD put it and raised by the body's camber there, with the same tangent conditions; and its nose is the MDC_BOD's nose, sheared by the camber across it. The Stack takes the MDC_BOD's placement, so its surface is the MDC_BOD's wherever the MDC_BOD is. Nothing is kept of the MDC_BOD's IDs.
Where replace_flag is true the Stack goes in the MDC_BOD's place in the model, under its name, with its children, subsurfaces, structures, mesh sources, textures and attributes, and the MDC_BOD is deleted. Where replace_flag is false the Stack is added beside the MDC_BOD, which is left as it was.
The Stack is the MDC_BOD's surface to within roundoff wherever the MDC_BOD's surface between its cross sections is determined by them alone. Where the MDC_BOD is cambered across an ogive aft body the camber lifts each point of that surface, where the Stack can lift only its cross sections, so the Stack is a little off; CompareGeomSurfaces measures how close it is.
The Stack's tangent conditions are tilted by the camber's slope to match, which is exact at the four sides of each cross section and leaves a few thousandths of the body's size between them.
if ( GetErrorLastCallFlag() ) {
Print(
"---> Error: API ConvertMdcBodToStack reported an error " ); __failure++; }
if (
GetGeomTypeName( sid ) !=
"Stack" ) {
Print(
"---> Error: API ConvertMdcBodToStack did not make a Stack " ); __failure++; }
if ( sid == mid ) {
Print(
"---> Error: API ConvertMdcBodToStack did not add a Geom " ); __failure++; }
if (
CompareGeomSurfaces( mid, sid ) > 1e-9 ) {
Print(
"---> Error: API ConvertMdcBodToStack made a different surface " ); __failure++; }
if ( GetErrorLastCallFlag() ) {
Print(
"---> Error: API ConvertMdcBodToStack reported an error replacing " ); __failure++; }
if (
dist( before,
CompPnt01( rid, 0, 0.3, 0.2 ) ) > 1e-9 ) {
Print(
"---> Error: API ConvertMdcBodToStack moved the surface " ); __failure++; }
std::string ConvertMdcBodToStack(const std::string &geom_id, bool replace_flag)
double CompareGeomSurfaces(const std::string &geom_a, const std::string &geom_b)
- Parameters
-
| [in] | geom_id | string MDC_BOD Geom ID |
| [in] | replace_flag | bool True to replace the MDC_BOD with the Stack, false to add the Stack beside it |
- Returns
- string ID of the Stack, or an empty string if it could not be made
| std::vector< std::string > vsp::ConvertMdcFinToWing |
( |
const std::string & | geom_id, |
|
|
bool | replace_flag ) |
|
extern |
Make a Wing of the same surfaces as an MDC_FIN, with Clones of it for the surfaces beyond the first. A fin set's panels are rolled about the axis to their PHIF and turned about their roots by their GAM. The first panel is a Wing, rolled to where the panel is. Each surface after it, a panel or a copy of one that the fin set's symmetry makes, is a Clone of that Wing, placed where the surface is and flipped where it is a reflection or where its section, if it is not symmetric top to bottom, is reflected rather than rotated from the first panel's. A Wing's chords, spans and sweeps are the fin set's stations', and each section's airfoil is the fin set's, so the sections are placed as the panel's are, and its control surfaces are the MDC_FIN's flaps. A Wing's surface runs around its sections the other way from a fin set's, so a point at W on a panel is at 1 - W on the Wing. Nothing is kept of the MDC_FIN's IDs.
Where replace_flag is true the Wing and its Clones go in the MDC_FIN's place in the model, under its name, and the MDC_FIN is deleted; its children, structures, mesh sources, textures and attributes go to the Wing, except for those on a surface the Wing does not have. Where replace_flag is false they are added beside the MDC_FIN, which is left as it was.
The surfaces are the MDC_FIN's to within roundoff for every fin set a Wing can place. A Wing's sweep stops at 89 degrees and a zero root chord is not a Wing's, so a fin set with either is a little off; CompareGeomSurfaces measures how close it is.
if ( GetErrorLastCallFlag() ) {
Print(
"---> Error: API ConvertMdcFinToWing reported an error " ); __failure++; }
if ( wid.length() != 4 ) {
Print(
"---> Error: API ConvertMdcFinToWing did not make a Geom for each panel " ); __failure++; }
if (
GetGeomTypeName( wid[0] ) !=
"Wing" ) {
Print(
"---> Error: API ConvertMdcFinToWing did not make a Wing " ); __failure++; }
if (
GetGeomTypeName( wid[1] ) !=
"Clone" ) {
Print(
"---> Error: API ConvertMdcFinToWing did not make a Clone of the Wing " ); __failure++; }
if (
dist( before,
CompPnt01( wid[0], 0, 0.3, 0.8 ) ) > 1e-9 ) {
Print(
"---> Error: API ConvertMdcFinToWing made a different surface " ); __failure++; }
if (
GetNumSubSurf( wid[0] ) != 1 ) {
Print(
"---> Error: API ConvertMdcFinToWing did not carry the flap " ); __failure++; }
if ( GetErrorLastCallFlag() ) {
Print(
"---> Error: API ConvertMdcFinToWing reported an error replacing " ); __failure++; }
if (
dist( before,
CompPnt01( rid[0], 0, 0.3, 0.8 ) ) > 1e-9 ) {
Print(
"---> Error: API ConvertMdcFinToWing moved the surface " ); __failure++; }
std::vector< std::string > ConvertMdcFinToWing(const std::string &geom_id, bool replace_flag)
int GetNumSubSurf(const std::string &geom_id)
- Parameters
-
| [in] | geom_id | string MDC_FIN Geom ID |
| [in] | replace_flag | bool True to replace the MDC_FIN with the Wing and Clones, false to add them beside it |
- Returns
- array<string> ID of the Wing, followed by the IDs of its Clones, or empty if they could not be made
| Matrix4d vsp::GetPropBladeXForm |
( |
const std::string & | geom_id, |
|
|
int | blade_index, |
|
|
int | symm_index, |
|
|
double | rotate ) |
|
extern |
Get the matrix that places one blade of a propeller, or of a Clone of one, at a rotation angle. It maps a point of the blade as built – in the propeller's own axes, before the blade is turned to its azimuth, rotated, preconed or moved by any hinge – to where that point sits in the model at the given rotation angle, after the Geom's own placement and the given symmetric copy.
The rotation angle plays the part of Rotate, so it is psi, the azimuth of blade 1 from PsiRef, and may be any value, not just one within Rotate's limits. Harmonic blade motion is evaluated at it. Rotate itself and the propeller's geometry are left alone. The blades, their hinges and the symmetric copies are those of the last Update, and the hinge angles are read as they stand, so call Update after changing the propeller.
A program that moves its own mesh of the blades with time asks for the matrix at each step. GetPropBladeMotionXForm gives the motion from where the blade sits at psi = 0 instead, for a mesh made around the placed blade.
if ( abs( pa.
x() - pb.
x() ) > 1e-9 || abs( pa.
y() - pb.
y() ) > 1e-9 || abs( pa.
z() - pb.
z() ) > 1e-9 )
{
Print(
"ERROR: GetPropBladeXForm did not place blade 2 where blade 1 goes half a turn later" );
__failure++;
}
Matrix4d GetPropBladeXForm(const std::string &geom_id, int blade_index, int symm_index, double rotate)
- See also
- GetPropBladeMotionXForm
- Parameters
-
| [in] | geom_id | string ID of a propeller, or of a Clone of one |
| [in] | blade_index | int Index of the blade, from 0 to the number of blades - 1; the blade's main surface index |
| [in] | symm_index | int Index of the symmetric copy, from 0 to the number of symmetric copies - 1, numbered as DegenGeom's sym_copy_index |
| [in] | rotate | double Rotation angle psi (degrees), any value |
- Returns
- Matrix4d From the blade as built to where it sits in the model, or the identity on an error