# This file was automatically generated by SWIG (https://www.swig.org).
# Version 4.4.0
#
# Do not make changes to this file unless you know what you are doing - modify
# the SWIG interface file instead.
from sys import version_info as _swig_python_version_info
# Import the low-level C/C++ module
if getattr(globals().get("__spec__"), "parent", None) or __package__ or "." in __name__:
from . import _vsp
else:
import _vsp
try:
import builtins as __builtin__
except ImportError:
import __builtin__
def _swig_repr(self):
try:
strthis = "proxy of " + self.this.__repr__()
except __builtin__.Exception:
strthis = ""
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
def _swig_setattr_nondynamic_instance_variable(set):
def set_instance_attr(self, name, value):
if name == "this":
set(self, name, value)
elif name == "thisown":
self.this.own(value)
elif hasattr(self, name) and isinstance(getattr(type(self), name), property):
set(self, name, value)
else:
raise AttributeError("You cannot add instance attributes to %s" % self)
return set_instance_attr
def _swig_setattr_nondynamic_class_variable(set):
def set_class_attr(cls, name, value):
if hasattr(cls, name) and not isinstance(getattr(cls, name), property):
set(cls, name, value)
else:
raise AttributeError("You cannot add class attributes to %s" % cls)
return set_class_attr
def _swig_add_metaclass(metaclass):
"""Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass"""
def wrapper(cls):
return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy())
return wrapper
class _SwigNonDynamicMeta(type):
"""Meta class to enforce nondynamic attributes (no new attributes) for a class"""
__setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__)
class SwigPyIterator(object):
r"""Proxy of C++ swig::SwigPyIterator class."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined - class is abstract")
__repr__ = _swig_repr
__swig_destroy__ = _vsp.delete_SwigPyIterator
def value(self):
r"""value(SwigPyIterator self) -> PyObject *"""
return _vsp.SwigPyIterator_value(self)
def incr(self, n=1):
r"""incr(SwigPyIterator self, size_t n=1) -> SwigPyIterator"""
return _vsp.SwigPyIterator_incr(self, n)
def decr(self, n=1):
r"""decr(SwigPyIterator self, size_t n=1) -> SwigPyIterator"""
return _vsp.SwigPyIterator_decr(self, n)
def distance(self, x):
r"""distance(SwigPyIterator self, SwigPyIterator x) -> ptrdiff_t"""
return _vsp.SwigPyIterator_distance(self, x)
def equal(self, x):
r"""equal(SwigPyIterator self, SwigPyIterator x) -> bool"""
return _vsp.SwigPyIterator_equal(self, x)
def copy(self):
r"""copy(SwigPyIterator self) -> SwigPyIterator"""
return _vsp.SwigPyIterator_copy(self)
def next(self):
r"""next(SwigPyIterator self) -> PyObject *"""
return _vsp.SwigPyIterator_next(self)
def __next__(self):
r"""__next__(SwigPyIterator self) -> PyObject *"""
return _vsp.SwigPyIterator___next__(self)
def previous(self):
r"""previous(SwigPyIterator self) -> PyObject *"""
return _vsp.SwigPyIterator_previous(self)
def advance(self, n):
r"""advance(SwigPyIterator self, ptrdiff_t n) -> SwigPyIterator"""
return _vsp.SwigPyIterator_advance(self, n)
def __eq__(self, x):
r"""__eq__(SwigPyIterator self, SwigPyIterator x) -> bool"""
return _vsp.SwigPyIterator___eq__(self, x)
def __ne__(self, x):
r"""__ne__(SwigPyIterator self, SwigPyIterator x) -> bool"""
return _vsp.SwigPyIterator___ne__(self, x)
def __iadd__(self, n):
r"""__iadd__(SwigPyIterator self, ptrdiff_t n) -> SwigPyIterator"""
return _vsp.SwigPyIterator___iadd__(self, n)
def __isub__(self, n):
r"""__isub__(SwigPyIterator self, ptrdiff_t n) -> SwigPyIterator"""
return _vsp.SwigPyIterator___isub__(self, n)
def __add__(self, n):
r"""__add__(SwigPyIterator self, ptrdiff_t n) -> SwigPyIterator"""
return _vsp.SwigPyIterator___add__(self, n)
def __sub__(self, *args):
r"""
__sub__(SwigPyIterator self, ptrdiff_t n) -> SwigPyIterator
__sub__(SwigPyIterator self, SwigPyIterator x) -> ptrdiff_t
"""
return _vsp.SwigPyIterator___sub__(self, *args)
def __iter__(self):
return self
# Register SwigPyIterator in _vsp:
_vsp.SwigPyIterator_swigregister(SwigPyIterator)
class IntVector(object):
r"""Proxy of C++ std::vector< int > class."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
def iterator(self):
r"""iterator(IntVector self) -> SwigPyIterator"""
return _vsp.IntVector_iterator(self)
def __iter__(self):
return self.iterator()
def __nonzero__(self):
r"""__nonzero__(IntVector self) -> bool"""
return _vsp.IntVector___nonzero__(self)
def __bool__(self):
r"""__bool__(IntVector self) -> bool"""
return _vsp.IntVector___bool__(self)
def __len__(self):
r"""__len__(IntVector self) -> std::vector< int >::size_type"""
return _vsp.IntVector___len__(self)
def __getslice__(self, i, j):
r"""__getslice__(IntVector self, std::vector< int >::difference_type i, std::vector< int >::difference_type j) -> IntVector"""
return _vsp.IntVector___getslice__(self, i, j)
def __setslice__(self, *args):
r"""
__setslice__(IntVector self, std::vector< int >::difference_type i, std::vector< int >::difference_type j)
__setslice__(IntVector self, std::vector< int >::difference_type i, std::vector< int >::difference_type j, IntVector v)
"""
return _vsp.IntVector___setslice__(self, *args)
def __delslice__(self, i, j):
r"""__delslice__(IntVector self, std::vector< int >::difference_type i, std::vector< int >::difference_type j)"""
return _vsp.IntVector___delslice__(self, i, j)
def __delitem__(self, *args):
r"""
__delitem__(IntVector self, std::vector< int >::difference_type i)
__delitem__(IntVector self, PySliceObject * slice)
"""
return _vsp.IntVector___delitem__(self, *args)
def __getitem__(self, *args):
r"""
__getitem__(IntVector self, PySliceObject * slice) -> IntVector
__getitem__(IntVector self, std::vector< int >::difference_type i) -> std::vector< int >::value_type const &
"""
return _vsp.IntVector___getitem__(self, *args)
def __setitem__(self, *args):
r"""
__setitem__(IntVector self, PySliceObject * slice, IntVector v)
__setitem__(IntVector self, PySliceObject * slice)
__setitem__(IntVector self, std::vector< int >::difference_type i, std::vector< int >::value_type const & x)
"""
return _vsp.IntVector___setitem__(self, *args)
def pop(self):
r"""pop(IntVector self) -> std::vector< int >::value_type"""
return _vsp.IntVector_pop(self)
def append(self, x):
r"""append(IntVector self, std::vector< int >::value_type const & x)"""
return _vsp.IntVector_append(self, x)
def empty(self):
r"""empty(IntVector self) -> bool"""
return _vsp.IntVector_empty(self)
def size(self):
r"""size(IntVector self) -> std::vector< int >::size_type"""
return _vsp.IntVector_size(self)
def swap(self, v):
r"""swap(IntVector self, IntVector v)"""
return _vsp.IntVector_swap(self, v)
def begin(self):
r"""begin(IntVector self) -> std::vector< int >::iterator"""
return _vsp.IntVector_begin(self)
def end(self):
r"""end(IntVector self) -> std::vector< int >::iterator"""
return _vsp.IntVector_end(self)
def rbegin(self):
r"""rbegin(IntVector self) -> std::vector< int >::reverse_iterator"""
return _vsp.IntVector_rbegin(self)
def rend(self):
r"""rend(IntVector self) -> std::vector< int >::reverse_iterator"""
return _vsp.IntVector_rend(self)
def clear(self):
r"""clear(IntVector self)"""
return _vsp.IntVector_clear(self)
def get_allocator(self):
r"""get_allocator(IntVector self) -> std::vector< int >::allocator_type"""
return _vsp.IntVector_get_allocator(self)
def pop_back(self):
r"""pop_back(IntVector self)"""
return _vsp.IntVector_pop_back(self)
def erase(self, *args):
r"""
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
"""
return _vsp.IntVector_erase(self, *args)
def __init__(self, *args):
r"""
__init__(IntVector self) -> IntVector
__init__(IntVector self, IntVector other) -> IntVector
__init__(IntVector self, std::vector< int >::size_type size) -> IntVector
__init__(IntVector self, std::vector< int >::size_type size, std::vector< int >::value_type const & value) -> IntVector
"""
_vsp.IntVector_swiginit(self, _vsp.new_IntVector(*args))
def push_back(self, x):
r"""push_back(IntVector self, std::vector< int >::value_type const & x)"""
return _vsp.IntVector_push_back(self, x)
def front(self):
r"""front(IntVector self) -> std::vector< int >::value_type const &"""
return _vsp.IntVector_front(self)
def back(self):
r"""back(IntVector self) -> std::vector< int >::value_type const &"""
return _vsp.IntVector_back(self)
def assign(self, n, x):
r"""assign(IntVector self, std::vector< int >::size_type n, std::vector< int >::value_type const & x)"""
return _vsp.IntVector_assign(self, n, x)
def resize(self, *args):
r"""
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)
"""
return _vsp.IntVector_resize(self, *args)
def insert(self, *args):
r"""
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)
"""
return _vsp.IntVector_insert(self, *args)
def reserve(self, n):
r"""reserve(IntVector self, std::vector< int >::size_type n)"""
return _vsp.IntVector_reserve(self, n)
def capacity(self):
r"""capacity(IntVector self) -> std::vector< int >::size_type"""
return _vsp.IntVector_capacity(self)
__swig_destroy__ = _vsp.delete_IntVector
# Register IntVector in _vsp:
_vsp.IntVector_swigregister(IntVector)
class DoubleVector(object):
r"""Proxy of C++ std::vector< double > class."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
def iterator(self):
r"""iterator(DoubleVector self) -> SwigPyIterator"""
return _vsp.DoubleVector_iterator(self)
def __iter__(self):
return self.iterator()
def __nonzero__(self):
r"""__nonzero__(DoubleVector self) -> bool"""
return _vsp.DoubleVector___nonzero__(self)
def __bool__(self):
r"""__bool__(DoubleVector self) -> bool"""
return _vsp.DoubleVector___bool__(self)
def __len__(self):
r"""__len__(DoubleVector self) -> std::vector< double >::size_type"""
return _vsp.DoubleVector___len__(self)
def __getslice__(self, i, j):
r"""__getslice__(DoubleVector self, std::vector< double >::difference_type i, std::vector< double >::difference_type j) -> DoubleVector"""
return _vsp.DoubleVector___getslice__(self, i, j)
def __setslice__(self, *args):
r"""
__setslice__(DoubleVector self, std::vector< double >::difference_type i, std::vector< double >::difference_type j)
__setslice__(DoubleVector self, std::vector< double >::difference_type i, std::vector< double >::difference_type j, DoubleVector v)
"""
return _vsp.DoubleVector___setslice__(self, *args)
def __delslice__(self, i, j):
r"""__delslice__(DoubleVector self, std::vector< double >::difference_type i, std::vector< double >::difference_type j)"""
return _vsp.DoubleVector___delslice__(self, i, j)
def __delitem__(self, *args):
r"""
__delitem__(DoubleVector self, std::vector< double >::difference_type i)
__delitem__(DoubleVector self, PySliceObject * slice)
"""
return _vsp.DoubleVector___delitem__(self, *args)
def __getitem__(self, *args):
r"""
__getitem__(DoubleVector self, PySliceObject * slice) -> DoubleVector
__getitem__(DoubleVector self, std::vector< double >::difference_type i) -> std::vector< double >::value_type const &
"""
return _vsp.DoubleVector___getitem__(self, *args)
def __setitem__(self, *args):
r"""
__setitem__(DoubleVector self, PySliceObject * slice, DoubleVector v)
__setitem__(DoubleVector self, PySliceObject * slice)
__setitem__(DoubleVector self, std::vector< double >::difference_type i, std::vector< double >::value_type const & x)
"""
return _vsp.DoubleVector___setitem__(self, *args)
def pop(self):
r"""pop(DoubleVector self) -> std::vector< double >::value_type"""
return _vsp.DoubleVector_pop(self)
def append(self, x):
r"""append(DoubleVector self, std::vector< double >::value_type const & x)"""
return _vsp.DoubleVector_append(self, x)
def empty(self):
r"""empty(DoubleVector self) -> bool"""
return _vsp.DoubleVector_empty(self)
def size(self):
r"""size(DoubleVector self) -> std::vector< double >::size_type"""
return _vsp.DoubleVector_size(self)
def swap(self, v):
r"""swap(DoubleVector self, DoubleVector v)"""
return _vsp.DoubleVector_swap(self, v)
def begin(self):
r"""begin(DoubleVector self) -> std::vector< double >::iterator"""
return _vsp.DoubleVector_begin(self)
def end(self):
r"""end(DoubleVector self) -> std::vector< double >::iterator"""
return _vsp.DoubleVector_end(self)
def rbegin(self):
r"""rbegin(DoubleVector self) -> std::vector< double >::reverse_iterator"""
return _vsp.DoubleVector_rbegin(self)
def rend(self):
r"""rend(DoubleVector self) -> std::vector< double >::reverse_iterator"""
return _vsp.DoubleVector_rend(self)
def clear(self):
r"""clear(DoubleVector self)"""
return _vsp.DoubleVector_clear(self)
def get_allocator(self):
r"""get_allocator(DoubleVector self) -> std::vector< double >::allocator_type"""
return _vsp.DoubleVector_get_allocator(self)
def pop_back(self):
r"""pop_back(DoubleVector self)"""
return _vsp.DoubleVector_pop_back(self)
def erase(self, *args):
r"""
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
"""
return _vsp.DoubleVector_erase(self, *args)
def __init__(self, *args):
r"""
__init__(DoubleVector self) -> DoubleVector
__init__(DoubleVector self, DoubleVector other) -> DoubleVector
__init__(DoubleVector self, std::vector< double >::size_type size) -> DoubleVector
__init__(DoubleVector self, std::vector< double >::size_type size, std::vector< double >::value_type const & value) -> DoubleVector
"""
_vsp.DoubleVector_swiginit(self, _vsp.new_DoubleVector(*args))
def push_back(self, x):
r"""push_back(DoubleVector self, std::vector< double >::value_type const & x)"""
return _vsp.DoubleVector_push_back(self, x)
def front(self):
r"""front(DoubleVector self) -> std::vector< double >::value_type const &"""
return _vsp.DoubleVector_front(self)
def back(self):
r"""back(DoubleVector self) -> std::vector< double >::value_type const &"""
return _vsp.DoubleVector_back(self)
def assign(self, n, x):
r"""assign(DoubleVector self, std::vector< double >::size_type n, std::vector< double >::value_type const & x)"""
return _vsp.DoubleVector_assign(self, n, x)
def resize(self, *args):
r"""
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)
"""
return _vsp.DoubleVector_resize(self, *args)
def insert(self, *args):
r"""
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)
"""
return _vsp.DoubleVector_insert(self, *args)
def reserve(self, n):
r"""reserve(DoubleVector self, std::vector< double >::size_type n)"""
return _vsp.DoubleVector_reserve(self, n)
def capacity(self):
r"""capacity(DoubleVector self) -> std::vector< double >::size_type"""
return _vsp.DoubleVector_capacity(self)
__swig_destroy__ = _vsp.delete_DoubleVector
# Register DoubleVector in _vsp:
_vsp.DoubleVector_swigregister(DoubleVector)
class StringVector(object):
r"""Proxy of C++ std::vector< std::string > class."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
def iterator(self):
r"""iterator(StringVector self) -> SwigPyIterator"""
return _vsp.StringVector_iterator(self)
def __iter__(self):
return self.iterator()
def __nonzero__(self):
r"""__nonzero__(StringVector self) -> bool"""
return _vsp.StringVector___nonzero__(self)
def __bool__(self):
r"""__bool__(StringVector self) -> bool"""
return _vsp.StringVector___bool__(self)
def __len__(self):
r"""__len__(StringVector self) -> std::vector< std::string >::size_type"""
return _vsp.StringVector___len__(self)
def __getslice__(self, i, j):
r"""__getslice__(StringVector self, std::vector< std::string >::difference_type i, std::vector< std::string >::difference_type j) -> StringVector"""
return _vsp.StringVector___getslice__(self, i, j)
def __setslice__(self, *args):
r"""
__setslice__(StringVector self, std::vector< std::string >::difference_type i, std::vector< std::string >::difference_type j)
__setslice__(StringVector self, std::vector< std::string >::difference_type i, std::vector< std::string >::difference_type j, StringVector v)
"""
return _vsp.StringVector___setslice__(self, *args)
def __delslice__(self, i, j):
r"""__delslice__(StringVector self, std::vector< std::string >::difference_type i, std::vector< std::string >::difference_type j)"""
return _vsp.StringVector___delslice__(self, i, j)
def __delitem__(self, *args):
r"""
__delitem__(StringVector self, std::vector< std::string >::difference_type i)
__delitem__(StringVector self, PySliceObject * slice)
"""
return _vsp.StringVector___delitem__(self, *args)
def __getitem__(self, *args):
r"""
__getitem__(StringVector self, PySliceObject * slice) -> StringVector
__getitem__(StringVector self, std::vector< std::string >::difference_type i) -> std::vector< std::string >::value_type const &
"""
return _vsp.StringVector___getitem__(self, *args)
def __setitem__(self, *args):
r"""
__setitem__(StringVector self, PySliceObject * slice, StringVector v)
__setitem__(StringVector self, PySliceObject * slice)
__setitem__(StringVector self, std::vector< std::string >::difference_type i, std::vector< std::string >::value_type const & x)
"""
return _vsp.StringVector___setitem__(self, *args)
def pop(self):
r"""pop(StringVector self) -> std::vector< std::string >::value_type"""
return _vsp.StringVector_pop(self)
def append(self, x):
r"""append(StringVector self, std::vector< std::string >::value_type const & x)"""
return _vsp.StringVector_append(self, x)
def empty(self):
r"""empty(StringVector self) -> bool"""
return _vsp.StringVector_empty(self)
def size(self):
r"""size(StringVector self) -> std::vector< std::string >::size_type"""
return _vsp.StringVector_size(self)
def swap(self, v):
r"""swap(StringVector self, StringVector v)"""
return _vsp.StringVector_swap(self, v)
def begin(self):
r"""begin(StringVector self) -> std::vector< std::string >::iterator"""
return _vsp.StringVector_begin(self)
def end(self):
r"""end(StringVector self) -> std::vector< std::string >::iterator"""
return _vsp.StringVector_end(self)
def rbegin(self):
r"""rbegin(StringVector self) -> std::vector< std::string >::reverse_iterator"""
return _vsp.StringVector_rbegin(self)
def rend(self):
r"""rend(StringVector self) -> std::vector< std::string >::reverse_iterator"""
return _vsp.StringVector_rend(self)
def clear(self):
r"""clear(StringVector self)"""
return _vsp.StringVector_clear(self)
def get_allocator(self):
r"""get_allocator(StringVector self) -> std::vector< std::string >::allocator_type"""
return _vsp.StringVector_get_allocator(self)
def pop_back(self):
r"""pop_back(StringVector self)"""
return _vsp.StringVector_pop_back(self)
def erase(self, *args):
r"""
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
"""
return _vsp.StringVector_erase(self, *args)
def __init__(self, *args):
r"""
__init__(StringVector self) -> StringVector
__init__(StringVector self, StringVector other) -> StringVector
__init__(StringVector self, std::vector< std::string >::size_type size) -> StringVector
__init__(StringVector self, std::vector< std::string >::size_type size, std::vector< std::string >::value_type const & value) -> StringVector
"""
_vsp.StringVector_swiginit(self, _vsp.new_StringVector(*args))
def push_back(self, x):
r"""push_back(StringVector self, std::vector< std::string >::value_type const & x)"""
return _vsp.StringVector_push_back(self, x)
def front(self):
r"""front(StringVector self) -> std::vector< std::string >::value_type const &"""
return _vsp.StringVector_front(self)
def back(self):
r"""back(StringVector self) -> std::vector< std::string >::value_type const &"""
return _vsp.StringVector_back(self)
def assign(self, n, x):
r"""assign(StringVector self, std::vector< std::string >::size_type n, std::vector< std::string >::value_type const & x)"""
return _vsp.StringVector_assign(self, n, x)
def resize(self, *args):
r"""
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)
"""
return _vsp.StringVector_resize(self, *args)
def insert(self, *args):
r"""
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)
"""
return _vsp.StringVector_insert(self, *args)
def reserve(self, n):
r"""reserve(StringVector self, std::vector< std::string >::size_type n)"""
return _vsp.StringVector_reserve(self, n)
def capacity(self):
r"""capacity(StringVector self) -> std::vector< std::string >::size_type"""
return _vsp.StringVector_capacity(self)
__swig_destroy__ = _vsp.delete_StringVector
# Register StringVector in _vsp:
_vsp.StringVector_swigregister(StringVector)
class BoolVector(object):
r"""Proxy of C++ std::vector< bool > class."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
def iterator(self):
r"""iterator(BoolVector self) -> SwigPyIterator"""
return _vsp.BoolVector_iterator(self)
def __iter__(self):
return self.iterator()
def __nonzero__(self):
r"""__nonzero__(BoolVector self) -> bool"""
return _vsp.BoolVector___nonzero__(self)
def __bool__(self):
r"""__bool__(BoolVector self) -> bool"""
return _vsp.BoolVector___bool__(self)
def __len__(self):
r"""__len__(BoolVector self) -> std::vector< bool >::size_type"""
return _vsp.BoolVector___len__(self)
def __getslice__(self, i, j):
r"""__getslice__(BoolVector self, std::vector< bool >::difference_type i, std::vector< bool >::difference_type j) -> BoolVector"""
return _vsp.BoolVector___getslice__(self, i, j)
def __setslice__(self, *args):
r"""
__setslice__(BoolVector self, std::vector< bool >::difference_type i, std::vector< bool >::difference_type j)
__setslice__(BoolVector self, std::vector< bool >::difference_type i, std::vector< bool >::difference_type j, BoolVector v)
"""
return _vsp.BoolVector___setslice__(self, *args)
def __delslice__(self, i, j):
r"""__delslice__(BoolVector self, std::vector< bool >::difference_type i, std::vector< bool >::difference_type j)"""
return _vsp.BoolVector___delslice__(self, i, j)
def __delitem__(self, *args):
r"""
__delitem__(BoolVector self, std::vector< bool >::difference_type i)
__delitem__(BoolVector self, PySliceObject * slice)
"""
return _vsp.BoolVector___delitem__(self, *args)
def __getitem__(self, *args):
r"""
__getitem__(BoolVector self, PySliceObject * slice) -> BoolVector
__getitem__(BoolVector self, std::vector< bool >::difference_type i) -> std::vector< bool >::value_type
"""
return _vsp.BoolVector___getitem__(self, *args)
def __setitem__(self, *args):
r"""
__setitem__(BoolVector self, PySliceObject * slice, BoolVector v)
__setitem__(BoolVector self, PySliceObject * slice)
__setitem__(BoolVector self, std::vector< bool >::difference_type i, std::vector< bool >::value_type x)
"""
return _vsp.BoolVector___setitem__(self, *args)
def pop(self):
r"""pop(BoolVector self) -> std::vector< bool >::value_type"""
return _vsp.BoolVector_pop(self)
def append(self, x):
r"""append(BoolVector self, std::vector< bool >::value_type x)"""
return _vsp.BoolVector_append(self, x)
def empty(self):
r"""empty(BoolVector self) -> bool"""
return _vsp.BoolVector_empty(self)
def size(self):
r"""size(BoolVector self) -> std::vector< bool >::size_type"""
return _vsp.BoolVector_size(self)
def swap(self, v):
r"""swap(BoolVector self, BoolVector v)"""
return _vsp.BoolVector_swap(self, v)
def begin(self):
r"""begin(BoolVector self) -> std::vector< bool >::iterator"""
return _vsp.BoolVector_begin(self)
def end(self):
r"""end(BoolVector self) -> std::vector< bool >::iterator"""
return _vsp.BoolVector_end(self)
def rbegin(self):
r"""rbegin(BoolVector self) -> std::vector< bool >::reverse_iterator"""
return _vsp.BoolVector_rbegin(self)
def rend(self):
r"""rend(BoolVector self) -> std::vector< bool >::reverse_iterator"""
return _vsp.BoolVector_rend(self)
def clear(self):
r"""clear(BoolVector self)"""
return _vsp.BoolVector_clear(self)
def get_allocator(self):
r"""get_allocator(BoolVector self) -> std::vector< bool >::allocator_type"""
return _vsp.BoolVector_get_allocator(self)
def pop_back(self):
r"""pop_back(BoolVector self)"""
return _vsp.BoolVector_pop_back(self)
def erase(self, *args):
r"""
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
"""
return _vsp.BoolVector_erase(self, *args)
def __init__(self, *args):
r"""
__init__(BoolVector self) -> BoolVector
__init__(BoolVector self, BoolVector other) -> BoolVector
__init__(BoolVector self, std::vector< bool >::size_type size) -> BoolVector
__init__(BoolVector self, std::vector< bool >::size_type size, std::vector< bool >::value_type value) -> BoolVector
"""
_vsp.BoolVector_swiginit(self, _vsp.new_BoolVector(*args))
def push_back(self, x):
r"""push_back(BoolVector self, std::vector< bool >::value_type x)"""
return _vsp.BoolVector_push_back(self, x)
def front(self):
r"""front(BoolVector self) -> std::vector< bool >::value_type"""
return _vsp.BoolVector_front(self)
def back(self):
r"""back(BoolVector self) -> std::vector< bool >::value_type"""
return _vsp.BoolVector_back(self)
def assign(self, n, x):
r"""assign(BoolVector self, std::vector< bool >::size_type n, std::vector< bool >::value_type x)"""
return _vsp.BoolVector_assign(self, n, x)
def resize(self, *args):
r"""
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)
"""
return _vsp.BoolVector_resize(self, *args)
def insert(self, *args):
r"""
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)
"""
return _vsp.BoolVector_insert(self, *args)
def reserve(self, n):
r"""reserve(BoolVector self, std::vector< bool >::size_type n)"""
return _vsp.BoolVector_reserve(self, n)
def capacity(self):
r"""capacity(BoolVector self) -> std::vector< bool >::size_type"""
return _vsp.BoolVector_capacity(self)
__swig_destroy__ = _vsp.delete_BoolVector
# Register BoolVector in _vsp:
_vsp.BoolVector_swigregister(BoolVector)
class StringVecVec(object):
r"""Proxy of C++ std::vector< std::vector< std::string > > class."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
def iterator(self):
r"""iterator(StringVecVec self) -> SwigPyIterator"""
return _vsp.StringVecVec_iterator(self)
def __iter__(self):
return self.iterator()
def __nonzero__(self):
r"""__nonzero__(StringVecVec self) -> bool"""
return _vsp.StringVecVec___nonzero__(self)
def __bool__(self):
r"""__bool__(StringVecVec self) -> bool"""
return _vsp.StringVecVec___bool__(self)
def __len__(self):
r"""__len__(StringVecVec self) -> std::vector< std::vector< std::string > >::size_type"""
return _vsp.StringVecVec___len__(self)
def __getslice__(self, i, j):
r"""__getslice__(StringVecVec self, std::vector< std::vector< std::string > >::difference_type i, std::vector< std::vector< std::string > >::difference_type j) -> StringVecVec"""
return _vsp.StringVecVec___getslice__(self, i, j)
def __setslice__(self, *args):
r"""
__setslice__(StringVecVec self, std::vector< std::vector< std::string > >::difference_type i, std::vector< std::vector< std::string > >::difference_type j)
__setslice__(StringVecVec self, std::vector< std::vector< std::string > >::difference_type i, std::vector< std::vector< std::string > >::difference_type j, StringVecVec v)
"""
return _vsp.StringVecVec___setslice__(self, *args)
def __delslice__(self, i, j):
r"""__delslice__(StringVecVec self, std::vector< std::vector< std::string > >::difference_type i, std::vector< std::vector< std::string > >::difference_type j)"""
return _vsp.StringVecVec___delslice__(self, i, j)
def __delitem__(self, *args):
r"""
__delitem__(StringVecVec self, std::vector< std::vector< std::string > >::difference_type i)
__delitem__(StringVecVec self, PySliceObject * slice)
"""
return _vsp.StringVecVec___delitem__(self, *args)
def __getitem__(self, *args):
r"""
__getitem__(StringVecVec self, PySliceObject * slice) -> StringVecVec
__getitem__(StringVecVec self, std::vector< std::vector< std::string > >::difference_type i) -> StringVector
"""
return _vsp.StringVecVec___getitem__(self, *args)
def __setitem__(self, *args):
r"""
__setitem__(StringVecVec self, PySliceObject * slice, StringVecVec v)
__setitem__(StringVecVec self, PySliceObject * slice)
__setitem__(StringVecVec self, std::vector< std::vector< std::string > >::difference_type i, StringVector x)
"""
return _vsp.StringVecVec___setitem__(self, *args)
def pop(self):
r"""pop(StringVecVec self) -> StringVector"""
return _vsp.StringVecVec_pop(self)
def append(self, x):
r"""append(StringVecVec self, StringVector x)"""
return _vsp.StringVecVec_append(self, x)
def empty(self):
r"""empty(StringVecVec self) -> bool"""
return _vsp.StringVecVec_empty(self)
def size(self):
r"""size(StringVecVec self) -> std::vector< std::vector< std::string > >::size_type"""
return _vsp.StringVecVec_size(self)
def swap(self, v):
r"""swap(StringVecVec self, StringVecVec v)"""
return _vsp.StringVecVec_swap(self, v)
def begin(self):
r"""begin(StringVecVec self) -> std::vector< std::vector< std::string > >::iterator"""
return _vsp.StringVecVec_begin(self)
def end(self):
r"""end(StringVecVec self) -> std::vector< std::vector< std::string > >::iterator"""
return _vsp.StringVecVec_end(self)
def rbegin(self):
r"""rbegin(StringVecVec self) -> std::vector< std::vector< std::string > >::reverse_iterator"""
return _vsp.StringVecVec_rbegin(self)
def rend(self):
r"""rend(StringVecVec self) -> std::vector< std::vector< std::string > >::reverse_iterator"""
return _vsp.StringVecVec_rend(self)
def clear(self):
r"""clear(StringVecVec self)"""
return _vsp.StringVecVec_clear(self)
def get_allocator(self):
r"""get_allocator(StringVecVec self) -> std::vector< std::vector< std::string > >::allocator_type"""
return _vsp.StringVecVec_get_allocator(self)
def pop_back(self):
r"""pop_back(StringVecVec self)"""
return _vsp.StringVecVec_pop_back(self)
def erase(self, *args):
r"""
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
"""
return _vsp.StringVecVec_erase(self, *args)
def __init__(self, *args):
r"""
__init__(StringVecVec self) -> StringVecVec
__init__(StringVecVec self, StringVecVec other) -> StringVecVec
__init__(StringVecVec self, std::vector< std::vector< std::string > >::size_type size) -> StringVecVec
__init__(StringVecVec self, std::vector< std::vector< std::string > >::size_type size, StringVector value) -> StringVecVec
"""
_vsp.StringVecVec_swiginit(self, _vsp.new_StringVecVec(*args))
def push_back(self, x):
r"""push_back(StringVecVec self, StringVector x)"""
return _vsp.StringVecVec_push_back(self, x)
def front(self):
r"""front(StringVecVec self) -> StringVector"""
return _vsp.StringVecVec_front(self)
def back(self):
r"""back(StringVecVec self) -> StringVector"""
return _vsp.StringVecVec_back(self)
def assign(self, n, x):
r"""assign(StringVecVec self, std::vector< std::vector< std::string > >::size_type n, StringVector x)"""
return _vsp.StringVecVec_assign(self, n, x)
def resize(self, *args):
r"""
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)
"""
return _vsp.StringVecVec_resize(self, *args)
def insert(self, *args):
r"""
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)
"""
return _vsp.StringVecVec_insert(self, *args)
def reserve(self, n):
r"""reserve(StringVecVec self, std::vector< std::vector< std::string > >::size_type n)"""
return _vsp.StringVecVec_reserve(self, n)
def capacity(self):
r"""capacity(StringVecVec self) -> std::vector< std::vector< std::string > >::size_type"""
return _vsp.StringVecVec_capacity(self)
__swig_destroy__ = _vsp.delete_StringVecVec
# Register StringVecVec in _vsp:
_vsp.StringVecVec_swigregister(StringVecVec)
class IntVecVec(object):
r"""Proxy of C++ std::vector< std::vector< int > > class."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
def iterator(self):
r"""iterator(IntVecVec self) -> SwigPyIterator"""
return _vsp.IntVecVec_iterator(self)
def __iter__(self):
return self.iterator()
def __nonzero__(self):
r"""__nonzero__(IntVecVec self) -> bool"""
return _vsp.IntVecVec___nonzero__(self)
def __bool__(self):
r"""__bool__(IntVecVec self) -> bool"""
return _vsp.IntVecVec___bool__(self)
def __len__(self):
r"""__len__(IntVecVec self) -> std::vector< std::vector< int > >::size_type"""
return _vsp.IntVecVec___len__(self)
def __getslice__(self, i, j):
r"""__getslice__(IntVecVec self, std::vector< std::vector< int > >::difference_type i, std::vector< std::vector< int > >::difference_type j) -> IntVecVec"""
return _vsp.IntVecVec___getslice__(self, i, j)
def __setslice__(self, *args):
r"""
__setslice__(IntVecVec self, std::vector< std::vector< int > >::difference_type i, std::vector< std::vector< int > >::difference_type j)
__setslice__(IntVecVec self, std::vector< std::vector< int > >::difference_type i, std::vector< std::vector< int > >::difference_type j, IntVecVec v)
"""
return _vsp.IntVecVec___setslice__(self, *args)
def __delslice__(self, i, j):
r"""__delslice__(IntVecVec self, std::vector< std::vector< int > >::difference_type i, std::vector< std::vector< int > >::difference_type j)"""
return _vsp.IntVecVec___delslice__(self, i, j)
def __delitem__(self, *args):
r"""
__delitem__(IntVecVec self, std::vector< std::vector< int > >::difference_type i)
__delitem__(IntVecVec self, PySliceObject * slice)
"""
return _vsp.IntVecVec___delitem__(self, *args)
def __getitem__(self, *args):
r"""
__getitem__(IntVecVec self, PySliceObject * slice) -> IntVecVec
__getitem__(IntVecVec self, std::vector< std::vector< int > >::difference_type i) -> IntVector
"""
return _vsp.IntVecVec___getitem__(self, *args)
def __setitem__(self, *args):
r"""
__setitem__(IntVecVec self, PySliceObject * slice, IntVecVec v)
__setitem__(IntVecVec self, PySliceObject * slice)
__setitem__(IntVecVec self, std::vector< std::vector< int > >::difference_type i, IntVector x)
"""
return _vsp.IntVecVec___setitem__(self, *args)
def pop(self):
r"""pop(IntVecVec self) -> IntVector"""
return _vsp.IntVecVec_pop(self)
def append(self, x):
r"""append(IntVecVec self, IntVector x)"""
return _vsp.IntVecVec_append(self, x)
def empty(self):
r"""empty(IntVecVec self) -> bool"""
return _vsp.IntVecVec_empty(self)
def size(self):
r"""size(IntVecVec self) -> std::vector< std::vector< int > >::size_type"""
return _vsp.IntVecVec_size(self)
def swap(self, v):
r"""swap(IntVecVec self, IntVecVec v)"""
return _vsp.IntVecVec_swap(self, v)
def begin(self):
r"""begin(IntVecVec self) -> std::vector< std::vector< int > >::iterator"""
return _vsp.IntVecVec_begin(self)
def end(self):
r"""end(IntVecVec self) -> std::vector< std::vector< int > >::iterator"""
return _vsp.IntVecVec_end(self)
def rbegin(self):
r"""rbegin(IntVecVec self) -> std::vector< std::vector< int > >::reverse_iterator"""
return _vsp.IntVecVec_rbegin(self)
def rend(self):
r"""rend(IntVecVec self) -> std::vector< std::vector< int > >::reverse_iterator"""
return _vsp.IntVecVec_rend(self)
def clear(self):
r"""clear(IntVecVec self)"""
return _vsp.IntVecVec_clear(self)
def get_allocator(self):
r"""get_allocator(IntVecVec self) -> std::vector< std::vector< int > >::allocator_type"""
return _vsp.IntVecVec_get_allocator(self)
def pop_back(self):
r"""pop_back(IntVecVec self)"""
return _vsp.IntVecVec_pop_back(self)
def erase(self, *args):
r"""
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
"""
return _vsp.IntVecVec_erase(self, *args)
def __init__(self, *args):
r"""
__init__(IntVecVec self) -> IntVecVec
__init__(IntVecVec self, IntVecVec other) -> IntVecVec
__init__(IntVecVec self, std::vector< std::vector< int > >::size_type size) -> IntVecVec
__init__(IntVecVec self, std::vector< std::vector< int > >::size_type size, IntVector value) -> IntVecVec
"""
_vsp.IntVecVec_swiginit(self, _vsp.new_IntVecVec(*args))
def push_back(self, x):
r"""push_back(IntVecVec self, IntVector x)"""
return _vsp.IntVecVec_push_back(self, x)
def front(self):
r"""front(IntVecVec self) -> IntVector"""
return _vsp.IntVecVec_front(self)
def back(self):
r"""back(IntVecVec self) -> IntVector"""
return _vsp.IntVecVec_back(self)
def assign(self, n, x):
r"""assign(IntVecVec self, std::vector< std::vector< int > >::size_type n, IntVector x)"""
return _vsp.IntVecVec_assign(self, n, x)
def resize(self, *args):
r"""
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)
"""
return _vsp.IntVecVec_resize(self, *args)
def insert(self, *args):
r"""
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)
"""
return _vsp.IntVecVec_insert(self, *args)
def reserve(self, n):
r"""reserve(IntVecVec self, std::vector< std::vector< int > >::size_type n)"""
return _vsp.IntVecVec_reserve(self, n)
def capacity(self):
r"""capacity(IntVecVec self) -> std::vector< std::vector< int > >::size_type"""
return _vsp.IntVecVec_capacity(self)
__swig_destroy__ = _vsp.delete_IntVecVec
# Register IntVecVec in _vsp:
_vsp.IntVecVec_swigregister(IntVecVec)
class DoubleVecVec(object):
r"""Proxy of C++ std::vector< std::vector< double > > class."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
def iterator(self):
r"""iterator(DoubleVecVec self) -> SwigPyIterator"""
return _vsp.DoubleVecVec_iterator(self)
def __iter__(self):
return self.iterator()
def __nonzero__(self):
r"""__nonzero__(DoubleVecVec self) -> bool"""
return _vsp.DoubleVecVec___nonzero__(self)
def __bool__(self):
r"""__bool__(DoubleVecVec self) -> bool"""
return _vsp.DoubleVecVec___bool__(self)
def __len__(self):
r"""__len__(DoubleVecVec self) -> std::vector< std::vector< double > >::size_type"""
return _vsp.DoubleVecVec___len__(self)
def __getslice__(self, i, j):
r"""__getslice__(DoubleVecVec self, std::vector< std::vector< double > >::difference_type i, std::vector< std::vector< double > >::difference_type j) -> DoubleVecVec"""
return _vsp.DoubleVecVec___getslice__(self, i, j)
def __setslice__(self, *args):
r"""
__setslice__(DoubleVecVec self, std::vector< std::vector< double > >::difference_type i, std::vector< std::vector< double > >::difference_type j)
__setslice__(DoubleVecVec self, std::vector< std::vector< double > >::difference_type i, std::vector< std::vector< double > >::difference_type j, DoubleVecVec v)
"""
return _vsp.DoubleVecVec___setslice__(self, *args)
def __delslice__(self, i, j):
r"""__delslice__(DoubleVecVec self, std::vector< std::vector< double > >::difference_type i, std::vector< std::vector< double > >::difference_type j)"""
return _vsp.DoubleVecVec___delslice__(self, i, j)
def __delitem__(self, *args):
r"""
__delitem__(DoubleVecVec self, std::vector< std::vector< double > >::difference_type i)
__delitem__(DoubleVecVec self, PySliceObject * slice)
"""
return _vsp.DoubleVecVec___delitem__(self, *args)
def __getitem__(self, *args):
r"""
__getitem__(DoubleVecVec self, PySliceObject * slice) -> DoubleVecVec
__getitem__(DoubleVecVec self, std::vector< std::vector< double > >::difference_type i) -> DoubleVector
"""
return _vsp.DoubleVecVec___getitem__(self, *args)
def __setitem__(self, *args):
r"""
__setitem__(DoubleVecVec self, PySliceObject * slice, DoubleVecVec v)
__setitem__(DoubleVecVec self, PySliceObject * slice)
__setitem__(DoubleVecVec self, std::vector< std::vector< double > >::difference_type i, DoubleVector x)
"""
return _vsp.DoubleVecVec___setitem__(self, *args)
def pop(self):
r"""pop(DoubleVecVec self) -> DoubleVector"""
return _vsp.DoubleVecVec_pop(self)
def append(self, x):
r"""append(DoubleVecVec self, DoubleVector x)"""
return _vsp.DoubleVecVec_append(self, x)
def empty(self):
r"""empty(DoubleVecVec self) -> bool"""
return _vsp.DoubleVecVec_empty(self)
def size(self):
r"""size(DoubleVecVec self) -> std::vector< std::vector< double > >::size_type"""
return _vsp.DoubleVecVec_size(self)
def swap(self, v):
r"""swap(DoubleVecVec self, DoubleVecVec v)"""
return _vsp.DoubleVecVec_swap(self, v)
def begin(self):
r"""begin(DoubleVecVec self) -> std::vector< std::vector< double > >::iterator"""
return _vsp.DoubleVecVec_begin(self)
def end(self):
r"""end(DoubleVecVec self) -> std::vector< std::vector< double > >::iterator"""
return _vsp.DoubleVecVec_end(self)
def rbegin(self):
r"""rbegin(DoubleVecVec self) -> std::vector< std::vector< double > >::reverse_iterator"""
return _vsp.DoubleVecVec_rbegin(self)
def rend(self):
r"""rend(DoubleVecVec self) -> std::vector< std::vector< double > >::reverse_iterator"""
return _vsp.DoubleVecVec_rend(self)
def clear(self):
r"""clear(DoubleVecVec self)"""
return _vsp.DoubleVecVec_clear(self)
def get_allocator(self):
r"""get_allocator(DoubleVecVec self) -> std::vector< std::vector< double > >::allocator_type"""
return _vsp.DoubleVecVec_get_allocator(self)
def pop_back(self):
r"""pop_back(DoubleVecVec self)"""
return _vsp.DoubleVecVec_pop_back(self)
def erase(self, *args):
r"""
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
"""
return _vsp.DoubleVecVec_erase(self, *args)
def __init__(self, *args):
r"""
__init__(DoubleVecVec self) -> DoubleVecVec
__init__(DoubleVecVec self, DoubleVecVec other) -> DoubleVecVec
__init__(DoubleVecVec self, std::vector< std::vector< double > >::size_type size) -> DoubleVecVec
__init__(DoubleVecVec self, std::vector< std::vector< double > >::size_type size, DoubleVector value) -> DoubleVecVec
"""
_vsp.DoubleVecVec_swiginit(self, _vsp.new_DoubleVecVec(*args))
def push_back(self, x):
r"""push_back(DoubleVecVec self, DoubleVector x)"""
return _vsp.DoubleVecVec_push_back(self, x)
def front(self):
r"""front(DoubleVecVec self) -> DoubleVector"""
return _vsp.DoubleVecVec_front(self)
def back(self):
r"""back(DoubleVecVec self) -> DoubleVector"""
return _vsp.DoubleVecVec_back(self)
def assign(self, n, x):
r"""assign(DoubleVecVec self, std::vector< std::vector< double > >::size_type n, DoubleVector x)"""
return _vsp.DoubleVecVec_assign(self, n, x)
def resize(self, *args):
r"""
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)
"""
return _vsp.DoubleVecVec_resize(self, *args)
def insert(self, *args):
r"""
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)
"""
return _vsp.DoubleVecVec_insert(self, *args)
def reserve(self, n):
r"""reserve(DoubleVecVec self, std::vector< std::vector< double > >::size_type n)"""
return _vsp.DoubleVecVec_reserve(self, n)
def capacity(self):
r"""capacity(DoubleVecVec self) -> std::vector< std::vector< double > >::size_type"""
return _vsp.DoubleVecVec_capacity(self)
__swig_destroy__ = _vsp.delete_DoubleVecVec
# Register DoubleVecVec in _vsp:
_vsp.DoubleVecVec_swigregister(DoubleVecVec)
class Vec3dVec(object):
r"""Proxy of C++ std::vector< vec3d > class."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
def iterator(self):
r"""iterator(Vec3dVec self) -> SwigPyIterator"""
return _vsp.Vec3dVec_iterator(self)
def __iter__(self):
return self.iterator()
def __nonzero__(self):
r"""__nonzero__(Vec3dVec self) -> bool"""
return _vsp.Vec3dVec___nonzero__(self)
def __bool__(self):
r"""__bool__(Vec3dVec self) -> bool"""
return _vsp.Vec3dVec___bool__(self)
def __len__(self):
r"""__len__(Vec3dVec self) -> std::vector< vec3d >::size_type"""
return _vsp.Vec3dVec___len__(self)
def __getslice__(self, i, j):
r"""__getslice__(Vec3dVec self, std::vector< vec3d >::difference_type i, std::vector< vec3d >::difference_type j) -> Vec3dVec"""
return _vsp.Vec3dVec___getslice__(self, i, j)
def __setslice__(self, *args):
r"""
__setslice__(Vec3dVec self, std::vector< vec3d >::difference_type i, std::vector< vec3d >::difference_type j)
__setslice__(Vec3dVec self, std::vector< vec3d >::difference_type i, std::vector< vec3d >::difference_type j, Vec3dVec v)
"""
return _vsp.Vec3dVec___setslice__(self, *args)
def __delslice__(self, i, j):
r"""__delslice__(Vec3dVec self, std::vector< vec3d >::difference_type i, std::vector< vec3d >::difference_type j)"""
return _vsp.Vec3dVec___delslice__(self, i, j)
def __delitem__(self, *args):
r"""
__delitem__(Vec3dVec self, std::vector< vec3d >::difference_type i)
__delitem__(Vec3dVec self, PySliceObject * slice)
"""
return _vsp.Vec3dVec___delitem__(self, *args)
def __getitem__(self, *args):
r"""
__getitem__(Vec3dVec self, PySliceObject * slice) -> Vec3dVec
__getitem__(Vec3dVec self, std::vector< vec3d >::difference_type i) -> vec3d
"""
return _vsp.Vec3dVec___getitem__(self, *args)
def __setitem__(self, *args):
r"""
__setitem__(Vec3dVec self, PySliceObject * slice, Vec3dVec v)
__setitem__(Vec3dVec self, PySliceObject * slice)
__setitem__(Vec3dVec self, std::vector< vec3d >::difference_type i, vec3d x)
"""
return _vsp.Vec3dVec___setitem__(self, *args)
def pop(self):
r"""pop(Vec3dVec self) -> vec3d"""
return _vsp.Vec3dVec_pop(self)
def append(self, x):
r"""append(Vec3dVec self, vec3d x)"""
return _vsp.Vec3dVec_append(self, x)
def empty(self):
r"""empty(Vec3dVec self) -> bool"""
return _vsp.Vec3dVec_empty(self)
def size(self):
r"""size(Vec3dVec self) -> std::vector< vec3d >::size_type"""
return _vsp.Vec3dVec_size(self)
def swap(self, v):
r"""swap(Vec3dVec self, Vec3dVec v)"""
return _vsp.Vec3dVec_swap(self, v)
def begin(self):
r"""begin(Vec3dVec self) -> std::vector< vec3d >::iterator"""
return _vsp.Vec3dVec_begin(self)
def end(self):
r"""end(Vec3dVec self) -> std::vector< vec3d >::iterator"""
return _vsp.Vec3dVec_end(self)
def rbegin(self):
r"""rbegin(Vec3dVec self) -> std::vector< vec3d >::reverse_iterator"""
return _vsp.Vec3dVec_rbegin(self)
def rend(self):
r"""rend(Vec3dVec self) -> std::vector< vec3d >::reverse_iterator"""
return _vsp.Vec3dVec_rend(self)
def clear(self):
r"""clear(Vec3dVec self)"""
return _vsp.Vec3dVec_clear(self)
def get_allocator(self):
r"""get_allocator(Vec3dVec self) -> std::vector< vec3d >::allocator_type"""
return _vsp.Vec3dVec_get_allocator(self)
def pop_back(self):
r"""pop_back(Vec3dVec self)"""
return _vsp.Vec3dVec_pop_back(self)
def erase(self, *args):
r"""
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
"""
return _vsp.Vec3dVec_erase(self, *args)
def __init__(self, *args):
r"""
__init__(Vec3dVec self) -> Vec3dVec
__init__(Vec3dVec self, Vec3dVec other) -> Vec3dVec
__init__(Vec3dVec self, std::vector< vec3d >::size_type size) -> Vec3dVec
__init__(Vec3dVec self, std::vector< vec3d >::size_type size, vec3d value) -> Vec3dVec
"""
_vsp.Vec3dVec_swiginit(self, _vsp.new_Vec3dVec(*args))
def push_back(self, x):
r"""push_back(Vec3dVec self, vec3d x)"""
return _vsp.Vec3dVec_push_back(self, x)
def front(self):
r"""front(Vec3dVec self) -> vec3d"""
return _vsp.Vec3dVec_front(self)
def back(self):
r"""back(Vec3dVec self) -> vec3d"""
return _vsp.Vec3dVec_back(self)
def assign(self, n, x):
r"""assign(Vec3dVec self, std::vector< vec3d >::size_type n, vec3d x)"""
return _vsp.Vec3dVec_assign(self, n, x)
def resize(self, *args):
r"""
resize(Vec3dVec self, std::vector< vec3d >::size_type new_size)
resize(Vec3dVec self, std::vector< vec3d >::size_type new_size, vec3d x)
"""
return _vsp.Vec3dVec_resize(self, *args)
def insert(self, *args):
r"""
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)
"""
return _vsp.Vec3dVec_insert(self, *args)
def reserve(self, n):
r"""reserve(Vec3dVec self, std::vector< vec3d >::size_type n)"""
return _vsp.Vec3dVec_reserve(self, n)
def capacity(self):
r"""capacity(Vec3dVec self) -> std::vector< vec3d >::size_type"""
return _vsp.Vec3dVec_capacity(self)
def as_numpy(self):
return _vsp.Vec3dVec_as_numpy(self)
__swig_destroy__ = _vsp.delete_Vec3dVec
# Register Vec3dVec in _vsp:
_vsp.Vec3dVec_swigregister(Vec3dVec)
class Vec2dVec(object):
r"""Proxy of C++ std::vector< vec2d > class."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
def iterator(self):
r"""iterator(Vec2dVec self) -> SwigPyIterator"""
return _vsp.Vec2dVec_iterator(self)
def __iter__(self):
return self.iterator()
def __nonzero__(self):
r"""__nonzero__(Vec2dVec self) -> bool"""
return _vsp.Vec2dVec___nonzero__(self)
def __bool__(self):
r"""__bool__(Vec2dVec self) -> bool"""
return _vsp.Vec2dVec___bool__(self)
def __len__(self):
r"""__len__(Vec2dVec self) -> std::vector< vec2d >::size_type"""
return _vsp.Vec2dVec___len__(self)
def __getslice__(self, i, j):
r"""__getslice__(Vec2dVec self, std::vector< vec2d >::difference_type i, std::vector< vec2d >::difference_type j) -> Vec2dVec"""
return _vsp.Vec2dVec___getslice__(self, i, j)
def __setslice__(self, *args):
r"""
__setslice__(Vec2dVec self, std::vector< vec2d >::difference_type i, std::vector< vec2d >::difference_type j)
__setslice__(Vec2dVec self, std::vector< vec2d >::difference_type i, std::vector< vec2d >::difference_type j, Vec2dVec v)
"""
return _vsp.Vec2dVec___setslice__(self, *args)
def __delslice__(self, i, j):
r"""__delslice__(Vec2dVec self, std::vector< vec2d >::difference_type i, std::vector< vec2d >::difference_type j)"""
return _vsp.Vec2dVec___delslice__(self, i, j)
def __delitem__(self, *args):
r"""
__delitem__(Vec2dVec self, std::vector< vec2d >::difference_type i)
__delitem__(Vec2dVec self, PySliceObject * slice)
"""
return _vsp.Vec2dVec___delitem__(self, *args)
def __getitem__(self, *args):
r"""
__getitem__(Vec2dVec self, PySliceObject * slice) -> Vec2dVec
__getitem__(Vec2dVec self, std::vector< vec2d >::difference_type i) -> vec2d
"""
return _vsp.Vec2dVec___getitem__(self, *args)
def __setitem__(self, *args):
r"""
__setitem__(Vec2dVec self, PySliceObject * slice, Vec2dVec v)
__setitem__(Vec2dVec self, PySliceObject * slice)
__setitem__(Vec2dVec self, std::vector< vec2d >::difference_type i, vec2d x)
"""
return _vsp.Vec2dVec___setitem__(self, *args)
def pop(self):
r"""pop(Vec2dVec self) -> vec2d"""
return _vsp.Vec2dVec_pop(self)
def append(self, x):
r"""append(Vec2dVec self, vec2d x)"""
return _vsp.Vec2dVec_append(self, x)
def empty(self):
r"""empty(Vec2dVec self) -> bool"""
return _vsp.Vec2dVec_empty(self)
def size(self):
r"""size(Vec2dVec self) -> std::vector< vec2d >::size_type"""
return _vsp.Vec2dVec_size(self)
def swap(self, v):
r"""swap(Vec2dVec self, Vec2dVec v)"""
return _vsp.Vec2dVec_swap(self, v)
def begin(self):
r"""begin(Vec2dVec self) -> std::vector< vec2d >::iterator"""
return _vsp.Vec2dVec_begin(self)
def end(self):
r"""end(Vec2dVec self) -> std::vector< vec2d >::iterator"""
return _vsp.Vec2dVec_end(self)
def rbegin(self):
r"""rbegin(Vec2dVec self) -> std::vector< vec2d >::reverse_iterator"""
return _vsp.Vec2dVec_rbegin(self)
def rend(self):
r"""rend(Vec2dVec self) -> std::vector< vec2d >::reverse_iterator"""
return _vsp.Vec2dVec_rend(self)
def clear(self):
r"""clear(Vec2dVec self)"""
return _vsp.Vec2dVec_clear(self)
def get_allocator(self):
r"""get_allocator(Vec2dVec self) -> std::vector< vec2d >::allocator_type"""
return _vsp.Vec2dVec_get_allocator(self)
def pop_back(self):
r"""pop_back(Vec2dVec self)"""
return _vsp.Vec2dVec_pop_back(self)
def erase(self, *args):
r"""
erase(Vec2dVec self, std::vector< vec2d >::iterator pos) -> std::vector< vec2d >::iterator
erase(Vec2dVec self, std::vector< vec2d >::iterator first, std::vector< vec2d >::iterator last) -> std::vector< vec2d >::iterator
"""
return _vsp.Vec2dVec_erase(self, *args)
def __init__(self, *args):
r"""
__init__(Vec2dVec self) -> Vec2dVec
__init__(Vec2dVec self, Vec2dVec other) -> Vec2dVec
__init__(Vec2dVec self, std::vector< vec2d >::size_type size) -> Vec2dVec
__init__(Vec2dVec self, std::vector< vec2d >::size_type size, vec2d value) -> Vec2dVec
"""
_vsp.Vec2dVec_swiginit(self, _vsp.new_Vec2dVec(*args))
def push_back(self, x):
r"""push_back(Vec2dVec self, vec2d x)"""
return _vsp.Vec2dVec_push_back(self, x)
def front(self):
r"""front(Vec2dVec self) -> vec2d"""
return _vsp.Vec2dVec_front(self)
def back(self):
r"""back(Vec2dVec self) -> vec2d"""
return _vsp.Vec2dVec_back(self)
def assign(self, n, x):
r"""assign(Vec2dVec self, std::vector< vec2d >::size_type n, vec2d x)"""
return _vsp.Vec2dVec_assign(self, n, x)
def resize(self, *args):
r"""
resize(Vec2dVec self, std::vector< vec2d >::size_type new_size)
resize(Vec2dVec self, std::vector< vec2d >::size_type new_size, vec2d x)
"""
return _vsp.Vec2dVec_resize(self, *args)
def insert(self, *args):
r"""
insert(Vec2dVec self, std::vector< vec2d >::iterator pos, vec2d x) -> std::vector< vec2d >::iterator
insert(Vec2dVec self, std::vector< vec2d >::iterator pos, std::vector< vec2d >::size_type n, vec2d x)
"""
return _vsp.Vec2dVec_insert(self, *args)
def reserve(self, n):
r"""reserve(Vec2dVec self, std::vector< vec2d >::size_type n)"""
return _vsp.Vec2dVec_reserve(self, n)
def capacity(self):
r"""capacity(Vec2dVec self) -> std::vector< vec2d >::size_type"""
return _vsp.Vec2dVec_capacity(self)
__swig_destroy__ = _vsp.delete_Vec2dVec
# Register Vec2dVec in _vsp:
_vsp.Vec2dVec_swigregister(Vec2dVec)
class Vec3dVecVec(object):
r"""Proxy of C++ std::vector< std::vector< vec3d > > class."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
def iterator(self):
r"""iterator(Vec3dVecVec self) -> SwigPyIterator"""
return _vsp.Vec3dVecVec_iterator(self)
def __iter__(self):
return self.iterator()
def __nonzero__(self):
r"""__nonzero__(Vec3dVecVec self) -> bool"""
return _vsp.Vec3dVecVec___nonzero__(self)
def __bool__(self):
r"""__bool__(Vec3dVecVec self) -> bool"""
return _vsp.Vec3dVecVec___bool__(self)
def __len__(self):
r"""__len__(Vec3dVecVec self) -> std::vector< std::vector< vec3d > >::size_type"""
return _vsp.Vec3dVecVec___len__(self)
def __getslice__(self, i, j):
r"""__getslice__(Vec3dVecVec self, std::vector< std::vector< vec3d > >::difference_type i, std::vector< std::vector< vec3d > >::difference_type j) -> Vec3dVecVec"""
return _vsp.Vec3dVecVec___getslice__(self, i, j)
def __setslice__(self, *args):
r"""
__setslice__(Vec3dVecVec self, std::vector< std::vector< vec3d > >::difference_type i, std::vector< std::vector< vec3d > >::difference_type j)
__setslice__(Vec3dVecVec self, std::vector< std::vector< vec3d > >::difference_type i, std::vector< std::vector< vec3d > >::difference_type j, Vec3dVecVec v)
"""
return _vsp.Vec3dVecVec___setslice__(self, *args)
def __delslice__(self, i, j):
r"""__delslice__(Vec3dVecVec self, std::vector< std::vector< vec3d > >::difference_type i, std::vector< std::vector< vec3d > >::difference_type j)"""
return _vsp.Vec3dVecVec___delslice__(self, i, j)
def __delitem__(self, *args):
r"""
__delitem__(Vec3dVecVec self, std::vector< std::vector< vec3d > >::difference_type i)
__delitem__(Vec3dVecVec self, PySliceObject * slice)
"""
return _vsp.Vec3dVecVec___delitem__(self, *args)
def __getitem__(self, *args):
r"""
__getitem__(Vec3dVecVec self, PySliceObject * slice) -> Vec3dVecVec
__getitem__(Vec3dVecVec self, std::vector< std::vector< vec3d > >::difference_type i) -> Vec3dVec
"""
return _vsp.Vec3dVecVec___getitem__(self, *args)
def __setitem__(self, *args):
r"""
__setitem__(Vec3dVecVec self, PySliceObject * slice, Vec3dVecVec v)
__setitem__(Vec3dVecVec self, PySliceObject * slice)
__setitem__(Vec3dVecVec self, std::vector< std::vector< vec3d > >::difference_type i, Vec3dVec x)
"""
return _vsp.Vec3dVecVec___setitem__(self, *args)
def pop(self):
r"""pop(Vec3dVecVec self) -> Vec3dVec"""
return _vsp.Vec3dVecVec_pop(self)
def append(self, x):
r"""append(Vec3dVecVec self, Vec3dVec x)"""
return _vsp.Vec3dVecVec_append(self, x)
def empty(self):
r"""empty(Vec3dVecVec self) -> bool"""
return _vsp.Vec3dVecVec_empty(self)
def size(self):
r"""size(Vec3dVecVec self) -> std::vector< std::vector< vec3d > >::size_type"""
return _vsp.Vec3dVecVec_size(self)
def swap(self, v):
r"""swap(Vec3dVecVec self, Vec3dVecVec v)"""
return _vsp.Vec3dVecVec_swap(self, v)
def begin(self):
r"""begin(Vec3dVecVec self) -> std::vector< std::vector< vec3d > >::iterator"""
return _vsp.Vec3dVecVec_begin(self)
def end(self):
r"""end(Vec3dVecVec self) -> std::vector< std::vector< vec3d > >::iterator"""
return _vsp.Vec3dVecVec_end(self)
def rbegin(self):
r"""rbegin(Vec3dVecVec self) -> std::vector< std::vector< vec3d > >::reverse_iterator"""
return _vsp.Vec3dVecVec_rbegin(self)
def rend(self):
r"""rend(Vec3dVecVec self) -> std::vector< std::vector< vec3d > >::reverse_iterator"""
return _vsp.Vec3dVecVec_rend(self)
def clear(self):
r"""clear(Vec3dVecVec self)"""
return _vsp.Vec3dVecVec_clear(self)
def get_allocator(self):
r"""get_allocator(Vec3dVecVec self) -> std::vector< std::vector< vec3d > >::allocator_type"""
return _vsp.Vec3dVecVec_get_allocator(self)
def pop_back(self):
r"""pop_back(Vec3dVecVec self)"""
return _vsp.Vec3dVecVec_pop_back(self)
def erase(self, *args):
r"""
erase(Vec3dVecVec self, std::vector< std::vector< vec3d > >::iterator pos) -> std::vector< std::vector< vec3d > >::iterator
erase(Vec3dVecVec self, std::vector< std::vector< vec3d > >::iterator first, std::vector< std::vector< vec3d > >::iterator last) -> std::vector< std::vector< vec3d > >::iterator
"""
return _vsp.Vec3dVecVec_erase(self, *args)
def __init__(self, *args):
r"""
__init__(Vec3dVecVec self) -> Vec3dVecVec
__init__(Vec3dVecVec self, Vec3dVecVec other) -> Vec3dVecVec
__init__(Vec3dVecVec self, std::vector< std::vector< vec3d > >::size_type size) -> Vec3dVecVec
__init__(Vec3dVecVec self, std::vector< std::vector< vec3d > >::size_type size, Vec3dVec value) -> Vec3dVecVec
"""
_vsp.Vec3dVecVec_swiginit(self, _vsp.new_Vec3dVecVec(*args))
def push_back(self, x):
r"""push_back(Vec3dVecVec self, Vec3dVec x)"""
return _vsp.Vec3dVecVec_push_back(self, x)
def front(self):
r"""front(Vec3dVecVec self) -> Vec3dVec"""
return _vsp.Vec3dVecVec_front(self)
def back(self):
r"""back(Vec3dVecVec self) -> Vec3dVec"""
return _vsp.Vec3dVecVec_back(self)
def assign(self, n, x):
r"""assign(Vec3dVecVec self, std::vector< std::vector< vec3d > >::size_type n, Vec3dVec x)"""
return _vsp.Vec3dVecVec_assign(self, n, x)
def resize(self, *args):
r"""
resize(Vec3dVecVec self, std::vector< std::vector< vec3d > >::size_type new_size)
resize(Vec3dVecVec self, std::vector< std::vector< vec3d > >::size_type new_size, Vec3dVec x)
"""
return _vsp.Vec3dVecVec_resize(self, *args)
def insert(self, *args):
r"""
insert(Vec3dVecVec self, std::vector< std::vector< vec3d > >::iterator pos, Vec3dVec x) -> std::vector< std::vector< vec3d > >::iterator
insert(Vec3dVecVec self, std::vector< std::vector< vec3d > >::iterator pos, std::vector< std::vector< vec3d > >::size_type n, Vec3dVec x)
"""
return _vsp.Vec3dVecVec_insert(self, *args)
def reserve(self, n):
r"""reserve(Vec3dVecVec self, std::vector< std::vector< vec3d > >::size_type n)"""
return _vsp.Vec3dVecVec_reserve(self, n)
def capacity(self):
r"""capacity(Vec3dVecVec self) -> std::vector< std::vector< vec3d > >::size_type"""
return _vsp.Vec3dVecVec_capacity(self)
__swig_destroy__ = _vsp.delete_Vec3dVecVec
# Register Vec3dVecVec in _vsp:
_vsp.Vec3dVecVec_swigregister(Vec3dVecVec)
class Matrix4dVec(object):
r"""Proxy of C++ std::vector< Matrix4d > class."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
def iterator(self):
r"""iterator(Matrix4dVec self) -> SwigPyIterator"""
return _vsp.Matrix4dVec_iterator(self)
def __iter__(self):
return self.iterator()
def __nonzero__(self):
r"""__nonzero__(Matrix4dVec self) -> bool"""
return _vsp.Matrix4dVec___nonzero__(self)
def __bool__(self):
r"""__bool__(Matrix4dVec self) -> bool"""
return _vsp.Matrix4dVec___bool__(self)
def __len__(self):
r"""__len__(Matrix4dVec self) -> std::vector< Matrix4d >::size_type"""
return _vsp.Matrix4dVec___len__(self)
def __getslice__(self, i, j):
r"""__getslice__(Matrix4dVec self, std::vector< Matrix4d >::difference_type i, std::vector< Matrix4d >::difference_type j) -> Matrix4dVec"""
return _vsp.Matrix4dVec___getslice__(self, i, j)
def __setslice__(self, *args):
r"""
__setslice__(Matrix4dVec self, std::vector< Matrix4d >::difference_type i, std::vector< Matrix4d >::difference_type j)
__setslice__(Matrix4dVec self, std::vector< Matrix4d >::difference_type i, std::vector< Matrix4d >::difference_type j, Matrix4dVec v)
"""
return _vsp.Matrix4dVec___setslice__(self, *args)
def __delslice__(self, i, j):
r"""__delslice__(Matrix4dVec self, std::vector< Matrix4d >::difference_type i, std::vector< Matrix4d >::difference_type j)"""
return _vsp.Matrix4dVec___delslice__(self, i, j)
def __delitem__(self, *args):
r"""
__delitem__(Matrix4dVec self, std::vector< Matrix4d >::difference_type i)
__delitem__(Matrix4dVec self, PySliceObject * slice)
"""
return _vsp.Matrix4dVec___delitem__(self, *args)
def __getitem__(self, *args):
r"""
__getitem__(Matrix4dVec self, PySliceObject * slice) -> Matrix4dVec
__getitem__(Matrix4dVec self, std::vector< Matrix4d >::difference_type i) -> Matrix4d
"""
return _vsp.Matrix4dVec___getitem__(self, *args)
def __setitem__(self, *args):
r"""
__setitem__(Matrix4dVec self, PySliceObject * slice, Matrix4dVec v)
__setitem__(Matrix4dVec self, PySliceObject * slice)
__setitem__(Matrix4dVec self, std::vector< Matrix4d >::difference_type i, Matrix4d x)
"""
return _vsp.Matrix4dVec___setitem__(self, *args)
def pop(self):
r"""pop(Matrix4dVec self) -> Matrix4d"""
return _vsp.Matrix4dVec_pop(self)
def append(self, x):
r"""append(Matrix4dVec self, Matrix4d x)"""
return _vsp.Matrix4dVec_append(self, x)
def empty(self):
r"""empty(Matrix4dVec self) -> bool"""
return _vsp.Matrix4dVec_empty(self)
def size(self):
r"""size(Matrix4dVec self) -> std::vector< Matrix4d >::size_type"""
return _vsp.Matrix4dVec_size(self)
def swap(self, v):
r"""swap(Matrix4dVec self, Matrix4dVec v)"""
return _vsp.Matrix4dVec_swap(self, v)
def begin(self):
r"""begin(Matrix4dVec self) -> std::vector< Matrix4d >::iterator"""
return _vsp.Matrix4dVec_begin(self)
def end(self):
r"""end(Matrix4dVec self) -> std::vector< Matrix4d >::iterator"""
return _vsp.Matrix4dVec_end(self)
def rbegin(self):
r"""rbegin(Matrix4dVec self) -> std::vector< Matrix4d >::reverse_iterator"""
return _vsp.Matrix4dVec_rbegin(self)
def rend(self):
r"""rend(Matrix4dVec self) -> std::vector< Matrix4d >::reverse_iterator"""
return _vsp.Matrix4dVec_rend(self)
def clear(self):
r"""clear(Matrix4dVec self)"""
return _vsp.Matrix4dVec_clear(self)
def get_allocator(self):
r"""get_allocator(Matrix4dVec self) -> std::vector< Matrix4d >::allocator_type"""
return _vsp.Matrix4dVec_get_allocator(self)
def pop_back(self):
r"""pop_back(Matrix4dVec self)"""
return _vsp.Matrix4dVec_pop_back(self)
def erase(self, *args):
r"""
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
"""
return _vsp.Matrix4dVec_erase(self, *args)
def __init__(self, *args):
r"""
__init__(Matrix4dVec self) -> Matrix4dVec
__init__(Matrix4dVec self, Matrix4dVec other) -> Matrix4dVec
__init__(Matrix4dVec self, std::vector< Matrix4d >::size_type size) -> Matrix4dVec
__init__(Matrix4dVec self, std::vector< Matrix4d >::size_type size, Matrix4d value) -> Matrix4dVec
"""
_vsp.Matrix4dVec_swiginit(self, _vsp.new_Matrix4dVec(*args))
def push_back(self, x):
r"""push_back(Matrix4dVec self, Matrix4d x)"""
return _vsp.Matrix4dVec_push_back(self, x)
def front(self):
r"""front(Matrix4dVec self) -> Matrix4d"""
return _vsp.Matrix4dVec_front(self)
def back(self):
r"""back(Matrix4dVec self) -> Matrix4d"""
return _vsp.Matrix4dVec_back(self)
def assign(self, n, x):
r"""assign(Matrix4dVec self, std::vector< Matrix4d >::size_type n, Matrix4d x)"""
return _vsp.Matrix4dVec_assign(self, n, x)
def resize(self, *args):
r"""
resize(Matrix4dVec self, std::vector< Matrix4d >::size_type new_size)
resize(Matrix4dVec self, std::vector< Matrix4d >::size_type new_size, Matrix4d x)
"""
return _vsp.Matrix4dVec_resize(self, *args)
def insert(self, *args):
r"""
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)
"""
return _vsp.Matrix4dVec_insert(self, *args)
def reserve(self, n):
r"""reserve(Matrix4dVec self, std::vector< Matrix4d >::size_type n)"""
return _vsp.Matrix4dVec_reserve(self, n)
def capacity(self):
r"""capacity(Matrix4dVec self) -> std::vector< Matrix4d >::size_type"""
return _vsp.Matrix4dVec_capacity(self)
__swig_destroy__ = _vsp.delete_Matrix4dVec
# Register Matrix4dVec in _vsp:
_vsp.Matrix4dVec_swigregister(Matrix4dVec)
ABS = _vsp.ABS
r"""Absolute position"""
REL = _vsp.REL
r"""Relative position"""
SELIG_AF_EXPORT = _vsp.SELIG_AF_EXPORT
r"""Selig airfoil file format"""
BEZIER_AF_EXPORT = _vsp.BEZIER_AF_EXPORT
r"""Bezier airfoil file format"""
ALIGN_LEFT = _vsp.ALIGN_LEFT
r"""Align to left"""
ALIGN_CENTER = _vsp.ALIGN_CENTER
r"""Align to center"""
ALIGN_RIGHT = _vsp.ALIGN_RIGHT
r"""Align to right"""
ALIGN_PIXEL = _vsp.ALIGN_PIXEL
r"""Align to specified pixel"""
ALIGN_TOP = _vsp.ALIGN_TOP
r"""Align to top"""
ALIGN_MIDDLE = _vsp.ALIGN_MIDDLE
r"""Align to middle"""
ALIGN_BOTTOM = _vsp.ALIGN_BOTTOM
r"""Align to bottom"""
NUM_ALIGN_TYPE = _vsp.NUM_ALIGN_TYPE
r"""Number of alignment types"""
ANG_RAD = _vsp.ANG_RAD
r"""Radians"""
ANG_DEG = _vsp.ANG_DEG
r"""Degrees"""
ANG_0 = _vsp.ANG_0
r"""Zero deg"""
ANG_90 = _vsp.ANG_90
r"""90 deg"""
ANG_180 = _vsp.ANG_180
r"""180 deg"""
ANG_270 = _vsp.ANG_270
r"""270 deg"""
NUM_ANG = _vsp.NUM_ANG
r"""Number of angle choices"""
ATMOS_TYPE_US_STANDARD_1976 = _vsp.ATMOS_TYPE_US_STANDARD_1976
r"""US Standard Atmosphere 1976 (default)"""
ATMOS_TYPE_HERRINGTON_1966 = _vsp.ATMOS_TYPE_HERRINGTON_1966
r"""USAF 1966"""
ATMOS_TYPE_MANUAL_P_R = _vsp.ATMOS_TYPE_MANUAL_P_R
r"""Manual: pressure and density control"""
ATMOS_TYPE_MANUAL_P_T = _vsp.ATMOS_TYPE_MANUAL_P_T
r"""Manual: pressure and temperature control"""
ATMOS_TYPE_MANUAL_R_T = _vsp.ATMOS_TYPE_MANUAL_R_T
r"""Manual: density and temperature control"""
ATMOS_TYPE_MANUAL_RE_L = _vsp.ATMOS_TYPE_MANUAL_RE_L
r"""Manual: Reynolds number and length control"""
ATTACH_TRANS_NONE = _vsp.ATTACH_TRANS_NONE
r"""No parent attachment for translations"""
ATTACH_TRANS_COMP = _vsp.ATTACH_TRANS_COMP
r"""Translation relative to parent body axes"""
ATTACH_TRANS_UV = _vsp.ATTACH_TRANS_UV
r"""Translation relative to parent surface coordinate frame"""
ATTACH_TRANS_RST = _vsp.ATTACH_TRANS_RST
r"""Translation relative to parent per-section volume coordinate frame"""
ATTACH_TRANS_LMN = _vsp.ATTACH_TRANS_LMN
r"""Translation relative to parent uniform volume coordinate frame"""
ATTACH_TRANS_EtaMN = _vsp.ATTACH_TRANS_EtaMN
r"""Translation relative to wing parent uniform eta volume coordinate frame"""
ATTACH_TRANS_NUM_TYPES = _vsp.ATTACH_TRANS_NUM_TYPES
r"""Number of translation attachment types"""
ATTACH_ROT_NONE = _vsp.ATTACH_ROT_NONE
r"""No parent attachment for rotations"""
ATTACH_ROT_COMP = _vsp.ATTACH_ROT_COMP
r"""Rotation relative to parent body axes"""
ATTACH_ROT_UV = _vsp.ATTACH_ROT_UV
r"""Rotation relative to parent surface coordinate frame"""
ATTACH_ROT_RST = _vsp.ATTACH_ROT_RST
r"""Rotation relative to parent per-section volume coordinate frame"""
ATTACH_ROT_LMN = _vsp.ATTACH_ROT_LMN
r"""Rotation relative to parent uniform volume coordinate frame"""
ATTACH_ROT_EtaMN = _vsp.ATTACH_ROT_EtaMN
r"""Rotation relative to wing parent eta volume coordinate frame"""
ATTACH_ROT_NUM_TYPES = _vsp.ATTACH_ROT_NUM_TYPES
r"""Number of rotation attachment types"""
ATTROBJ_PARM = _vsp.ATTROBJ_PARM
r"""Parm"""
ATTROBJ_GEOM = _vsp.ATTROBJ_GEOM
r"""Geom"""
ATTROBJ_VEH = _vsp.ATTROBJ_VEH
r"""Vehicle"""
ATTROBJ_SUBSURF = _vsp.ATTROBJ_SUBSURF
r"""SubSurf"""
ATTROBJ_MEASURE = _vsp.ATTROBJ_MEASURE
r"""Measure"""
ATTROBJ_LINK = _vsp.ATTROBJ_LINK
r"""Link"""
ATTROBJ_ADVLINK = _vsp.ATTROBJ_ADVLINK
r"""Adv Link"""
ATTROBJ_ATTR = _vsp.ATTROBJ_ATTR
r"""Attribute"""
ATTROBJ_COLLECTION = _vsp.ATTROBJ_COLLECTION
r"""Attribute Collection"""
ATTROBJ_XSEC = _vsp.ATTROBJ_XSEC
r"""Cross Section"""
ATTROBJ_SEC = _vsp.ATTROBJ_SEC
r"""Wing Section"""
ATTROBJ_MODE = _vsp.ATTROBJ_MODE
r"""Mode"""
ATTROBJ_SET = _vsp.ATTROBJ_SET
r"""Geom Set"""
ATTROBJ_VARGROUP = _vsp.ATTROBJ_VARGROUP
r"""Var Preset Group"""
ATTROBJ_VARSETTING = _vsp.ATTROBJ_VARSETTING
r"""Var Preset Setting"""
ATTROBJ_FREE = _vsp.ATTROBJ_FREE
r"""Unattached attribute"""
ATTR_GROUP_NONE = _vsp.ATTR_GROUP_NONE
r"""No event (user attributes)"""
ATTR_GROUP_WATERMARK = _vsp.ATTR_GROUP_WATERMARK
r"""Watermark group"""
NUM_ATTR_EVENT_GROUPS = _vsp.NUM_ATTR_EVENT_GROUPS
r"""Number attribute event groups"""
AUX_GEOM_ROTOR_TIP_PATH = _vsp.AUX_GEOM_ROTOR_TIP_PATH
r"""Rotor tip path"""
AUX_GEOM_ROTOR_BURST = _vsp.AUX_GEOM_ROTOR_BURST
r"""Rotor burst zone"""
AUX_GEOM_THREE_PT_GROUND = _vsp.AUX_GEOM_THREE_PT_GROUND
r"""Three contact point ground plane"""
AUX_GEOM_TWO_PT_GROUND = _vsp.AUX_GEOM_TWO_PT_GROUND
r"""Two contact point ground plane"""
AUX_GEOM_ONE_PT_GROUND = _vsp.AUX_GEOM_ONE_PT_GROUND
r"""One contact point ground plane"""
AUX_GEOM_THREE_PT_CCE = _vsp.AUX_GEOM_THREE_PT_CCE
r"""Three contact point composite clearance envelope"""
AUX_GEOM_SUPER_CONE = _vsp.AUX_GEOM_SUPER_CONE
r"""Super cone (XSecCurve based profile)"""
AUX_GEOM_SINGLE_GEAR = _vsp.AUX_GEOM_SINGLE_GEAR
r"""Single (potentially) off nominal gear"""
AUX_GEOM_ROTOR_FRAGMENT = _vsp.AUX_GEOM_ROTOR_FRAGMENT
r"""AC 20-128 A rotor fragment"""
AUX_GEOM_THROWN_BLADE = _vsp.AUX_GEOM_THROWN_BLADE
r"""AC 25.905-1 thrown blade"""
AUX_GEOM_TIRE_SPRAY = _vsp.AUX_GEOM_TIRE_SPRAY
r"""ESDU 83042a Tire spray pattern"""
AUX_GEOM_WHEEL_TIRE_FAILURE = _vsp.AUX_GEOM_WHEEL_TIRE_FAILURE
r"""AMC 25.734 Wheel and tire failure models"""
NUM_AUX_GEOM_MODES = _vsp.NUM_AUX_GEOM_MODES
r"""Number of auxiliary geom modes."""
BOGIE_CENTER_DIST = _vsp.BOGIE_CENTER_DIST
r"""Distance between centers"""
BOGIE_CENTER_DIST_FRAC = _vsp.BOGIE_CENTER_DIST_FRAC
r"""Fractional distance between centers"""
BOGIE_GAP = _vsp.BOGIE_GAP
r"""Gap"""
BOGIE_GAP_FRAC = _vsp.BOGIE_GAP_FRAC
r"""Fractional gap"""
NUM_BOGIE_SPACING_TYPE = _vsp.NUM_BOGIE_SPACING_TYPE
r"""Number of bogie spacing control modes"""
BOR_FLOWTHROUGH = _vsp.BOR_FLOWTHROUGH
r"""Flowthrough mode (default)"""
BOR_UPPER = _vsp.BOR_UPPER
r"""Upper surface mode"""
BOR_LOWER = _vsp.BOR_LOWER
r"""Lower surface mode"""
BOR_NUM_MODES = _vsp.BOR_NUM_MODES
r"""Number of Body of Revolution modes"""
MAX_CAMB = _vsp.MAX_CAMB
r"""Input maximum camber, calculate ideal lift coefficient"""
DESIGN_CL = _vsp.DESIGN_CL
r"""Input ideal lift coefficient, calculate maximum camber"""
CAM_TOP = _vsp.CAM_TOP
r"""Camera top view"""
CAM_FRONT = _vsp.CAM_FRONT
r"""Camera front view"""
CAM_FRONT_YUP = _vsp.CAM_FRONT_YUP
r"""Camera front Y-up view"""
CAM_LEFT = _vsp.CAM_LEFT
r"""Camera left view"""
CAM_LEFT_ISO = _vsp.CAM_LEFT_ISO
r"""Camera left isometric view"""
CAM_BOTTOM = _vsp.CAM_BOTTOM
r"""Camera bottom view"""
CAM_REAR = _vsp.CAM_REAR
r"""Camera rear view"""
CAM_RIGHT = _vsp.CAM_RIGHT
r"""Camera right view"""
CAM_RIGHT_ISO = _vsp.CAM_RIGHT_ISO
r"""Camera right isometric view"""
CAM_CENTER = _vsp.CAM_CENTER
r"""Camera center view"""
NO_END_CAP = _vsp.NO_END_CAP
r"""No end cap"""
FLAT_END_CAP = _vsp.FLAT_END_CAP
r"""Flat end cap"""
ROUND_END_CAP = _vsp.ROUND_END_CAP
r"""Round end cap"""
EDGE_END_CAP = _vsp.EDGE_END_CAP
r"""Edge end cap"""
SHARP_END_CAP = _vsp.SHARP_END_CAP
r"""Sharp end cap"""
POINT_END_CAP = _vsp.POINT_END_CAP
r"""Point end cap"""
ROUND_EXT_END_CAP_NONE = _vsp.ROUND_EXT_END_CAP_NONE
r"""Extended round end cap, but not extended"""
ROUND_EXT_END_CAP_LE = _vsp.ROUND_EXT_END_CAP_LE
r"""Extended round end cap, extend LE"""
ROUND_EXT_END_CAP_TE = _vsp.ROUND_EXT_END_CAP_TE
r"""Extended round end cap, extend TE"""
ROUND_EXT_END_CAP_BOTH = _vsp.ROUND_EXT_END_CAP_BOTH
r"""Extended round end cap, extend both"""
NUM_END_CAP_OPTIONS = _vsp.NUM_END_CAP_OPTIONS
r"""Number of end cap options"""
CFD_MIN_EDGE_LEN = _vsp.CFD_MIN_EDGE_LEN
r"""Minimum mesh edge length"""
CFD_MAX_EDGE_LEN = _vsp.CFD_MAX_EDGE_LEN
r"""Maximum mesh edge length"""
CFD_MAX_GAP = _vsp.CFD_MAX_GAP
r"""Maximum mesh edge gap"""
CFD_NUM_CIRCLE_SEGS = _vsp.CFD_NUM_CIRCLE_SEGS
r"""Number of edge segments to resolve circle"""
CFD_GROWTH_RATIO = _vsp.CFD_GROWTH_RATIO
r"""Maximum allowed edge growth ratio"""
CFD_LIMIT_GROWTH_FLAG = _vsp.CFD_LIMIT_GROWTH_FLAG
r"""Rigorous 3D growth limiting flag"""
CFD_INTERSECT_SUBSURFACE_FLAG = _vsp.CFD_INTERSECT_SUBSURFACE_FLAG
r"""Flag to intersect sub-surfaces"""
CFD_HALF_MESH_FLAG = _vsp.CFD_HALF_MESH_FLAG
r"""Flag to generate a half mesh"""
CFD_FAR_FIELD_FLAG = _vsp.CFD_FAR_FIELD_FLAG
r"""Flag to generate a far field mesh"""
CFD_FAR_MAX_EDGE_LEN = _vsp.CFD_FAR_MAX_EDGE_LEN
r"""Maximum far field mesh edge length"""
CFD_FAR_MAX_GAP = _vsp.CFD_FAR_MAX_GAP
r"""Maximum far field mesh edge gap"""
CFD_FAR_NUM_CIRCLE_SEGS = _vsp.CFD_FAR_NUM_CIRCLE_SEGS
r"""Number of far field edge segments to resolve circle"""
CFD_FAR_SIZE_ABS_FLAG = _vsp.CFD_FAR_SIZE_ABS_FLAG
r"""Relative or absolute size flag"""
CFD_FAR_LENGTH = _vsp.CFD_FAR_LENGTH
r"""Far field length"""
CFD_FAR_WIDTH = _vsp.CFD_FAR_WIDTH
r"""Far field width"""
CFD_FAR_HEIGHT = _vsp.CFD_FAR_HEIGHT
r"""Far field height"""
CFD_FAR_X_SCALE = _vsp.CFD_FAR_X_SCALE
r"""Far field X scale"""
CFD_FAR_Y_SCALE = _vsp.CFD_FAR_Y_SCALE
r"""Far field Y scale"""
CFD_FAR_Z_SCALE = _vsp.CFD_FAR_Z_SCALE
r"""Far field Z scale"""
CFD_FAR_LOC_MAN_FLAG = _vsp.CFD_FAR_LOC_MAN_FLAG
r"""Far field location flag: centered or manual"""
CFD_FAR_LOC_X = _vsp.CFD_FAR_LOC_X
r"""Far field X location"""
CFD_FAR_LOC_Y = _vsp.CFD_FAR_LOC_Y
r"""Far field Y location"""
CFD_FAR_LOC_Z = _vsp.CFD_FAR_LOC_Z
r"""Far field Z location"""
CFD_SRF_XYZ_FLAG = _vsp.CFD_SRF_XYZ_FLAG
r"""Flag to include X,Y,Z intersection curves in export files"""
CFD_STL_FILE_NAME = _vsp.CFD_STL_FILE_NAME
r"""STL export type"""
CFD_POLY_FILE_NAME = _vsp.CFD_POLY_FILE_NAME
r"""POLY export type"""
CFD_TRI_FILE_NAME = _vsp.CFD_TRI_FILE_NAME
r"""TRI export type"""
CFD_OBJ_FILE_NAME = _vsp.CFD_OBJ_FILE_NAME
r"""OBJ export type"""
CFD_DAT_FILE_NAME = _vsp.CFD_DAT_FILE_NAME
r"""DAT export type"""
CFD_KEY_FILE_NAME = _vsp.CFD_KEY_FILE_NAME
r"""KEY export type"""
CFD_GMSH_FILE_NAME = _vsp.CFD_GMSH_FILE_NAME
r"""GMSH export type"""
CFD_TKEY_FILE_NAME = _vsp.CFD_TKEY_FILE_NAME
r"""TKEY export type"""
CFD_FACET_FILE_NAME = _vsp.CFD_FACET_FILE_NAME
r"""FACET export type"""
CFD_VSPGEOM_FILE_NAME = _vsp.CFD_VSPGEOM_FILE_NAME
r"""VSPGEOM export type"""
CFD_NUM_FILE_NAMES = _vsp.CFD_NUM_FILE_NAMES
r"""Number of CFD Mesh export file types"""
POINT_SOURCE = _vsp.POINT_SOURCE
r"""Point source"""
LINE_SOURCE = _vsp.LINE_SOURCE
r"""Line source"""
BOX_SOURCE = _vsp.BOX_SOURCE
r"""Box source"""
ULINE_SOURCE = _vsp.ULINE_SOURCE
r"""Constant U Line source"""
WLINE_SOURCE = _vsp.WLINE_SOURCE
r"""Constant W Line source"""
NUM_SOURCE_TYPES = _vsp.NUM_SOURCE_TYPES
r"""Number of CFD Mesh source types"""
TAG = _vsp.TAG
r"""Color mesh by tag value (component, subsurface, part, etc)"""
REASON = _vsp.REASON
r"""Color mesh by local edge length reason"""
CF_LAM_BLASIUS = _vsp.CF_LAM_BLASIUS
r"""Blasius laminar Cf equation"""
CF_LAM_BLASIUS_W_HEAT = _vsp.CF_LAM_BLASIUS_W_HEAT
r"""Blasius laminar Cf equation with heat (NOT IMPLEMENTED)"""
CF_TURB_EXPLICIT_FIT_SPALDING = _vsp.CF_TURB_EXPLICIT_FIT_SPALDING
r"""Explicit Fit of Spalding turbulent Cf equation"""
CF_TURB_EXPLICIT_FIT_SPALDING_CHI = _vsp.CF_TURB_EXPLICIT_FIT_SPALDING_CHI
r"""Explicit Fit of Spalding and Chi turbulent Cf equation"""
CF_TURB_EXPLICIT_FIT_SCHOENHERR = _vsp.CF_TURB_EXPLICIT_FIT_SCHOENHERR
r"""Explicit Fit of Schoenherr turbulent Cf equation"""
DO_NOT_USE_CF_TURB_IMPLICIT_KARMAN = _vsp.DO_NOT_USE_CF_TURB_IMPLICIT_KARMAN
r"""Implicit Karman turbulent Cf equation (DO NOT USE)"""
CF_TURB_IMPLICIT_SCHOENHERR = _vsp.CF_TURB_IMPLICIT_SCHOENHERR
r"""Implicit Schoenherr turbulent Cf equation"""
CF_TURB_IMPLICIT_KARMAN_SCHOENHERR = _vsp.CF_TURB_IMPLICIT_KARMAN_SCHOENHERR
r"""Implicit Karman-Schoenherr turbulent Cf equation"""
CF_TURB_POWER_LAW_BLASIUS = _vsp.CF_TURB_POWER_LAW_BLASIUS
r"""Power Law Blasius turbulent Cf equation"""
CF_TURB_POWER_LAW_PRANDTL_LOW_RE = _vsp.CF_TURB_POWER_LAW_PRANDTL_LOW_RE
r"""Power Law Prandtl Low Re turbulent Cf equation"""
CF_TURB_POWER_LAW_PRANDTL_MEDIUM_RE = _vsp.CF_TURB_POWER_LAW_PRANDTL_MEDIUM_RE
r"""Power Law Prandtl Medium Re turbulent Cf equation"""
CF_TURB_POWER_LAW_PRANDTL_HIGH_RE = _vsp.CF_TURB_POWER_LAW_PRANDTL_HIGH_RE
r"""Power Law Prandtl High Re turbulent Cf equation"""
CF_TURB_SCHLICHTING_COMPRESSIBLE = _vsp.CF_TURB_SCHLICHTING_COMPRESSIBLE
r"""Schlichting Compressible turbulent Cf equation"""
DO_NOT_USE_CF_TURB_SCHLICHTING_INCOMPRESSIBLE = _vsp.DO_NOT_USE_CF_TURB_SCHLICHTING_INCOMPRESSIBLE
r"""Schlichting Incompressible turbulent Cf equation (DO NOT USE)"""
DO_NOT_USE_CF_TURB_SCHLICHTING_PRANDTL = _vsp.DO_NOT_USE_CF_TURB_SCHLICHTING_PRANDTL
r"""Schlichting-Prandtl turbulent Cf equation (DO NOT USE)"""
DO_NOT_USE_CF_TURB_SCHULTZ_GRUNOW_HIGH_RE = _vsp.DO_NOT_USE_CF_TURB_SCHULTZ_GRUNOW_HIGH_RE
r"""Schultz-Grunow High Re turbulent Cf equation (DO NOT USE)"""
CF_TURB_SCHULTZ_GRUNOW_SCHOENHERR = _vsp.CF_TURB_SCHULTZ_GRUNOW_SCHOENHERR
r"""Schultz-Grunow Estimate of Schoenherr turbulent Cf equation."""
DO_NOT_USE_CF_TURB_WHITE_CHRISTOPH_COMPRESSIBLE = _vsp.DO_NOT_USE_CF_TURB_WHITE_CHRISTOPH_COMPRESSIBLE
r"""White-Christoph Compressible turbulent Cf equation (DO NOT USE)"""
CF_TURB_ROUGHNESS_SCHLICHTING_AVG = _vsp.CF_TURB_ROUGHNESS_SCHLICHTING_AVG
r"""Roughness Schlichting Avg turbulent Cf equation."""
DO_NOT_USE_CF_TURB_ROUGHNESS_SCHLICHTING_LOCAL = _vsp.DO_NOT_USE_CF_TURB_ROUGHNESS_SCHLICHTING_LOCAL
r"""Roughness Schlichting Local turbulent Cf equation (DO NOT USE)"""
DO_NOT_USE_CF_TURB_ROUGHNESS_WHITE = _vsp.DO_NOT_USE_CF_TURB_ROUGHNESS_WHITE
r"""Roughness White turbulent Cf equation (DO NOT USE)"""
CF_TURB_ROUGHNESS_SCHLICHTING_AVG_FLOW_CORRECTION = _vsp.CF_TURB_ROUGHNESS_SCHLICHTING_AVG_FLOW_CORRECTION
r"""Roughness Schlichting Avg Compressible turbulent Cf equation."""
CF_TURB_HEATTRANSFER_WHITE_CHRISTOPH = _vsp.CF_TURB_HEATTRANSFER_WHITE_CHRISTOPH
r"""Heat Transfer White-Christoph turbulent Cf equation."""
CHEVRON_NONE = _vsp.CHEVRON_NONE
r"""No chevron."""
CHEVRON_PARTIAL = _vsp.CHEVRON_PARTIAL
r"""One or more chevrons of limited extent."""
CHEVRON_FULL = _vsp.CHEVRON_FULL
r"""Full period of chevrons."""
CHEVRON_NUM_TYPES = _vsp.CHEVRON_NUM_TYPES
r"""Number of chevron types."""
CHEVRON_W01_SE = _vsp.CHEVRON_W01_SE
r"""Start and End"""
CHEVRON_W01_CW = _vsp.CHEVRON_W01_CW
r"""Center and Width"""
CHEVRON_W01_NUM_MODES = _vsp.CHEVRON_W01_NUM_MODES
r"""Number of chevron W parameter mode types."""
COLLISION_OK = _vsp.COLLISION_OK
r"""No Error."""
COLLISION_INTERSECT_NO_SOLUTION = _vsp.COLLISION_INTERSECT_NO_SOLUTION
r"""Touching, no solution"""
COLLISION_CLEAR_NO_SOLUTION = _vsp.COLLISION_CLEAR_NO_SOLUTION
r"""Not touching, no solution"""
NO_FILE_TYPE = _vsp.NO_FILE_TYPE
r"""No export file type"""
COMP_GEOM_TXT_TYPE = _vsp.COMP_GEOM_TXT_TYPE
COMP_GEOM_CSV_TYPE = _vsp.COMP_GEOM_CSV_TYPE
DRAG_BUILD_TSV_TYPE_DEPRECATED = _vsp.DRAG_BUILD_TSV_TYPE_DEPRECATED
SLICE_TXT_TYPE = _vsp.SLICE_TXT_TYPE
MASS_PROP_TXT_TYPE = _vsp.MASS_PROP_TXT_TYPE
DEGEN_GEOM_CSV_TYPE = _vsp.DEGEN_GEOM_CSV_TYPE
DEGEN_GEOM_M_TYPE = _vsp.DEGEN_GEOM_M_TYPE
CFD_STL_TYPE = _vsp.CFD_STL_TYPE
CFD_POLY_TYPE = _vsp.CFD_POLY_TYPE
CFD_TRI_TYPE = _vsp.CFD_TRI_TYPE
CFD_OBJ_TYPE = _vsp.CFD_OBJ_TYPE
CFD_DAT_TYPE = _vsp.CFD_DAT_TYPE
CFD_KEY_TYPE = _vsp.CFD_KEY_TYPE
CFD_GMSH_TYPE = _vsp.CFD_GMSH_TYPE
CFD_SRF_TYPE_DEPRECATED = _vsp.CFD_SRF_TYPE_DEPRECATED
CFD_TKEY_TYPE = _vsp.CFD_TKEY_TYPE
PROJ_AREA_CSV_TYPE = _vsp.PROJ_AREA_CSV_TYPE
WAVE_DRAG_TXT_TYPE = _vsp.WAVE_DRAG_TXT_TYPE
VSPAERO_PANEL_TRI_TYPE = _vsp.VSPAERO_PANEL_TRI_TYPE
DRAG_BUILD_CSV_TYPE = _vsp.DRAG_BUILD_CSV_TYPE
CFD_FACET_TYPE = _vsp.CFD_FACET_TYPE
CFD_CURV_TYPE_DEPRECATED = _vsp.CFD_CURV_TYPE_DEPRECATED
CFD_PLOT3D_TYPE_DEPRECATED = _vsp.CFD_PLOT3D_TYPE_DEPRECATED
CFD_VSPGEOM_TYPE = _vsp.CFD_VSPGEOM_TYPE
VSPAERO_VSPGEOM_TYPE = _vsp.VSPAERO_VSPGEOM_TYPE
U_TRIM = _vsp.U_TRIM
r"""Trim by U coordinate"""
L_TRIM = _vsp.L_TRIM
r"""Trim by L coordinate"""
ETA_TRIM = _vsp.ETA_TRIM
r"""Trim by Eta coordinate"""
NUM_TRIM_TYPES = _vsp.NUM_TRIM_TYPES
r"""Number of conformal component trim types"""
DELIM_COMMA = _vsp.DELIM_COMMA
r"""Comma delimiter"""
DELIM_USCORE = _vsp.DELIM_USCORE
r"""Underscore delimiter"""
DELIM_SPACE = _vsp.DELIM_SPACE
r"""Space delimiter"""
DELIM_NONE = _vsp.DELIM_NONE
r"""No delimiter"""
DELIM_NUM_TYPES = _vsp.DELIM_NUM_TYPES
r"""Number of delimiter types"""
DEPTH_FRONT = _vsp.DEPTH_FRONT
r"""Set 3D background before model"""
DEPTH_REAR = _vsp.DEPTH_REAR
r"""Set 3D background behind model"""
DEPTH_FREE = _vsp.DEPTH_FREE
r"""Set 3D background at specified location"""
NUM_DEPTH_TYPE = _vsp.NUM_DEPTH_TYPE
r"""Number of depth types"""
SET_3D = _vsp.SET_3D
r"""3D DXF export (default)"""
SET_2D = _vsp.SET_2D
r"""2D DXF export"""
X_DIR = _vsp.X_DIR
r"""X direction"""
Y_DIR = _vsp.Y_DIR
Z_DIR = _vsp.Z_DIR
ALL_DIR = _vsp.ALL_DIR
DISPLAY_BEZIER = _vsp.DISPLAY_BEZIER
r"""Display the normal Bezier surface (default)"""
DISPLAY_DEGEN_SURF = _vsp.DISPLAY_DEGEN_SURF
r"""Display as surface Degen Geom"""
DISPLAY_DEGEN_PLATE = _vsp.DISPLAY_DEGEN_PLATE
r"""Display as plate Degen Geom"""
DISPLAY_DEGEN_CAMBER = _vsp.DISPLAY_DEGEN_CAMBER
r"""Display as camber Degen Geom"""
GEOM_DRAW_WIRE = _vsp.GEOM_DRAW_WIRE
r"""Draw the wireframe mesh (see through)"""
GEOM_DRAW_HIDDEN = _vsp.GEOM_DRAW_HIDDEN
r"""Draw the hidden mesh"""
GEOM_DRAW_SHADE = _vsp.GEOM_DRAW_SHADE
r"""Draw the shaded mesh"""
GEOM_DRAW_TEXTURE = _vsp.GEOM_DRAW_TEXTURE
r"""Draw the textured mesh"""
GEOM_DRAW_NONE = _vsp.GEOM_DRAW_NONE
r"""Do not draw anything"""
ENGINE_GEOM_NONE = _vsp.ENGINE_GEOM_NONE
r"""Component is not an integrated flowpath component."""
ENGINE_GEOM_INLET = _vsp.ENGINE_GEOM_INLET
r"""Component represents integrated flowpath inlet."""
ENGINE_GEOM_INLET_OUTLET = _vsp.ENGINE_GEOM_INLET_OUTLET
r"""Component represents integrated flowpath inlet and outlet."""
ENGINE_GEOM_OUTLET = _vsp.ENGINE_GEOM_OUTLET
r"""Component represents integrated flowpath outlet."""
ENGINE_GEOM_IO_NUM_TYPES = _vsp.ENGINE_GEOM_IO_NUM_TYPES
r"""Number of integrated flowpath component types."""
ENGINE_GEOM_FLOWTHROUGH = _vsp.ENGINE_GEOM_FLOWTHROUGH
r"""Component is modeled as flowthrough engine."""
ENGINE_GEOM_TO_LIP = _vsp.ENGINE_GEOM_TO_LIP
r"""Component is modeled to the lip."""
ENGINE_GEOM_FLOWPATH = _vsp.ENGINE_GEOM_FLOWPATH
r"""Component flowpath is modeled."""
ENGINE_GEOM_TO_FACE = _vsp.ENGINE_GEOM_TO_FACE
r"""Component is modeled to face."""
ENGINE_GEOM_NUM_TYPES = _vsp.ENGINE_GEOM_NUM_TYPES
r"""Number of integrated flowpath modeling types."""
ENGINE_LOC_INDEX = _vsp.ENGINE_LOC_INDEX
r"""Integrated flowpath key point identified by XSec index."""
ENGINE_LOC_U = _vsp.ENGINE_LOC_U
r"""Integrated flowpath key point identified by U parameter."""
ENGINE_LOC_INLET_LIP = _vsp.ENGINE_LOC_INLET_LIP
r"""Integrated flowpath key point is inlet lip."""
ENGINE_LOC_INLET_FACE = _vsp.ENGINE_LOC_INLET_FACE
r"""Integrated flowpath key point is inlet face."""
ENGINE_LOC_OUTLET_LIP = _vsp.ENGINE_LOC_OUTLET_LIP
r"""Integrated flowpath key point is outlet lip."""
ENGINE_LOC_OUTLET_FACE = _vsp.ENGINE_LOC_OUTLET_FACE
r"""Integrated flowpath key point is outlet face."""
ENGINE_LOC_NUM = _vsp.ENGINE_LOC_NUM
r"""Number of integrated flowpath key point locations."""
ENGINE_MODE_FLOWTHROUGH = _vsp.ENGINE_MODE_FLOWTHROUGH
r"""Represent integrated flowpath as flowthrough engine."""
ENGINE_MODE_FLOWTHROUGH_NEG = _vsp.ENGINE_MODE_FLOWTHROUGH_NEG
r"""Represent integrated flowpath as flowthrough engine with negative flowpath."""
ENGINE_MODE_FLOWTHROUGH_NEG_ONLY = _vsp.ENGINE_MODE_FLOWTHROUGH_NEG_ONLY
r"""Represent ONLY the integrated flowpath as flowthrough engine with negative flowpath."""
ENGINE_MODE_TO_LIP = _vsp.ENGINE_MODE_TO_LIP
r"""Represent integrated flowpath to the lip."""
ENGINE_MODE_TO_FACE = _vsp.ENGINE_MODE_TO_FACE
r"""Represent integrated flowpath to the face."""
ENGINE_MODE_TO_FACE_NEG = _vsp.ENGINE_MODE_TO_FACE_NEG
r"""Represent integrated flowpath to the face with negative flowpath to the face."""
ENGINE_MODE_TO_FACE_NEG_ONLY = _vsp.ENGINE_MODE_TO_FACE_NEG_ONLY
r"""Represent ONLY the integrated flowpath to the face with negative flowpath to the face."""
ENGINE_MODE_EXTEND = _vsp.ENGINE_MODE_EXTEND
r"""Represent integrated flowpath with farfield extensions."""
ENGINE_MODE_NUM_TYPES = _vsp.ENGINE_MODE_NUM_TYPES
r"""Number of integrated flowpath representations."""
VSP_UNKNOWN = _vsp.VSP_UNKNOWN
r"""Unknown error"""
VSP_OK = _vsp.VSP_OK
r"""No error"""
VSP_INVALID_PTR = _vsp.VSP_INVALID_PTR
r"""Invalid pointer error"""
VSP_INVALID_TYPE = _vsp.VSP_INVALID_TYPE
r"""Invalid type error"""
VSP_CANT_FIND_TYPE = _vsp.VSP_CANT_FIND_TYPE
r"""Can't find type error"""
VSP_CANT_FIND_PARM = _vsp.VSP_CANT_FIND_PARM
r"""Can't find parm error"""
VSP_CANT_FIND_NAME = _vsp.VSP_CANT_FIND_NAME
r"""Can't find name error"""
VSP_INVALID_GEOM_ID = _vsp.VSP_INVALID_GEOM_ID
r"""Invalid Geom ID error"""
VSP_FILE_DOES_NOT_EXIST = _vsp.VSP_FILE_DOES_NOT_EXIST
r"""File does not exist error"""
VSP_FILE_WRITE_FAILURE = _vsp.VSP_FILE_WRITE_FAILURE
r"""File write failure error"""
VSP_FILE_READ_FAILURE = _vsp.VSP_FILE_READ_FAILURE
r"""File read failure error"""
VSP_WRONG_GEOM_TYPE = _vsp.VSP_WRONG_GEOM_TYPE
r"""Wrong Geom type error"""
VSP_WRONG_XSEC_TYPE = _vsp.VSP_WRONG_XSEC_TYPE
r"""Wrong XSec type error"""
VSP_WRONG_FILE_TYPE = _vsp.VSP_WRONG_FILE_TYPE
r"""Wrong file type error"""
VSP_INDEX_OUT_RANGE = _vsp.VSP_INDEX_OUT_RANGE
r"""Index out of range error"""
VSP_INVALID_XSEC_ID = _vsp.VSP_INVALID_XSEC_ID
r"""Invalid XSec ID error"""
VSP_INVALID_ID = _vsp.VSP_INVALID_ID
r"""Invalid ID error"""
VSP_CANT_SET_NOT_EQ_PARM = _vsp.VSP_CANT_SET_NOT_EQ_PARM
r"""Can't set NotEqParm error"""
VSP_AMBIGUOUS_SUBSURF = _vsp.VSP_AMBIGUOUS_SUBSURF
r"""Ambiguous flow-through sub-surface error"""
VSP_INVALID_VARPRESET_SETNAME = _vsp.VSP_INVALID_VARPRESET_SETNAME
r"""Invalid Variable Preset set name error"""
VSP_INVALID_VARPRESET_GROUPNAME = _vsp.VSP_INVALID_VARPRESET_GROUPNAME
r"""Invalid Variable Preset group name error"""
VSP_CONFORMAL_PARENT_UNSUPPORTED = _vsp.VSP_CONFORMAL_PARENT_UNSUPPORTED
r"""Unsupported Conformal Geom parent error"""
VSP_UNEXPECTED_RESET_REMAP_ID = _vsp.VSP_UNEXPECTED_RESET_REMAP_ID
r"""Unexpected reset remap ID error"""
VSP_INVALID_INPUT_VAL = _vsp.VSP_INVALID_INPUT_VAL
r"""Invalid input value error"""
VSP_INVALID_CF_EQN = _vsp.VSP_INVALID_CF_EQN
r"""Invalid friction coefficient equation error"""
VSP_INVALID_DRIVERS = _vsp.VSP_INVALID_DRIVERS
r"""Invalid drivers for driver group"""
VSP_ADV_LINK_BUILD_FAIL = _vsp.VSP_ADV_LINK_BUILD_FAIL
r"""Advanced link build failure"""
VSP_DEPRECATED = _vsp.VSP_DEPRECATED
r"""This capability has been deprecated and is not longer supported"""
VSP_LINK_LOOP_DETECTED = _vsp.VSP_LINK_LOOP_DETECTED
r"""A parameter link loop was detected and stopped"""
VSP_LINK_OUTPUT_NOT_ASSIGNED = _vsp.VSP_LINK_OUTPUT_NOT_ASSIGNED
r"""An output of a parameter link was not set"""
VSP_DUPLICATE_NAME = _vsp.VSP_DUPLICATE_NAME
r"""A duplicate name has been provided"""
VSP_GUI_DEVICE_DEACTIVATED = _vsp.VSP_GUI_DEVICE_DEACTIVATED
r"""A deactivated GUI device was touched"""
VSP_COULD_NOT_CREATE_BACKGROUND3D = _vsp.VSP_COULD_NOT_CREATE_BACKGROUND3D
r"""Could not create and add Background3D"""
VSP_NUM_ERROR_CODE = _vsp.VSP_NUM_ERROR_CODE
r"""Total number of VSP error codes"""
EXCRESCENCE_COUNT = _vsp.EXCRESCENCE_COUNT
r"""Drag counts excressence type"""
EXCRESCENCE_CD = _vsp.EXCRESCENCE_CD
r"""Drag coefficient excressence type"""
EXCRESCENCE_PERCENT_GEOM = _vsp.EXCRESCENCE_PERCENT_GEOM
r"""Percent of parent Geom drag coefficient excressence type"""
EXCRESCENCE_MARGIN = _vsp.EXCRESCENCE_MARGIN
r"""Percent margin excressence type"""
EXCRESCENCE_DRAGAREA = _vsp.EXCRESCENCE_DRAGAREA
r"""Drag area (D/q) excressence type"""
EXPORT_FELISA = _vsp.EXPORT_FELISA
r"""FELISA export type (NOT IMPLEMENTED)"""
EXPORT_XSEC = _vsp.EXPORT_XSEC
r"""XSec (\*.hrm) export type"""
EXPORT_STL = _vsp.EXPORT_STL
r"""Stereolith (\*.stl) export type"""
EXPORT_AWAVE = _vsp.EXPORT_AWAVE
r"""AWAVE export type (NOT IMPLEMENTED)"""
EXPORT_NASCART = _vsp.EXPORT_NASCART
r"""NASCART (\*.dat) export type"""
EXPORT_POVRAY = _vsp.EXPORT_POVRAY
r"""POVRAY (\*.pov) export type"""
EXPORT_CART3D = _vsp.EXPORT_CART3D
r"""Cart3D (\*.tri) export type"""
EXPORT_VSPGEOM = _vsp.EXPORT_VSPGEOM
r"""VSPGeom (\*.vspgeom) export type"""
EXPORT_VORXSEC = _vsp.EXPORT_VORXSEC
r"""VORXSEC export type (NOT IMPLEMENTED)"""
EXPORT_XSECGEOM = _vsp.EXPORT_XSECGEOM
r"""XSECGEOM export type (NOT IMPLEMENTED)"""
EXPORT_GMSH = _vsp.EXPORT_GMSH
r"""Gmsh (\*.msh) export type"""
EXPORT_X3D = _vsp.EXPORT_X3D
r"""X3D (\*.x3d) export type"""
EXPORT_STEP = _vsp.EXPORT_STEP
r"""STEP (\*.stp) export type"""
EXPORT_PLOT3D = _vsp.EXPORT_PLOT3D
r"""PLOT3D (\*.p3d) export type"""
EXPORT_IGES = _vsp.EXPORT_IGES
r"""IGES (\*.igs) export type"""
EXPORT_BEM = _vsp.EXPORT_BEM
r"""Blade Element (\*.bem) export type"""
EXPORT_DXF = _vsp.EXPORT_DXF
r"""AutoCAD (\*.dxf) export type"""
EXPORT_FACET = _vsp.EXPORT_FACET
r"""Xpatch (\*.facet) export type"""
EXPORT_SVG = _vsp.EXPORT_SVG
r"""SVG (\*.svg) export type"""
EXPORT_PMARC = _vsp.EXPORT_PMARC
r"""PMARC 12 (\*.pmin) export type"""
EXPORT_OBJ = _vsp.EXPORT_OBJ
r"""OBJ (\*.obj) export type"""
EXPORT_SELIG_AIRFOIL = _vsp.EXPORT_SELIG_AIRFOIL
r"""Airfoil points (\*.dat) export type"""
EXPORT_BEZIER_AIRFOIL = _vsp.EXPORT_BEZIER_AIRFOIL
r"""Airfoil curves (\*.bz) export type"""
EXPORT_IGES_STRUCTURE = _vsp.EXPORT_IGES_STRUCTURE
r"""IGES structure (\*.igs) export type"""
EXPORT_STEP_STRUCTURE = _vsp.EXPORT_STEP_STRUCTURE
r"""STEP structure (\*.stp) export type"""
FEA_BCM_USER = _vsp.FEA_BCM_USER
r"""FEA boundary condition constraints user defined."""
FEA_BCM_ALL = _vsp.FEA_BCM_ALL
r"""FEA boundary condition constrains all DOF."""
FEA_BCM_PIN = _vsp.FEA_BCM_PIN
r"""FEA boundary condition pin constraints."""
FEA_BCM_SYMM = _vsp.FEA_BCM_SYMM
r"""FEA boundary condition symmetrical constraints."""
FEA_BCM_ASYMM = _vsp.FEA_BCM_ASYMM
r"""FEA boundary condition antisymmetrical constraints."""
FEA_NUM_BCM_MODES = _vsp.FEA_NUM_BCM_MODES
r"""Number of FEA boundary condition constraint types."""
FEA_BC_STRUCTURE = _vsp.FEA_BC_STRUCTURE
r"""FEA boundary condition assigned to structure."""
FEA_BC_PART = _vsp.FEA_BC_PART
r"""FEA boundary condition assigned to part."""
FEA_BC_SUBSURF = _vsp.FEA_BC_SUBSURF
r"""FEA boundary condition assigned to subsurface."""
FEA_NUM_BC_TYPES = _vsp.FEA_NUM_BC_TYPES
r"""Number of FEA boundary condition definition types."""
FEA_XSEC_GENERAL = _vsp.FEA_XSEC_GENERAL
r"""General XSec type"""
FEA_XSEC_CIRC = _vsp.FEA_XSEC_CIRC
r"""Circle XSec type"""
FEA_XSEC_PIPE = _vsp.FEA_XSEC_PIPE
r"""Pipe XSec type"""
FEA_XSEC_I = _vsp.FEA_XSEC_I
r"""I XSec type"""
FEA_XSEC_RECT = _vsp.FEA_XSEC_RECT
r"""Rectangle XSec type"""
FEA_XSEC_BOX = _vsp.FEA_XSEC_BOX
r"""Box XSec type"""
FEA_MASS_FILE_NAME = _vsp.FEA_MASS_FILE_NAME
r"""FEA Mesh mass export type"""
FEA_NASTRAN_FILE_NAME = _vsp.FEA_NASTRAN_FILE_NAME
r"""FEA Mesh NASTRAN export type"""
FEA_NKEY_FILE_NAME = _vsp.FEA_NKEY_FILE_NAME
r"""FEA Mesh NKey export type"""
FEA_CALCULIX_FILE_NAME = _vsp.FEA_CALCULIX_FILE_NAME
r"""FEA Mesh Calculix export type"""
FEA_STL_FILE_NAME = _vsp.FEA_STL_FILE_NAME
r"""FEA Mesh STL export type"""
FEA_GMSH_FILE_NAME = _vsp.FEA_GMSH_FILE_NAME
r"""FEA Mesh GMSH export type"""
FEA_SRF_FILE_NAME = _vsp.FEA_SRF_FILE_NAME
r"""FEA Mesh SRF export type"""
FEA_CURV_FILE_NAME = _vsp.FEA_CURV_FILE_NAME
r"""FEA Mesh CURV export type"""
FEA_PLOT3D_FILE_NAME = _vsp.FEA_PLOT3D_FILE_NAME
r"""FEA Mesh PLOT3D export type"""
FEA_IGES_FILE_NAME = _vsp.FEA_IGES_FILE_NAME
r"""FEA Mesh trimmed IGES export type"""
FEA_STEP_FILE_NAME = _vsp.FEA_STEP_FILE_NAME
r"""FEA Mesh trimmed STEP export type"""
FEA_NUM_FILE_NAMES = _vsp.FEA_NUM_FILE_NAMES
r"""Number of FEA Mesh export type."""
FEA_FIX_PT_ON_BODY = _vsp.FEA_FIX_PT_ON_BODY
r"""On body fixed point type"""
FEA_FIX_PT_GLOBAL_XYZ = _vsp.FEA_FIX_PT_GLOBAL_XYZ
r"""Global XYZ off body fixed point type"""
FEA_FIX_PT_DELTA_XYZ = _vsp.FEA_FIX_PT_DELTA_XYZ
r"""Delta XYZ off body fixed point type"""
FEA_FIX_PT_DELTA_UVN = _vsp.FEA_FIX_PT_DELTA_UVN
r"""Delta UVN off body fixed point type"""
FEA_FIX_PT_GEOM_ORIGIN = _vsp.FEA_FIX_PT_GEOM_ORIGIN
r"""Geom origin off body fixed point type"""
FEA_FIX_PT_GEOM_CG = _vsp.FEA_FIX_PT_GEOM_CG
r"""Geom CG off body fixed point type"""
FEA_NUM_FIX_PT_TYPES = _vsp.FEA_NUM_FIX_PT_TYPES
r"""Number of off body fixed point types"""
FEA_ISOTROPIC = _vsp.FEA_ISOTROPIC
r"""Isotropic material"""
FEA_ENG_ORTHO = _vsp.FEA_ENG_ORTHO
r"""Orthotropic material in engineering parameters"""
FEA_ENG_ORTHO_TRANS_ISO = _vsp.FEA_ENG_ORTHO_TRANS_ISO
r"""Orthotropic material with transverse isotropy assumed in engineering parameters"""
FEA_LAMINATE = _vsp.FEA_LAMINATE
r"""Laminate buildup material"""
FEA_NUM_MAT_TYPES = _vsp.FEA_NUM_MAT_TYPES
r"""Number of FEA material types"""
FEA_ORIENT_GLOBAL_X = _vsp.FEA_ORIENT_GLOBAL_X
r"""FEA Global X material orientation"""
FEA_ORIENT_GLOBAL_Y = _vsp.FEA_ORIENT_GLOBAL_Y
r"""FEA Global Y material orientation"""
FEA_ORIENT_GLOBAL_Z = _vsp.FEA_ORIENT_GLOBAL_Z
r"""FEA Global Z material orientation"""
FEA_ORIENT_COMP_X = _vsp.FEA_ORIENT_COMP_X
r"""FEA Comp X material orientation"""
FEA_ORIENT_COMP_Y = _vsp.FEA_ORIENT_COMP_Y
r"""FEA Comp Y material orientation"""
FEA_ORIENT_COMP_Z = _vsp.FEA_ORIENT_COMP_Z
r"""FEA Comp Z material orientation"""
FEA_ORIENT_PART_U = _vsp.FEA_ORIENT_PART_U
r"""FEA Part U material orientation"""
FEA_ORIENT_PART_V = _vsp.FEA_ORIENT_PART_V
r"""FEA Part V material orientation"""
FEA_ORIENT_OML_U = _vsp.FEA_ORIENT_OML_U
r"""FEA OML U material orientation"""
FEA_ORIENT_OML_V = _vsp.FEA_ORIENT_OML_V
r"""FEA OML V material orientation"""
FEA_ORIENT_OML_R = _vsp.FEA_ORIENT_OML_R
r"""FEA OML R material orientation"""
FEA_ORIENT_OML_S = _vsp.FEA_ORIENT_OML_S
r"""FEA OML S material orientation"""
FEA_ORIENT_OML_T = _vsp.FEA_ORIENT_OML_T
r"""FEA OML T material orientation"""
FEA_NUM_ORIENT_TYPES = _vsp.FEA_NUM_ORIENT_TYPES
r"""Number of FEA material orientation types"""
FEA_DEPRECATED = _vsp.FEA_DEPRECATED
r"""Flag for deprecated element type option"""
FEA_SHELL = _vsp.FEA_SHELL
r"""Shell (tris) FEA element type"""
FEA_BEAM = _vsp.FEA_BEAM
r"""Beam FEA element type"""
FEA_SHELL_AND_BEAM = _vsp.FEA_SHELL_AND_BEAM
r"""Both Shell and Beam FEA element types"""
FEA_NO_ELEMENTS = _vsp.FEA_NO_ELEMENTS
r"""FEA part with no elements"""
FEA_NUM_ELEMENT_TYPES = _vsp.FEA_NUM_ELEMENT_TYPES
r"""Number of FEA element type choices"""
FEA_SLICE = _vsp.FEA_SLICE
r"""Slice FEA Part type"""
FEA_RIB = _vsp.FEA_RIB
r"""Rib FEA Part type"""
FEA_SPAR = _vsp.FEA_SPAR
r"""Spar FEA Part type"""
FEA_FIX_POINT = _vsp.FEA_FIX_POINT
r"""Fixed Point FEA Part type"""
FEA_DOME = _vsp.FEA_DOME
r"""Dome FEA Part type"""
FEA_RIB_ARRAY = _vsp.FEA_RIB_ARRAY
r"""Rib array FEA Part type"""
FEA_SLICE_ARRAY = _vsp.FEA_SLICE_ARRAY
r"""Slice array FEA Part type"""
FEA_SKIN = _vsp.FEA_SKIN
r"""Skin FEA Part type"""
FEA_TRIM = _vsp.FEA_TRIM
r"""Trim FEA Part type"""
FEA_POLY_SPAR = _vsp.FEA_POLY_SPAR
r"""Poly Spar FEA Part type"""
FEA_NUM_TYPES = _vsp.FEA_NUM_TYPES
r"""Number of FEA Part types"""
NO_NORMAL = _vsp.NO_NORMAL
r"""FEA Rib or Rib Array has no set perpendicular edge"""
LE_NORMAL = _vsp.LE_NORMAL
r"""FEA Rib or Rib Array is set perpendicular to the leading edge"""
TE_NORMAL = _vsp.TE_NORMAL
r"""FEA Rib or Rib Array is set perpendicular to the trailing edge"""
SPAR_NORMAL = _vsp.SPAR_NORMAL
r"""FEA Rib or Rib Array is set perpendicular to an FEA Spar"""
FEA_KEEP = _vsp.FEA_KEEP
r"""Keep shell elements"""
FEA_DELETE = _vsp.FEA_DELETE
r"""Delete shell elements"""
FEA_NUM_SHELL_TREATMENT_TYPES = _vsp.FEA_NUM_SHELL_TREATMENT_TYPES
r"""Number of FEA subsurface treatment choices"""
XY_BODY = _vsp.XY_BODY
r"""Slice is parallel to parent Geom body XY plane"""
YZ_BODY = _vsp.YZ_BODY
r"""Slice is parallel to parent Geom body YZ plane"""
XZ_BODY = _vsp.XZ_BODY
r"""Slice is parallel to parent Geom body XZ plane"""
XY_ABS = _vsp.XY_ABS
r"""Slice is parallel to absolute XY plane"""
YZ_ABS = _vsp.YZ_ABS
r"""Slice is parallel to absolute YZ plane"""
XZ_ABS = _vsp.XZ_ABS
r"""Slice is parallel to absolute XZ plane"""
SPINE_NORMAL = _vsp.SPINE_NORMAL
r"""Slice is perpendicular to thespine of the parent Geom"""
POLY_SPAR_POINT_U01 = _vsp.POLY_SPAR_POINT_U01
r"""Spar points span specified in U01"""
POLY_SPAR_POINT_U0N = _vsp.POLY_SPAR_POINT_U0N
r"""Spar points span specified in U0N"""
POLY_SPAR_POINT_ETA = _vsp.POLY_SPAR_POINT_ETA
r"""Spar points span specified in eta"""
NUM_POLY_SPAR_POINT_TYPES = _vsp.NUM_POLY_SPAR_POINT_TYPES
r"""Number of poly spar point types"""
SI_UNIT = _vsp.SI_UNIT
r"""FEA Files output in (m, kg)"""
CGS_UNIT = _vsp.CGS_UNIT
r"""FEA Files output in (cm, g)"""
MPA_UNIT = _vsp.MPA_UNIT
r"""FEA Files output in (mm, tonne)"""
BFT_UNIT = _vsp.BFT_UNIT
r"""FEA Files output in (ft, slug)"""
BIN_UNIT = _vsp.BIN_UNIT
r"""FEA Files output in (in, lbf*sec^2/in)"""
FIT_MODEL_FIXED = _vsp.FIT_MODEL_FIXED
r"""Target point is held at the given surface coordinate"""
FIT_MODEL_FREE = _vsp.FIT_MODEL_FREE
r"""Target point may slide along the surface in this direction"""
FF_B_MANUAL = _vsp.FF_B_MANUAL
r"""Manual FF equation"""
FF_B_SCHEMENSKY_FUSE = _vsp.FF_B_SCHEMENSKY_FUSE
r"""Schemensky Fuselage FF equation"""
FF_B_SCHEMENSKY_NACELLE = _vsp.FF_B_SCHEMENSKY_NACELLE
r"""Schemensky Nacelle FF equation"""
FF_B_HOERNER_STREAMBODY = _vsp.FF_B_HOERNER_STREAMBODY
r"""Hoerner Streamlined Body FF equation"""
FF_B_TORENBEEK = _vsp.FF_B_TORENBEEK
r"""Torenbeek FF equation"""
FF_B_SHEVELL = _vsp.FF_B_SHEVELL
r"""Shevell FF equation"""
FF_B_COVERT = _vsp.FF_B_COVERT
r"""Covert FF equation"""
FF_B_JENKINSON_FUSE = _vsp.FF_B_JENKINSON_FUSE
r"""Jenkinson Fuselage FF equation"""
FF_B_JENKINSON_WING_NACELLE = _vsp.FF_B_JENKINSON_WING_NACELLE
r"""Jenkinson Wing Nacelle FF equation"""
FF_B_JENKINSON_AFT_FUSE_NACELLE = _vsp.FF_B_JENKINSON_AFT_FUSE_NACELLE
r"""Jenkinson Aft Fuselage Nacelle FF equation"""
FF_W_MANUAL = _vsp.FF_W_MANUAL
r"""Manual FF equation"""
FF_W_EDET_CONV = _vsp.FF_W_EDET_CONV
r"""EDET Conventional Airfoil FF equation"""
FF_W_EDET_ADV = _vsp.FF_W_EDET_ADV
r"""EDET Advanced Airfoil FF equation"""
FF_W_HOERNER = _vsp.FF_W_HOERNER
r"""Hoerner FF equation"""
FF_W_COVERT = _vsp.FF_W_COVERT
r"""Covert FF equation"""
FF_W_SHEVELL = _vsp.FF_W_SHEVELL
r"""Shevell FF equation"""
FF_W_KROO = _vsp.FF_W_KROO
r"""Kroo FF equation"""
FF_W_TORENBEEK = _vsp.FF_W_TORENBEEK
r"""Torenbeek FF equation"""
FF_W_DATCOM = _vsp.FF_W_DATCOM
r"""DATCOM FF equation"""
FF_W_SCHEMENSKY_6_SERIES_AF = _vsp.FF_W_SCHEMENSKY_6_SERIES_AF
r"""Schemensky 6 Series Airfoil FF equation"""
FF_W_SCHEMENSKY_4_SERIES_AF = _vsp.FF_W_SCHEMENSKY_4_SERIES_AF
r"""Schemensky 4 Series Airfoil FF equation"""
FF_W_JENKINSON_WING = _vsp.FF_W_JENKINSON_WING
r"""Jenkinson Wing FF equation"""
FF_W_JENKINSON_TAIL = _vsp.FF_W_JENKINSON_TAIL
r"""Jenkinson Tail FF equation"""
FF_W_SCHEMENSKY_SUPERCRITICAL_AF = _vsp.FF_W_SCHEMENSKY_SUPERCRITICAL_AF
r"""Schemensky Supercritical Airfoil FF equation"""
ONE_THIRD_ROTOR_FRAGMENT = _vsp.ONE_THIRD_ROTOR_FRAGMENT
r"""One third rotor fragment"""
INTERMEDIATE_FRAGMENT = _vsp.INTERMEDIATE_FRAGMENT
r"""Intermediate rotor fragment"""
ALTERNATE_FRAGMENT = _vsp.ALTERNATE_FRAGMENT
r"""Alternate rotor fragment model"""
FAN_FRAGMENT = _vsp.FAN_FRAGMENT
r"""Fan blade fragment"""
SMALL_FRAGMENT = _vsp.SMALL_FRAGMENT
r"""Small fragment"""
GENERIC_FRAGMENT = _vsp.GENERIC_FRAGMENT
r"""Generic fragment"""
NUM_FRAGMENT_MODES = _vsp.NUM_FRAGMENT_MODES
r"""Number of auxiliary geom modes."""
PD_UNITS_IMPERIAL = _vsp.PD_UNITS_IMPERIAL
r"""Imperial unit system"""
PD_UNITS_METRIC = _vsp.PD_UNITS_METRIC
r"""Metric unit system"""
OPEN = _vsp.OPEN
r"""Browse files that already exist"""
SAVE = _vsp.SAVE
r"""Browse file system and enter file name"""
NUM_FILE_CHOOSER_MODES = _vsp.NUM_FILE_CHOOSER_MODES
r"""Number of file chooser modes"""
FC_OPENVSP = _vsp.FC_OPENVSP
r"""OpenVSP's own file chooser with directory preferences."""
FC_NATIVE = _vsp.FC_NATIVE
r"""Operating system's native file chooser"""
NUM_FILE_CHOOSER_TYPES = _vsp.NUM_FILE_CHOOSER_TYPES
r"""Number of file chooser types"""
GDEV_TAB = _vsp.GDEV_TAB
r"""Custom GUI Tab"""
GDEV_SCROLL_TAB = _vsp.GDEV_SCROLL_TAB
r"""Custom GUI Fl_Scroll and Tab"""
GDEV_GROUP = _vsp.GDEV_GROUP
r"""Custom GUI Group"""
GDEV_PARM_BUTTON = _vsp.GDEV_PARM_BUTTON
r"""Custom GUI ParmButton"""
GDEV_INPUT = _vsp.GDEV_INPUT
r"""Custom GUI Input"""
GDEV_OUTPUT = _vsp.GDEV_OUTPUT
r"""Custom GUI Output"""
GDEV_SLIDER = _vsp.GDEV_SLIDER
r"""Custom GUI Slider"""
GDEV_SLIDER_ADJ_RANGE = _vsp.GDEV_SLIDER_ADJ_RANGE
r"""Custom GUI SliderAdjRangeInput"""
GDEV_CHECK_BUTTON = _vsp.GDEV_CHECK_BUTTON
r"""Custom GUI CheckButton"""
GDEV_CHECK_BUTTON_BIT = _vsp.GDEV_CHECK_BUTTON_BIT
r"""Custom GUI CheckButtonBit"""
GDEV_RADIO_BUTTON = _vsp.GDEV_RADIO_BUTTON
r"""Custom GUI RadioButton"""
GDEV_TOGGLE_BUTTON = _vsp.GDEV_TOGGLE_BUTTON
r"""Custom GUI ToggleButton"""
GDEV_TOGGLE_BUTTON_FREE = _vsp.GDEV_TOGGLE_BUTTON_FREE
r"""Custom GUI ToggleButton without Parm"""
GDEV_TOGGLE_RADIO_GROUP = _vsp.GDEV_TOGGLE_RADIO_GROUP
r"""Custom GUI ToggleRadioGroup (NOT IMPLEMENTED)"""
GDEV_TRIGGER_BUTTON = _vsp.GDEV_TRIGGER_BUTTON
r"""Custom GUI TriggerButton"""
GDEV_COUNTER = _vsp.GDEV_COUNTER
r"""Custom GUI Counter"""
GDEV_CHOICE = _vsp.GDEV_CHOICE
r"""Custom GUI Choice"""
GDEV_ADD_CHOICE_ITEM = _vsp.GDEV_ADD_CHOICE_ITEM
r"""Add item to custom GUI Choice"""
GDEV_SLIDER_INPUT = _vsp.GDEV_SLIDER_INPUT
r"""Custom GUI SliderInput"""
GDEV_SLIDER_ADJ_RANGE_INPUT = _vsp.GDEV_SLIDER_ADJ_RANGE_INPUT
r"""Custom GUI SliderAdjRangeInput"""
GDEV_SLIDER_ADJ_RANGE_TWO_INPUT = _vsp.GDEV_SLIDER_ADJ_RANGE_TWO_INPUT
r"""Custom GUI SliderAdjRangeInput with two inputs (NOT IMPLEMENTED)"""
GDEV_FRACT_PARM_SLIDER = _vsp.GDEV_FRACT_PARM_SLIDER
r"""Custom GUI FractParmSlider"""
GDEV_STRING_INPUT = _vsp.GDEV_STRING_INPUT
r"""Custom GUI StringInput"""
GDEV_INDEX_SELECTOR = _vsp.GDEV_INDEX_SELECTOR
r"""Custom GUI IndexSelector"""
GDEV_COLOR_PICKER = _vsp.GDEV_COLOR_PICKER
r"""Custom GUI ColorPicker"""
GDEV_YGAP = _vsp.GDEV_YGAP
r"""Custom GUI Y gap"""
GDEV_DIVIDER_BOX = _vsp.GDEV_DIVIDER_BOX
r"""Custom GUI divider box"""
GDEV_BEGIN_SAME_LINE = _vsp.GDEV_BEGIN_SAME_LINE
r"""Set begin same line flag for custom GUI"""
GDEV_END_SAME_LINE = _vsp.GDEV_END_SAME_LINE
r"""Set end same line flag for custom GUI"""
GDEV_FORCE_WIDTH = _vsp.GDEV_FORCE_WIDTH
r"""Set forced width for custom GUI"""
GDEV_SET_FORMAT = _vsp.GDEV_SET_FORMAT
r"""Set format label for custom GUI"""
NUM_GDEV_TYPES = _vsp.NUM_GDEV_TYPES
r"""Number of GDEV types"""
ALL_GDEV_TYPES = _vsp.ALL_GDEV_TYPES
r"""Flag for all GDEV types"""
GEAR_CONFIGURATION_DOWN = _vsp.GEAR_CONFIGURATION_DOWN
r"""Gear drawn down"""
GEAR_CONFIGURATION_UP = _vsp.GEAR_CONFIGURATION_UP
r"""Gear drawn up"""
GEAR_CONFIGURATION_UP_AND_DOWN = _vsp.GEAR_CONFIGURATION_UP_AND_DOWN
r"""Gear drawn both up and down"""
GEAR_CONFIGURATION_INTERMEDIATE = _vsp.GEAR_CONFIGURATION_INTERMEDIATE
r"""Gear drawn somewhere beteween down and up"""
GEAR_CONFIGURATION_ALL = _vsp.GEAR_CONFIGURATION_ALL
r"""Gear drawn in all configurations"""
NUM_GEAR_CONFIGURATION_MODES = _vsp.NUM_GEAR_CONFIGURATION_MODES
r"""Number of gear configuration choices"""
GEAR_STOWED_POSITION = _vsp.GEAR_STOWED_POSITION
r"""Specified by stowed position"""
GEAR_MECHANISM = _vsp.GEAR_MECHANISM
r"""Specified by mechanism"""
NUM_GEAR_RETRACT_MODES = _vsp.NUM_GEAR_RETRACT_MODES
r"""Number of gear retract choices"""
GEAR_SUSPENSION_NOMINAL = _vsp.GEAR_SUSPENSION_NOMINAL
r"""Gear suspension at nominal extension"""
GEAR_SUSPENSION_COMPRESSED = _vsp.GEAR_SUSPENSION_COMPRESSED
r"""Gear suspension is compressed"""
GEAR_SUSPENSION_EXTENDED = _vsp.GEAR_SUSPENSION_EXTENDED
r"""Gear suspension is extended"""
NUM_GEAR_SUSPENSION_MODES = _vsp.NUM_GEAR_SUSPENSION_MODES
r"""Number of gear suspension choices"""
MALE = _vsp.MALE
r"""Male Human component"""
FEMALE = _vsp.FEMALE
r"""Female Human component"""
EXTERNAL_INTERFERENCE = _vsp.EXTERNAL_INTERFERENCE
r"""Interference between mutually external bodies"""
PACKAGING_INTERFERENCE = _vsp.PACKAGING_INTERFERENCE
r"""Interference when one body is internal to another"""
EXTERNAL_SELF_INTERFERENCE = _vsp.EXTERNAL_SELF_INTERFERENCE
r"""Interference between multiple surfaces of one Geom / Set"""
PLANE_STATIC_DISTANCE_INTERFERENCE = _vsp.PLANE_STATIC_DISTANCE_INTERFERENCE
r"""Interference between surfaces and a plane"""
PLANE_2PT_ANGLE_INTERFERENCE = _vsp.PLANE_2PT_ANGLE_INTERFERENCE
r"""Interference angle between surfaces and a plane"""
GEAR_CG_TIPBACK_ANALYSIS = _vsp.GEAR_CG_TIPBACK_ANALYSIS
r"""Calculate tipback angle"""
PLANE_1PT_ANGLE_INTERFERENCE = _vsp.PLANE_1PT_ANGLE_INTERFERENCE
r"""Interference roll angle between surfaces and a plane"""
GEAR_WEIGHT_DISTRIBUTION_ANALYSIS = _vsp.GEAR_WEIGHT_DISTRIBUTION_ANALYSIS
r"""Calculate distribution of weight across landing gear"""
GEAR_TIPOVER_ANALYSIS = _vsp.GEAR_TIPOVER_ANALYSIS
r"""Calculate tipover angle"""
GEAR_TURN_ANALYSIS = _vsp.GEAR_TURN_ANALYSIS
r"""Calculate ground manueveribility"""
VISIBLE_FROM_POINT_ANALYSIS = _vsp.VISIBLE_FROM_POINT_ANALYSIS
r"""Calculate az,el domain visible from a point"""
CCE_INTERFERENCE = _vsp.CCE_INTERFERENCE
r"""Interference with composite clearance envelope"""
LINEAR_SWEPT_VOLUME_ANALYSIS = _vsp.LINEAR_SWEPT_VOLUME_ANALYSIS
r"""Interference with linear swept volume"""
VISIBLE_AT_SURF_ANALYSIS = _vsp.VISIBLE_AT_SURF_ANALYSIS
r"""Calculate visibility of a surface from a direction"""
RISK_ANGLE = _vsp.RISK_ANGLE
r"""Calculate risk angle for thrown debris"""
COMP_GEOM = _vsp.COMP_GEOM
r"""Calculate wetted area and volume"""
PLANAR_SLICE = _vsp.PLANAR_SLICE
r"""Calculate planar slices and area distribution"""
PROJ_AREA = _vsp.PROJ_AREA
r"""Calculate projected area"""
MASS_PROP = _vsp.MASS_PROP
r"""Calculate mass properties"""
AERO_CENTER = _vsp.AERO_CENTER
r"""Calculate aero center of single lifting surface"""
NUM_INTERFERENCE_TYPES = _vsp.NUM_INTERFERENCE_TYPES
r"""Number of interference check types"""
POD_GEOM_SCREEN = _vsp.POD_GEOM_SCREEN
r"""Pod geom screen"""
FUSELAGE_GEOM_SCREEN = _vsp.FUSELAGE_GEOM_SCREEN
r"""Fuselage geom screen"""
MS_WING_GEOM_SCREEN = _vsp.MS_WING_GEOM_SCREEN
r"""Wing geom screen"""
BLANK_GEOM_SCREEN = _vsp.BLANK_GEOM_SCREEN
r"""Blank geom screen"""
MESH_GEOM_SCREEN = _vsp.MESH_GEOM_SCREEN
r"""Mesh geom screen"""
NGON_MESH_GEOM_SCREEN = _vsp.NGON_MESH_GEOM_SCREEN
r"""NGon Mesh geom screen"""
STACK_GEOM_SCREEN = _vsp.STACK_GEOM_SCREEN
r"""Stack geom screen"""
CUSTOM_GEOM_SCREEN = _vsp.CUSTOM_GEOM_SCREEN
r"""Custom geom screen"""
PT_CLOUD_GEOM_SCREEN = _vsp.PT_CLOUD_GEOM_SCREEN
r"""Point cloud geom screen"""
PROP_GEOM_SCREEN = _vsp.PROP_GEOM_SCREEN
r"""Propeller geom screen"""
HINGE_GEOM_SCREEN = _vsp.HINGE_GEOM_SCREEN
r"""Hinge geom screen"""
MULT_GEOM_SCREEN = _vsp.MULT_GEOM_SCREEN
r"""Multiple geom screen"""
CONFORMAL_SCREEN = _vsp.CONFORMAL_SCREEN
r"""Conformal geom screen"""
ELLIPSOID_GEOM_SCREEN = _vsp.ELLIPSOID_GEOM_SCREEN
r"""Ellipsoid geom screen"""
BOR_GEOM_SCREEN = _vsp.BOR_GEOM_SCREEN
r"""Body of revolution geom screen"""
WIRE_FRAME_GEOM_SCREEN = _vsp.WIRE_FRAME_GEOM_SCREEN
r"""Wireframe geom screen"""
HUMAN_GEOM_SCREEN = _vsp.HUMAN_GEOM_SCREEN
r"""Human geom screen"""
ROUTING_GEOM_SCREEN = _vsp.ROUTING_GEOM_SCREEN
r"""Routing geom screen"""
AUXILIARY_GEOM_SCREEN = _vsp.AUXILIARY_GEOM_SCREEN
r"""Auxiliary geom screen"""
GEAR_GEOM_SCREEN = _vsp.GEAR_GEOM_SCREEN
r"""Gear geom screen"""
COBRA_GEOM_SCREEN = _vsp.COBRA_GEOM_SCREEN
r"""Cobra body geom screen"""
NUM_GEOM_SCREENS = _vsp.NUM_GEOM_SCREENS
r"""Number of geom screens"""
ALL_GEOM_SCREENS = _vsp.ALL_GEOM_SCREENS
r"""All geom screens"""
VSP_ADV_LINK_SCREEN = _vsp.VSP_ADV_LINK_SCREEN
r"""Advanced linking screen"""
VSP_ADV_LINK_VAR_RENAME_SCREEN = _vsp.VSP_ADV_LINK_VAR_RENAME_SCREEN
r"""Advanced link variable rename screen"""
VSP_AERO_STRUCT_SCREEN = _vsp.VSP_AERO_STRUCT_SCREEN
r"""Aero / structural analysis screen"""
VSP_AIRFOIL_CURVES_EXPORT_SCREEN = _vsp.VSP_AIRFOIL_CURVES_EXPORT_SCREEN
r"""Airfoil curves export screen"""
VSP_AIRFOIL_POINTS_EXPORT_SCREEN = _vsp.VSP_AIRFOIL_POINTS_EXPORT_SCREEN
r"""Airfoil points screen"""
VSP_ATTRIBUTE_EXPLORER_SCREEN = _vsp.VSP_ATTRIBUTE_EXPLORER_SCREEN
r"""Attribute details screen"""
VSP_BACKGROUND_SCREEN = _vsp.VSP_BACKGROUND_SCREEN
r"""Background control screen"""
VSP_BACKGROUND3D_SCREEN = _vsp.VSP_BACKGROUND3D_SCREEN
r"""Background3D control screen"""
VSP_BACKGROUND3D_PREVIEW_SCREEN = _vsp.VSP_BACKGROUND3D_PREVIEW_SCREEN
r"""Background3D preview screen"""
VSP_BEM_OPTIONS_SCREEN = _vsp.VSP_BEM_OPTIONS_SCREEN
r"""Blade element method options screen"""
VSP_CFD_MESH_SCREEN = _vsp.VSP_CFD_MESH_SCREEN
r"""CFD Mesh screen"""
VSP_CLIPPING_SCREEN = _vsp.VSP_CLIPPING_SCREEN
r"""Clipping screen"""
VSP_COMP_GEOM_SCREEN = _vsp.VSP_COMP_GEOM_SCREEN
r"""CompGeom screen"""
VSP_COR_SCREEN = _vsp.VSP_COR_SCREEN
r"""Center of rotation screen"""
VSP_CURVE_EDIT_SCREEN = _vsp.VSP_CURVE_EDIT_SCREEN
r"""Curve edit screen"""
VSP_DEGEN_GEOM_SCREEN = _vsp.VSP_DEGEN_GEOM_SCREEN
r"""Degen geom screen"""
VSP_DESIGN_VAR_SCREEN = _vsp.VSP_DESIGN_VAR_SCREEN
r"""Design variables screen"""
VSP_DXF_OPTIONS_SCREEN = _vsp.VSP_DXF_OPTIONS_SCREEN
r"""DXF options screen"""
VSP_EXPORT_SCREEN = _vsp.VSP_EXPORT_SCREEN
r"""Export screen"""
VSP_FEA_PART_EDIT_SCREEN = _vsp.VSP_FEA_PART_EDIT_SCREEN
r"""FEA Part edit screen"""
VSP_FEA_XSEC_SCREEN = _vsp.VSP_FEA_XSEC_SCREEN
r"""FEA XSec screen"""
VSP_FIT_MODEL_SCREEN = _vsp.VSP_FIT_MODEL_SCREEN
r"""Fit model screen"""
VSP_IGES_OPTIONS_SCREEN = _vsp.VSP_IGES_OPTIONS_SCREEN
r"""IGES options screen"""
VSP_IGES_STRUCTURE_OPTIONS_SCREEN = _vsp.VSP_IGES_STRUCTURE_OPTIONS_SCREEN
r"""IGES structure options screen"""
VSP_EXPORT_CUSTOM_SCRIPT = _vsp.VSP_EXPORT_CUSTOM_SCRIPT
r"""Custom geom export screen"""
VSP_GEOMETRY_ANALYSIS_SCREEN = _vsp.VSP_GEOMETRY_ANALYSIS_SCREEN
r"""Geometry analysis screen"""
VSP_IMPORT_SCREEN = _vsp.VSP_IMPORT_SCREEN
r"""Import screen"""
VSP_LIGHTING_SCREEN = _vsp.VSP_LIGHTING_SCREEN
r"""Lighting screen"""
VSP_MANAGE_GEOM_SCREEN = _vsp.VSP_MANAGE_GEOM_SCREEN
r"""Manage geom screen"""
VSP_MANAGE_TEXTURE_SCREEN = _vsp.VSP_MANAGE_TEXTURE_SCREEN
r"""Texture mapping screen"""
VSP_MASS_PROP_SCREEN = _vsp.VSP_MASS_PROP_SCREEN
r"""Mass properties screen"""
VSP_MATERIAL_EDIT_SCREEN = _vsp.VSP_MATERIAL_EDIT_SCREEN
r"""Material edit screen"""
VSP_MEASURE_SCREEN = _vsp.VSP_MEASURE_SCREEN
r"""Measure screen"""
VSP_MODE_EDITOR_SCREEN = _vsp.VSP_MODE_EDITOR_SCREEN
r"""Mode editor screen"""
VSP_NERF_MANAGE_GEOM_SCREEN = _vsp.VSP_NERF_MANAGE_GEOM_SCREEN
r"""NERF'ed (limited to make safe) Manage geom screen"""
VSP_SNAP_TO_SCREEN = _vsp.VSP_SNAP_TO_SCREEN
r"""Snap to screen"""
VSP_PARASITE_DRAG_SCREEN = _vsp.VSP_PARASITE_DRAG_SCREEN
r"""Parasite drg screen"""
VSP_PARM_DEBUG_SCREEN = _vsp.VSP_PARM_DEBUG_SCREEN
r"""Parameter debug screen"""
VSP_PARM_LINK_SCREEN = _vsp.VSP_PARM_LINK_SCREEN
r"""Parameter linking screen"""
VSP_PARM_SCREEN = _vsp.VSP_PARM_SCREEN
r"""Parameter screen"""
VSP_PICK_SET_SCREEN = _vsp.VSP_PICK_SET_SCREEN
r"""Pick set screen"""
VSP_PREFERENCES_SCREEN = _vsp.VSP_PREFERENCES_SCREEN
r"""Preferences screen"""
VSP_PROJECTION_SCREEN = _vsp.VSP_PROJECTION_SCREEN
r"""Projected area screen"""
VSP_PSLICE_SCREEN = _vsp.VSP_PSLICE_SCREEN
r"""Planar slicing screen"""
VSP_RESULTS_VIEWER_SCREEN = _vsp.VSP_RESULTS_VIEWER_SCREEN
r"""Results viewing screen"""
VSP_SCREENSHOT_SCREEN = _vsp.VSP_SCREENSHOT_SCREEN
r"""Screenshot screen"""
VSP_SELECT_FILE_SCREEN = _vsp.VSP_SELECT_FILE_SCREEN
r"""Select file screen"""
VSP_SET_EDITOR_SCREEN = _vsp.VSP_SET_EDITOR_SCREEN
r"""Set editor screen"""
VSP_STEP_OPTIONS_SCREEN = _vsp.VSP_STEP_OPTIONS_SCREEN
r"""STEP options screen"""
VSP_STEP_STRUCTURE_OPTIONS_SCREEN = _vsp.VSP_STEP_STRUCTURE_OPTIONS_SCREEN
r"""STEP structure options screen"""
VSP_STL_OPTIONS_SCREEN = _vsp.VSP_STL_OPTIONS_SCREEN
r"""STL options screen"""
VSP_STRUCT_SCREEN = _vsp.VSP_STRUCT_SCREEN
r"""Structure definition screen"""
VSP_STRUCT_ASSEMBLY_SCREEN = _vsp.VSP_STRUCT_ASSEMBLY_SCREEN
r"""Structure assembly screen"""
VSP_SURFACE_INTERSECTION_SCREEN = _vsp.VSP_SURFACE_INTERSECTION_SCREEN
r"""Surface intersection screen"""
VSP_SVG_OPTIONS_SCREEN = _vsp.VSP_SVG_OPTIONS_SCREEN
r"""SVG options screen"""
VSP_USER_PARM_SCREEN = _vsp.VSP_USER_PARM_SCREEN
r"""User parameter screen"""
VSP_VAR_PRESET_SCREEN = _vsp.VSP_VAR_PRESET_SCREEN
r"""Variable presets editor screen"""
VSP_VEH_NOTES_SCREEN = _vsp.VSP_VEH_NOTES_SCREEN
r"""Vehicle notes screen"""
VSP_VEH_SCREEN = _vsp.VSP_VEH_SCREEN
r"""Veh geom screen"""
VSP_VIEW_SCREEN = _vsp.VSP_VIEW_SCREEN
r"""Adjust viewpoint screen"""
VSP_VSPAERO_PLOT_SCREEN = _vsp.VSP_VSPAERO_PLOT_SCREEN
r"""VSPAERO results manager screen"""
VSP_VSPAERO_SCREEN = _vsp.VSP_VSPAERO_SCREEN
r"""VSPAERO screen"""
VSP_XSEC_SCREEN = _vsp.VSP_XSEC_SCREEN
r"""XSec screen"""
VSP_WAVEDRAG_SCREEN = _vsp.VSP_WAVEDRAG_SCREEN
r"""Wave drag screen"""
VSP_MAIN_SCREEN = _vsp.VSP_MAIN_SCREEN
r"""Main screen"""
VSP_NUM_SCREENS = _vsp.VSP_NUM_SCREENS
r"""Number of screens"""
VSP_ALL_SCREENS = _vsp.VSP_ALL_SCREENS
r"""Flag for all screens"""
EDIT_XSEC_CIRCLE = _vsp.EDIT_XSEC_CIRCLE
r"""Circle initialized as cubic Bezier type"""
EDIT_XSEC_ELLIPSE = _vsp.EDIT_XSEC_ELLIPSE
r"""Ellipse initialized as PCHIP type"""
EDIT_XSEC_RECTANGLE = _vsp.EDIT_XSEC_RECTANGLE
r"""Rectangle initialized as linear type"""
NUM_INIT_EDIT_XSEC_TYPES = _vsp.NUM_INIT_EDIT_XSEC_TYPES
r"""Number of initializable edit curve types"""
IMPORT_STL = _vsp.IMPORT_STL
r"""Stereolith (\*.stl) import"""
IMPORT_NASCART = _vsp.IMPORT_NASCART
r"""NASCART (\*.dat) import"""
IMPORT_CART3D_TRI = _vsp.IMPORT_CART3D_TRI
r"""Cart3D (\*.try) import"""
IMPORT_XSEC_MESH = _vsp.IMPORT_XSEC_MESH
r"""XSec as Tri Mesh (\*.hrm) import"""
IMPORT_PTS = _vsp.IMPORT_PTS
r"""Point Cloud (\*.pts) import"""
IMPORT_V2 = _vsp.IMPORT_V2
r"""OpenVSP v2 (\*.vsp) import"""
IMPORT_BEM = _vsp.IMPORT_BEM
r"""Blade Element (\*.bem) import"""
IMPORT_XSEC_WIRE = _vsp.IMPORT_XSEC_WIRE
r"""XSec as Wireframe (\*.hrm) import"""
IMPORT_P3D_WIRE = _vsp.IMPORT_P3D_WIRE
r"""Plot3D as Wireframe (\*.p3d) import"""
INTERSECT_SRF_FILE_NAME = _vsp.INTERSECT_SRF_FILE_NAME
r"""SRF intersection file type"""
INTERSECT_CURV_FILE_NAME = _vsp.INTERSECT_CURV_FILE_NAME
r"""CURV intersection file type"""
INTERSECT_PLOT3D_FILE_NAME = _vsp.INTERSECT_PLOT3D_FILE_NAME
r"""PLOT3D intersection file type"""
INTERSECT_IGES_FILE_NAME = _vsp.INTERSECT_IGES_FILE_NAME
r"""IGES intersection file type"""
INTERSECT_STEP_FILE_NAME = _vsp.INTERSECT_STEP_FILE_NAME
r"""STEP intersection file type"""
INTERSECT_NUM_FILE_NAMES = _vsp.INTERSECT_NUM_FILE_NAMES
r"""Number of surface intersection file types"""
LEN_MM = _vsp.LEN_MM
r"""Millimeter"""
LEN_CM = _vsp.LEN_CM
r"""Centimeter"""
LEN_M = _vsp.LEN_M
r"""Meter"""
LEN_IN = _vsp.LEN_IN
r"""Inch"""
LEN_FT = _vsp.LEN_FT
r"""Feet"""
LEN_YD = _vsp.LEN_YD
r"""Yard"""
LEN_UNITLESS = _vsp.LEN_UNITLESS
r"""Unitless"""
NUM_LEN_UNIT = _vsp.NUM_LEN_UNIT
r"""Number of length unit types"""
MASS_UNIT_G = _vsp.MASS_UNIT_G
r"""Gram"""
MASS_UNIT_KG = _vsp.MASS_UNIT_KG
r"""Kilogram"""
MASS_UNIT_TONNE = _vsp.MASS_UNIT_TONNE
r"""Tonne"""
MASS_UNIT_LBM = _vsp.MASS_UNIT_LBM
r"""Pound-mass"""
MASS_UNIT_SLUG = _vsp.MASS_UNIT_SLUG
r"""Slug"""
MASS_LBFSEC2IN = _vsp.MASS_LBFSEC2IN
r"""lbf*sec^2/in"""
NUM_MASS_UNIT = _vsp.NUM_MASS_UNIT
r"""Number of mass unit types"""
NO_REASON = _vsp.NO_REASON
r"""No reason determined."""
MAX_LEN_CONSTRAINT = _vsp.MAX_LEN_CONSTRAINT
r"""Maximum edge length."""
CURV_GAP = _vsp.CURV_GAP
r"""Maximum gap curvature based criteria."""
CURV_NCIRCSEG = _vsp.CURV_NCIRCSEG
r"""Minimum number of segments to define a circle curvature based criteria."""
SOURCES = _vsp.SOURCES
r"""Mesh sources."""
MIN_LEN_CONSTRAINT = _vsp.MIN_LEN_CONSTRAINT
r"""Minimum edge length."""
MIN_LEN_CONSTRAINT_CURV_GAP = _vsp.MIN_LEN_CONSTRAINT_CURV_GAP
r"""Maximum gap constrained by minimum length."""
MIN_LEN_CONSTRAINT_CURV_NCIRCSEG = _vsp.MIN_LEN_CONSTRAINT_CURV_NCIRCSEG
r"""Number of segments to define a circle constrained by minimum length."""
MIN_LEN_CONSTRAINT_SOURCES = _vsp.MIN_LEN_CONSTRAINT_SOURCES
r"""Mesh sources constrained by minimum length (not applied)."""
GROW_LIMIT_MAX_LEN_CONSTRAINT = _vsp.GROW_LIMIT_MAX_LEN_CONSTRAINT
r"""Maximum growth limit from maximum edge length (not used, growth limited small to large)."""
GROW_LIMIT_CURV_GAP = _vsp.GROW_LIMIT_CURV_GAP
r"""Maximum growth limit from maximum gap."""
GROW_LIMIT_CURV_NCIRCSEG = _vsp.GROW_LIMIT_CURV_NCIRCSEG
r"""Maximum growth limit from number of segments to define a circle."""
GROW_LIMIT_SOURCES = _vsp.GROW_LIMIT_SOURCES
r"""Maximum growth limit from mesh sources."""
GROW_LIMIT_MIN_LEN_CONSTRAINT = _vsp.GROW_LIMIT_MIN_LEN_CONSTRAINT
r"""Maximum growth limit from minimum length constraint."""
GROW_LIMIT_MIN_LEN_CONSTRAINT_CURV_GAP = _vsp.GROW_LIMIT_MIN_LEN_CONSTRAINT_CURV_GAP
r"""Maximum growth limit from maximum gap constrained by minimum length."""
GROW_LIMIT_MIN_LEN_CONSTRAINT_CURV_NCIRCSEG = _vsp.GROW_LIMIT_MIN_LEN_CONSTRAINT_CURV_NCIRCSEG
r"""Maximum growth limit from number of segments to define a circle constrained by minimum length."""
GROW_LIMIT_MIN_LEN_CONSTRAINT_SOURCES = _vsp.GROW_LIMIT_MIN_LEN_CONSTRAINT_SOURCES
r"""Maximum growth limit from sources constrained by minimum length."""
NUM_MESH_REASON = _vsp.NUM_MESH_REASON
r"""Number of reasons that can set the mesh local minimum edge length."""
MIN_LEN_INCREMENT = _vsp.MIN_LEN_INCREMENT
r"""Reason increment when adding minimum length constraint."""
GROW_LIMIT_INCREMENT = _vsp.GROW_LIMIT_INCREMENT
r"""Reason increment when adding growth limit constraint."""
MIN_GROW_LIMIT = _vsp.MIN_GROW_LIMIT
r"""Reason marker for minimum reason to apply growth limit."""
TRI_MESH_TYPE = _vsp.TRI_MESH_TYPE
r"""Triangle mesh"""
QUAD_MESH_TYPE = _vsp.QUAD_MESH_TYPE
r"""Quadrilateral mesh"""
NGON_MESH_TYPE = _vsp.NGON_MESH_TYPE
r"""N-gon mesh"""
NUM_MESH_TYPE = _vsp.NUM_MESH_TYPE
r"""Number of mesh types"""
EXTENT_FORWARD_INF = _vsp.EXTENT_FORWARD_INF
r"""Forward beyond extent of model."""
EXTENT_REVERSE_INF = _vsp.EXTENT_REVERSE_INF
r"""Reverse beyond extent of model."""
EXTENT_FORWARD_FINITE = _vsp.EXTENT_FORWARD_FINITE
r"""Forward displacement."""
EXTENT_REVERSE_FINITE = _vsp.EXTENT_REVERSE_FINITE
r"""Reverse displacement."""
EXTENT_SLIDER_FULL = _vsp.EXTENT_SLIDER_FULL
r"""Full range of slider motion."""
EXTENT_SLIDER_BEFORE = _vsp.EXTENT_SLIDER_BEFORE
r"""Slider motion from start to current position."""
EXTENT_SLIDER_AFTER = _vsp.EXTENT_SLIDER_AFTER
r"""Slider motion from current position to end."""
MOTION_NUM_EXTENT_TYPES = _vsp.MOTION_NUM_EXTENT_TYPES
r"""Number of swept volume extent types."""
ID_LENGTH_PRESET_GROUP = _vsp.ID_LENGTH_PRESET_GROUP
r"""ID for Var Preset Groups are length 5"""
ID_LENGTH_PRESET_SETTING = _vsp.ID_LENGTH_PRESET_SETTING
r"""ID for Var Preset Settings are length 6"""
ID_LENGTH_ATTR = _vsp.ID_LENGTH_ATTR
r"""ID for Attributes are length 8"""
ID_LENGTH_ATTRCOLL = _vsp.ID_LENGTH_ATTRCOLL
r"""ID for Attribute Collections are length 9"""
ID_LENGTH_PARMCONTAINER = _vsp.ID_LENGTH_PARMCONTAINER
r"""ID for Parm Containers are length 10"""
ID_LENGTH_PARM = _vsp.ID_LENGTH_PARM
r"""ID for Parms are length 11"""
PARM_DOUBLE_TYPE = _vsp.PARM_DOUBLE_TYPE
r"""Double Parm type (Parm)"""
PARM_INT_TYPE = _vsp.PARM_INT_TYPE
r"""Integer Parm type (IntParm)"""
PARM_BOOL_TYPE = _vsp.PARM_BOOL_TYPE
r"""Bool Parm type (BoolParm)"""
PARM_FRACTION_TYPE = _vsp.PARM_FRACTION_TYPE
r"""Fraction Parm type (FractionParm)"""
PARM_LIMITED_INT_TYPE = _vsp.PARM_LIMITED_INT_TYPE
r"""Limited integer Parm type (LimIntParm)"""
PARM_NOTEQ_TYPE = _vsp.PARM_NOTEQ_TYPE
r"""Not equal Parm type (NotEqParm)"""
PARM_POWER_INT_TYPE = _vsp.PARM_POWER_INT_TYPE
r"""Power integer Parm type (PowIntParm)"""
PATCH_NONE = _vsp.PATCH_NONE
r"""No patch"""
PATCH_POINT = _vsp.PATCH_POINT
r"""Point patch type"""
PATCH_LINE = _vsp.PATCH_LINE
r"""Line patch type"""
PATCH_COPY = _vsp.PATCH_COPY
r"""Copy patch type"""
PATCH_HALFWAY = _vsp.PATCH_HALFWAY
r"""Halfway patch type"""
PATCH_NUM_TYPES = _vsp.PATCH_NUM_TYPES
r"""Number of patch types"""
LINEAR = _vsp.LINEAR
r"""Linear curve type"""
PCHIP = _vsp.PCHIP
r"""Piecewise Cubic Hermite Interpolating Polynomial curve type"""
CEDIT = _vsp.CEDIT
r"""Cubic Bezier curve type"""
APPROX_CEDIT = _vsp.APPROX_CEDIT
r"""Approximate curve as Cubic Bezier"""
NUM_PCURV_TYPE = _vsp.NUM_PCURV_TYPE
r"""Number of curve types"""
PRES_UNIT_PSF = _vsp.PRES_UNIT_PSF
r"""Pounds per square foot"""
PRES_UNIT_PSI = _vsp.PRES_UNIT_PSI
r"""Pounds per square inch"""
PRES_UNIT_BA = _vsp.PRES_UNIT_BA
r"""Barye"""
PRES_UNIT_PA = _vsp.PRES_UNIT_PA
r"""Pascal"""
PRES_UNIT_KPA = _vsp.PRES_UNIT_KPA
r"""Kilopascal"""
PRES_UNIT_MPA = _vsp.PRES_UNIT_MPA
r"""Megapascal"""
PRES_UNIT_INCHHG = _vsp.PRES_UNIT_INCHHG
r"""Inch of mercury"""
PRES_UNIT_MMHG = _vsp.PRES_UNIT_MMHG
r"""Millimeter of mercury"""
PRES_UNIT_MMH20 = _vsp.PRES_UNIT_MMH20
r"""Millimeter of water"""
PRES_UNIT_MB = _vsp.PRES_UNIT_MB
r"""Millibar"""
PRES_UNIT_ATM = _vsp.PRES_UNIT_ATM
r"""Atmosphere"""
NUM_PRES_UNIT = _vsp.NUM_PRES_UNIT
r"""Number of pressure unit choices"""
NO_BOUNDARY = _vsp.NO_BOUNDARY
r"""No boundary"""
SET_BOUNDARY = _vsp.SET_BOUNDARY
r"""Set boundary"""
GEOM_BOUNDARY = _vsp.GEOM_BOUNDARY
r"""Geom boundary"""
NUM_PROJ_BNDY_OPTIONS = _vsp.NUM_PROJ_BNDY_OPTIONS
r"""Number of projected area boundary options"""
X_PROJ = _vsp.X_PROJ
r"""Project in X axis direction"""
Y_PROJ = _vsp.Y_PROJ
r"""Project in Y axis direction"""
Z_PROJ = _vsp.Z_PROJ
r"""Project in Z axis direction"""
GEOM_PROJ = _vsp.GEOM_PROJ
r"""Project toward a Geom"""
VEC_PROJ = _vsp.VEC_PROJ
r"""Project along a 3D vector"""
NUM_PROJ_DIR_OPTIONS = _vsp.NUM_PROJ_DIR_OPTIONS
r"""Number of Projected Area direction types"""
SET_TARGET = _vsp.SET_TARGET
r"""Set target type"""
GEOM_TARGET = _vsp.GEOM_TARGET
r"""Geom target type"""
MODE_TARGET = _vsp.MODE_TARGET
r"""Mode target type"""
Z_TARGET = _vsp.Z_TARGET
r"""Z plane target type"""
XYZ_TARGET = _vsp.XYZ_TARGET
r"""XYZ point target type"""
NUM_PROJ_TGT_OPTIONS = _vsp.NUM_PROJ_TGT_OPTIONS
r"""Number of Projected Area target types"""
PROP_AZI_UNIFORM = _vsp.PROP_AZI_UNIFORM
r"""Propeller blades are uniformly spaced"""
PROP_AZI_FREE = _vsp.PROP_AZI_FREE
r"""Propeller blades are free to spaced arbitrarially"""
PROP_AZI_BALANCED = _vsp.PROP_AZI_BALANCED
r"""Propeller blade balance is enforced"""
NUM_PROP_AZI = _vsp.NUM_PROP_AZI
r"""Number of propeller blade azimuth modes"""
PROP_BLADE_TRADITIONAL = _vsp.PROP_BLADE_TRADITIONAL
r"""Traditional straight blades"""
PROP_BLADE_NONTRADITIONAL = _vsp.PROP_BLADE_NONTRADITIONAL
r"""Non-traditional blades"""
NUM_PROP_BLADE_MODES = _vsp.NUM_PROP_BLADE_MODES
r"""Number of propeller blade modes"""
RPM_PROP_DRIVER = _vsp.RPM_PROP_DRIVER
r"""RPM driver"""
CT_PROP_DRIVER = _vsp.CT_PROP_DRIVER
r"""Thrust coefficient driver"""
CP_PROP_DRIVER = _vsp.CP_PROP_DRIVER
r"""Power coefficient driver"""
T_PROP_DRIVER = _vsp.T_PROP_DRIVER
r"""Thrust driver"""
ETA_PROP_DRIVER = _vsp.ETA_PROP_DRIVER
r"""Prop efficiency driver"""
J_PROP_DRIVER = _vsp.J_PROP_DRIVER
r"""Advance ratio driver"""
P_PROP_DRIVER = _vsp.P_PROP_DRIVER
r"""Power driver"""
CQ_PROP_DRIVER = _vsp.CQ_PROP_DRIVER
r"""Torque coefficient driver"""
Q_PROP_DRIVER = _vsp.Q_PROP_DRIVER
r"""Torque driver"""
NUM_PROP_DRIVER = _vsp.NUM_PROP_DRIVER
r"""Number of actuator disk drivers"""
PROP_BLADES = _vsp.PROP_BLADES
r"""Propeller Geom is defined by individual propeller blades"""
PROP_BOTH = _vsp.PROP_BOTH
r"""Propeller Geom is defined by blades and a disk together"""
PROP_DISK = _vsp.PROP_DISK
r"""Propeller Geom is defined by a flat circular disk"""
PROP_CHORD = _vsp.PROP_CHORD
r"""Chord parameterization"""
PROP_TWIST = _vsp.PROP_TWIST
r"""Twist parameterization"""
PROP_RAKE = _vsp.PROP_RAKE
r"""Rake parameterization"""
PROP_SKEW = _vsp.PROP_SKEW
r"""Skew parameterization"""
PROP_SWEEP = _vsp.PROP_SWEEP
r"""Sweep parameterization"""
PROP_THICK = _vsp.PROP_THICK
r"""Thickness parameterization"""
PROP_CLI = _vsp.PROP_CLI
r"""Induced lift coefficient parameterization"""
PROP_AXIAL = _vsp.PROP_AXIAL
r"""Axial parameterization"""
PROP_TANGENTIAL = _vsp.PROP_TANGENTIAL
r"""Tangential parameterization"""
NUM_PROP_PCURVE = _vsp.NUM_PROP_PCURVE
r"""Number of propeller blade curve parameterization options"""
REORDER_MOVE_UP = _vsp.REORDER_MOVE_UP
r"""Move up one position"""
REORDER_MOVE_DOWN = _vsp.REORDER_MOVE_DOWN
r"""Move down one position"""
REORDER_MOVE_TOP = _vsp.REORDER_MOVE_TOP
r"""Move to top"""
REORDER_MOVE_BOTTOM = _vsp.REORDER_MOVE_BOTTOM
r"""Move to bottom"""
NUM_REORDER_TYPES = _vsp.NUM_REORDER_TYPES
r"""Number reordering instructions"""
MANUAL_REF = _vsp.MANUAL_REF
r"""Manually specify the reference areas and lengths"""
COMPONENT_REF = _vsp.COMPONENT_REF
r"""Use a particular wing to calculate the reference area and lengths"""
NUM_REF_TYPES = _vsp.NUM_REF_TYPES
r"""Number of wing reference types"""
INVALID_TYPE = _vsp.INVALID_TYPE
r"""Invalid data type"""
BOOL_DATA = _vsp.BOOL_DATA
r"""Bool data type"""
INT_DATA = _vsp.INT_DATA
r"""Integer data type"""
DOUBLE_DATA = _vsp.DOUBLE_DATA
r"""Double data type"""
STRING_DATA = _vsp.STRING_DATA
r"""String data type"""
VEC3D_DATA = _vsp.VEC3D_DATA
r"""Vec3d data type"""
INT_MATRIX_DATA = _vsp.INT_MATRIX_DATA
r"""Int matrix data type"""
DOUBLE_MATRIX_DATA = _vsp.DOUBLE_MATRIX_DATA
r"""Double matrix data type"""
ATTR_COLLECTION_DATA = _vsp.ATTR_COLLECTION_DATA
r"""Attribute collection data type"""
PARM_REFERENCE_DATA = _vsp.PARM_REFERENCE_DATA
r"""Parm reference data type"""
MESH_INDEXED_TRI = _vsp.MESH_INDEXED_TRI
r"""Indexed triangulated mesh Geom type"""
MESH_SLICE_TRI = _vsp.MESH_SLICE_TRI
r"""Sliced Triangulated mesh Geom type"""
GEOM_XSECS = _vsp.GEOM_XSECS
r"""GeomXSec Geom type"""
MESH_INDEX_AND_SLICE_TRI = _vsp.MESH_INDEX_AND_SLICE_TRI
r"""Both indexed and sliced triangulated mesh Geom type"""
RHO_UNIT_SLUG_FT3 = _vsp.RHO_UNIT_SLUG_FT3
r"""Slug per cubic foot"""
RHO_UNIT_G_CM3 = _vsp.RHO_UNIT_G_CM3
r"""Gram per cubic centimeter"""
RHO_UNIT_KG_M3 = _vsp.RHO_UNIT_KG_M3
r"""Kilogram per cubic meter"""
RHO_UNIT_TONNE_MM3 = _vsp.RHO_UNIT_TONNE_MM3
r"""Tonne per cubic millimeter"""
RHO_UNIT_LBM_FT3 = _vsp.RHO_UNIT_LBM_FT3
r"""Pound-mass per cubic foot"""
RHO_UNIT_LBFSEC2_IN4 = _vsp.RHO_UNIT_LBFSEC2_IN4
r"""Pound-force-second squared per inch to the fourth"""
RHO_UNIT_LBM_IN3 = _vsp.RHO_UNIT_LBM_IN3
r"""Pound-mass per cubic inch"""
NUM_RHO_UNIT = _vsp.NUM_RHO_UNIT
r"""Number of density unit options"""
ROUTE_PT_COMP = _vsp.ROUTE_PT_COMP
r"""Routing point relative to parent body axes"""
ROUTE_PT_UV = _vsp.ROUTE_PT_UV
r"""Routing point relative to parent surface coordinate frame"""
ROUTE_PT_RST = _vsp.ROUTE_PT_RST
r"""Routing point relative to parent per-section volume coordinate frame"""
ROUTE_PT_LMN = _vsp.ROUTE_PT_LMN
r"""Routing point relative to parent uniform volume coordinate frame"""
ROUTE_PT_EtaMN = _vsp.ROUTE_PT_EtaMN
r"""Routing point relative to wing parent uniform eta volume coordinate frame"""
ROUTE_PT_NUM_TYPES = _vsp.ROUTE_PT_NUM_TYPES
r"""Number of routing point coordinate types"""
ROUTE_PT_DELTA_XYZ = _vsp.ROUTE_PT_DELTA_XYZ
r"""Routing point ofset in global axes"""
ROUTE_PT_DELTA_COMP = _vsp.ROUTE_PT_DELTA_COMP
r"""Routing point offset in parent body frame"""
ROUTE_PT_DELTA_UVN = _vsp.ROUTE_PT_DELTA_UVN
r"""Routing point offset in parent surface coordinate frame"""
ROUTE_PT_DELTA_NUM_TYPES = _vsp.ROUTE_PT_DELTA_NUM_TYPES
r"""Number of routing point offset coordinate types"""
SCALE_WIDTH = _vsp.SCALE_WIDTH
r"""Scale image to match desired width with 1:1 AR"""
SCALE_HEIGHT = _vsp.SCALE_HEIGHT
r"""Scale image to match desired height with 1:1 AR"""
SCALE_WIDTH_HEIGHT = _vsp.SCALE_WIDTH_HEIGHT
r"""Scale image to match desired width and height"""
SCALE_RESOLUTION = _vsp.SCALE_RESOLUTION
r"""Scale image to specified resolution"""
SCALE_WIDTH_AR = _vsp.SCALE_WIDTH_AR
r"""Scale image to match desired width with specified AR"""
SCALE_HEIGHT_AR = _vsp.SCALE_HEIGHT_AR
r"""Scale image to match desired height with specified AR"""
NUM_SCALE_TYPES = _vsp.NUM_SCALE_TYPES
r"""Number of ways to scale 3D background image."""
SET_NONE = _vsp.SET_NONE
r"""None set"""
SET_ALL = _vsp.SET_ALL
r"""All set"""
SET_SHOWN = _vsp.SET_SHOWN
r"""Shown set"""
SET_NOT_SHOWN = _vsp.SET_NOT_SHOWN
r"""Not shown set"""
SET_FIRST_USER = _vsp.SET_FIRST_USER
r"""First user-defined set"""
MIN_NUM_USER = _vsp.MIN_NUM_USER
r"""Minimum number of user sets"""
MAX_NUM_SETS = _vsp.MAX_NUM_SETS
r"""Maximum possible number of sets"""
STACK_PRESET_DEFAULT = _vsp.STACK_PRESET_DEFAULT
r"""Standard init type"""
STACK_PRESET_CYLINDER_ENDPTS = _vsp.STACK_PRESET_CYLINDER_ENDPTS
r"""Cylinder with points as first/last XSec"""
STACK_PRESET_CYLINDER_ENDCAPS = _vsp.STACK_PRESET_CYLINDER_ENDCAPS
r"""Cylinder with end caps instead of points"""
STACK_PRESET_FLOWTHRU_OUTLIP_ORIG = _vsp.STACK_PRESET_FLOWTHRU_OUTLIP_ORIG
r"""Flowthru nacelle starting/ending with outlet lip"""
STACK_PRESET_FLOWTHRU_INLIP_ORIG = _vsp.STACK_PRESET_FLOWTHRU_INLIP_ORIG
r"""Flowthru nacelle starting/ending with inlet lip"""
STACK_PRESET_FLOWTHRU_MID_ORIG = _vsp.STACK_PRESET_FLOWTHRU_MID_ORIG
r"""Flowthru nacelle starting/ending with outlet face"""
STACK_PRESET_BOTHFACEFACE = _vsp.STACK_PRESET_BOTHFACEFACE
r"""Nacelle from the inlet face around the outside to the outlet face"""
STACK_PRESET_BOTHLIPFACE = _vsp.STACK_PRESET_BOTHLIPFACE
r"""Nacelle from the inlet lip around the outside to the outlet face"""
STACK_PRESET_BOTHFACELIP = _vsp.STACK_PRESET_BOTHFACELIP
r"""Nacelle from the inlet face around the outside to the outlet lip"""
STACK_PRESET_BOTHLIPLIP = _vsp.STACK_PRESET_BOTHLIPLIP
r"""Nacelle from the inlet lip around the outside to the outlet lip"""
STACK_PRESET_OUTFACE = _vsp.STACK_PRESET_OUTFACE
r"""Nacelle with no inlet, around the outside to the outlet face"""
STACK_PRESET_OUTLIP = _vsp.STACK_PRESET_OUTLIP
r"""Nacelle with no inlet, around the outside to the outlet lip"""
STACK_PRESET_INFACE = _vsp.STACK_PRESET_INFACE
r"""Nacelle from the inlet face, then closed out with no outlet"""
STACK_PRESET_INLIP = _vsp.STACK_PRESET_INLIP
r"""Nacelle from the inlet lip, then closed out with no outlet"""
STACK_PRESET_FLOWPATH_BOTH = _vsp.STACK_PRESET_FLOWPATH_BOTH
r"""Nacelle flowpath only, from inlet to outlet"""
STACK_PRESET_FLOWPATH_IN = _vsp.STACK_PRESET_FLOWPATH_IN
r"""Nacelle flowpath only, inlet lip to face"""
STACK_PRESET_FLOWPATH_OUT = _vsp.STACK_PRESET_FLOWPATH_OUT
r"""Nacelle flowpath only, outlet face to lip"""
STEP_SHELL = _vsp.STEP_SHELL
r"""Manifold shell surface STEP file representation"""
STEP_BREP = _vsp.STEP_BREP
r"""Manifold solid BREP STEP file representation"""
SS_INC_TREAT_AS_PARENT = _vsp.SS_INC_TREAT_AS_PARENT
r"""Treat the sub-surface the same as the parent"""
SS_INC_SEPARATE_TREATMENT = _vsp.SS_INC_SEPARATE_TREATMENT
r"""Treat the sub-surface separately from the parent"""
SS_INC_ZERO_DRAG = _vsp.SS_INC_ZERO_DRAG
r"""No drag contribution for the sub-surface"""
INSIDE = _vsp.INSIDE
r"""The interior of the sub-surface is its surface"""
OUTSIDE = _vsp.OUTSIDE
r"""The exterior of the sub-surface is its surface"""
NONE = _vsp.NONE
r"""No part of the parent surface belongs to the sub-surface"""
CONST_U = _vsp.CONST_U
r"""Constant U sub-surface"""
CONST_W = _vsp.CONST_W
r"""Constant W sub-surface"""
SS_LINE = _vsp.SS_LINE
r"""Line sub-surface type"""
SS_RECTANGLE = _vsp.SS_RECTANGLE
r"""Rectangle sub-surface type"""
SS_ELLIPSE = _vsp.SS_ELLIPSE
r"""Ellipse sub-surface type"""
SS_CONTROL = _vsp.SS_CONTROL
r"""Control sub-surface type"""
SS_LINE_ARRAY = _vsp.SS_LINE_ARRAY
r"""Line array sub-surface type"""
SS_FINITE_LINE = _vsp.SS_FINITE_LINE
r"""Finite line sub-surface type"""
SS_XSEC_CURVE = _vsp.SS_XSEC_CURVE
r"""XSecCurve based sub-surface type"""
SS_INTERSECT = _vsp.SS_INTERSECT
r"""Intersection derived sub-surface type"""
SS_NUM_TYPES = _vsp.SS_NUM_TYPES
r"""Number of sub-surface types"""
SYM_XY = _vsp.SYM_XY
r"""XY planar symmetry."""
SYM_XZ = _vsp.SYM_XZ
r"""XZ planar symmetry."""
SYM_YZ = _vsp.SYM_YZ
r"""YZ planar symmetry."""
SYM_ROT_X = _vsp.SYM_ROT_X
r"""X rotational symmetry."""
SYM_ROT_Y = _vsp.SYM_ROT_Y
r"""Y rotational symmetry."""
SYM_ROT_Z = _vsp.SYM_ROT_Z
r"""Z rotational symmetry."""
SYM_PLANAR_TYPES = _vsp.SYM_PLANAR_TYPES
r"""Number of planar symmetry types."""
SYM_NUM_TYPES = _vsp.SYM_NUM_TYPES
r"""Number of symmetry types."""
SYM_NONE = _vsp.SYM_NONE
r"""No cross section symmetry."""
SYM_RL = _vsp.SYM_RL
r"""Right/left cross section symmetry."""
SYM_TB = _vsp.SYM_TB
r"""Top/bottom cross section symmetry."""
SYM_ALL = _vsp.SYM_ALL
r"""All cross section symmetry."""
TEMP_UNIT_K = _vsp.TEMP_UNIT_K
r"""Kelvin"""
TEMP_UNIT_C = _vsp.TEMP_UNIT_C
r"""Celsius"""
TEMP_UNIT_F = _vsp.TEMP_UNIT_F
r"""Fahrenheit"""
TEMP_UNIT_R = _vsp.TEMP_UNIT_R
r"""Rankine"""
NUM_TEMP_UNIT = _vsp.NUM_TEMP_UNIT
r"""Number of temperature unit choices"""
TIRE_NOMINAL_CLEARANCE = _vsp.TIRE_NOMINAL_CLEARANCE
r"""Tire nominal shape"""
TIRE_GROWTH_CLEARANCE = _vsp.TIRE_GROWTH_CLEARANCE
r"""Tire growth (spinning) clearance"""
TIRE_CLEARANCE = _vsp.TIRE_CLEARANCE
r"""TRA clearance envelope"""
NUM_TIRE_CLEARANCE_MODES = _vsp.NUM_TIRE_CLEARANCE_MODES
r"""Number of tire clearance modes"""
TIRE_STATIC_LODED_CONTACT = _vsp.TIRE_STATIC_LODED_CONTACT
r"""Tire static loaded radius"""
TIRE_NOMINAL_CONTACT = _vsp.TIRE_NOMINAL_CONTACT
r"""Tire nominal radius"""
TIRE_GROWTH_CONTACT = _vsp.TIRE_GROWTH_CONTACT
r"""Tire growth (spinning) radius"""
TIRE_FLAT_CONTACT = _vsp.TIRE_FLAT_CONTACT
r"""Tire flat tire radius"""
NUM_TIRE_CONTACT_MODES = _vsp.NUM_TIRE_CONTACT_MODES
r"""Number of tire radius modes"""
TIRE_DIM_IN = _vsp.TIRE_DIM_IN
r"""Tire dimensions in inches"""
TIRE_DIM_MODEL = _vsp.TIRE_DIM_MODEL
r"""Tire dimensions in model units"""
TIRE_DIM_FRAC = _vsp.TIRE_DIM_FRAC
r"""Tire dimensions as fractions"""
NUM_TIRE_DIM_MODES = _vsp.NUM_TIRE_DIM_MODES
r"""Number of tire dimension choices"""
TIRE_TRA = _vsp.TIRE_TRA
r"""Full TRA model"""
TIRE_FAIR_FLANGE = _vsp.TIRE_FAIR_FLANGE
r"""TRA with faired flange / flank"""
TIRE_FAIR_WHEEL = _vsp.TIRE_FAIR_WHEEL
r"""TRA with faired wheel"""
TIRE_BALLOON = _vsp.TIRE_BALLOON
r"""Balloon tire"""
TIRE_BALLOON_WHEEL = _vsp.TIRE_BALLOON_WHEEL
r"""Balloon tire with wheel"""
TIRE_BALLOON_FAIR_WHEEL = _vsp.TIRE_BALLOON_FAIR_WHEEL
r"""Balloon tire with faired wheel"""
NUM_TIRE_MODES = _vsp.NUM_TIRE_MODES
r"""Number of tire choices"""
V_UNIT_FT_S = _vsp.V_UNIT_FT_S
r"""Feet per second"""
V_UNIT_M_S = _vsp.V_UNIT_M_S
r"""Meter per second"""
V_UNIT_MPH = _vsp.V_UNIT_MPH
r"""Mile per hour"""
V_UNIT_KM_HR = _vsp.V_UNIT_KM_HR
r"""Kilometer per hour"""
V_UNIT_KEAS = _vsp.V_UNIT_KEAS
r"""Knots equivalent airspeed"""
V_UNIT_KTAS = _vsp.V_UNIT_KTAS
r"""Knots true airspeed"""
V_UNIT_MACH = _vsp.V_UNIT_MACH
r"""Mach"""
VIEW_1 = _vsp.VIEW_1
r"""One 2D view"""
VIEW_2HOR = _vsp.VIEW_2HOR
r"""Two horizontal 2D views"""
VIEW_2VER = _vsp.VIEW_2VER
r"""Two vertical 2D views"""
VIEW_4 = _vsp.VIEW_4
r"""Four 2D views"""
ROT_0 = _vsp.ROT_0
r"""No rotation"""
ROT_90 = _vsp.ROT_90
r"""90 degree rotation"""
ROT_180 = _vsp.ROT_180
r"""180 degree rotation"""
ROT_270 = _vsp.ROT_270
r"""270 degree rotation"""
VIEW_LEFT = _vsp.VIEW_LEFT
r"""Left 2D view type"""
VIEW_RIGHT = _vsp.VIEW_RIGHT
r"""Right 2D view type"""
VIEW_TOP = _vsp.VIEW_TOP
r"""Top 2D view type"""
VIEW_BOTTOM = _vsp.VIEW_BOTTOM
r"""Bottom 2D view type"""
VIEW_FRONT = _vsp.VIEW_FRONT
r"""Front 2D view type"""
VIEW_REAR = _vsp.VIEW_REAR
r"""Rear 2D view type"""
VIEW_NONE = _vsp.VIEW_NONE
r"""No 2D view type"""
VIEW_NUM_TYPES = _vsp.VIEW_NUM_TYPES
r"""Number of 2D view types"""
NOISE_FLYBY = _vsp.NOISE_FLYBY
r"""Set up fly by noise analysis in VSPAERO for PSU-WOPWOP"""
NOISE_FOOTPRINT = _vsp.NOISE_FOOTPRINT
r"""Set up footprint noise analysis in VSPAERO for PSU-WOPWOP"""
NOISE_STEADY = _vsp.NOISE_STEADY
r"""Set up steady state noise analysis in VSPAERO for PSU-WOPWOP"""
NOISE_SI = _vsp.NOISE_SI
r"""Assume geometry and VSPAERO inputs in SI (m N kg s) for PSU-WOPWOP"""
NOISE_ENGLISH = _vsp.NOISE_ENGLISH
r"""Assume geometry and VSPAERO inputs in english (ft lbf slug s) units, will convert to SI (m N kg s) for PSU-WOPWOP"""
VSPAERO_PROP_STATIC = _vsp.VSPAERO_PROP_STATIC
r"""Model propellers as static, non-rotating blades -- i.e. used as a wing."""
VSPAERO_PROP_UNSTEADY = _vsp.VSPAERO_PROP_UNSTEADY
r"""Model propellers as unsteady rotating blades"""
VSPAERO_PROP_PSEUDO_STEADY = _vsp.VSPAERO_PROP_PSEUDO_STEADY
r"""Model propellers with pseudo steady model"""
VSPAERO_PROP_NUM_MODES = _vsp.VSPAERO_PROP_NUM_MODES
r"""Number of ways to model propeller blades in VSPAERO"""
STABILITY_OFF = _vsp.STABILITY_OFF
r"""No stability analysis (off)"""
STABILITY_DEFAULT = _vsp.STABILITY_DEFAULT
r"""Steady 6DOF stability analysis"""
STABILITY_P_ANALYSIS = _vsp.STABILITY_P_ANALYSIS
r"""Unsteady roll stability analysis"""
STABILITY_Q_ANALYSIS = _vsp.STABILITY_Q_ANALYSIS
r"""Unsteady pitch stability analysis"""
STABILITY_R_ANALYSIS = _vsp.STABILITY_R_ANALYSIS
r"""Unsteady yaw stability analysis"""
STABILITY_PITCH = _vsp.STABILITY_PITCH
r"""Simplified pitch stability analysis"""
STABILITY_ADJOINT = _vsp.STABILITY_ADJOINT
r"""Steady 6DOF stability analysis using adjoint"""
STABILITY_NUM_TYPES = _vsp.STABILITY_NUM_TYPES
r"""Number of stability analysis types"""
STALL_OFF = _vsp.STALL_OFF
r"""Stall modeling off"""
STALL_ON = _vsp.STALL_ON
r"""Stall modeling on"""
CFD_NORMAL = _vsp.CFD_NORMAL
r"""Normal CFD Mesh surface"""
CFD_NEGATIVE = _vsp.CFD_NEGATIVE
r"""Negative volume CFD Mesh surface"""
CFD_TRANSPARENT = _vsp.CFD_TRANSPARENT
r"""Transparent CFD Mesh surface"""
CFD_STRUCTURE = _vsp.CFD_STRUCTURE
r"""FEA structure CFD Mesh surface"""
CFD_STIFFENER = _vsp.CFD_STIFFENER
r"""FEA stiffener CFD Mesh surface"""
CFD_MEASURE_DUCT = _vsp.CFD_MEASURE_DUCT
r"""Measure duct cross sectional area surface"""
CFD_NUM_TYPES = _vsp.CFD_NUM_TYPES
r"""Number of CFD Mesh surface types"""
NORMAL_SURF = _vsp.NORMAL_SURF
r"""Normal VSP surface"""
WING_SURF = _vsp.WING_SURF
r"""Wing VSP surface"""
DISK_SURF = _vsp.DISK_SURF
r"""Disk VSP surface"""
NUM_SURF_TYPES = _vsp.NUM_SURF_TYPES
r"""Number of VSP surface types"""
WHEEL_TIRE_1LG = _vsp.WHEEL_TIRE_1LG
r"""Large tire debris"""
WHEEL_TIRE_1SM = _vsp.WHEEL_TIRE_1SM
r"""Small tire debris"""
WHEEL_TIRE_2 = _vsp.WHEEL_TIRE_2
r"""Wheel flange debris"""
WHEEL_TIRE_3E = _vsp.WHEEL_TIRE_3E
r"""Flailing tire strip extended"""
WHEEL_TIRE_3R = _vsp.WHEEL_TIRE_3R
r"""Flailing tire strip retracted"""
WHEEL_TIRE_4 = _vsp.WHEEL_TIRE_4
r"""Tire burst pressure (Not implemented)"""
NUM_WHEEL_TIRE_FAILURE_MODES = _vsp.NUM_WHEEL_TIRE_FAILURE_MODES
r"""Number of wheel and tire failure modes"""
W_RIGHT_0 = _vsp.W_RIGHT_0
r"""Chevron start/ends at right (W = 0) of cross section"""
W_BOTTOM = _vsp.W_BOTTOM
r"""Chevron start/ends at bottom of cross section"""
W_LEFT = _vsp.W_LEFT
r"""Chevron start/ends at left of cross section"""
W_TOP = _vsp.W_TOP
r"""Chevron start/ends at top of cross section"""
W_RIGHT_1 = _vsp.W_RIGHT_1
r"""Chevron start/ends at right (W = 1) of cross section"""
W_FREE = _vsp.W_FREE
r"""Chevron start/ends at user specified point on cross section"""
BLEND_FREE = _vsp.BLEND_FREE
r"""Free blending"""
BLEND_ANGLES = _vsp.BLEND_ANGLES
r"""Blend based on angles (sweep & dihedral)"""
BLEND_MATCH_IN_LE_TRAP = _vsp.BLEND_MATCH_IN_LE_TRAP
r"""Match inboard leading edge trapezoid"""
BLEND_MATCH_IN_TE_TRAP = _vsp.BLEND_MATCH_IN_TE_TRAP
r"""Match inboard trailing edge trapezoid"""
BLEND_MATCH_OUT_LE_TRAP = _vsp.BLEND_MATCH_OUT_LE_TRAP
r"""Match outboard leading edge trapezoid"""
BLEND_MATCH_OUT_TE_TRAP = _vsp.BLEND_MATCH_OUT_TE_TRAP
r"""Match outboard trailing edge trapezoid"""
BLEND_MATCH_IN_ANGLES = _vsp.BLEND_MATCH_IN_ANGLES
r"""Match inboard angles"""
BLEND_MATCH_LE_ANGLES = _vsp.BLEND_MATCH_LE_ANGLES
r"""Match leading edge angles"""
BLEND_NUM_TYPES = _vsp.BLEND_NUM_TYPES
r"""Number of blending types"""
AR_WSECT_DRIVER = _vsp.AR_WSECT_DRIVER
r"""Aspect ratio driver"""
SPAN_WSECT_DRIVER = _vsp.SPAN_WSECT_DRIVER
r"""Span driver"""
AREA_WSECT_DRIVER = _vsp.AREA_WSECT_DRIVER
r"""Area driver"""
TAPER_WSECT_DRIVER = _vsp.TAPER_WSECT_DRIVER
r"""Taper driver"""
AVEC_WSECT_DRIVER = _vsp.AVEC_WSECT_DRIVER
r"""Average chord driver"""
ROOTC_WSECT_DRIVER = _vsp.ROOTC_WSECT_DRIVER
r"""Root chord driver"""
TIPC_WSECT_DRIVER = _vsp.TIPC_WSECT_DRIVER
r"""Tip chord driver"""
SECSWEEP_WSECT_DRIVER = _vsp.SECSWEEP_WSECT_DRIVER
r"""Section sweep driver"""
NUM_WSECT_DRIVER = _vsp.NUM_WSECT_DRIVER
r"""Number of wing section drivers"""
SWEEP_WSECT_DRIVER = _vsp.SWEEP_WSECT_DRIVER
SWEEPLOC_WSECT_DRIVER = _vsp.SWEEPLOC_WSECT_DRIVER
SECSWEEPLOC_WSECT_DRIVER = _vsp.SECSWEEPLOC_WSECT_DRIVER
XDDM_VAR = _vsp.XDDM_VAR
r"""Variable XDDM type"""
XDDM_CONST = _vsp.XDDM_CONST
r"""Constant XDDM type"""
CLOSE_NONE = _vsp.CLOSE_NONE
r"""No closure"""
CLOSE_SKEWLOW = _vsp.CLOSE_SKEWLOW
r"""Skew lower closure"""
CLOSE_SKEWUP = _vsp.CLOSE_SKEWUP
r"""Skew upper closure"""
CLOSE_SKEWBOTH = _vsp.CLOSE_SKEWBOTH
r"""Skew both closure"""
CLOSE_EXTRAP = _vsp.CLOSE_EXTRAP
r"""Extrapolate closure"""
CLOSE_NUM_TYPES = _vsp.CLOSE_NUM_TYPES
r"""Number of XSec closure types"""
XS_UNDEFINED = _vsp.XS_UNDEFINED
XS_POINT = _vsp.XS_POINT
r"""Point XSec"""
XS_CIRCLE = _vsp.XS_CIRCLE
r"""Circle XSec"""
XS_ELLIPSE = _vsp.XS_ELLIPSE
r"""Ellipse XSec"""
XS_SUPER_ELLIPSE = _vsp.XS_SUPER_ELLIPSE
r"""Super ellipse XSec"""
XS_ROUNDED_RECTANGLE = _vsp.XS_ROUNDED_RECTANGLE
r"""Rounded rectangle XSec"""
XS_GENERAL_FUSE = _vsp.XS_GENERAL_FUSE
r"""General fuselage XSec"""
XS_FILE_FUSE = _vsp.XS_FILE_FUSE
r"""Fuselage file XSec"""
XS_FOUR_SERIES = _vsp.XS_FOUR_SERIES
r"""Four series XSec"""
XS_SIX_SERIES = _vsp.XS_SIX_SERIES
r"""Six series XSec"""
XS_BICONVEX = _vsp.XS_BICONVEX
r"""Biconvex XSec"""
XS_WEDGE = _vsp.XS_WEDGE
r"""Wedge XSec"""
XS_EDIT_CURVE = _vsp.XS_EDIT_CURVE
r"""Generic Edit Curve XSec"""
XS_FILE_AIRFOIL = _vsp.XS_FILE_AIRFOIL
r"""Airfoil file XSec"""
XS_CST_AIRFOIL = _vsp.XS_CST_AIRFOIL
r"""CST airfoil XSec"""
XS_VKT_AIRFOIL = _vsp.XS_VKT_AIRFOIL
r"""VKT airfoil XSec"""
XS_FOUR_DIGIT_MOD = _vsp.XS_FOUR_DIGIT_MOD
r"""Four digit modified XSec"""
XS_FIVE_DIGIT = _vsp.XS_FIVE_DIGIT
r"""Five digit XSec"""
XS_FIVE_DIGIT_MOD = _vsp.XS_FIVE_DIGIT_MOD
r"""Five digit modified XSec"""
XS_ONE_SIX_SERIES = _vsp.XS_ONE_SIX_SERIES
r"""One six series XSec"""
XS_AC25_773 = _vsp.XS_AC25_773
r"""FAA AC 25.773 pilot view requirement"""
XS_NUM_TYPES = _vsp.XS_NUM_TYPES
r"""Number of XSec types"""
WIDTH_XSEC_DRIVER = _vsp.WIDTH_XSEC_DRIVER
r"""Width driver"""
AREA_XSEC_DRIVER = _vsp.AREA_XSEC_DRIVER
r"""Area driver"""
HEIGHT_XSEC_DRIVER = _vsp.HEIGHT_XSEC_DRIVER
r"""Height driver"""
HWRATIO_XSEC_DRIVER = _vsp.HWRATIO_XSEC_DRIVER
r"""Height/width ratio driver"""
NUM_XSEC_DRIVER = _vsp.NUM_XSEC_DRIVER
r"""Number of XSec drivers"""
CIRCLE_NUM_XSEC_DRIVER = _vsp.CIRCLE_NUM_XSEC_DRIVER
FLAP_NONE = _vsp.FLAP_NONE
r"""No flap"""
FLAP_PLAIN = _vsp.FLAP_PLAIN
r"""Plain flap"""
FLAP_NUM_TYPES = _vsp.FLAP_NUM_TYPES
r"""Number of flap types"""
XSEC_BOTH_SIDES = _vsp.XSEC_BOTH_SIDES
r"""Both sides"""
XSEC_LEFT_SIDE = _vsp.XSEC_LEFT_SIDE
r"""Left side"""
XSEC_RIGHT_SIDE = _vsp.XSEC_RIGHT_SIDE
r"""Right side"""
TRIM_NONE = _vsp.TRIM_NONE
r"""No trimming"""
TRIM_X = _vsp.TRIM_X
r"""Trim XSec by X"""
TRIM_THICK = _vsp.TRIM_THICK
r"""Trim XSec by thickness"""
TRIM_NUM_TYPES = _vsp.TRIM_NUM_TYPES
r"""Number of trimming types"""
XSEC_FUSE = _vsp.XSEC_FUSE
r"""Fuselage XSec Geom"""
XSEC_STACK = _vsp.XSEC_STACK
r"""Stack XSec Geom"""
XSEC_WING = _vsp.XSEC_WING
r"""Wing XSec Geom"""
XSEC_CUSTOM = _vsp.XSEC_CUSTOM
r"""Custom XSec Geom"""
XSEC_PROP = _vsp.XSEC_PROP
r"""Propeller XSec Geom"""
XSEC_NUM_TYPES = _vsp.XSEC_NUM_TYPES
r"""Number of XSec types"""
XS_SHIFT_LE = _vsp.XS_SHIFT_LE
r"""Shift leading edge"""
XS_SHIFT_MID = _vsp.XS_SHIFT_MID
XS_SHIFT_TE = _vsp.XS_SHIFT_TE
[docs]
class ErrorObj(object):
r"""ErrorObj is defined by an error code enum and associated error string."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
def __init__(self, *args):
r"""
__init__(ErrorObj self) -> ErrorObj
__init__(ErrorObj self, vsp::ERROR_CODE err_code, string const & err_str) -> ErrorObj
__init__(ErrorObj self, ErrorObj _from) -> ErrorObj
"""
_vsp.ErrorObj_swiginit(self, _vsp.new_ErrorObj(*args))
__swig_destroy__ = _vsp.delete_ErrorObj
[docs]
def GetErrorCode(self):
r"""
Get the ERROR_CODE enum of the last raised error
.. code-block:: python
err_mgr = ErrorMgrSingleton.getInstance()
#==== Silence the errors so the bogus call below does not print ====#
err_mgr.SilenceErrors()
#==== Bogus call to raise an error ====#
SetParmVal( "BogusParmID", 23.0 )
err_mgr.PrintOnErrors()
err = err_mgr.PopLastError()
assert err.GetErrorCode() == VSP_CANT_FIND_PARM, "GetErrorCode did not report the missing Parm"
#==== Leave the queue as it was found ====#
while err_mgr.GetNumTotalErrors() > 0:
err_mgr.PopLastError()
See also: ERROR_CODE
:rtype: int
:return: ERROR_CODE error code enum
"""
return _vsp.ErrorObj_GetErrorCode(self)
[docs]
def GetErrorString(self):
r"""
Get the error string of the last raised error
.. code-block:: python
err_mgr = ErrorMgrSingleton.getInstance()
err_mgr.SilenceErrors()
SetParmVal( "BogusParmID", 23.0 )
err_mgr.PrintOnErrors()
err = err_mgr.PopLastError()
assert len( err.GetErrorString() ) > 0, "GetErrorString returned nothing to report"
while err_mgr.GetNumTotalErrors() > 0:
err_mgr.PopLastError()
:rtype: string
:return: Error string
"""
return _vsp.ErrorObj_GetErrorString(self)
m_ErrorCode = property(_vsp.ErrorObj_m_ErrorCode_get, _vsp.ErrorObj_m_ErrorCode_set, doc=r"""m_ErrorCode : vsp::ERROR_CODE""")
m_ErrorString = property(_vsp.ErrorObj_m_ErrorString_get, _vsp.ErrorObj_m_ErrorString_set, doc=r"""m_ErrorString : string""")
[docs]
def NoError(self):
r"""NoError(ErrorObj self)"""
return _vsp.ErrorObj_NoError(self)
# Register ErrorObj in _vsp:
_vsp.ErrorObj_swigregister(ErrorObj)
[docs]
class ErrorMgrSingleton(object):
r"""
ErrorMgrSingleton is the queue that API errors are reported through. An API function that fails
pushes an ErrorObj onto it and returns a default value rather than throwing, so a script that
does not check anything keeps running. Reach it with ErrorMgrSingleton.getInstance(), then use
GetNumTotalErrors and PopLastError to find out what went wrong.
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
[docs]
def GetErrorLastCallFlag(self):
r"""
Check if there was an error on the last call to the API
.. code-block:: python
err_mgr = ErrorMgrSingleton.getInstance()
err_mgr.SilenceErrors()
#==== Bogus call to raise an error ====#
SetParmVal( "BogusParmID", 23.0 )
assert err_mgr.GetErrorLastCallFlag(), "GetErrorLastCallFlag missed the error"
err_mgr.PrintOnErrors()
while err_mgr.GetNumTotalErrors() > 0:
err_mgr.PopLastError()
:rtype: boolean
:return: False if no error, true otherwise
"""
return _vsp.ErrorMgrSingleton_GetErrorLastCallFlag(self)
[docs]
def GetNumTotalErrors(self):
r"""
Count the total number of errors on the stack
.. code-block:: python
err_mgr = ErrorMgrSingleton.getInstance()
err_mgr.SilenceErrors()
#==== Two bogus calls, so the count is something to check ====#
SetParmVal( "BogusParmID", 23.0 )
SetParmVal( "AnotherBogusParmID", 23.0 )
assert err_mgr.GetNumTotalErrors() == 2, "GetNumTotalErrors did not count both errors"
err_mgr.PrintOnErrors()
while err_mgr.GetNumTotalErrors() > 0:
err_mgr.PopLastError()
:rtype: int
:return: Number of errors
"""
return _vsp.ErrorMgrSingleton_GetNumTotalErrors(self)
[docs]
def PopLastError(self):
r"""
Pop (remove) and return the most recent error from the stack. Note, errors are printed on occurrence by default.
.. code-block:: python
err_mgr = ErrorMgrSingleton.getInstance()
err_mgr.SilenceErrors()
SetParmVal( "BogusParmID", 23.0 )
n0 = err_mgr.GetNumTotalErrors()
err = err_mgr.PopLastError()
#==== Pop takes the error off the queue ====#
assert err_mgr.GetNumTotalErrors() == n0 - 1, "PopLastError left the error on the queue"
assert err.GetErrorCode() == VSP_CANT_FIND_PARM, "PopLastError returned the wrong error"
err_mgr.PrintOnErrors()
while err_mgr.GetNumTotalErrors() > 0:
err_mgr.PopLastError()
:rtype: :py:class:`ErrorObj`
:return: Error object
"""
return _vsp.ErrorMgrSingleton_PopLastError(self)
[docs]
def GetLastError(self):
r"""
Return the most recent error from the stack (does NOT pop error off the stack)
.. code-block:: python
err_mgr = ErrorMgrSingleton.getInstance()
err_mgr.SilenceErrors()
SetParmVal( "BogusParmID", 23.0 )
n0 = err_mgr.GetNumTotalErrors()
err = err_mgr.GetLastError()
#==== Unlike PopLastError, the error stays on the queue ====#
assert err_mgr.GetNumTotalErrors() == n0, "GetLastError removed the error"
assert err.GetErrorCode() == VSP_CANT_FIND_PARM, "GetLastError returned the wrong error"
err_mgr.PrintOnErrors()
while err_mgr.GetNumTotalErrors() > 0:
err_mgr.PopLastError()
See also: SilenceErrors, PrintOnErrors;
:rtype: :py:class:`ErrorObj`
:return: Error object
"""
return _vsp.ErrorMgrSingleton_GetLastError(self)
[docs]
def PopErrorAndPrint(self, stream):
r"""PopErrorAndPrint(ErrorMgrSingleton self, FILE * stream) -> bool"""
return _vsp.ErrorMgrSingleton_PopErrorAndPrint(self, stream)
[docs]
def SilenceErrors(self):
r"""
Prevent errors from printing to stdout as they occur.
.. code-block:: python
err_mgr = ErrorMgrSingleton.getInstance()
#==== Errors are printed as they happen unless silenced ====#
err_mgr.SilenceErrors()
SetParmVal( "BogusParmID", 23.0 )
#==== The error is still recorded, it is only the printing that stops ====#
assert err_mgr.GetNumTotalErrors() == 1, "SilenceErrors also stopped the error being recorded"
err_mgr.PrintOnErrors()
while err_mgr.GetNumTotalErrors() > 0:
err_mgr.PopLastError()
See also: PrintOnErrors
"""
return _vsp.ErrorMgrSingleton_SilenceErrors(self)
[docs]
def PrintOnErrors(self):
r"""
Cause errors to be printed to stdout as they occur.
.. code-block:: python
err_mgr = ErrorMgrSingleton.getInstance()
err_mgr.SilenceErrors()
SetParmVal( "BogusParmID", 23.0 )
#==== Turn printing back on ====#
err_mgr.PrintOnErrors()
assert err_mgr.GetNumTotalErrors() == 1, "PrintOnErrors lost the recorded error"
while err_mgr.GetNumTotalErrors() > 0:
err_mgr.PopLastError()
See also: SilenceErrors
"""
return _vsp.ErrorMgrSingleton_PrintOnErrors(self)
[docs]
def AddError(self, code, desc):
r"""AddError(ErrorMgrSingleton self, vsp::ERROR_CODE code, string const & desc)"""
return _vsp.ErrorMgrSingleton_AddError(self, code, desc)
[docs]
def NoError(self):
r"""NoError(ErrorMgrSingleton self)"""
return _vsp.ErrorMgrSingleton_NoError(self)
[docs]
def MessageCallback(self, _from, data):
r"""MessageCallback(ErrorMgrSingleton self, MessageBase const * _from, MessageData const & data)"""
return _vsp.ErrorMgrSingleton_MessageCallback(self, _from, data)
[docs]
@staticmethod
def getInstance():
r"""
Get the error manager. There is one queue for the whole session, and this is how a script
reaches it -- every other call in this group is made on the object returned here.
.. code-block:: python
err_mgr = ErrorMgrSingleton.getInstance()
assert err_mgr.GetNumTotalErrors() >= 0, "getInstance did not return a usable error manager"
See also: GetNumTotalErrors, PopLastError, GetErrorLastCallFlag
:rtype: :py:class:`ErrorMgrSingleton`
:return: ErrorMgrSingleton The one error manager for this session
"""
return _vsp.ErrorMgrSingleton_getInstance()
# Register ErrorMgrSingleton in _vsp:
_vsp.ErrorMgrSingleton_swigregister(ErrorMgrSingleton)
[docs]
def VSPCheckSetup():
r"""
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.
.. code-block:: python
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...
"""
return _vsp.VSPCheckSetup()
[docs]
def VSPRenew():
r"""
Clear and reinitialize OpenVSP to all default settings
.. code-block:: python
#==== 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"
"""
return _vsp.VSPRenew()
[docs]
def Update(update_managers=True):
r"""
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.
.. code-block:: python
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"
:type update_managers: boolean, optional
:param update_managers: bool Flag to indicate if managers should be updated
"""
return _vsp.Update(update_managers)
[docs]
def VSPExit(error_code):
r"""
Exit the program with a specific error code
.. code-block:: python
Update()
# Shown rather than run: this ends the process, and would take the caller with it.
# VSPExit( 0 )
:param [in]: error_code int Error code
"""
return _vsp.VSPExit(error_code)
[docs]
def VSPCrash(crash_type):
r"""
Cause OpenVSP to crash in a variety of ways.
.. code-block:: python
Update()
# Shown rather than run: this deliberately crashes the process, and is only for exercising
# the crash handler.
# VSPCrash( 0 )
:param [in]: crash_type int Type of crash to attempt.
"""
return _vsp.VSPCrash(crash_type)
[docs]
def GetAndResetUpdateCount():
r"""
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.
.. code-block:: python
#==== 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"
:rtype: int
:return: int OpenVSP update count
"""
return _vsp.GetAndResetUpdateCount()
[docs]
def Print(*args):
r"""
*Overload 1:*
Print a string to stdout. Print to stdout. Writes the value and, unless asked not to, a newline; there is nothing to
check in an example beyond the call itself.
.. code-block:: python
Print( "Hello from the OpenVSP API" )
See also: Min, Max, Rad2Deg, Deg2Rad
:param [in]: data string Text to print
:param [in]: new_line bool Follow the text with a newline
|
*Overload 2:*
Print a vec3d to stdout, as its three coordinates. Print to stdout. Writes the value and, unless asked not to, a newline; there is nothing to
check in an example beyond the call itself.
.. code-block:: python
Print( vec3d( 1.0, 2.0, 3.0 ) )
See also: Print
:param [in]: data vec3d Point to print
:param [in]: new_line bool Follow the point with a newline
|
*Overload 3:*
Print a vec3d to stdout, as its three coordinates. Print to stdout. Writes the value and, unless asked not to, a newline; there is nothing to
check in an example beyond the call itself.
.. code-block:: python
Print( vec3d( 1.0, 2.0, 3.0 ) )
See also: Print
:param [in]: data vec3d Point to print
:param [in]: new_line bool Follow the point with a newline
|
*Overload 4:*
Print a double to stdout. Print to stdout. Writes the value and, unless asked not to, a newline; there is nothing to
check in an example beyond the call itself.
.. code-block:: python
Print( 3.14159 )
See also: Print
:param [in]: data double Value to print
:param [in]: new_line bool Follow the value with a newline
|
*Overload 5:*
Print a double to stdout. Print to stdout. Writes the value and, unless asked not to, a newline; there is nothing to
check in an example beyond the call itself.
.. code-block:: python
Print( 3.14159 )
See also: Print
:param [in]: data double Value to print
:param [in]: new_line bool Follow the value with a newline
|
*Overload 6:*
Print an integer to stdout. Print to stdout. Writes the value and, unless asked not to, a newline; there is nothing to
check in an example beyond the call itself.
.. code-block:: python
Print( 42 )
See also: Print
:param [in]: data int Value to print
:param [in]: new_line bool Follow the value with a newline
|
*Overload 7:*
Print an integer to stdout. Print to stdout. Writes the value and, unless asked not to, a newline; there is nothing to
check in an example beyond the call itself.
.. code-block:: python
Print( 42 )
See also: Print
:param [in]: data int Value to print
:param [in]: new_line bool Follow the value with a newline
"""
return _vsp.Print(*args)
[docs]
def Min(x, y):
r"""
Get the smaller of two values.
.. code-block:: python
assert abs( Min( 2.0, 5.0 ) - 2.0 ) < 1e-12, "Min did not return the smaller value"
assert abs( Min( 5.0, 2.0 ) - 2.0 ) < 1e-12, "Min depends on the order of its arguments"
See also: Max
:param [in]: x double First value
:param [in]: y double Second value
:rtype: float
:return: double The smaller of the two
"""
return _vsp.Min(x, y)
[docs]
def Max(x, y):
r"""
Get the larger of two values.
.. code-block:: python
assert abs( Max( 2.0, 5.0 ) - 5.0 ) < 1e-12, "Max did not return the larger value"
assert abs( Max( 5.0, 2.0 ) - 5.0 ) < 1e-12, "Max depends on the order of its arguments"
See also: Min
:param [in]: x double First value
:param [in]: y double Second value
:rtype: float
:return: double The larger of the two
"""
return _vsp.Max(x, y)
[docs]
def Rad2Deg(r):
r"""
Convert an angle from radians to degrees.
.. code-block:: python
import math
assert abs( Rad2Deg( math.pi ) - 180.0 ) < 1e-9, "Rad2Deg did not convert half a turn to 180 degrees"
See also: Deg2Rad
:param [in]: r double Angle in radians
:rtype: float
:return: double Angle in degrees
"""
return _vsp.Rad2Deg(r)
[docs]
def Deg2Rad(d):
r"""
Convert an angle from degrees to radians.
.. code-block:: python
import math
assert abs( Deg2Rad( 180.0 ) - math.pi ) < 1e-9, "Deg2Rad did not convert 180 degrees to half a turn"
See also: Rad2Deg
:param [in]: d double Angle in degrees
:rtype: float
:return: double Angle in radians
"""
return _vsp.Deg2Rad(d)
[docs]
def GetVSPVersion():
r"""
Get the version of the OpenVSP instance currently running
.. code-block:: python
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
:rtype: string
:return: string OpenVSP version string (i.e. "OpenVSP 3.17.1")
"""
return _vsp.GetVSPVersion()
[docs]
def GetVSPVersionMajor():
r"""
Get the major version of the OpenVSP instance currently running as an integer
.. code-block:: python
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"
:rtype: int
:return: int OpenVSP major version number (i.e. 3 in 3.X.Y)
"""
return _vsp.GetVSPVersionMajor()
[docs]
def GetVSPVersionMinor():
r"""
Get the minor version of the OpenVSP instance currently running as an integer
.. code-block:: python
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"
:rtype: int
:return: int OpenVSP minor version number (i.e. X in 3.X.Y)
"""
return _vsp.GetVSPVersionMinor()
[docs]
def GetVSPVersionChange():
r"""
Get the change version of the OpenVSP instance currently running as an integer
.. code-block:: python
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"
:rtype: int
:return: int OpenVSP change version number (i.e. Y in 3.X.Y)
"""
return _vsp.GetVSPVersionChange()
[docs]
def GetVSPExePath():
r"""
Get the path to the OpenVSP executable. OpenVSP will assume that the VSPAERO, VSPSLICER, and VSPVIEWER are in the same directory unless
instructed otherwise.
.. code-block:: python
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
"""
return _vsp.GetVSPExePath()
[docs]
def SetVSPAEROPath(path):
r"""
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.
.. code-block:: python
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
"""
return _vsp.SetVSPAEROPath(path)
[docs]
def GetVSPAEROPath():
r"""
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.
.. code-block:: python
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
"""
return _vsp.GetVSPAEROPath()
[docs]
def CheckForVSPAERO(path):
r"""
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.
.. code-block:: python
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
"""
return _vsp.CheckForVSPAERO(path)
[docs]
def SetVSPHelpPath(path):
r"""
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.
.. code-block:: python
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
"""
return _vsp.SetVSPHelpPath(path)
[docs]
def GetVSPHelpPath():
r"""
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.
.. code-block:: python
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
"""
return _vsp.GetVSPHelpPath()
[docs]
def CheckForVSPHelp(path):
r"""
Check if all OpenVSP help files are in a given directory.
.. code-block:: python
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
"""
return _vsp.CheckForVSPHelp(path)
def RegisterCFDMeshAnalyses():
r"""RegisterCFDMeshAnalyses()"""
return _vsp.RegisterCFDMeshAnalyses()
[docs]
def ReadVSPFile(file_name):
r"""
Load an OpenVSP project from a VSP3 file
.. code-block:: python
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"
:param [in]: file_name string \*.vsp3 file name
"""
return _vsp.ReadVSPFile(file_name)
[docs]
def WriteVSPFile(*args):
r"""
Save the current OpenVSP project to a VSP3 file
.. code-block:: python
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"
:param [in]: file_name string \*.vsp3 file name
:param [in]: set int Set index to write (i.e. SET_ALL)
"""
return _vsp.WriteVSPFile(*args)
[docs]
def SetVSP3FileName(file_name):
r"""
Set the file name of a OpenVSP project
.. code-block:: python
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"
:param [in]: file_name string File name
"""
return _vsp.SetVSP3FileName(file_name)
[docs]
def GetVSPFileName():
r"""
Get the file name of the current OpenVSP project
.. code-block:: python
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"
:rtype: string
:return: string File name for the current OpenVSP project
"""
return _vsp.GetVSPFileName()
[docs]
def ClearVSPModel():
r"""
Clear the current OpenVSP model
.. code-block:: python
fid = AddGeom( "FUSELAGE", "" ) # Add Fuselage
#==== Reset Geometry ====//
print( "--->Resetting VSP model to blank slate\n" )
ClearVSPModel()
assert len( FindGeoms() ) == 0, "ClearVSPModel left Geoms behind"
"""
return _vsp.ClearVSPModel()
[docs]
def InsertVSPFile(file_name, parent_geom_id):
r"""
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.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
WriteVSPFile( "TestInsert.vsp3" )
InsertVSPFile( "TestInsert.vsp3", "" )
assert len( FindGeoms() ) == 2, "InsertVSPFile did not bring in the Geom"
:param [in]: file_name string \*.vsp3 filename
:param [in]: parent_geom_id string Parent geom ID (ignored with empty string)
"""
return _vsp.InsertVSPFile(file_name, parent_geom_id)
[docs]
def ExportFile(*args):
r"""
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.
.. code-block:: python
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
"""
return _vsp.ExportFile(*args)
[docs]
def ImportFile(file_name, file_type, parent):
r"""
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.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
SetComputationFileName( COMP_GEOM_TXT_TYPE, "TestImport.txt" )
ExportFile( "TestImport.stl", SET_ALL, EXPORT_STL )
mesh_id = ImportFile( "TestImport.stl", IMPORT_STL, "" )
assert len( mesh_id ) > 0, "ImportFile returned no ID"
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)
"""
return _vsp.ImportFile(file_name, file_type, parent)
[docs]
def GetBEMPropID():
r"""
Set the ID of the propeller to be exported to a BEM file. Call this function before ExportFile.
.. code-block:: python
#==== 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.
.. code-block:: python
#==== 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
"""
return _vsp.GetBEMPropID()
[docs]
def SetBEMPropID(prop_id):
r"""
Set the propeller to write when a BEM file is exported. Without this the first propeller found
is used.
.. code-block:: python
prop_id = AddGeom( "PROP" )
Update()
SetBEMPropID( prop_id )
assert GetBEMPropID() == prop_id, "SetBEMPropID did not take"
See also: GetBEMPropID, ExportFile
:param [in]: prop_id string Propeller Geom ID to write
"""
return _vsp.SetBEMPropID(prop_id)
[docs]
def ReadApplyDESFile(file_name):
r"""
Read in and apply a design file (\*.des) to the current OpenVSP project
.. code-block:: python
pid = AddGeom( "POD" )
Update()
length = GetParm( pid, "Length", "Design" )
AddDesignVar( length, XDDM_VAR )
WriteDESFile( "TestDesignVars.des" )
ReadApplyDESFile( "TestDesignVars.des" )
:param [in]: file_name string \*.des input file
"""
return _vsp.ReadApplyDESFile(file_name)
[docs]
def WriteDESFile(file_name):
r"""
Write all design variables to a design file (\*.des)
.. code-block:: python
pid = AddGeom( "POD" )
Update()
length = GetParm( pid, "Length", "Design" )
AddDesignVar( length, XDDM_VAR )
WriteDESFile( "TestDesignVars.des" )
:param [in]: file_name string \*.des output file
"""
return _vsp.WriteDESFile(file_name)
[docs]
def ReadApplyXDDMFile(file_name):
r"""
Read in and apply a Cart3D XDDM file (\*.xddm) to the current OpenVSP project
.. code-block:: python
pid = AddGeom( "POD" )
Update()
length = GetParm( pid, "Length", "Design" )
AddDesignVar( length, XDDM_VAR )
WriteXDDMFile( "TestDesignVars.xddm" )
ReadApplyXDDMFile( "TestDesignVars.xddm" )
:param [in]: file_name string \*.xddm input file
"""
return _vsp.ReadApplyXDDMFile(file_name)
[docs]
def WriteXDDMFile(file_name):
r"""
Write all design variables to a Cart3D XDDM file (\*.xddm)
.. code-block:: python
pid = AddGeom( "POD" )
Update()
length = GetParm( pid, "Length", "Design" )
AddDesignVar( length, XDDM_VAR )
WriteXDDMFile( "TestDesignVars.xddm" )
:param [in]: file_name string \*.xddm output file
"""
return _vsp.WriteXDDMFile(file_name)
[docs]
def GetNumDesignVars():
r"""
Get the number of design variables
.. code-block:: python
pid = AddGeom( "POD" )
Update()
length = GetParm( pid, "Length", "Design" )
AddDesignVar( length, XDDM_VAR )
assert GetNumDesignVars() == 1, "GetNumDesignVars did not count the variable"
:rtype: int
:return: int Number of design variables
"""
return _vsp.GetNumDesignVars()
[docs]
def AddDesignVar(parm_id, type):
r"""
Add a design variable
.. code-block:: python
pid = AddGeom( "POD" )
Update()
length = GetParm( pid, "Length", "Design" )
AddDesignVar( length, XDDM_VAR )
assert GetNumDesignVars() == 1, "AddDesignVar did not add the 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)
"""
return _vsp.AddDesignVar(parm_id, type)
[docs]
def DeleteAllDesignVars():
r"""
Delete all design variables
.. code-block:: python
pid = AddGeom( "POD" )
Update()
length = GetParm( pid, "Length", "Design" )
AddDesignVar( length, XDDM_VAR )
DeleteAllDesignVars()
assert GetNumDesignVars() == 0, "DeleteAllDesignVars left variables behind"
"""
return _vsp.DeleteAllDesignVars()
[docs]
def GetDesignVar(index):
r"""
Get the Parm ID of the specified design variable
.. code-block:: python
pid = AddGeom( "POD" )
Update()
length = GetParm( pid, "Length", "Design" )
AddDesignVar( length, XDDM_VAR )
assert GetDesignVar( 0 ) == length, "GetDesignVar did not report the variable"
:param [in]: index int Index of design variable
:rtype: string
:return: string Parm ID
"""
return _vsp.GetDesignVar(index)
[docs]
def GetDesignVarType(index):
r"""
Get the XDDM type of the specified design variable
.. code-block:: python
pid = AddGeom( "POD" )
Update()
length = GetParm( pid, "Length", "Design" )
AddDesignVar( length, XDDM_VAR )
assert GetDesignVarType( 0 ) == XDDM_VAR, "GetDesignVarType did not report the type"
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)
"""
return _vsp.GetDesignVarType(index)
[docs]
def GetComputationFileName(file_type):
r"""
Get the file name of a specified file type. Note, this function cannot be used to set FEA Mesh file names.
.. code-block:: python
#==== 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.
.. code-block:: python
#==== 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
"""
return _vsp.GetComputationFileName(file_type)
[docs]
def SetComputationFileName(file_type, file_name):
r"""
Set the file name a computation writes for one export type. The type is one of the computation
file type enums, and each is remembered separately.
.. code-block:: python
SetComputationFileName( CFD_STL_TYPE, "TestCFDMesh.stl" )
SetComputationFileName( CFD_TRI_TYPE, "TestCFDMesh.tri" )
See also: COMPUTATION_FILE_TYPE, ComputeCFDMesh
:param [in]: file_type int Computation file type enum (i.e. CFD_STL_TYPE)
:param [in]: file_name string Name of the file to write
"""
return _vsp.SetComputationFileName(file_type, file_name)
[docs]
def ComputeMassProps(set, num_slices, idir):
r"""
Compute mass properties for the components in the set. Alternatively can be run through the Analysis Manager with 'MassProp'.
.. code-block:: python
#==== 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
"""
return _vsp.ComputeMassProps(set, num_slices, idir)
[docs]
def ComputeCompGeom(set, half_mesh, file_export_types):
r"""
Mesh, intersect, and trim components in the set. Alternatively can be run through the Analysis Manager with 'CompGeom'.
.. code-block:: python
#==== 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
"""
return _vsp.ComputeCompGeom(set, half_mesh, file_export_types)
[docs]
def ComputePlaneSlice(set, num_slices, norm, auto_bnd, start_bnd=0, end_bnd=0, measureduct=False):
r"""
Slice and mesh the components in the set. Alternatively can be run through the Analysis Manager with 'PlanarSlice'.
.. code-block:: python
#==== 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
"""
return _vsp.ComputePlaneSlice(set, num_slices, norm, auto_bnd, start_bnd, end_bnd, measureduct)
[docs]
def ComputeDegenGeom(set, file_export_types):
r"""
Compute the degenerate geometry representation for the components in the set. Alternatively can be run through the Analysis Manager with 'DegenGeom' or 'VSPAERODegenGeom'.
.. code-block:: python
#==== 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)
"""
return _vsp.ComputeDegenGeom(set, file_export_types)
[docs]
def ComputeCFDMesh(set, degenset, file_export_types):
r"""
Create a CFD Mesh for the components in the set. This analysis cannot be run through the Analysis Manager.
.. code-block:: python
#==== 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)
"""
return _vsp.ComputeCFDMesh(set, degenset, file_export_types)
[docs]
def GetCFDMeshVal(type):
r"""
Set the value of a specific CFD Mesh option
.. code-block:: python
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
.. code-block:: python
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
"""
return _vsp.GetCFDMeshVal(type)
[docs]
def SetCFDMeshVal(type, val):
r"""
Set one of the CFD Mesh settings. The type is one of the CFD mesh setting enums, and the value
is read as a double whatever the setting means.
.. code-block:: python
SetCFDMeshVal( CFD_MIN_EDGE_LEN, 0.2 )
SetCFDMeshVal( CFD_MAX_EDGE_LEN, 1.0 )
See also: CFD_CONTROL_TYPE, ComputeCFDMesh
:param [in]: type int CFD mesh setting enum (i.e. CFD_MIN_EDGE_LEN)
:param [in]: val double Value to set
"""
return _vsp.SetCFDMeshVal(type, val)
[docs]
def GetCFDWakeFlag(geom_id):
r"""
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.
.. code-block:: python
#==== 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
.. code-block:: python
#==== 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
"""
return _vsp.GetCFDWakeFlag(geom_id)
[docs]
def SetCFDWakeFlag(geom_id, flag):
r"""
Say whether a Geom sheds a wake in CFD Mesh. This is the Wake check box on the CFD Mesh screen.
.. code-block:: python
wid = AddGeom( "WING" )
Update()
SetCFDWakeFlag( wid, True )
assert GetParmVal( FindParm( wid, "Wake", "Shape" ) ) == 1.0, "SetCFDWakeFlag did not take"
See also: ComputeCFDMesh
:param [in]: geom_id string Geom ID
:param [in]: flag bool True to shed a wake from this Geom
"""
return _vsp.SetCFDWakeFlag(geom_id, flag)
[docs]
def SetCFDFarFieldGeomID(geom_id):
r"""
Set the Geom that stands in for the CFD Mesh far field box. Turning the far field on and choosing to use a
component for it are separate settings; this one only names the component. Pass an empty string to clear it.
.. code-block:: python
#==== Add Pod And A Sphere Around It ====//
pid = AddGeom( "POD" )
eid = AddGeom( "ELLIPSOID" )
SetParmVal( eid, "A_Radius", "Design", 12.0 )
SetCFDMeshVal( CFD_FAR_FIELD_FLAG, 1.0 )
SetParmVal( FindParm( FindContainer( "CFDMeshSettings", 0 ), "FarComp", "FarField" ), 1.0 )
SetCFDFarFieldGeomID( eid )
assert GetCFDFarFieldGeomID() == eid, "SetCFDFarFieldGeomID did not name the Geom"
# An empty string puts the setting back the way it reads before a choice is made.
SetCFDFarFieldGeomID( "" )
assert GetCFDFarFieldGeomID() == "", "SetCFDFarFieldGeomID did not clear the choice"
# 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()
SetCFDFarFieldGeomID( "NoSuchGeom" )
assert err_mgr.GetNumTotalErrors() > 0, "SetCFDFarFieldGeomID accepted a Geom that does not exist"
# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
err = err_mgr.PopLastError()
See also: GetCFDFarFieldGeomID, SetCFDMeshVal
:param [in]: geom_id string Geom ID, or an empty string to clear
"""
return _vsp.SetCFDFarFieldGeomID(geom_id)
[docs]
def GetCFDFarFieldGeomID():
r"""
Get the Geom that stands in for the CFD Mesh far field box. Comes back empty when none has been named.
.. code-block:: python
#==== Add Two Geoms To Choose Between ====//
pid = AddGeom( "POD" )
eid = AddGeom( "ELLIPSOID" )
SetCFDFarFieldGeomID( eid )
assert GetCFDFarFieldGeomID() == eid, "GetCFDFarFieldGeomID did not report the Geom that was set"
# It follows the setting, so naming another Geom changes what comes back.
SetCFDFarFieldGeomID( pid )
assert GetCFDFarFieldGeomID() == pid, "GetCFDFarFieldGeomID did not follow SetCFDFarFieldGeomID"
# With the choice cleared it comes back empty.
SetCFDFarFieldGeomID( "" )
assert GetCFDFarFieldGeomID() == "", "GetCFDFarFieldGeomID did not come back empty"
See also: SetCFDFarFieldGeomID
:rtype: string
:return: string Geom ID
"""
return _vsp.GetCFDFarFieldGeomID()
[docs]
def GetNumCFDSources(geom_id):
r"""
Delete all CFD Mesh sources for all Geoms
.. code-block:: python
#==== 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
.. code-block:: python
#==== 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
"""
return _vsp.GetNumCFDSources(geom_id)
[docs]
def GetCFDSourceName(geom_id, source_index):
r"""
Get the name of a CFD Mesh source on the specified Geom
.. code-block:: python
#==== 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
"""
return _vsp.GetCFDSourceName(geom_id, source_index)
[docs]
def SetCFDSourceName(geom_id, source_index, name):
r"""
Get the type of a CFD Mesh source on the specified Geom
.. code-block:: python
#==== 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
.. code-block:: python
#==== 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
"""
return _vsp.SetCFDSourceName(geom_id, source_index, name)
[docs]
def GetCFDSourceType(geom_id, source_index):
r"""
Get the type of one CFD Mesh source on a Geom.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddCFDSource( POINT_SOURCE, pid, 0, 0.25, 1.0, 0.25, 0.5 )
assert GetCFDSourceType( pid, 0 ) == POINT_SOURCE, "GetCFDSourceType did not report the source type"
See also: CFD_MESH_SOURCE_TYPE, AddCFDSource
:param [in]: geom_id string Geom ID
:param [in]: source_index int Index of the source on that Geom
:rtype: int
:return: int CFD mesh source type enum (i.e. POINT_SOURCE)
"""
return _vsp.GetCFDSourceType(geom_id, source_index)
[docs]
def DeleteCFDSource(geom_id, source_index):
r"""
Delete a single CFD Mesh source from the specified Geom
.. code-block:: python
#==== 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
"""
return _vsp.DeleteCFDSource(geom_id, source_index)
[docs]
def DeleteAllCFDSources():
r"""
Delete every CFD Mesh source on every Geom.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddCFDSource( POINT_SOURCE, pid, 0, 0.25, 1.0, 0.25, 0.5 )
DeleteAllCFDSources()
assert GetNumCFDSources( pid ) == 0, "DeleteAllCFDSources left sources behind"
See also: AddCFDSource, DeleteCFDSource
"""
return _vsp.DeleteAllCFDSources()
[docs]
def GetCFDSourceID(geom_id, source_index):
r"""
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.
.. code-block:: python
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
"""
return _vsp.GetCFDSourceID(geom_id, source_index)
[docs]
def AdjustAllCFDSourceLen(mult):
r"""
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.
.. code-block:: python
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
"""
return _vsp.AdjustAllCFDSourceLen(mult)
[docs]
def AdjustAllCFDSourceRad(mult):
r"""
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.
.. code-block:: python
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
"""
return _vsp.AdjustAllCFDSourceRad(mult)
[docs]
def AddDefaultSources():
r"""
Add default CFD Mesh sources for all Geoms
.. code-block:: python
#==== 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"
"""
return _vsp.AddDefaultSources()
[docs]
def AddCFDSource(type, geom_id, surf_index, l1, r1, u1, w1, l2=0, r2=0, u2=0, w2=0):
r"""
Add a CFD Mesh default source for the indicated Geom. Note, certain input params may not be used depending on the source type
.. code-block:: python
#==== 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
"""
return _vsp.AddCFDSource(type, geom_id, surf_index, l1, r1, u1, w1, l2, r2, u2, w2)
[docs]
def GetVSPAERORefWingID():
r"""
Get ID of the current VSPAERO reference Geom
.. code-block:: python
wid = AddGeom( "WING" )
Update()
SetVSPAERORefWingID( wid )
assert GetVSPAERORefWingID() == wid, "GetVSPAERORefWingID did not report the wing that was set"
:rtype: string
:return: string Reference Geom ID
"""
return _vsp.GetVSPAERORefWingID()
[docs]
def SetVSPAERORefWingID(geom_id):
r"""
Set the current VSPAERO reference Geom ID
.. code-block:: python
#==== 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()
:param [in]: geom_id string Reference Geom ID
"""
return _vsp.SetVSPAERORefWingID(geom_id)
[docs]
def GetNumAnalysis():
r"""
Get the number of analysis types available in the Analysis Manager
.. code-block:: python
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"
:rtype: int
:return: int Number of analyses
"""
return _vsp.GetNumAnalysis()
[docs]
def ListAnalysis():
r"""
Get the name of every available analysis in the Analysis Manager
.. code-block:: python
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"
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<string> Array of analysis names
"""
return _vsp.ListAnalysis()
[docs]
def GetAnalysisDoc(analysis):
r"""
Get the analysis documentation string
.. code-block:: python
analysis_name = "VSPAEROComputeGeometry"
doc = GetAnalysisDoc( analysis_name )
assert len( doc ) > 0, "GetAnalysisDoc returned nothing"
:param [in]: analysis string Analysis name
:rtype: string
:return: string Documentation string
"""
return _vsp.GetAnalysisDoc(analysis)
[docs]
def ExecAnalysis(analysis):
r"""
Execute an analysis through the Analysis Manager
.. code-block:: python
analysis_name = "VSPAEROComputeGeometry"
res_id = ExecAnalysis( analysis_name )
assert len( res_id ) > 0, "ExecAnalysis returned no id"
:param [in]: analysis string Analysis name
:rtype: string
:return: string Result ID
"""
return _vsp.ExecAnalysis(analysis)
[docs]
def PrintAnalysisDocs(analysis_name):
r"""
Print to stdout all current input documentation for a specific analysis
.. code-block:: python
#==== 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()
:param [in]: analysis_name string Name of analysis
"""
return _vsp.PrintAnalysisDocs(analysis_name)
[docs]
def AddGeometryAnalysis():
r"""
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.
.. code-block:: python
##==== 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
"""
return _vsp.AddGeometryAnalysis()
[docs]
def AddGeometryAnalysisAzEl(geom_analysis_id, azimuth, elevation):
r"""
Delete a specific Geometry Analysis case from the Geometry Analysis Manager.
.. code-block:: python
##==== 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.
.. code-block:: python
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)
"""
return _vsp.AddGeometryAnalysisAzEl(geom_analysis_id, azimuth, elevation)
[docs]
def DeleteGeometryAnalysisAzEl(geom_analysis_id, index):
r"""
Delete one azimuth and elevation pair from a Geometry Analysis case
.. code-block:: python
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
"""
return _vsp.DeleteGeometryAnalysisAzEl(geom_analysis_id, index)
[docs]
def DeleteAllGeometryAnalysisAzEl(geom_analysis_id):
r"""
Delete every azimuth and elevation pair from a Geometry Analysis case
.. code-block:: python
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
"""
return _vsp.DeleteAllGeometryAnalysisAzEl(geom_analysis_id)
[docs]
def GetNumGeometryAnalysisAzEl(geom_analysis_id):
r"""
Get the number of azimuth and elevation pairs in a Geometry Analysis case
.. code-block:: python
id = AddGeometryAnalysis()
AddGeometryAnalysisAzEl( id, 10.0, 20.0 )
assert GetNumGeometryAnalysisAzEl( id ) == 1, "GetNumGeometryAnalysisAzEl did not count the pair"
See also: AddGeometryAnalysisAzEl
:param [in]: geom_analysis_id string Geometry Analysis case ID
:rtype: int
:return: int Number of az/el pairs
"""
return _vsp.GetNumGeometryAnalysisAzEl(geom_analysis_id)
[docs]
def GetGeometryAnalysisAzimuthParm(geom_analysis_id, index):
r"""
Get the Parm ID of the azimuth of one az/el pair, so its value can be read or changed
.. code-block:: python
id = AddGeometryAnalysis()
AddGeometryAnalysisAzEl( id, 10.0, 20.0 )
azparm = GetGeometryAnalysisAzimuthParm( id, 0 )
assert abs( GetParmVal( azparm ) - 10.0 ) < 1e-6, "GetGeometryAnalysisAzimuthParm did not report the azimuth"
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
"""
return _vsp.GetGeometryAnalysisAzimuthParm(geom_analysis_id, index)
[docs]
def GetGeometryAnalysisElevationParm(geom_analysis_id, index):
r"""
Get the Parm ID of the elevation of one az/el pair, so its value can be read or changed
.. code-block:: python
id = AddGeometryAnalysis()
AddGeometryAnalysisAzEl( id, 10.0, 20.0 )
elparm = GetGeometryAnalysisElevationParm( id, 0 )
assert abs( GetParmVal( elparm ) - 20.0 ) < 1e-6, "GetGeometryAnalysisElevationParm did not report the elevation"
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
"""
return _vsp.GetGeometryAnalysisElevationParm(geom_analysis_id, index)
[docs]
def DeleteGeometryAnalysis(id):
r"""
Delete one geometry analysis case.
.. code-block:: python
id = AddGeometryAnalysis()
SetActiveGeometryAnalysis( id )
assert GetActiveGeometryAnalysis() == id, "SetActiveGeometryAnalysis did not take"
DeleteGeometryAnalysis( id )
# The case that was active is gone, so nothing is active.
assert GetActiveGeometryAnalysis() != id, "DeleteGeometryAnalysis did not delete the case"
See also: AddGeometryAnalysis
:param [in]: id string Geometry analysis case ID
"""
return _vsp.DeleteGeometryAnalysis(id)
[docs]
def DeleteAllGeometryAnalyses():
r"""
Delete all Geometry Analysis cases from the Geometry Analysis Manager.
.. code-block:: python
##==== 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
"""
return _vsp.DeleteAllGeometryAnalyses()
[docs]
def GetAllGeometryAnalysesIDVec():
r"""
Get a vector of all Geometry Analysis case IDs in the Geometry Analysis Manager.
.. code-block:: python
##==== 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
"""
return _vsp.GetAllGeometryAnalysesIDVec()
[docs]
def SetActiveGeometryAnalysis(id):
r"""
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.
.. code-block:: python
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)
"""
return _vsp.SetActiveGeometryAnalysis(id)
[docs]
def GetActiveGeometryAnalysis():
r"""
Get the ID of the active Geometry Analysis case.
.. code-block:: python
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)
"""
return _vsp.GetActiveGeometryAnalysis()
[docs]
def MakeMeshGeom(ga_id):
r"""
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.
.. code-block:: python
#==== 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
"""
return _vsp.MakeMeshGeom(ga_id)
[docs]
def SummarizeAttributes():
r"""
Print a tab-delimited summary of all Attributes in the vehicle, denoting Name, Type, Data, Description, and path from Root of vehicle to Attribute
.. code-block:: python
##==== Attributes: SummarizeAttributes ====##
SummaryText = SummarizeAttributes()
assert len( SummaryText ) > 0, "SummarizeAttributes returned no id"
print( SummaryText )
:rtype: string
:return: string Tab-delimited summary of all Attributes in vehicle
"""
return _vsp.SummarizeAttributes()
[docs]
def SummarizeAttributesAsTree():
r"""
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
.. code-block:: python
##==== Attributes: SummarizeAttributesAsTree ====##
SummaryTextTree = SummarizeAttributesAsTree();
assert len( SummaryTextTree ) > 0, "SummarizeAttributesAsTree returned no id"
print( SummaryTextTree )
:rtype: string
:return: string Plain-text attribute tree of vehicle
"""
return _vsp.SummarizeAttributesAsTree()
[docs]
def FindAllAttributes():
r"""
Returns a vector of string IDs for all Attributes in the vehicle
.. code-block:: python
##==== Attributes: FindAllAttributes ====##
AttrIDs = FindAllAttributes()
assert len( AttrIDs ) > 0, "FindAllAttributes found nothing"
for AttrID in AttrIDs:
print( AttrID )
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector <string> Vector of All Attribute IDs
"""
return _vsp.FindAllAttributes()
[docs]
def FindAttributesByName(search_str):
r"""
Returns all attributes that contain the string search_str within their name, case insensitive
.. code-block:: python
##==== Attributes: FindAttributesByName ====##
AttrIDs = FindAttributesByName( "Watermark" )
assert len( AttrIDs ) > 0, "FindAttributesByName found nothing"
for AttrID in AttrIDs:
print( AttrID )
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector <string> Vector of string IDs of matching Attributes
:param [in]: search_str string for filtering attributes in model
"""
return _vsp.FindAttributesByName(search_str)
[docs]
def FindAttributeByName(search_str, index):
r"""
Searches all attributes that contain the search string, case insensitive, and returns the user-specified index
.. code-block:: python
##==== Attributes: FindAttributeByName ====##
AttrID = FindAttributeByName( "Watermark", 0 )
assert len( AttrID ) > 0, "FindAttributeByName found nothing"
print( AttrID )
:rtype: string
:return: string Returns a StringID of the attribute indexed/searched by user, if found
:param [in]: search_str string for filtering attributes in model
:param [in]: index int for indexing which of the vector of found attributes to select
"""
return _vsp.FindAttributeByName(search_str, index)
[docs]
def FindAttributeInCollection(obj_id, search_str, index):
r"""
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.
.. code-block:: python
##==== Attributes: FindAttributeInCollection ====##
VehID = GetVehicleID()
AttrID = FindAttributeInCollection( VehID, 'Watermark', 0 )
assert len( AttrID ) > 0, "FindAttributeInCollection found nothing"
print( AttrID )
:rtype: string
:return: string Returns a StringID of the attribute indexed/searched by user, if found
:param [in]: obj_id string id of object to search within for attributes
:param [in]: search_str string for filtering attributes in object
:param [in]: index int for indexing which of the vector of found attributes to select
"""
return _vsp.FindAttributeInCollection(obj_id, search_str, index)
[docs]
def FindAttributeNamesInCollection(collID):
r"""
Return a list of all attribute Names within an attribute collection
.. code-block:: python
##==== Attributes: FindAttributeNamesInCollection ====##
VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
AttrNames = FindAttributeNamesInCollection( CollID )
assert len( AttrNames ) > 0, "FindAttributeNamesInCollection found nothing"
for AttrName in AttrNames:
print( AttrName )
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<string> Array of result names
:param [in]: collID string ID of an attribute collection
"""
return _vsp.FindAttributeNamesInCollection(collID)
[docs]
def FindAttributesInCollection(collID):
r"""
Get all attribute IDs within a single AttributeCollection, referenced by collID
.. code-block:: python
##==== Attributes: FindAttributesInCollection ====##
VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
AttrIDs = FindAttributesInCollection( CollID )
assert len( AttrIDs ) > 0, "FindAttributesInCollection found nothing"
for AttrID in AttrIDs:
print( AttrID )
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<string> Vector of attribute IDs in an attribute collection.
:param [in]: collID string ID of an attribute collection
"""
return _vsp.FindAttributesInCollection(collID)
[docs]
def FindAttributedObjects():
r"""
Get array of IDs of all OpenVSP entities that have populated attributeCollections
Includes attributeGroups
.. code-block:: python
##==== Attributes: FindAttributedObjects ====##
AttachIDs = FindAttributedObjects()
assert len( AttachIDs ) > 0, "FindAttributedObjects found nothing"
for AttachID in AttachIDs:
print( AttachID )
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<string> Array of IDs of entities in OpenVSP that contain populated attribute collections
"""
return _vsp.FindAttributedObjects()
[docs]
def GetObjectType(attachID):
r"""
Get the type of an OpenVSP Entity by ID
.. code-block:: python
##==== 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
:rtype: int
:return: int return string of object name
:param [in]: attachID string ID of an OpenVSP object
"""
return _vsp.GetObjectType(attachID)
[docs]
def GetObjectTypeName(attachID):
r"""
Get the named type of an OpenVSP Entity by ID
.. code-block:: python
AttachIDs = FindAttributedObjects()
for AttachID in AttachIDs:
ObjTypeName = GetObjectTypeName( AttachID )
assert len( ObjTypeName ) > 0, "GetObjectTypeName returned nothing"
print( ObjTypeName )
:rtype: string
:return: string return string of object name
:param [in]: attachID string ID of an OpenVSP object
"""
return _vsp.GetObjectTypeName(attachID)
[docs]
def GetObjectName(attachID):
r"""
Get the name of an OpenVSP Entity by ID
.. code-block:: python
##==== Attributes: GetObjectName ====##
AttachIDs = FindAttributedObjects()
for AttachID in AttachIDs:
ObjName = GetObjectName( AttachID )
assert len( ObjName ) > 0, "GetObjectName returned nothing"
print( ObjName )
:rtype: string
:return: string return string of object name
:param [in]: attachID string ID of an OpenVSP object
"""
return _vsp.GetObjectName(attachID)
[docs]
def GetObjectParent(id):
r"""
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.
.. code-block:: python
##==== 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 )
:rtype: string
:return: string ID of object parent
"""
return _vsp.GetObjectParent(id)
[docs]
def GetChildCollection(attachID):
r"""
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
.. code-block:: python
##==== Attributes: GetChildCollection =====##
VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
assert len( CollID ) > 0, "GetChildCollection returned nothing"
print( CollID )
:rtype: string
:return: string String ID of attribute collection associated with the attachID
:param [in]: attachID string ID of an OpenVSP object
"""
return _vsp.GetChildCollection(attachID)
[docs]
def GetGeomSetCollection(index):
r"""
Get collection ID from a vehicle's GeomSet
.. code-block:: python
##==== Attributes: GetGeomSetCollection =====##
CollID = GetGeomSetCollection( 0 )
assert len( CollID ) > 0, "GetGeomSetCollection returned nothing"
print( CollID )
:rtype: string
:return: string String ID of attribute collection associated with the geom set
:param [in]: index int Geom set
"""
return _vsp.GetGeomSetCollection(index)
[docs]
def GetAttributeName(attrID):
r"""
Return the name of an attribute by its ID
.. code-block:: python
##==== Attributes: GetAttributeName =====##
AttrIDs = FindAllAttributes()
for AttrID in AttrIDs:
AttrName = GetAttributeName( AttrID )
assert len( AttrName ) > 0, "GetAttributeName returned nothing"
print( AttrName )
:param [in]: attrID string ID of an attribute
:rtype: string
:return: string name of attribute
"""
return _vsp.GetAttributeName(attrID)
[docs]
def GetAttributeID(collID, attributeName, index):
r"""
Return the ID of an attribute by its name and collection ID
.. code-block:: python
##==== 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 )
:rtype: string
:return: string String ID of attribute based on collectionID and name
:param [in]: collID string ID of an attribute collection
:param [in]: attributeName string name of an attribute in that collection
:param [in]: index int index of attribute in collection
"""
return _vsp.GetAttributeID(collID, attributeName, index)
[docs]
def GetAttributeDoc(attrID):
r"""
Return string doc of attribute by its ID
.. code-block:: python
##==== Attributes: GetAttributeDoc =====##
AttrID = FindAllAttributes()[0]
AttrDoc = GetAttributeDoc(AttrID)
assert len( AttrDoc ) > 0, "GetAttributeDoc returned nothing"
print( AttrDoc )
:rtype: string
:return: string Return string doc of attribute by its ID
:param [in]: attrID string ID of attribute
"""
return _vsp.GetAttributeDoc(attrID)
[docs]
def GetAttributeType(attrID):
r"""
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
.. code-block:: python
##==== 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()
:rtype: int
:return: int Int type of attribute
:param [in]: attrID string ID of attribute
"""
return _vsp.GetAttributeType(attrID)
[docs]
def GetAttributeTypeName(attrID):
r"""
Get the attribute's type as a string
.. code-block:: python
##==== Attributes: GetAttributeTypeName =====##
AttrID = FindAllAttributes()[0]
AttributeTypeName = GetAttributeTypeName( AttrID )
assert len( AttributeTypeName ) > 0, "GetAttributeTypeName returned nothing"
print( AttributeTypeName )
:rtype: string
:return: string Type of attribute as string
:param [in]: attrID string ID of attribute
"""
return _vsp.GetAttributeTypeName(attrID)
[docs]
def GetAttributeBoolVal(attrID):
r"""
Get the boolean value of a bool-type attribute
.. code-block:: python
##==== 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!"
:rtype: std::vector< int,std::allocator< int > >
:return: vector<int> Bool value of attribute
:param [in]: attrID string ID of attribute
"""
return _vsp.GetAttributeBoolVal(attrID)
[docs]
def GetAttributeIntVal(attrID):
r"""
Get the integer value of an int-type attribute
.. code-block:: python
##==== 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!"
:rtype: std::vector< int,std::allocator< int > >
:return: vector<int> Int value of attribute
:param [in]: attrID string ID of attribute
"""
return _vsp.GetAttributeIntVal(attrID)
[docs]
def GetAttributeDoubleVal(attrID):
r"""
Get the double value of a double-type attribute
.. code-block:: python
##==== 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!"
:rtype: std::vector< double,std::allocator< double > >
:return: vector<double> Double value of attribute
:param [in]: attrID string ID of attribute
"""
return _vsp.GetAttributeDoubleVal(attrID)
[docs]
def GetAttributeStringVal(attrID):
r"""
Get the string value of a string-type attribute
.. code-block:: python
##==== 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!"
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<string> String value of attribute
:param [in]: attrID string ID of attribute
"""
return _vsp.GetAttributeStringVal(attrID)
[docs]
def GetAttributeParmID(attrID):
r"""
Get the parm value of a parm-type attribute
.. code-block:: python
##==== 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!"
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<string> Parm value of attribute
:param [in]: attrID string ID of attribute
"""
return _vsp.GetAttributeParmID(attrID)
[docs]
def GetAttributeParmVal(attrID):
r"""
Get the parm value of a parm-type attribute
.. code-block:: python
##==== 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!"
:rtype: std::vector< double,std::allocator< double > >
:return: vector <double> Parm value of attribute
:param [in]: attrID string ID of attribute
"""
return _vsp.GetAttributeParmVal(attrID)
[docs]
def GetAttributeParmName(attrID):
r"""
Get the name of the referenced parm of a parm-type attribute
.. code-block:: python
##==== 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!"
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector <string> Parm name of attribute
:param [in]: attrID string ID of attribute
"""
return _vsp.GetAttributeParmName(attrID)
[docs]
def GetAttributeVec3dVal(attrID):
r"""
Get the vec3d value of a string-type attribute
.. code-block:: python
##==== 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!"
:rtype: std::vector< vec3d,std::allocator< vec3d > >
:return: vector<vec3d> Vec3d value of attribute
:param [in]: attrID string ID of attribute
"""
return _vsp.GetAttributeVec3dVal(attrID)
[docs]
def GetAttributeIntMatrixVal(attrID):
r"""
Get the Int Matrix of an Int-matrix-type attribute
.. code-block:: python
##==== 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!"
:rtype: std::vector< std::vector< int,std::allocator< int > >,std::allocator< std::vector< int,std::allocator< int > > > >
:return: vector<vector <int\>> Int Matrix value of attribute as vector < vector < int > >
:param [in]: attrID string ID of attribute
"""
return _vsp.GetAttributeIntMatrixVal(attrID)
[docs]
def GetAttributeDoubleMatrixVal(attrID):
r"""
Get the Double Matrix of an Double-matrix-type attribute
.. code-block:: python
##==== 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!"
:rtype: std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > >
:return: vector<vector <double\>> Double Matrix value of attribute as vector < vector < Double > >
:param [in]: attrID string ID of attribute
"""
return _vsp.GetAttributeDoubleMatrixVal(attrID)
[docs]
def SetAttributeName(attrID, name):
r"""
Set the name of an Attribute by ID
.. code-block:: python
##==== 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!"
:param [in]: attrID string of attribute ID
:param [in]: name string name for attribute
"""
return _vsp.SetAttributeName(attrID, name)
[docs]
def SetAttributeDoc(attrID, doc):
r"""
Set the docstring of an Attribute by ID
.. code-block:: python
##==== 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!"
:param [in]: attrID string of attribute ID
:param [in]: doc string of documentation for attribute
"""
return _vsp.SetAttributeDoc(attrID, doc)
[docs]
def SetAttributeBool(attrID, value):
r"""
Set the Bool value of a bool-type Attribute by ID
.. code-block:: python
##==== 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!"
:param [in]: attrID string of attribute ID
:param [in]: value bool boolean value for attribute
"""
return _vsp.SetAttributeBool(attrID, value)
[docs]
def SetAttributeInt(attrID, value):
r"""
Set the Int value of an int-type Attribute by ID
.. code-block:: python
##==== 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!"
:param [in]: attrID string of attribute ID
:param [in]: value int value for attribute
"""
return _vsp.SetAttributeInt(attrID, value)
[docs]
def SetAttributeDouble(attrID, value):
r"""
Set the Double value of a double-type Attribute by ID
.. code-block:: python
##==== 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!"
:param [in]: attrID string of attribute ID
:param [in]: value double value for attribute
"""
return _vsp.SetAttributeDouble(attrID, value)
[docs]
def SetAttributeString(attrID, value):
r"""
Set the String value of a string-type Attribute by ID
.. code-block:: python
##==== 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!"
:param [in]: attrID string of attribute ID
:param [in]: value string value for attribute
"""
return _vsp.SetAttributeString(attrID, value)
[docs]
def SetAttributeParmID(attrID, value):
r"""
Set the ParmID value of a Parm-type Attribute by ID
.. code-block:: python
##==== 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!"
:param [in]: attrID string of attribute ID
:param [in]: value string value for attribute
"""
return _vsp.SetAttributeParmID(attrID, value)
[docs]
def SetAttributeVec3d(attrID, value):
r"""
Set the Vec3d value of a Vec3d-type Attribute by ID
.. code-block:: python
##==== 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!"
:param [in]: attrID string of attribute ID
:param [in]: value vec3d value for attribute
"""
return _vsp.SetAttributeVec3d(attrID, value)
[docs]
def SetAttributeIntMatrix(attrID, value):
r"""
Set the int matrix of a int-matrix-type Attribute by ID
.. code-block:: python
##==== 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!"
:param [in]: attrID string of attribute ID
:param [in]: value int matrix value for attribute
"""
return _vsp.SetAttributeIntMatrix(attrID, value)
[docs]
def SetAttributeDoubleMatrix(attrID, value):
r"""
Set the double matrix of a double-matrix-type Attribute by ID
.. code-block:: python
##==== 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!"
:param [in]: attrID string of attribute ID
:param [in]: value double matrix value for attribute
"""
return _vsp.SetAttributeDoubleMatrix(attrID, value)
[docs]
def DeleteAttribute(attrID):
r"""
Delete attribute by attribute ID
.. code-block:: python
##==== 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!"
:param [in]: attrID string of attribute ID
"""
return _vsp.DeleteAttribute(attrID)
[docs]
def AddAttributeBool(collID, attributeName, value):
r"""
Add a boolean attribute by name to an attribute collection
.. code-block:: python
##==== 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!"
:param [in]: collID string ID of attribute collection
:param [in]: attributeName string name of new attribute
:param [in]: value bool boolean value of new attribute
"""
return _vsp.AddAttributeBool(collID, attributeName, value)
[docs]
def AddAttributeInt(collID, attributeName, value):
r"""
Add a integer attribute by name to an attribute collection
.. code-block:: python
##==== 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!"
:param [in]: collID string ID of attribute collection
:param [in]: attributeName string name of new attribute
:param [in]: value int integer value of new attribute
"""
return _vsp.AddAttributeInt(collID, attributeName, value)
[docs]
def AddAttributeDouble(collID, attributeName, value):
r"""
Add a double attribute by name to an attribute collection
.. code-block:: python
##==== 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!"
:param [in]: collID string ID of attribute collection
:param [in]: attributeName string name of new attribute
:param [in]: value double value of new attribute
"""
return _vsp.AddAttributeDouble(collID, attributeName, value)
[docs]
def AddAttributeString(collID, attributeName, value):
r"""
Add a string attribute by name to an attribute collection
.. code-block:: python
##==== 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!"
:param [in]: collID string ID of attribute collection
:param [in]: attributeName string name of new attribute
:param [in]: value string value of new attribute
"""
return _vsp.AddAttributeString(collID, attributeName, value)
[docs]
def AddAttributeParm(collID, attributeName, parmID):
r"""
Add a parm attribute by name to an attribute collection
.. code-block:: python
##==== 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!"
:param [in]: collID string ID of attribute collection
:param [in]: attributeName string name of new attribute
:param [in]: parmID string Parm ID to add to attribute
"""
return _vsp.AddAttributeParm(collID, attributeName, parmID)
[docs]
def AddAttributeVec3d(collID, attributeName, value):
r"""
Add a Vec3d attribute by name to an attribute collection
use vec3d() to create a vec3d object to pass into the args!
.. code-block:: python
##==== 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!"
:param [in]: collID string ID of attribute collection
:param [in]: attributeName string name of new attribute
:param [in]: value vector <vec3d> Vec3d value of new attribute
"""
return _vsp.AddAttributeVec3d(collID, attributeName, value)
[docs]
def AddAttributeIntMatrix(collID, attributeName, value):
r"""
Add an Int Matrix attribute by name to an attribute collection
use nested vectors/arrays of ints for matrix argument
.. code-block:: python
##==== 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!"
:param [in]: collID string ID of attribute collection
:param [in]: attributeName string name of new attribute
:param [in]: value int matrix value of new attribute
"""
return _vsp.AddAttributeIntMatrix(collID, attributeName, value)
[docs]
def AddAttributeDoubleMatrix(collID, attributeName, value):
r"""
Add an Double Matrix attribute by name to an attribute collection
use nested vectors/arrays of ints for matrix argument
.. code-block:: python
##==== 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!"
:param [in]: collID string ID of attribute collection
:param [in]: attributeName string name of new attribute
:param [in]: value vector <vector <double>> Double matrix value of new attribute
"""
return _vsp.AddAttributeDoubleMatrix(collID, attributeName, value)
[docs]
def AddAttributeGroup(collID, attributeName):
r"""
Add an empty Attribute Group-type attribute by name to an attribute collection
.. code-block:: python
##==== 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!"
:param [in]: collID string ID of attribute collection
:param [in]: attributeName string name of new attribute group
"""
return _vsp.AddAttributeGroup(collID, attributeName)
[docs]
def CopyAttribute(attrID):
r"""
Copy an attribute to the clipboard by attributeID
.. code-block:: python
##==== 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!"
:param [in]: attrID string ID of attribute to be copied
"""
return _vsp.CopyAttribute(attrID)
[docs]
def CutAttribute(attrID):
r"""
Cut an attribute from its collection to the clipboard by attributeID
.. code-block:: python
##==== 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!"
:param [in]: attrID string ID of attribute to be copied
"""
return _vsp.CutAttribute(attrID)
[docs]
def PasteAttribute(coll_id):
r"""
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
.. code-block:: python
##==== 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!"
:param [in]: coll_id string ID of destination for pasting attribute into
"""
return _vsp.PasteAttribute(coll_id)
[docs]
def GetAllResultsNames():
r"""
Get the name of all results in the Results Manager
.. code-block:: python
#==== 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 )
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<string> Array of result names
"""
return _vsp.GetAllResultsNames()
[docs]
def GetAllDataNames(results_id):
r"""
Get all data names for a particular result
.. code-block:: python
#==== 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"
:param [in]: results_id string Result ID
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<string> Array of result names
"""
return _vsp.GetAllDataNames(results_id)
[docs]
def GetNumResults(name):
r"""
Get the number of results for a particular result name
.. code-block:: python
#==== Write Some Fake Test Results =====//
WriteTestResults()
if ( GetNumResults( "Test_Results" ) != 2 ):
print( "---> Error: API GetNumResults" )
assert False, "---> Error: API GetNumResults"
:param [in]: name string Input name
:rtype: int
:return: int Number of results
"""
return _vsp.GetNumResults(name)
[docs]
def GetResultsName(results_id):
r"""
Get the name of a result given its ID
.. code-block:: python
#==== 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"
:param [in]: results_id string Result ID
:rtype: string
:return: string Result name
"""
return _vsp.GetResultsName(results_id)
[docs]
def GetResultsSetDoc(results_id):
r"""
Get the documentation string for a result given its ID
.. code-block:: python
#==== 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"
:param [in]: results_id string Result ID
:rtype: string
:return: string Result documentation string
"""
return _vsp.GetResultsSetDoc(results_id)
[docs]
def GetResultsEntryDoc(results_id, data_name):
r"""
Get the documentation string for one entry of a results object.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
rid = ExecAnalysis( "CompGeom" )
name_array = GetAllDataNames( rid )
if len( name_array ) > 0:
doc = GetResultsEntryDoc( rid, name_array[0] )
assert len( doc ) > 0, "GetResultsEntryDoc returned nothing"
See also: GetResultsDoc, GetAllDataNames
:param [in]: results_id string Results ID
:param [in]: data_name string Name of the entry in that results object
:rtype: string
:return: string Documentation for that entry
"""
return _vsp.GetResultsEntryDoc(results_id, data_name)
[docs]
def FindResultsID(name, index=0):
r"""
Find a results ID given its name and index
.. code-block:: python
#==== 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"
:param [in]: name string Result name
:param [in]: index int Result index
:rtype: string
:return: string Result ID
"""
return _vsp.FindResultsID(name, index)
[docs]
def FindLatestResultsID(name):
r"""
Find the latest results ID for particular result name
.. code-block:: python
#==== 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 )
:param [in]: name string Result name
:rtype: string
:return: string Result ID
"""
return _vsp.FindLatestResultsID(name)
[docs]
def GetNumData(results_id, data_name):
r"""
Get the number of data values for a given result ID and data name
.. code-block:: python
#==== 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"
:param [in]: results_id string Result ID
:param [in]: data_name string Data name
:rtype: int
:return: int Number of data values
"""
return _vsp.GetNumData(results_id, data_name)
[docs]
def GetResultsType(results_id, data_name):
r"""
Get the data type for a given result ID and data name
.. code-block:: python
#==== 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)
"""
return _vsp.GetResultsType(results_id, data_name)
[docs]
def GetIntResults(id, name, index=0):
r"""
Get all integer values for a particular result, name, and index
.. code-block:: python
#==== 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"
:param [in]: id string Result ID
:param [in]: name string Data name
:param [in]: index int Data index
:rtype: std::vector< int,std::allocator< int > >
:return: vector<int> Array of data values
"""
return _vsp.GetIntResults(id, name, index)
[docs]
def GetDoubleResults(id, name, index=0):
r"""
Get all double values for a particular result, name, and index
.. code-block:: python
#==== 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"
:param [in]: id string Result ID
:param [in]: name string Data name
:param [in]: index int Data index
:rtype: std::vector< double,std::allocator< double > >
:return: vector<double> Array of data values
"""
return _vsp.GetDoubleResults(id, name, index)
[docs]
def GetDoubleMatResults(id, name, index=0):
r"""
Get all matrix (vector<vector<double>>) values for a particular result, name, and index
.. code-block:: python
pid = AddGeom( "POD" )
Update()
rid = ExecAnalysis( "CompGeom" )
for name in GetAllDataNames( rid ):
if GetResultsType( rid, name ) == DOUBLE_MATRIX_DATA:
mat = GetDoubleMatResults( rid, name )
assert len( mat ) > 0, "GetDoubleMatResults returned nothing"
: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
"""
return _vsp.GetDoubleMatResults(id, name, index)
[docs]
def GetStringResults(id, name, index=0):
r"""
Get all string values for a particular result, name, and index
.. code-block:: python
#==== 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"
:param [in]: id string Result ID
:param [in]: name string Data name
:param [in]: index int Data index
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<string> Array of data values
"""
return _vsp.GetStringResults(id, name, index)
[docs]
def GetVec3dResults(id, name, index=0):
r"""
Get all vec3d values for a particular result, name, and index
.. code-block:: python
#==== 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() )
:param [in]: id string Result ID
:param [in]: name string Data name
:param [in]: index int Data index
:rtype: std::vector< vec3d,std::allocator< vec3d > >
:return: vector<vec3d> Array of data values
"""
return _vsp.GetVec3dResults(id, name, index)
[docs]
def CreateGeomResults(geom_id, name):
r"""
Create a new result for a Geom
.. code-block:: python
#==== 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"
:param [in]: geom_id string Geom ID
:param [in]: name string Result name
:rtype: string
:return: string Result ID
"""
return _vsp.CreateGeomResults(geom_id, name)
[docs]
def DeleteAllResults():
r"""
Delete all results
.. code-block:: python
#==== 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"
"""
return _vsp.DeleteAllResults()
[docs]
def DeleteResult(id):
r"""
Delete a particular result
.. code-block:: python
#==== 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"
:param [in]: id string Result ID
"""
return _vsp.DeleteResult(id)
[docs]
def WriteResultsCSVFile(id, file_name):
r"""
Export a result to CSV
.. code-block:: python
# 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"
:param [in]: id string Rsult ID
:param [in]: file_name string CSV output file name
"""
return _vsp.WriteResultsCSVFile(id, file_name)
[docs]
def PrintResults(results_id):
r"""
Print a result's name value pairs to stdout
.. code-block:: python
# 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"
:param [in]: results_id string Result ID
"""
return _vsp.PrintResults(results_id)
[docs]
def PrintResultsDocs(results_id):
r"""
Print a result's names and documentation to stdout
.. code-block:: python
# 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"
:param [in]: results_id string Result ID
"""
return _vsp.PrintResultsDocs(results_id)
[docs]
def WriteTestResults():
r"""
Generate some example results for testing.
.. code-block:: python
#==== 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"
"""
return _vsp.WriteTestResults()
[docs]
def InitGUI():
r"""
Low level routine that should be called to set up GUI before running StartGUI()
.. code-block:: python
InitGUI()
"""
return _vsp.InitGUI()
[docs]
def StartGUI():
r"""
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.
.. code-block:: python
StartGUI()
"""
return _vsp.StartGUI()
[docs]
def StopGUI():
r"""
Stop OpenVSP GUI event loop and hide screens. Keep OpenVSP running and in memory.
.. code-block:: python
StartGUI()
StopGUI()
StartGUI()
See also: StartGUI
"""
return _vsp.StopGUI()
[docs]
def UpdateGUI():
r"""
Tell OpenVSP that the GUI needs to be updated.
.. code-block:: python
StartGUI()
pod_id = AddGeom( "POD" )
length = FindParm( pod_id, "Length", "Design" )
SetParmVal( length, 13.0 )
UpdateGUI()
See also: StartGUI
"""
return _vsp.UpdateGUI()
[docs]
def IsGUIBuild():
r"""
Test if the current OpenVSP build includes graphics capabilities.
.. code-block:: python
if ( IsGUIBuild() ):
print( "OpenVSP build is graphics capable." )
else:
print( "OpenVSP build is not graphics capable." )
:rtype: boolean
:return: bool True if the current OpenVSP build includes graphics capabilities. False otherwise.
"""
return _vsp.IsGUIBuild()
[docs]
def Lock():
r"""
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.
.. code-block:: python
StartGUI()
pod_id = AddGeom( "POD" )
Lock()
rid = ExecAnalysis( "CompGeom" )
mesh_id_vec = GetStringResults( rid, "Mesh_GeomID" )
DeleteGeomVec( mesh_id_vec )
Unlock()
See also: Unlock
"""
return _vsp.Lock()
[docs]
def Unlock():
r"""
Release the lock on the OpenVSP GUI event loop.
.. code-block:: python
StartGUI()
pod_id = AddGeom( "POD" )
Lock()
rid = ExecAnalysis( "CompGeom" )
mesh_id_vec = GetStringResults( rid, "Mesh_GeomID" )
DeleteGeomVec( mesh_id_vec )
Unlock()
See also: Lock
"""
return _vsp.Unlock()
[docs]
def IsEventLoopRunning():
r"""
Test if the OpenVSP GUI event loop is running.
.. code-block:: python
StartGUI()
if ( IsEventLoopRunning() ):
print( "Event loop is running." )
:rtype: boolean
:return: bool True if the OpenVSP GUI event loop is running. False otherwise.
"""
return _vsp.IsEventLoopRunning()
[docs]
def ScreenGrab(fname, w, h, transparentBG, autocrop=False):
r"""
Capture the specified screen and save to file. Note, VSP_USE_FLTK must be defined
.. code-block:: python
screenw = 2000 # Set screenshot width and height
screenh = 2000
fname = "test_screen_grab.png"
ScreenGrab( fname, screenw, screenh, True, True ) # Take PNG screenshot
:param [in]: fname string Output file name
:param [in]: w int Width of screen grab
:param [in]: h int Height of screen grab
:param [in]: transparentBG bool Transparent background flag
:param [in]: autocrop bool Automatically crop transparent background flag
"""
return _vsp.ScreenGrab(fname, w, h, transparentBG, autocrop)
[docs]
def SetViewAxis(vaxis):
r"""
Toggle viewing the axis
.. code-block:: python
SetViewAxis( False ) # Turn off axis marker in corner of viewscreen
:param [in]: vaxis bool True to show the axis, false to hide the axis
"""
return _vsp.SetViewAxis(vaxis)
[docs]
def SetShowBorders(brdr):
r"""
Toggle viewing the border frame
.. code-block:: python
SetShowBorders( False ) # Turn off red/black border on active window
:param [in]: brdr bool True to show the border frame, false to hide the border frame
"""
return _vsp.SetShowBorders(brdr)
[docs]
def SetGeomDrawType(geom_id, type):
r"""
Set the draw type of the specified geometry
.. code-block:: python
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)
"""
return _vsp.SetGeomDrawType(geom_id, type)
[docs]
def SetGeomWireColor(geom_id, r, g, b):
r"""
Set the wireframe color of the specified geometry
.. code-block:: python
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()
:param [in]: geom_id string Geom ID
:param [in]: r int Red component of color [0, 255]
:param [in]: g int Green component of color [0, 255]
:param [in]: b int Blue component of color [0, 255]
"""
return _vsp.SetGeomWireColor(geom_id, r, g, b)
[docs]
def SetGeomDisplayType(geom_id, type):
r"""
Set the display type of the specified geometry
.. code-block:: python
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)
"""
return _vsp.SetGeomDisplayType(geom_id, type)
[docs]
def GetGeomDrawType(geom_id):
r"""
Set the visualization material the specified geometry
.. code-block:: python
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()
:param [in]: geom_id string Geom ID
:param [in]: name string Material name
Get the draw type of the specified geometry
.. code-block:: python
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)
"""
return _vsp.GetGeomDrawType(geom_id)
[docs]
def GetGeomDisplayType(geom_id):
r"""
Get the display type of the specified geometry
.. code-block:: python
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)
"""
return _vsp.GetGeomDisplayType(geom_id)
[docs]
def GetGeomWireColor(geom_id):
r"""
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].
.. code-block:: python
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: :py:class:`vec3d`
:return: vec3d Red, green and blue components of the wireframe color
"""
return _vsp.GetGeomWireColor(geom_id)
[docs]
def GetGeomMaterialName(geom_id):
r"""
Get the name of the visualization material applied to the specified geometry
.. code-block:: python
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
"""
return _vsp.GetGeomMaterialName(geom_id)
[docs]
def SetGeomMaterialName(geom_id, name):
r"""
Set the material a Geom is drawn with, by name. The name must be one of the materials in the
material library.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
SetGeomMaterialName( pid, "Aluminum" )
See also: AddMaterial
:param [in]: geom_id string Geom ID
:param [in]: name string Material name
"""
return _vsp.SetGeomMaterialName(geom_id, name)
[docs]
def AddMaterial(name, ambient, diffuse, specular, emissive, alpha, shininess):
r"""
Set the visualization material the specified geometry
.. code-block:: python
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()
:param [in]: name string Material name
:param [in]: ambient vec3d Ambient color RGB triple on scale [0, 255]
:param [in]: diffuse vec3d Diffuse color RGB triple on scale [0, 255]
:param [in]: specular vec3d Specular color RGB triple on scale [0, 255]
:param [in]: emissive vec3d Emissive color RGB triple on scale [0, 255]
:param [in]: shininess double Shininess exponent on scale [0, 127]
:param [in]: alpha double Transparency factor on scale [0, 1]
"""
return _vsp.AddMaterial(name, ambient, diffuse, specular, emissive, alpha, shininess)
[docs]
def GetMaterialNames():
r"""
Get the names of all visualization materials
.. code-block:: python
mat_array = GetMaterialNames()
assert len( mat_array ) > 0, "GetMaterialNames returned nothing"
for i in range(int( len(mat_array) )):
print( mat_array[i] )
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<string> Array of material names
"""
return _vsp.GetMaterialNames()
[docs]
def GetNumLights():
r"""
Get the number of lights in the model. The count is fixed: a model always has the same
lights, each one either active or not.
.. code-block:: python
#==== A model always has the same number of lights ====#
assert GetNumLights() > 0, "GetNumLights did not count the lights"
#==== Every one of them answers ====#
for i in range( GetNumLights() ):
assert len( FindLight( i ) ) > 0, "FindLight found nothing"
See also: FindLight
:rtype: int
:return: int Number of lights
"""
return _vsp.GetNumLights()
[docs]
def FindLight(index):
r"""
Get the ID of a light, so that its Parms can be reached the way any other container's are.
A light has an ActiveFlag, a position and ambient, diffuse and specular strengths, all in
Parm group "Light_Parm".
.. code-block:: python
#==== Take the first light and put it somewhere of its own ====#
light_id = FindLight( 0 )
assert len( light_id ) > 0, "FindLight found nothing"
SetParmVal( FindParm( light_id, "ActiveFlag", "Light_Parm" ), 1.0 )
SetParmVal( FindParm( light_id, "X", "Light_Parm" ), 12.0 )
Update()
moved = GetParmVal( light_id, "X", "Light_Parm" )
assert abs( moved - 12.0 ) < 1e-6, "the light did not take the position it was given"
#==== Asking for one that is not there is refused. The error queue is reached through
#==== the error manager singleton in Python, and is drained first so the count below is
#==== about that call and not about anything before it.
err_mgr = ErrorMgrSingleton.getInstance()
while err_mgr.GetNumTotalErrors() > 0 :
drained = err_mgr.PopLastError()
FindLight( GetNumLights() )
assert err_mgr.GetNumTotalErrors() > 0, "FindLight answered for a light that does not exist"
# That error was raised deliberately, so take it back off the queue.
while err_mgr.GetNumTotalErrors() > 0 :
err = err_mgr.PopLastError()
See also: GetNumLights
:param [in]: index int Light index
:rtype: string
:return: string Light ID
"""
return _vsp.FindLight(index)
[docs]
def SetBackground(r, g, b):
r"""
Set the background color
.. code-block:: python
SetBackground( 1.0, 1.0, 1.0 ) # Set background to bright white
:param [in]: r double Red 8-bit unsigned integer (range: 0-255)
:param [in]: g double Green 8-bit unsigned integer (range: 0-255)
:param [in]: b double Blue 8-bit unsigned integer (range: 0-255)
"""
return _vsp.SetBackground(r, g, b)
[docs]
def SetAllViews(view):
r"""
Set the view of all viewports
.. code-block:: python
SetAllViews( CAM_CENTER )
:param [in]: view int CAMERA_VIEW enum
"""
return _vsp.SetAllViews(view)
[docs]
def SetView(viewport, view):
r"""
Set the view of a particular viewports
.. code-block:: python
SetView( 0, CAM_CENTER )
:param [in]: viewport int Viewport to set view
:param [in]: view int CAMERA_VIEW enum
"""
return _vsp.SetView(viewport, view)
[docs]
def FitAllViews():
r"""
Fit contents to all viewports
.. code-block:: python
FitAllViews()
"""
return _vsp.FitAllViews()
[docs]
def ResetViews():
r"""
Reset views of all viewports
.. code-block:: python
ResetViews()
"""
return _vsp.ResetViews()
[docs]
def SetWindowLayout(r, c):
r"""
Set the rows and columns of the window layout
.. code-block:: python
SetWindowLayout( 2, 2 )
:param [in]: r int Number of viewport rows
:param [in]: c int Number of viewport columns
"""
return _vsp.SetWindowLayout(r, c)
[docs]
def SetGUIElementDisable(e, state):
r"""
Set whether all instances of GUI device type are disabled
.. code-block:: python
SetGUIElementDisable( GDEV_INPUT, True )
:param [in]: e int GDEV enum for GUI device type
:param [in]: state bool True to disable GUI device type
"""
return _vsp.SetGUIElementDisable(e, state)
[docs]
def SetGUIScreenDisable(s, state):
r"""
Set whether screen is disabled
.. code-block:: python
SetGUIScreenDisable( VSP_CFD_MESH_SCREEN, True )
:param [in]: s int GUI_VSP_SCREEN enum for screen
:param [in]: state bool True to disable screen
"""
return _vsp.SetGUIScreenDisable(s, state)
[docs]
def SetGeomScreenDisable(s, state):
r"""
Set whether geom screen is disabled
.. code-block:: python
SetGeomScreenDisable( ALL_GEOM_SCREENS, True )
:param [in]: s int GUI_GEOM_SCREEN enum for geom screen
:param [in]: state bool True to disable geom screen
"""
return _vsp.SetGeomScreenDisable(s, state)
[docs]
def HideScreen(s):
r"""
Hide an OpenVSP GUI screen
.. code-block:: python
HideScreen( VSP_CFD_MESH_SCREEN )
:param [in]: s int GUI_VSP_SCREEN enum for screen
"""
return _vsp.HideScreen(s)
[docs]
def ShowScreen(s):
r"""
Show an OpenVSP GUI screen
.. code-block:: python
ShowScreen( VSP_CFD_MESH_SCREEN )
:param [in]: s int GUI_VSP_SCREEN enum for screen
"""
return _vsp.ShowScreen(s)
[docs]
def GetGeomTypes():
r"""
Get an array of all Geom types (i.e FUSELAGE, POD, etc.)
.. code-block:: python
#==== 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"
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<string> Array of Geom type names
"""
return _vsp.GetGeomTypes()
[docs]
def AddGeom(*args):
r"""
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
.. code-block:: python
#==== Add Wing Geometry ====//
wing_id = AddGeom( "WING" )
:param [in]: type string Geom type (i.e FUSELAGE, POD, etc.)
:param [in]: parent string Parent Geom ID
:rtype: string
:return: string Geom ID
"""
return _vsp.AddGeom(*args)
[docs]
def UpdateGeom(geom_id):
r"""
Perform an update for the specified Geom
.. code-block:: python
#==== 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
"""
return _vsp.UpdateGeom(geom_id)
[docs]
def DeleteGeom(geom_id):
r"""
Delete a particular Geom
.. code-block:: python
#==== 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"
:param [in]: geom_id string Geom ID
"""
return _vsp.DeleteGeom(geom_id)
[docs]
def DeleteGeomVec(del_vec):
r"""
Delete multiple Geoms
.. code-block:: python
#==== 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"
:param [in]: del_vec vector<string> Vector of Geom IDs
"""
return _vsp.DeleteGeomVec(del_vec)
[docs]
def CutGeomToClipboard(geom_id):
r"""
Cut Geom from current location and store on clipboard
.. code-block:: python
#==== 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
"""
return _vsp.CutGeomToClipboard(geom_id)
[docs]
def CopyGeomToClipboard(geom_id):
r"""
Copy Geom from current location and store on clipboard
.. code-block:: python
#==== 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
"""
return _vsp.CopyGeomToClipboard(geom_id)
[docs]
def PasteGeomClipboard(*args):
r"""
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.
.. code-block:: python
#==== 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"
:param [in]: parent string Parent Geom ID
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<string> Vector of pasted Geom IDs
"""
return _vsp.PasteGeomClipboard(*args)
[docs]
def FindGeoms():
r"""
Find and return all Geom IDs in the model
.. code-block:: python
#==== 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"
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<string> Array of all Geom IDs
"""
return _vsp.FindGeoms()
[docs]
def FindGeomsWithName(name):
r"""
Find and return all Geom IDs with the specified name
.. code-block:: python
#==== 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
"""
return _vsp.FindGeomsWithName(name)
[docs]
def FindGeom(name, index):
r"""
Find and return the Geom ID with the specified name at given index. Equivalent to FindGeomsWithName( name )[index].
.. code-block:: python
#==== 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
"""
return _vsp.FindGeom(name, index)
[docs]
def SetGeomName(geom_id, name):
r"""
Set the name of the specified Geom
.. code-block:: python
#==== 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"
:param [in]: geom_id string Geom ID
:param [in]: name string Geom name
"""
return _vsp.SetGeomName(geom_id, name)
[docs]
def GetGeomName(geom_id):
r"""
Get the name of a specific Geom
.. code-block:: python
#==== 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"
:param [in]: geom_id string Geom ID
:rtype: string
:return: string Geom name
"""
return _vsp.GetGeomName(geom_id)
[docs]
def GetGeomParmIDs(geom_id):
r"""
Get all Parm IDs associated with this Geom Parm container
.. code-block:: python
#==== 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"
:param [in]: geom_id string Geom ID
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<string> Array of Parm IDs
"""
return _vsp.GetGeomParmIDs(geom_id)
[docs]
def GetGeomTypeName(geom_id):
r"""
Get the type name of specified Geom (i.e. FUSELAGE)
.. code-block:: python
#==== 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"
:param [in]: geom_id string Geom ID
:rtype: string
:return: string Geom type name
"""
return _vsp.GetGeomTypeName(geom_id)
[docs]
def GetParm(geom_id, name, group):
r"""
Get Parm ID
.. code-block:: python
#==== Add Pod Geometry ====//
pid = AddGeom( "POD" )
lenid = GetParm( pid, "Length", "Design" )
if not ValidParm( lenid ) :
print( "---> Error: API GetParm " )
assert False, "---> Error: API GetParm"
:param [in]: geom_id string Geom ID
:param [in]: name string Parm name
:param [in]: group string Parm group name
:rtype: string
:return: string Parm ID
"""
return _vsp.GetParm(geom_id, name, group)
[docs]
def SetGeomParent(geom_id, parent_id):
r"""
Get the parent Geom ID for the input child Geom. "NONE" is returned if the Geom has no parent.
.. code-block:: python
#==== 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!"
:param [in]: geom_id string Geom ID
:param [in]: parent_id string Parent Geom ID
"""
return _vsp.SetGeomParent(geom_id, parent_id)
[docs]
def ReorderGeom(geom_id, reorder_type):
r"""
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.
.. code-block:: python
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)
"""
return _vsp.ReorderGeom(geom_id, reorder_type)
[docs]
def AttachGeomTexture(geom_id, file_name):
r"""
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.
.. code-block:: python
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
"""
return _vsp.AttachGeomTexture(geom_id, file_name)
[docs]
def RemoveGeomTexture(geom_id, texture_id):
r"""
Remove a texture from a Geom, the way the Delete button on the Texture screen does.
.. code-block:: python
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
"""
return _vsp.RemoveGeomTexture(geom_id, texture_id)
[docs]
def GetGeomTextureIDVec(geom_id):
r"""
Get the ParmContainer IDs of all the textures attached to a Geom, in the order they are drawn.
.. code-block:: python
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
"""
return _vsp.GetGeomTextureIDVec(geom_id)
[docs]
def GetGeomTextureFileName(geom_id, texture_id):
r"""
Get the image file a texture was attached from.
.. code-block:: python
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
"""
return _vsp.GetGeomTextureFileName(geom_id, texture_id)
[docs]
def GetGeomParent(geom_id):
r"""
Get the parent Geom ID for the input child Geom. "NONE" is returned if the Geom has no parent.
.. code-block:: python
#==== 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"
:param [in]: geom_id string Geom ID
:rtype: string
:return: string Parent Geom ID
"""
return _vsp.GetGeomParent(geom_id)
[docs]
def GetGeomChildren(geom_id):
r"""
Get the IDs for each child of the input parent Geom.
.. code-block:: python
#==== 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] )
:param [in]: geom_id string Geom ID
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<string> Vector of child Geom IDs
"""
return _vsp.GetGeomChildren(geom_id)
[docs]
def GetNumXSecSurfs(geom_id):
r"""
Get the number of XSecSurfs for the specified Geom
.. code-block:: python
#==== 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"
:param [in]: geom_id string Geom ID
:rtype: int
:return: int Number of XSecSurfs
"""
return _vsp.GetNumXSecSurfs(geom_id)
[docs]
def GetNumMainSurfs(geom_id):
r"""
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.
.. code-block:: python
#==== 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 )
:param [in]: geom_id string Geom ID
:rtype: int
:return: int Number of main surfaces
"""
return _vsp.GetNumMainSurfs(geom_id)
[docs]
def GetTotalNumSurfs(geom_id):
r"""
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.
.. code-block:: python
#==== 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 )
:param [in]: geom_id string Geom ID
:rtype: int
:return: int Number of main surfaces
"""
return _vsp.GetTotalNumSurfs(geom_id)
[docs]
def GetGeomVSPSurfType(geom_id, main_surf_ind=0):
r"""
Get the VSP surface type of the specified Geom
.. code-block:: python
#==== 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)
"""
return _vsp.GetGeomVSPSurfType(geom_id, main_surf_ind)
[docs]
def GetGeomVSPSurfCfdType(geom_id, main_surf_ind=0):
r"""
Get the VSP surface CFD type of the specified Geom
.. code-block:: python
#==== 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)
"""
return _vsp.GetGeomVSPSurfCfdType(geom_id, main_surf_ind)
[docs]
def GetGeomBBoxMax(geom_id, main_surf_ind=0, ref_frame_is_absolute=True):
r"""
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.
A Geom with no surfaces -- a mesh, a point cloud, a wireframe -- answers out of its own bounding box, and
main_surf_ind does not apply. That box is built in absolute coordinates, so the body reference frame answer is
the absolute box turned back through the model matrix, which contains the geometry but is not as tight as the
box a surface gives.
.. code-block:: python
#==== 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: :py:class:`vec3d`
:return: vec3d Maximum coordinate of the bounding box
"""
return _vsp.GetGeomBBoxMax(geom_id, main_surf_ind, ref_frame_is_absolute)
[docs]
def GetGeomBBoxMin(geom_id, main_surf_ind=0, ref_frame_is_absolute=True):
r"""
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.
A Geom with no surfaces -- a mesh, a point cloud, a wireframe -- answers out of its own bounding box, and
main_surf_ind does not apply. That box is built in absolute coordinates, so the body reference frame answer is
the absolute box turned back through the model matrix, which contains the geometry but is not as tight as the
box a surface gives.
.. code-block:: python
#==== 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: :py:class:`vec3d`
:return: vec3d Minimum coordinate of the bounding box
"""
return _vsp.GetGeomBBoxMin(geom_id, main_surf_ind, ref_frame_is_absolute)
[docs]
def AddSubSurf(geom_id, type, surfindex=0):
r"""
Add a sub-surface to the specified Geom
.. code-block:: python
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
"""
return _vsp.AddSubSurf(geom_id, type, surfindex)
[docs]
def GetSubSurf(*args):
r"""
*Overload 1:*
Get the ID of the specified sub-surface
.. code-block:: python
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()
:param [in]: geom_id string Geom ID
:param [in]: index int Sub-surface index
:rtype: string
:return: string Sub-surface ID
|
*Overload 2:*
Get the ID of the specified sub-surface
.. code-block:: python
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()
:param [in]: geom_id string Geom ID
:param [in]: name string Sub surface name
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<string> Vector of sub-surface ID
"""
return _vsp.GetSubSurf(*args)
[docs]
def ReorderSubSurf(geom_id, sub_id, reorder_type):
r"""
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.
.. code-block:: python
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)
"""
return _vsp.ReorderSubSurf(geom_id, sub_id, reorder_type)
[docs]
def DeleteSubSurf(*args):
r"""
*Overload 1:*
Delete the specified sub-surface
.. code-block:: python
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 )
:param [in]: geom_id string Geom ID
:param [in]: sub_id string Sub-surface ID
|
*Overload 2:*
Delete the specified sub-surface
.. code-block:: python
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 )
:param [in]: sub_id string Sub-surface ID
"""
return _vsp.DeleteSubSurf(*args)
[docs]
def SetSubSurfName(*args):
r"""
*Overload 1:*
Set the name of the specified sub-surface
.. code-block:: python
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"
:param [in]: geom_id string Geom ID
:param [in]: sub_id string Sub-surface ID
:param [in]: name string Sub-surface name
|
*Overload 2:*
Set the name of the specified sub-surface
.. code-block:: python
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"
:param [in]: sub_id string Sub-surface ID
:param [in]: name string Sub-surface name
"""
return _vsp.SetSubSurfName(*args)
[docs]
def GetSubSurfName(*args):
r"""
*Overload 1:*
Get the name of the specified sub-surface
.. code-block:: python
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 )
:param [in]: geom_id string Geom ID
:param [in]: sub_id string Sub-surface ID
:rtype: string
:return: string Sub-surface name
|
*Overload 2:*
Get the name of the specified sub-surface
.. code-block:: python
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 )
:param [in]: sub_id string Sub-surface ID
:rtype: string
:return: string Sub-surface name
"""
return _vsp.GetSubSurfName(*args)
[docs]
def GetSubSurfIndex(sub_id):
r"""
Get the index of the specified sub-surface in its parent Geom's sub-surface vector
.. code-block:: python
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"
:param [in]: sub_id string Sub-surface ID
:rtype: int
:return: int Sub-surface index
"""
return _vsp.GetSubSurfIndex(sub_id)
[docs]
def GetSubSurfIDVec(geom_id):
r"""
Get a vector of all sub-surface IDs for the specified geometry
.. code-block:: python
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 )
:param [in]: geom_id string Geom ID
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<int> Array of sub-surface IDs
"""
return _vsp.GetSubSurfIDVec(geom_id)
[docs]
def GetAllSubSurfIDs():
r"""
Get a vector of all sub-surface IDs for the entire model
.. code-block:: python
pid = AddGeom( "POD" )
AddSubSurf( pid, SS_RECTANGLE )
Update()
assert len( GetAllSubSurfIDs() ) == 1, "GetAllSubSurfIDs did not report the sub-surface"
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<string> Array of sub-surface IDs
"""
return _vsp.GetAllSubSurfIDs()
[docs]
def GetNumSubSurf(geom_id):
r"""
Get the number of sub-surfaces for the specified Geom
.. code-block:: python
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 )
:param [in]: geom_id string Geom ID
:rtype: int
:return: int Number of Sub-surfaces
"""
return _vsp.GetNumSubSurf(geom_id)
[docs]
def GetSubSurfType(sub_id):
r"""
Get the type for the specified sub-surface (i.e. SS_RECTANGLE)
.. code-block:: python
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)
"""
return _vsp.GetSubSurfType(sub_id)
[docs]
def GetSubSurfParmIDs(sub_id):
r"""
Get the vector of Parm IDs for specified sub-surface
.. code-block:: python
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 )
:param [in]: sub_id string Sub-surface ID
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<string> Vector of Parm IDs
"""
return _vsp.GetSubSurfParmIDs(sub_id)
[docs]
def IntersectSubSurf(sub_id):
r"""
Trigger intersection for SS_INTERSECT type subsurfaces
.. code-block:: python
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()
:param [in]: sub_id string Sub-surface ID
"""
return _vsp.IntersectSubSurf(sub_id)
[docs]
def GetIntersectSubSurfGeomID(sub_id):
r"""
Set Geom ID to intersect parent with to create intersection SS_INTERSECT type subsurfaces
.. code-block:: python
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()
:param [in]: sub_id string Sub-surface ID
:param [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
.. code-block:: python
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
"""
return _vsp.GetIntersectSubSurfGeomID(sub_id)
[docs]
def SetIntersectSubSurfGeomID(sub_id, geom_id):
r"""
Say which Geom a sub-surface belongs to for intersection purposes.
.. code-block:: python
pid = AddGeom( "POD" )
ssid = AddSubSurf( pid, SS_INTERSECT )
Update()
SetIntersectSubSurfGeomID( ssid, pid )
See also: AddSubSurf
:param [in]: sub_id string Sub-surface ID
:param [in]: geom_id string Geom ID the sub-surface belongs to
"""
return _vsp.SetIntersectSubSurfGeomID(sub_id, geom_id)
[docs]
def AddFeaStruct(geom_id, init_skin=True, surfindex=0):
r"""
Add an FEA Structure to a specified Geom
Warning: init_skin should ALWAYS be set to true.
.. code-block:: python
#==== 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"
:param [in]: geom_id string Parent Geom ID
:param [in]: init_skin bool Flag to initialize the FEA Structure by creating an FEA Skin from the parent Geom's OML at surfindex
:param [in]: surfindex int Main surface index for the FEA Structure
:rtype: int
:return: int FEA Structure index
"""
return _vsp.AddFeaStruct(geom_id, init_skin, surfindex)
[docs]
def GetFeaMeshStructIndex():
r"""
Sets FeaMeshMgr m_FeaMeshStructIndex member using passed in index of a FeaStructure
.. code-block:: python
#==== 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
.. code-block:: python
#==== 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
"""
return _vsp.GetFeaMeshStructIndex()
[docs]
def SetFeaMeshStructIndex(struct_index):
r"""
Choose which structure the FEA Mesh tool works on, by index.
.. code-block:: python
pid = AddGeom( "POD" )
AddFeaStruct( pid )
Update()
SetFeaMeshStructIndex( 0 )
See also: AddFeaStruct, NumFeaStructures
:param [in]: struct_index int Index of the structure to work on
"""
return _vsp.SetFeaMeshStructIndex(struct_index)
[docs]
def DeleteFeaStruct(geom_id, fea_struct_ind):
r"""
Delete an FEA Structure and all FEA Parts and FEA SubSurfaces associated with it
.. code-block:: python
#==== 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"
:param [in]: geom_id string Parent Geom ID
:param [in]: fea_struct_ind int FEA Structure index
"""
return _vsp.DeleteFeaStruct(geom_id, fea_struct_ind)
[docs]
def GetFeaStructID(geom_id, fea_struct_ind):
r"""
Get the ID of an FEA Structure
.. code-block:: python
#==== 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"
:param [in]: geom_id string Parent Geom ID
:param [in]: fea_struct_ind int FEA Structure index
:rtype: string
:return: string FEA Structure ID
"""
return _vsp.GetFeaStructID(geom_id, fea_struct_ind)
[docs]
def GetFeaStructIndex(struct_id):
r"""
Get the index of an FEA Structure in its Parent Geom's vector of Structures
.. code-block:: python
#==== 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()
:param [in]: struct_id string FEA Structure ID
:rtype: int
:return: int FEA Structure index
"""
return _vsp.GetFeaStructIndex(struct_id)
[docs]
def GetFeaStructParentGeomID(struct_id):
r"""
Get the Parent Geom ID for an FEA Structure
.. code-block:: python
#==== 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"
:param [in]: struct_id string FEA Structure ID
:rtype: string
:return: string Parent Geom ID
"""
return _vsp.GetFeaStructParentGeomID(struct_id)
[docs]
def GetFeaStructName(geom_id, fea_struct_ind):
r"""
Get the name of an FEA Structure. The FEA Structure name functions as the the Parm Container name
.. code-block:: python
#==== 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
"""
return _vsp.GetFeaStructName(geom_id, fea_struct_ind)
[docs]
def SetFeaStructName(geom_id, fea_struct_ind, name):
r"""
Set the name of an FEA Structure
.. code-block:: python
#==== 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
"""
return _vsp.SetFeaStructName(geom_id, fea_struct_ind, name)
[docs]
def GetFeaStructIDVec():
r"""
Get the IDs of all FEA Structures in the vehicle
.. code-block:: python
#==== 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
"""
return _vsp.GetFeaStructIDVec()
[docs]
def SetFeaPartName(part_id, name):
r"""
Set the name of an FEA Part
.. code-block:: python
#==== 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
"""
return _vsp.SetFeaPartName(part_id, name)
[docs]
def AddFeaPart(geom_id, fea_struct_ind, type):
r"""
Add an FEA Part to a Structure
.. code-block:: python
#==== 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
"""
return _vsp.AddFeaPart(geom_id, fea_struct_ind, type)
[docs]
def DeleteFeaPart(geom_id, fea_struct_ind, part_id):
r"""
Delete an FEA Part from a Structure
.. code-block:: python
#==== 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"
:param [in]: geom_id string Parent Geom ID
:param [in]: fea_struct_ind int FEA Structure index
:param [in]: part_id string FEA Part ID
"""
return _vsp.DeleteFeaPart(geom_id, fea_struct_ind, part_id)
[docs]
def ReorderFeaPart(geom_id, fea_struct_ind, part_id, reorder_type):
r"""
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.
.. code-block:: python
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)
"""
return _vsp.ReorderFeaPart(geom_id, fea_struct_ind, part_id, reorder_type)
[docs]
def IndividualizeFeaPart(geom_id, fea_struct_ind, part_id):
r"""
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.
.. code-block:: python
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
"""
return _vsp.IndividualizeFeaPart(geom_id, fea_struct_ind, part_id)
[docs]
def GetFeaPartID(fea_struct_id, fea_part_index):
r"""
Get the Parm ID of an FEA Part, identified from a FEA Structure Parm ID and FEA Part index.
.. code-block:: python
#==== 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"
:param [in]: fea_struct_id string FEA Structure ID
:param [in]: fea_part_index int FEA Part index
:rtype: string
:return: string FEA Part ID
"""
return _vsp.GetFeaPartID(fea_struct_id, fea_part_index)
[docs]
def GetFeaPartName(part_id):
r"""
Get the name of an FEA Part
.. code-block:: python
#==== 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
"""
return _vsp.GetFeaPartName(part_id)
[docs]
def GetFeaPartType(part_id):
r"""
Get the type of an FEA Part
.. code-block:: python
#==== 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
"""
return _vsp.GetFeaPartType(part_id)
[docs]
def GetFeaPartIDVec(fea_struct_id):
r"""
Get the IDs of all FEA Parts in the given FEA Structure
.. code-block:: python
#==== 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
"""
return _vsp.GetFeaPartIDVec(fea_struct_id)
[docs]
def GetFeaSubSurfIDVec(fea_struct_id):
r"""
Get the IDs of all FEA SubSurfaces in the given FEA Structure
.. code-block:: python
#==== 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
"""
return _vsp.GetFeaSubSurfIDVec(fea_struct_id)
[docs]
def SetFeaPartPerpendicularSparID(part_id, perpendicular_spar_id):
r"""
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.
.. code-block:: python
#==== 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
"""
return _vsp.SetFeaPartPerpendicularSparID(part_id, perpendicular_spar_id)
[docs]
def GetFeaPartPerpendicularSparID(part_id):
r"""
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.
.. code-block:: python
#==== 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
"""
return _vsp.GetFeaPartPerpendicularSparID(part_id)
[docs]
def SetFeaSubSurfName(subsurf_id, name):
r"""
Set the name of an FEA SubSurface
.. code-block:: python
#==== 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"
:param [in]: subsurf_id string FEA SubSurface ID
:param [in]: name string New name for the FEA SubSurface
"""
return _vsp.SetFeaSubSurfName(subsurf_id, name)
[docs]
def GetFeaSubSurfName(subsurf_id):
r"""
Set the name of an FEA SubSurface
.. code-block:: python
#==== 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"
:param [in]: subsurf_id string FEA SubSurface ID
:rtype: string
:return: string FEA SubSurf name
"""
return _vsp.GetFeaSubSurfName(subsurf_id)
[docs]
def AddFeaSubSurf(geom_id, fea_struct_ind, type):
r"""
Add an FEA SubSurface to a Structure
.. code-block:: python
#==== 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
"""
return _vsp.AddFeaSubSurf(geom_id, fea_struct_ind, type)
[docs]
def DeleteFeaSubSurf(geom_id, fea_struct_ind, ss_id):
r"""
Delete an FEA SubSurface from a Structure
.. code-block:: python
#==== 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"
:param [in]: geom_id string Parent Geom ID
:param [in]: fea_struct_ind int FEA Structure index
:param [in]: ss_id string FEA SubSurface ID
"""
return _vsp.DeleteFeaSubSurf(geom_id, fea_struct_ind, ss_id)
[docs]
def GetFeaSubSurfIndex(ss_id):
r"""
Get the index of an FEA SubSurface give the SubSurface ID
.. code-block:: python
#==== 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"
:param [in]: ss_id string FEA SubSurface ID
:rtype: int
:return: int FEA SubSurface Index
"""
return _vsp.GetFeaSubSurfIndex(ss_id)
[docs]
def GetFeaPolySparNumPt(pspar_id):
r"""
Get the number of points in an FEA Poly Spar. A newly created Poly Spar contains two points
(the inboard and outboard endpoints).
.. code-block:: python
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
"""
return _vsp.GetFeaPolySparNumPt(pspar_id)
[docs]
def AddFeaPolySparPt(pspar_id):
r"""
Add a point to the end of an FEA Poly Spar and return its ID. The new point is appended
after all existing points.
.. code-block:: python
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
"""
return _vsp.AddFeaPolySparPt(pspar_id)
[docs]
def InsertFeaPolySparPt(pspar_id, index):
r"""
Insert a point into an FEA Poly Spar before the given index and return its ID.
.. code-block:: python
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
"""
return _vsp.InsertFeaPolySparPt(pspar_id, index)
[docs]
def DelFeaPolySparPt(pspar_id, index):
r"""
Delete the point at the given index from an FEA Poly Spar.
.. code-block:: python
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
"""
return _vsp.DelFeaPolySparPt(pspar_id, index)
[docs]
def DelAllFeaPolySparPt(pspar_id):
r"""
Delete all points from an FEA Poly Spar.
.. code-block:: python
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
"""
return _vsp.DelAllFeaPolySparPt(pspar_id)
[docs]
def MoveFeaPolySparPt(pspar_id, index, reorder_type):
r"""
Move a point within an FEA Poly Spar using a reorder type and return the new index of the moved point.
.. code-block:: python
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
"""
return _vsp.MoveFeaPolySparPt(pspar_id, index, reorder_type)
[docs]
def SetFeaPolySparPtName(pspar_id, index, name):
r"""
Set the name of a point in an FEA Poly Spar.
.. code-block:: python
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
"""
return _vsp.SetFeaPolySparPtName(pspar_id, index, name)
[docs]
def GetFeaPolySparPtName(pspar_id, index):
r"""
Get the name of a point in an FEA Poly Spar.
.. code-block:: python
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
"""
return _vsp.GetFeaPolySparPtName(pspar_id, index)
[docs]
def GetFeaPolySparPtID(pspar_id, index):
r"""
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.
.. code-block:: python
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
"""
return _vsp.GetFeaPolySparPtID(pspar_id, index)
[docs]
def GetAllFeaPolySparPtIDVec(pspar_id):
r"""
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.
.. code-block:: python
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
"""
return _vsp.GetAllFeaPolySparPtIDVec(pspar_id)
[docs]
def AddFeaTrimPart(trim_id, part_id):
r"""
Get the total number of FEA Structures in the vehicle
.. code-block:: python
#==== 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.
.. code-block:: python
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.
.. code-block:: python
#==== 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
"""
return _vsp.AddFeaTrimPart(trim_id, part_id)
[docs]
def DeleteFeaTrimPart(trim_id, index):
r"""
Remove an entry from the list a Trim part trims against
.. code-block:: python
pid = AddGeom( "POD" )
struct_ind = AddFeaStruct( pid )
Update()
trim_id = AddFeaPart( pid, struct_ind, FEA_TRIM )
# Nothing has been added to trim against, so there is nothing to take out yet.
assert len( GetFeaTrimPartIDVec( trim_id ) ) == 0, "GetFeaTrimPartIDVec reported trim parts on a new part"
See also: AddFeaTrimPart, GetFeaTrimPartIDVec
:param [in]: trim_id string FEA Trim part ID
:param [in]: index int Trim entry index
"""
return _vsp.DeleteFeaTrimPart(trim_id, index)
[docs]
def GetFeaTrimPartIDVec(trim_id):
r"""
Get the FEA Parts a Trim part trims against
.. code-block:: python
pid = AddGeom( "POD" )
struct_ind = AddFeaStruct( pid )
Update()
trim_id = AddFeaPart( pid, struct_ind, FEA_TRIM )
# A trim part starts with nothing to trim against.
assert len( GetFeaTrimPartIDVec( trim_id ) ) == 0, "GetFeaTrimPartIDVec reported trim parts on a new part"
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
"""
return _vsp.GetFeaTrimPartIDVec(trim_id)
[docs]
def AddFeaAssembly():
r"""
Add an FEA assembly, which gathers structures together so they can be meshed as one.
.. code-block:: python
assembly_id = AddFeaAssembly()
assert len( assembly_id ) > 0, "AddFeaAssembly returned no ID"
assert NumFeaAssemblies() == 1, "AddFeaAssembly did not add the assembly"
See also: NumFeaAssemblies, DeleteFeaAssembly
:rtype: string
:return: string FEA assembly ID
"""
return _vsp.AddFeaAssembly()
[docs]
def DeleteFeaAssembly(assembly_id):
r"""
Delete an FEA Assembly. The Structures it gathered are left in the model.
.. code-block:: python
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
"""
return _vsp.DeleteFeaAssembly(assembly_id)
[docs]
def NumFeaAssemblies():
r"""
Get the number of FEA Assemblies in the model
.. code-block:: python
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
"""
return _vsp.NumFeaAssemblies()
[docs]
def GetFeaAssemblyIDVec():
r"""
Get the IDs of every FEA Assembly in the model
.. code-block:: python
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
"""
return _vsp.GetFeaAssemblyIDVec()
[docs]
def GetFeaAssemblyName(assembly_id):
r"""
Get the name of an FEA Assembly
.. code-block:: python
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
"""
return _vsp.GetFeaAssemblyName(assembly_id)
[docs]
def SetFeaAssemblyName(assembly_id, name):
r"""
Set the name of an FEA Assembly. The assembly's export file names are rebuilt from the new name.
.. code-block:: python
pid = AddGeom( "POD" )
struct_ind = AddFeaStruct( pid )
Update()
assembly_id = AddFeaAssembly()
AddFeaAssemblyStructure( assembly_id, GetFeaStructID( pid, struct_ind ) )
SetFeaAssemblyName( assembly_id, "TestAssembly" )
assert GetFeaAssemblyName( assembly_id ) == "TestAssembly", "SetFeaAssemblyName did not take"
See also: AddFeaAssembly, GetFeaAssemblyName
:param [in]: assembly_id string FEA Assembly ID
:param [in]: name string FEA Assembly name
"""
return _vsp.SetFeaAssemblyName(assembly_id, name)
[docs]
def AddFeaStructureToAssembly(assembly_id, struct_id):
r"""
Add an FEA Structure to an FEA Assembly
.. code-block:: python
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
"""
return _vsp.AddFeaStructureToAssembly(assembly_id, struct_id)
[docs]
def DeleteFeaStructureFromAssembly(assembly_id, struct_id):
r"""
Remove an FEA Structure from an FEA Assembly. The Structure itself is left in the model.
.. code-block:: python
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
"""
return _vsp.DeleteFeaStructureFromAssembly(assembly_id, struct_id)
[docs]
def AddFeaAssemblyStructure(assembly_id, struct_id):
r"""
Put a structure into an FEA assembly. An assembly starts empty; this is what fills it, so that
ComputeFeaAssemblyMesh has something to mesh. Adding the same structure twice is refused.
.. code-block:: python
pid = AddGeom( "POD" )
struct_ind = AddFeaStruct( pid )
Update()
struct_id = GetFeaStructID( pid, struct_ind )
assembly_id = AddFeaAssembly()
AddFeaAssemblyStructure( assembly_id, struct_id )
assert len( GetFeaAssemblyStructureIDVec( assembly_id ) ) == 1, "AddFeaAssemblyStructure did not add the structure"
See also: DeleteFeaAssemblyStructure, GetFeaAssemblyStructureIDVec, ComputeFeaAssemblyMesh
:param [in]: assembly_id string FEA assembly ID
:param [in]: struct_id string FEA structure ID to add
"""
return _vsp.AddFeaAssemblyStructure(assembly_id, struct_id)
[docs]
def DeleteFeaAssemblyStructure(assembly_id, struct_id):
r"""
Take a structure back out of an FEA assembly. The structure itself is left alone; only its
membership of the assembly goes.
.. code-block:: python
pid = AddGeom( "POD" )
struct_ind = AddFeaStruct( pid )
Update()
struct_id = GetFeaStructID( pid, struct_ind )
assembly_id = AddFeaAssembly()
AddFeaAssemblyStructure( assembly_id, struct_id )
DeleteFeaAssemblyStructure( assembly_id, struct_id )
assert len( GetFeaAssemblyStructureIDVec( assembly_id ) ) == 0, "DeleteFeaAssemblyStructure did not remove the structure"
# The structure is still there; it is only out of the assembly.
assert NumFeaStructures() == 1, "DeleteFeaAssemblyStructure deleted the structure itself"
See also: AddFeaAssemblyStructure, GetFeaAssemblyStructureIDVec
:param [in]: assembly_id string FEA assembly ID
:param [in]: struct_id string FEA structure ID to remove
"""
return _vsp.DeleteFeaAssemblyStructure(assembly_id, struct_id)
[docs]
def GetFeaAssemblyStructureIDVec(assembly_id):
r"""
Get the IDs of the FEA Structures gathered by an FEA Assembly
.. code-block:: python
pid = AddGeom( "POD" )
struct_ind = AddFeaStruct( pid )
Update()
assembly_id = AddFeaAssembly()
AddFeaAssemblyStructure( assembly_id, GetFeaStructID( pid, struct_ind ) )
assert len( GetFeaAssemblyStructureIDVec( assembly_id ) ) == 1, "GetFeaAssemblyStructureIDVec did not report the structure"
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
"""
return _vsp.GetFeaAssemblyStructureIDVec(assembly_id)
[docs]
def AddFeaAssemblyConnection(assembly_id, start_fix_pt_id, start_struct_id, start_index, end_fix_pt_id, end_struct_id, end_index):
r"""
Connect two FEA Fixed Points, each belonging to a Structure in the assembly, so the Structures
are tied together where they meet.
.. code-block:: python
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
"""
return _vsp.AddFeaAssemblyConnection(assembly_id, start_fix_pt_id, start_struct_id, start_index, end_fix_pt_id, end_struct_id, end_index)
[docs]
def DeleteFeaAssemblyConnection(assembly_id, connection_index):
r"""
Delete a connection from an FEA Assembly
.. code-block:: python
pid = AddGeom( "POD" )
struct_ind = AddFeaStruct( pid )
Update()
assembly_id = AddFeaAssembly()
AddFeaAssemblyStructure( assembly_id, GetFeaStructID( pid, struct_ind ) )
# A new assembly has no connections, so there is nothing to take out yet.
assert NumFeaAssemblyConnections( assembly_id ) == 0, "NumFeaAssemblyConnections miscounted a new assembly"
See also: AddFeaAssemblyConnection, NumFeaAssemblyConnections
:param [in]: assembly_id string FEA Assembly ID
:param [in]: connection_index int Connection index
"""
return _vsp.DeleteFeaAssemblyConnection(assembly_id, connection_index)
[docs]
def NumFeaAssemblyConnections(assembly_id):
r"""
Get the number of connections in an FEA Assembly
.. code-block:: python
pid = AddGeom( "POD" )
struct_ind = AddFeaStruct( pid )
Update()
assembly_id = AddFeaAssembly()
AddFeaAssemblyStructure( assembly_id, GetFeaStructID( pid, struct_ind ) )
assert NumFeaAssemblyConnections( assembly_id ) == 0, "NumFeaAssemblyConnections miscounted a new assembly"
See also: AddFeaAssemblyConnection, DeleteFeaAssemblyConnection
:param [in]: assembly_id string FEA Assembly ID
:rtype: int
:return: int Number of connections
"""
return _vsp.NumFeaAssemblyConnections(assembly_id)
[docs]
def GetFeaAssemblyConnectionID(assembly_id, connection_index):
r"""
Get the ID of one of an assembly's connections, so that its Parms can be reached the way any
other container's are. A connection carries the two fix point surface indices, its mode and
its constraints, all in Parm group "Connection". Everything else about connections is
addressed by index; this is what lets a script read or set what a connection does.
.. code-block:: python
#==== Two structures to connect ====#
pod = AddGeom( "POD", "" )
wing = AddGeom( "WING", "" )
pod_struct = AddFeaStruct( pod )
wing_struct = AddFeaStruct( wing )
pod_struct_id = GetFeaStructID( pod, pod_struct )
wing_struct_id = GetFeaStructID( wing, wing_struct )
#==== A fix point on each, which is what a connection joins ====#
pod_pt = AddFeaPart( pod, pod_struct, FEA_FIX_POINT )
wing_pt = AddFeaPart( wing, wing_struct, FEA_FIX_POINT )
assembly_id = AddFeaAssembly()
AddFeaStructureToAssembly( assembly_id, pod_struct_id )
AddFeaStructureToAssembly( assembly_id, wing_struct_id )
AddFeaAssemblyConnection( assembly_id, pod_pt, pod_struct_id, 0, wing_pt, wing_struct_id, 0 )
assert NumFeaAssemblyConnections( assembly_id ) == 1, "the connection was not added"
conn_id = GetFeaAssemblyConnectionID( assembly_id, 0 )
assert len( conn_id ) > 0, "GetFeaAssemblyConnectionID found nothing"
#==== And what it constrains is a Parm like any other ====#
SetParmVal( FindParm( conn_id, "ConMode", "Connection" ), FEA_BCM_PIN )
Update()
mode = GetParmVal( conn_id, "ConMode", "Connection" )
assert mode == FEA_BCM_PIN, "the connection did not take the mode it was given"
See also: NumFeaAssemblyConnections, AddFeaAssemblyConnection
:param [in]: assembly_id string FEA assembly ID
:param [in]: connection_index int Connection index
:rtype: string
:return: string Connection ID
"""
return _vsp.GetFeaAssemblyConnectionID(assembly_id, connection_index)
[docs]
def GetFeaAssemblyFileName(assembly_id, file_type):
r"""
Mesh and write out an FEA Assembly. Any Structure in the assembly that has not been meshed yet
is meshed first.
.. code-block:: python
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.
.. code-block:: python
pid = AddGeom( "POD" )
struct_ind = AddFeaStruct( pid )
Update()
assembly_id = AddFeaAssembly()
AddFeaAssemblyStructure( assembly_id, GetFeaStructID( pid, struct_ind ) )
SetFeaAssemblyFileName( assembly_id, FEA_MASS_FILE_NAME, "TestAssemblyMass.txt" )
assert GetFeaAssemblyFileName( assembly_id, FEA_MASS_FILE_NAME ) == "TestAssemblyMass.txt", "GetFeaAssemblyFileName did not report the name"
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
"""
return _vsp.GetFeaAssemblyFileName(assembly_id, file_type)
[docs]
def SetFeaAssemblyFileName(assembly_id, file_type, file_name):
r"""
Set the name of an FEA Assembly output file
.. code-block:: python
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
"""
return _vsp.SetFeaAssemblyFileName(assembly_id, file_type, file_name)
[docs]
def ComputeFeaAssemblyMesh(assembly_id):
r"""
Mesh an FEA assembly, meshing every structure it holds and joining them at their connections.
An assembly starts empty; use AddFeaAssemblyStructure to put structures into it first.
.. code-block:: python
pid = AddGeom( "POD" )
struct_ind = AddFeaStruct( pid )
Update()
assembly_id = AddFeaAssembly()
AddFeaAssemblyStructure( assembly_id, GetFeaStructID( pid, struct_ind ) )
# Meshing an assembly is not quick; keep the mesh coarse.
SetFeaMeshVal( pid, 0, CFD_MAX_EDGE_LEN, 1.0 )
ComputeFeaAssemblyMesh( assembly_id )
See also: AddFeaAssembly, AddFeaAssemblyStructure, GetFeaAssemblyStructureIDVec
:param [in]: assembly_id string FEA assembly ID
"""
return _vsp.ComputeFeaAssemblyMesh(assembly_id)
[docs]
def NumFeaStructures():
r"""
Get the number of FEA structures in the model, counting those on every Geom.
.. code-block:: python
pid = AddGeom( "POD" )
AddFeaStruct( pid )
Update()
assert NumFeaStructures() == 1, "NumFeaStructures did not count the structure"
See also: AddFeaStruct
:rtype: int
:return: int Number of FEA structures
"""
return _vsp.NumFeaStructures()
[docs]
def NumFeaParts(fea_struct_id):
r"""
Get the number of FEA Parts for a particular FEA Structure
.. code-block:: python
#==== 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
"""
return _vsp.NumFeaParts(fea_struct_id)
[docs]
def NumFeaSubSurfs(fea_struct_id):
r"""
Get the number of FEA Subsurfaces for a particular FEA Structure
.. code-block:: python
#==== 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
"""
return _vsp.NumFeaSubSurfs(fea_struct_id)
[docs]
def AddFeaBC(fea_struct_id, type=-1):
r"""
Add an FEA BC to a Structure
.. code-block:: python
#==== 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
"""
return _vsp.AddFeaBC(fea_struct_id, type)
[docs]
def DelFeaBC(fea_struct_id, bc_id):
r"""
Delete an FEA BC from a Structure
.. code-block:: python
#==== 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
"""
return _vsp.DelFeaBC(fea_struct_id, bc_id)
[docs]
def GetFeaBCIDVec(fea_struct_id):
r"""
Return a vector of FEA BC ID's for a structure
.. code-block:: python
#==== 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"
:param [in]: fea_struct_id string FEA Structure ID
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<string> Array of FEA BC IDs
"""
return _vsp.GetFeaBCIDVec(fea_struct_id)
[docs]
def NumFeaBCs(fea_struct_id):
r"""
Return number of FEA BC's in a structure
.. code-block:: python
#==== 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"
:param [in]: fea_struct_id string FEA Structure ID
:rtype: int
:return: int Number of FEA BCs
"""
return _vsp.NumFeaBCs(fea_struct_id)
[docs]
def AddFeaLayer(material_id):
r"""
Add an FEA Material the FEA Mesh material library. Materials are available across all Geoms and Structures.
.. code-block:: python
#==== Create FeaMaterial ====//
mat_id = AddFeaMaterial()
SetParmVal( FindParm( mat_id, "MassDensity", "FeaMaterial" ), 0.016 )
:rtype: string
:return: 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.
.. code-block:: python
#==== 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.
.. code-block:: python
#==== 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
"""
return _vsp.AddFeaLayer(material_id)
[docs]
def DeleteFeaLayer(material_id, layer_id):
r"""
Delete a layer from an FEA laminate material
.. code-block:: python
mat_id = AddFeaMaterial()
SetParmVal( FindParm( mat_id, "FeaMaterialType", "FeaMaterial" ), FEA_LAMINATE )
Update()
# A laminate material starts with a layer of its own, so count before and after.
n0 = NumFeaLayers( mat_id )
layer_id = AddFeaLayer( mat_id )
DeleteFeaLayer( mat_id, layer_id )
assert NumFeaLayers( mat_id ) == n0, "DeleteFeaLayer did not delete the layer"
See also: AddFeaLayer, GetFeaLayerIDVec
:param [in]: material_id string FEA Material ID of a laminate
:param [in]: layer_id string FEA Layer ID
"""
return _vsp.DeleteFeaLayer(material_id, layer_id)
[docs]
def ReorderFeaLayer(material_id, layer_id, reorder_type):
r"""
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.
.. code-block:: python
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)
"""
return _vsp.ReorderFeaLayer(material_id, layer_id, reorder_type)
[docs]
def NumFeaLayers(material_id):
r"""
Get the number of layers in an FEA laminate material
.. code-block:: python
mat_id = AddFeaMaterial()
SetParmVal( FindParm( mat_id, "FeaMaterialType", "FeaMaterial" ), FEA_LAMINATE )
Update()
# A laminate material starts with a layer of its own, so count before and after.
n0 = NumFeaLayers( mat_id )
layer_id = AddFeaLayer( mat_id )
assert NumFeaLayers( mat_id ) == n0 + 1, "NumFeaLayers did not count the layer"
See also: AddFeaLayer, GetFeaLayerIDVec
:param [in]: material_id string FEA Material ID of a laminate
:rtype: int
:return: int Number of layers
"""
return _vsp.NumFeaLayers(material_id)
[docs]
def GetFeaLayerIDVec(material_id):
r"""
Get the IDs of every layer in an FEA laminate material
.. code-block:: python
mat_id = AddFeaMaterial()
SetParmVal( FindParm( mat_id, "FeaMaterialType", "FeaMaterial" ), FEA_LAMINATE )
Update()
# A laminate material starts with a layer of its own, so count before and after.
n0 = NumFeaLayers( mat_id )
layer_id = AddFeaLayer( mat_id )
layer_array = GetFeaLayerIDVec( mat_id )
assert len( layer_array ) == n0 + 1, "GetFeaLayerIDVec did not report the layer"
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
"""
return _vsp.GetFeaLayerIDVec(material_id)
[docs]
def GetFeaMaterialIDVec():
r"""
Get the IDs of every FEA material, the built in ones as well as any added.
.. code-block:: python
mat_id = AddFeaMaterial()
mat_array = GetFeaMaterialIDVec()
assert mat_id in mat_array, "GetFeaMaterialIDVec did not report the new material"
See also: AddFeaMaterial
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<string> FEA material IDs
"""
return _vsp.GetFeaMaterialIDVec()
[docs]
def DeleteFeaMaterial(id):
r"""
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.
.. code-block:: python
#==== 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
"""
return _vsp.DeleteFeaMaterial(id)
[docs]
def AddFeaMaterial():
r"""
Add an FEA material to the material library, with default properties.
.. code-block:: python
mat_id = AddFeaMaterial()
assert len( mat_id ) > 0, "AddFeaMaterial returned no ID"
See also: GetFeaMaterialIDVec, DeleteFeaMaterial
:rtype: string
:return: string FEA material ID
"""
return _vsp.AddFeaMaterial()
[docs]
def GetFeaPropertyIDVec():
r"""
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.
.. code-block:: python
#==== 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.
.. code-block:: python
#==== 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
"""
return _vsp.GetFeaPropertyIDVec()
[docs]
def DeleteFeaProperty(id):
r"""
Delete an FEA Property from the FEA Mesh property library
.. code-block:: python
#==== 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
"""
return _vsp.DeleteFeaProperty(id)
[docs]
def AddFeaProperty(property_type=0):
r"""
Add an FEA property to the property library.
.. code-block:: python
prop_id = AddFeaProperty()
assert len( prop_id ) > 0, "AddFeaProperty returned no ID"
See also: GetFeaPropertyIDVec, DeleteFeaProperty
:param [in]: property_type int FEA property type enum (default: shell)
:rtype: string
:return: string FEA property ID
"""
return _vsp.AddFeaProperty(property_type)
[docs]
def GetFeaMeshVal(geom_id, fea_struct_ind, type):
r"""
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.
.. code-block:: python
#==== 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
.. code-block:: python
#==== 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
"""
return _vsp.GetFeaMeshVal(geom_id, fea_struct_ind, type)
[docs]
def SetFeaMeshVal(geom_id, fea_struct_ind, type, val):
r"""
Set one of the FEA Mesh settings for a structure.
.. code-block:: python
pid = AddGeom( "POD" )
AddFeaStruct( pid )
Update()
SetFeaMeshVal( pid, 0, CFD_MAX_EDGE_LEN, 0.75 )
See also: CFD_CONTROL_TYPE, ComputeFeaMesh
:param [in]: geom_id string Geom ID the structure is on
:param [in]: fea_struct_ind int Index of the structure on that Geom
:param [in]: type int CFD mesh setting enum (i.e. CFD_MAX_EDGE_LEN)
:param [in]: val double Value to set
"""
return _vsp.SetFeaMeshVal(geom_id, fea_struct_ind, type, val)
[docs]
def GetFeaMeshFileName(geom_id, fea_struct_ind, file_type):
r"""
Set the name of a particular FEA Mesh output file for a specified Structure
.. code-block:: python
#==== 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"
: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)
:param [in]: file_name string Name for the output file
Get the name of a particular FEA Mesh output file for a specified Structure
.. code-block:: python
#==== 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
"""
return _vsp.GetFeaMeshFileName(geom_id, fea_struct_ind, file_type)
[docs]
def SetFeaMeshFileName(geom_id, fea_struct_ind, file_type, file_name):
r"""
Set the file name an FEA Mesh writes for one export type.
.. code-block:: python
pid = AddGeom( "POD" )
AddFeaStruct( pid )
Update()
SetFeaMeshFileName( pid, 0, FEA_MASS_FILE_NAME, "TestFeaMass.txt" )
See also: FEA_EXPORT_TYPE, ComputeFeaMesh
:param [in]: geom_id string Geom ID the structure is on
:param [in]: fea_struct_ind int Index of the structure on that Geom
:param [in]: file_type int FEA export type enum (i.e. FEA_MASS_FILE_NAME)
:param [in]: file_name string Name of the file to write
"""
return _vsp.SetFeaMeshFileName(geom_id, fea_struct_ind, file_type, file_name)
[docs]
def ComputeFeaMesh(*args):
r"""
*Overload 1:*
Compute an FEA Mesh for a Structure. Only a single output file can be generated with this function.
.. code-block:: python
#==== 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.
.. code-block:: python
#==== 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)
"""
return _vsp.ComputeFeaMesh(*args)
[docs]
def SetXSecAlias(id, alias):
r"""
Set XSec Alias by ID
.. code-block:: python
# 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!"
:param [in]: id string XSec ID
:param [in]: alias string Xsec alias
"""
return _vsp.SetXSecAlias(id, alias)
[docs]
def GetXSecAlias(id):
r"""
Get XSec Alias by ID
.. code-block:: python
# 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!"
:param [in]: id string XSec ID
:rtype: string
:return: string Xsec alias
"""
return _vsp.GetXSecAlias(id)
[docs]
def SetXSecCurveAlias(id, alias):
r"""
Set XSecCurve Alias by XSec ID
.. code-block:: python
# 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!"
:param [in]: id string XSec ID
:param [in]: alias string XsecCurve alias
"""
return _vsp.SetXSecCurveAlias(id, alias)
[docs]
def GetXSecCurveAlias(id):
r"""
Get XSecCurve Alias by XSec ID
.. code-block:: python
# 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!"
:param [in]: id string XSec ID
"""
return _vsp.GetXSecCurveAlias(id)
[docs]
def CutXSec(geom_id, index):
r"""
Cut a cross-section from the specified geometry and maintain it in memory
.. code-block:: python
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
"""
return _vsp.CutXSec(geom_id, index)
[docs]
def CopyXSec(geom_id, index):
r"""
Copy a cross-section from the specified geometry and maintain it in memory
.. code-block:: python
# 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
"""
return _vsp.CopyXSec(geom_id, index)
[docs]
def PasteXSec(geom_id, index):
r"""
Paste the cross-section currently held in memory to the specified geometry
.. code-block:: python
# 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
"""
return _vsp.PasteXSec(geom_id, index)
[docs]
def InsertXSec(geom_id, index, type):
r"""
Insert a cross-section of particular type to the specified geometry after the given index
.. code-block:: python
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)
"""
return _vsp.InsertXSec(geom_id, index, type)
[docs]
def SplitWingXSec(wing_id, section_index):
r"""
Split a given wing section.
.. code-block:: python
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
"""
return _vsp.SplitWingXSec(wing_id, section_index)
[docs]
def GetDriverGroup(geom_id, section_index):
r"""
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.
.. code-block:: python
#==== 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.
.. code-block:: python
#==== 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
"""
return _vsp.GetDriverGroup(geom_id, section_index)
[docs]
def SetDriverGroup(geom_id, section_index, driver_0, driver_1=-1, driver_2=-1):
r"""
Choose which quantities drive a wing section. A section is defined by three of its measures and
the rest follow; this says which three.
.. code-block:: python
wid = AddGeom( "WING", "" )
SetDriverGroup( wid, 1, SPAN_WSECT_DRIVER, ROOTC_WSECT_DRIVER, TIPC_WSECT_DRIVER )
Update()
See also: WING_DRIVERS
:param [in]: geom_id string Geom ID
:param [in]: section_index int Wing section index
:param [in]: driver_0 int Wing driver enum (i.e. SPAN_WSECT_DRIVER)
:param [in]: driver_1 int Second wing driver enum
:param [in]: driver_2 int Third wing driver enum
"""
return _vsp.SetDriverGroup(geom_id, section_index, driver_0, driver_1, driver_2)
[docs]
def GetXSecSurf(geom_id, index):
r"""
Get the XSecSurf ID for a particular Geom and XSecSurf index
.. code-block:: python
# Add Stack
sid = AddGeom( "STACK", "" )
# Get First (and Only) XSec Surf
xsec_surf = GetXSecSurf( sid, 0 )
assert len( xsec_surf ) > 0, "GetXSecSurf returned nothing"
:param [in]: geom_id string Geom ID
:param [in]: index int XSecSurf index
:rtype: string
:return: string XSecSurf ID
"""
return _vsp.GetXSecSurf(geom_id, index)
[docs]
def GetNumXSec(xsec_surf_id):
r"""
Get number of XSecs in an XSecSurf
.. code-block:: python
# 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"
:param [in]: xsec_surf_id string XSecSurf ID
:rtype: int
:return: int Number of XSecs
"""
return _vsp.GetNumXSec(xsec_surf_id)
[docs]
def GetXSec(xsec_surf_id, xsec_index):
r"""
Get Xsec ID for a particular XSecSurf at given index
.. code-block:: python
# 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"
:param [in]: xsec_surf_id string XSecSurf ID
:param [in]: xsec_index int Xsec index
:rtype: string
:return: string Xsec ID
"""
return _vsp.GetXSec(xsec_surf_id, xsec_index)
[docs]
def ChangeXSecShape(xsec_surf_id, xsec_index, type):
r"""
Change the shape of a particular XSec, identified by an XSecSurf ID and XSec index
.. code-block:: python
# 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)
"""
return _vsp.ChangeXSecShape(xsec_surf_id, xsec_index, type)
[docs]
def FitCSTAirfoil(xsec_surf_id, xsec_index, deg):
r"""
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.
.. code-block:: python
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
"""
return _vsp.FitCSTAirfoil(xsec_surf_id, xsec_index, deg)
[docs]
def GetXSecShape(xsec_id):
r"""
Get the shape of an XSec
.. code-block:: python
# 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)
"""
return _vsp.GetXSecShape(xsec_id)
[docs]
def GetXSecWidth(xsec_id):
r"""
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.
.. code-block:: python
# 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
"""
return _vsp.GetXSecWidth(xsec_id)
[docs]
def GetXSecHeight(xsec_id):
r"""
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.
.. code-block:: python
# 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
"""
return _vsp.GetXSecHeight(xsec_id)
[docs]
def SetXSecWidthHeight(xsec_id, w, h):
r"""
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.
.. code-block:: python
# 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
"""
return _vsp.SetXSecWidthHeight(xsec_id, w, h)
[docs]
def SetXSecWidth(xsec_id, w):
r"""
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.
.. code-block:: python
# 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
"""
return _vsp.SetXSecWidth(xsec_id, w)
[docs]
def SetXSecHeight(xsec_id, h):
r"""
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.
.. code-block:: python
# 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
"""
return _vsp.SetXSecHeight(xsec_id, h)
[docs]
def GetXSecParmIDs(xsec_id):
r"""
Get all Parm IDs for specified XSec Parm Container
.. code-block:: python
# 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"
:param [in]: xsec_id string XSec ID
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<string> Array of Parm IDs
"""
return _vsp.GetXSecParmIDs(xsec_id)
[docs]
def GetXSecParm(xsec_id, name):
r"""
Get a specific Parm ID from an Xsec
.. code-block:: python
# 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"
:param [in]: xsec_id string XSec ID
:param [in]: name string Parm name
:rtype: string
:return: string Parm ID
"""
return _vsp.GetXSecParm(xsec_id, name)
[docs]
def ReadFileXSec(xsec_id, file_name):
r"""
Read in XSec shape from fuselage (\*.fsx) file and set to the specified XSec. The XSec must be of type XS_FILE_FUSE.
.. code-block:: python
# 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"
:param [in]: xsec_id string XSec ID
:param [in]: file_name string Fuselage XSec file name
:rtype: std::vector< vec3d,std::allocator< vec3d > >
:return: vector<vec3d> Array of coordinate points read from the file and set to the XSec
"""
return _vsp.ReadFileXSec(xsec_id, file_name)
[docs]
def GetXSecPnts(xsec_id):
r"""
Set the coordinate points for a specific XSec. The XSec must be of type XS_FILE_FUSE.
.. code-block:: python
# 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"
:param [in]: xsec_id string XSec ID
:param [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.
.. code-block:: python
# 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
"""
return _vsp.GetXSecPnts(xsec_id)
[docs]
def CopyXSecCurve(geom_id, index):
r"""
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.
.. code-block:: python
# 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
"""
return _vsp.CopyXSecCurve(geom_id, index)
[docs]
def PasteXSecCurve(geom_id, index):
r"""
Paste the XSecCurve clipboard onto a cross section
.. code-block:: python
# 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
"""
return _vsp.PasteXSecCurve(geom_id, index)
[docs]
def SetXSecPnts(xsec_id, pnt_vec):
r"""
Set the points of a file XSec. The XSec must be of type XS_FILE_FUSE; this is how a section read
from a file is replaced from a script.
.. code-block:: python
sid = AddGeom( "STACK", "" )
xsec_surf = GetXSecSurf( sid, 0 )
ChangeXSecShape( xsec_surf, 1, XS_FILE_FUSE )
Update()
xsec = GetXSec( xsec_surf, 1 )
# Take the section's own points and hand back a squashed copy of them. Building a set from
# nothing has to match what a file section expects, which is a closed curve in the section's
# own plane.
pnt_vec = [ vec3d( p.x(), 0.5 * p.y(), p.z() ) for p in GetXSecPnts( xsec ) ]
SetXSecPnts( xsec, pnt_vec )
Update()
assert len( GetXSecPnts( xsec ) ) == len( pnt_vec ), "SetXSecPnts did not take the points"
See also: GetXSecPnts, ChangeXSecShape
:param [in]: xsec_id string XSec ID, of type XS_FILE_FUSE
:param [in]: pnt_vec vector<vec3d> Points defining the section
"""
return _vsp.SetXSecPnts(xsec_id, pnt_vec)
[docs]
def ComputeXSecPnt(xsec_id, fract):
r"""
Compute 3D coordinate for a point on an XSec curve given the parameter value (U) along the curve
.. code-block:: python
#==== 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"
:param [in]: xsec_id string XSec ID
:param [in]: fract double Curve parameter value (range: 0 - 1)
:rtype: :py:class:`vec3d`
:return: vec3d 3D coordinate point
"""
return _vsp.ComputeXSecPnt(xsec_id, fract)
[docs]
def ComputeXSecTan(xsec_id, fract):
r"""
Compute the tangent vector of a point on an XSec curve given the parameter value (U) along the curve
.. code-block:: python
#==== 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"
:param [in]: xsec_id string XSec ID
:param [in]: fract double Curve parameter value (range: 0 - 1)
:rtype: :py:class:`vec3d`
:return: vec3d Tangent vector
"""
return _vsp.ComputeXSecTan(xsec_id, fract)
[docs]
def ResetXSecSkinParms(xsec_id):
r"""
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.
.. code-block:: python
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"
:param [in]: xsec_id string XSec ID
"""
return _vsp.ResetXSecSkinParms(xsec_id)
[docs]
def GetXSecContinuity(xsec_id):
r"""
Set C-type continuity enforcement for a particular XSec
.. code-block:: python
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 )
:param [in]: xsec_id string XSec ID
:param [in]: cx int Continuity level (0, 1, or 2)
Get the C-type continuity enforcement for a particular XSec
.. code-block:: python
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)
"""
return _vsp.GetXSecContinuity(xsec_id)
[docs]
def SetXSecContinuity(xsec_id, cx):
r"""
Set how many derivatives are continuous across an XSec: 0 for position only, 1 to also match
slope, 2 to also match curvature.
.. code-block:: python
sid = AddGeom( "STACK", "" )
xsec_surf = GetXSecSurf( sid, 0 )
xsec = GetXSec( xsec_surf, 1 )
SetXSecContinuity( xsec, 1 )
assert GetXSecContinuity( xsec ) == 1, "SetXSecContinuity did not take"
See also: GetXSecContinuity
:param [in]: xsec_id string XSec ID
:param [in]: cx int Number of continuous derivatives, 0, 1 or 2
"""
return _vsp.SetXSecContinuity(xsec_id, cx)
[docs]
def GetXSecTanAngles(xsec_id, side):
r"""
Set the tangent angles for the specified XSec
.. code-block:: python
# 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.
.. code-block:: python
# 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
"""
return _vsp.GetXSecTanAngles(xsec_id, side)
[docs]
def SetXSecTanAngles(xsec_id, side, top, right, bottom, left):
r"""
Set the tangent angles for one side of an XSec. The four values are given in the order top, right, bottom
and left; a value of -1.0e12 leaves that position as it was. XSEC_BOTH_SIDES sets both sides at
once.
.. code-block:: python
sid = AddGeom( "STACK", "" )
xsec_surf = GetXSecSurf( sid, 0 )
xsec = GetXSec( xsec_surf, 1 )
SetXSecTanAngles( xsec, XSEC_BOTH_SIDES, 5.0, 5.0, 5.0, 5.0 )
vals = GetXSecTanAngles( xsec, XSEC_LEFT_SIDE )
for v in vals:
assert abs( v - 5.0 ) < 1e-6, "SetXSecTanAngles did not take"
See also: GetXSecTanAngles, XSEC_SIDES_TYPE
:param [in]: xsec_id string XSec ID
:param [in]: side int XSec side type enum (i.e. XSEC_BOTH_SIDES)
:param [in]: top double Value at the top, or -1.0e12 to leave it
:param [in]: right double Value at the right, or -1.0e12 to leave it
:param [in]: bottom double Value at the bottom, or -1.0e12 to leave it
:param [in]: left double Value at the left, or -1.0e12 to leave it
"""
return _vsp.SetXSecTanAngles(xsec_id, side, top, right, bottom, left)
[docs]
def GetXSecTanSlews(xsec_id, side):
r"""
Set the tangent slew angles for the specified XSec
.. code-block:: python
# 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.
.. code-block:: python
# 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
"""
return _vsp.GetXSecTanSlews(xsec_id, side)
[docs]
def SetXSecTanSlews(xsec_id, side, top, right, bottom, left):
r"""
Set the tangent slews for one side of an XSec. The four values are given in the order top, right, bottom
and left; a value of -1.0e12 leaves that position as it was. XSEC_BOTH_SIDES sets both sides at
once.
.. code-block:: python
sid = AddGeom( "STACK", "" )
xsec_surf = GetXSecSurf( sid, 0 )
xsec = GetXSec( xsec_surf, 1 )
SetXSecTanSlews( xsec, XSEC_BOTH_SIDES, 5.0, 5.0, 5.0, 5.0 )
vals = GetXSecTanSlews( xsec, XSEC_LEFT_SIDE )
for v in vals:
assert abs( v - 5.0 ) < 1e-6, "SetXSecTanSlews did not take"
See also: GetXSecTanSlews, XSEC_SIDES_TYPE
:param [in]: xsec_id string XSec ID
:param [in]: side int XSec side type enum (i.e. XSEC_BOTH_SIDES)
:param [in]: top double Value at the top, or -1.0e12 to leave it
:param [in]: right double Value at the right, or -1.0e12 to leave it
:param [in]: bottom double Value at the bottom, or -1.0e12 to leave it
:param [in]: left double Value at the left, or -1.0e12 to leave it
"""
return _vsp.SetXSecTanSlews(xsec_id, side, top, right, bottom, left)
[docs]
def GetXSecTanStrengths(xsec_id, side):
r"""
Set the tangent strengths for the specified XSec
.. code-block:: python
# 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.
.. code-block:: python
# 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
"""
return _vsp.GetXSecTanStrengths(xsec_id, side)
[docs]
def SetXSecTanStrengths(xsec_id, side, top, right, bottom, left):
r"""
Set the tangent strengths for one side of an XSec. The four values are given in the order top, right, bottom
and left; a value of -1.0e12 leaves that position as it was. XSEC_BOTH_SIDES sets both sides at
once.
.. code-block:: python
sid = AddGeom( "STACK", "" )
xsec_surf = GetXSecSurf( sid, 0 )
xsec = GetXSec( xsec_surf, 1 )
SetXSecTanStrengths( xsec, XSEC_BOTH_SIDES, 5.0, 5.0, 5.0, 5.0 )
vals = GetXSecTanStrengths( xsec, XSEC_LEFT_SIDE )
for v in vals:
assert abs( v - 5.0 ) < 1e-6, "SetXSecTanStrengths did not take"
See also: GetXSecTanStrengths, XSEC_SIDES_TYPE
:param [in]: xsec_id string XSec ID
:param [in]: side int XSec side type enum (i.e. XSEC_BOTH_SIDES)
:param [in]: top double Value at the top, or -1.0e12 to leave it
:param [in]: right double Value at the right, or -1.0e12 to leave it
:param [in]: bottom double Value at the bottom, or -1.0e12 to leave it
:param [in]: left double Value at the left, or -1.0e12 to leave it
"""
return _vsp.SetXSecTanStrengths(xsec_id, side, top, right, bottom, left)
[docs]
def GetXSecCurvatures(xsec_id, side):
r"""
Set curvatures for the specified XSec
.. code-block:: python
# 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.
.. code-block:: python
# 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
"""
return _vsp.GetXSecCurvatures(xsec_id, side)
[docs]
def SetXSecCurvatures(xsec_id, side, top, right, bottom, left):
r"""
Set the curvatures for one side of an XSec. The four values are given in the order top, right, bottom
and left; a value of -1.0e12 leaves that position as it was. XSEC_BOTH_SIDES sets both sides at
once.
.. code-block:: python
sid = AddGeom( "STACK", "" )
xsec_surf = GetXSecSurf( sid, 0 )
xsec = GetXSec( xsec_surf, 1 )
SetXSecCurvatures( xsec, XSEC_BOTH_SIDES, 5.0, 5.0, 5.0, 5.0 )
vals = GetXSecCurvatures( xsec, XSEC_LEFT_SIDE )
for v in vals:
assert abs( v - 5.0 ) < 1e-6, "SetXSecCurvatures did not take"
See also: GetXSecCurvatures, XSEC_SIDES_TYPE
:param [in]: xsec_id string XSec ID
:param [in]: side int XSec side type enum (i.e. XSEC_BOTH_SIDES)
:param [in]: top double Value at the top, or -1.0e12 to leave it
:param [in]: right double Value at the right, or -1.0e12 to leave it
:param [in]: bottom double Value at the bottom, or -1.0e12 to leave it
:param [in]: left double Value at the left, or -1.0e12 to leave it
"""
return _vsp.SetXSecCurvatures(xsec_id, side, top, right, bottom, left)
[docs]
def ReadFileAirfoil(xsec_id, file_name):
r"""
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.
.. code-block:: python
# 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"
:param [in]: xsec_id string XSec ID
:param [in]: file_name string Airfoil XSec file name
"""
return _vsp.ReadFileAirfoil(xsec_id, file_name)
[docs]
def SetAirfoilUpperPnts(xsec_id, up_pnt_vec):
r"""
Set the upper points for an airfoil. The XSec must be of type XS_FILE_AIRFOIL.
.. code-block:: python
# 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"
:param [in]: xsec_id string XSec ID
:param [in]: up_pnt_vec vector<vec3d> Array of points defining the upper surface of the airfoil
"""
return _vsp.SetAirfoilUpperPnts(xsec_id, up_pnt_vec)
[docs]
def SetAirfoilLowerPnts(xsec_id, low_pnt_vec):
r"""
Set the lower points for an airfoil. The XSec must be of type XS_FILE_AIRFOIL.
.. code-block:: python
# 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"
:param [in]: xsec_id string XSec ID
:param [in]: low_pnt_vec vector<vec3d> Array of points defining the lower surface of the airfoil
"""
return _vsp.SetAirfoilLowerPnts(xsec_id, low_pnt_vec)
[docs]
def SetAirfoilPnts(xsec_id, up_pnt_vec, low_pnt_vec):
r"""
Set the upper and lower points for an airfoil. The XSec must be of type XS_FILE_AIRFOIL.
.. code-block:: python
# 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"
:param [in]: xsec_id string XSec ID
:param [in]: up_pnt_vec vector<vec3d> Array of points defining the upper surface of the airfoil
:param [in]: low_pnt_vec vector<vec3d> Array of points defining the lower surface of the airfoil
"""
return _vsp.SetAirfoilPnts(xsec_id, up_pnt_vec, low_pnt_vec)
[docs]
def GetHersheyBarLiftDist(npts, alpha, Vinf, span, full_span_flag=False):
r"""
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.
.. code-block:: python
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 )
:param [in]: npts int Number of points along the span to assess
:param [in]: alpha double Wing angle of attack (Radians)
:param [in]: Vinf double Freestream velocity
:param [in]: span double Hershey Bar full-span. Note, only half is used in the calculation
:param [in]: full_span_flag bool Flag to apply symmetry to results
:rtype: std::vector< vec3d,std::allocator< vec3d > >
:return: vector<vec3d> Theoretical coefficient of lift distribution array (size = 2*npts if full_span_flag = true)
"""
return _vsp.GetHersheyBarLiftDist(npts, alpha, Vinf, span, full_span_flag)
[docs]
def GetHersheyBarDragDist(npts, alpha, Vinf, span, full_span_flag=False):
r"""
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.
.. code-block:: python
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"
:param [in]: npts int Number of points along the span to assess
:param [in]: alpha double Wing angle of attack (Radians)
:param [in]: Vinf double Freestream velocity
:param [in]: span double Hershey Bar full-span. Note, only half is used in the calculation
:param [in]: full_span_flag bool Flag to apply symmetry to results (default: false)
:rtype: std::vector< vec3d,std::allocator< vec3d > >
:return: vector<vec3d> Theoretical coefficient of drag distribution array (size = 2*npts if full_span_flag = true)
"""
return _vsp.GetHersheyBarDragDist(npts, alpha, Vinf, span, full_span_flag)
[docs]
def GetVKTAirfoilPnts(npts, alpha, epsilon, kappa, tau):
r"""
Get the 2D coordinates an input number of points along a Von K�rm�n-Trefftz airfoil of specified shape
.. code-block:: python
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 )
:param [in]: npts int Number of points along the airfoil to return
: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)
:rtype: std::vector< vec3d,std::allocator< vec3d > >
:return: vector<vec3d> Array of points on the VKT airfoil (size = npts)
"""
return _vsp.GetVKTAirfoilPnts(npts, alpha, epsilon, kappa, tau)
[docs]
def GetVKTAirfoilCpDist(alpha, epsilon, kappa, tau, xyz_data):
r"""
Get the pressure coefficient (Cp) along a Von Kármán-Trefftz airfoil of specified shape at specified points along the airfoil
.. code-block:: python
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
"""
return _vsp.GetVKTAirfoilCpDist(alpha, epsilon, kappa, tau, xyz_data)
[docs]
def GetEllipsoidSurfPnts(center, abc_rad, u_npts=20, w_npts=20):
r"""
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).
.. code-block:: python
pnts = GetEllipsoidSurfPnts( vec3d( 0.0, 0.0, 0.0 ), vec3d( 1.0, 2.0, 3.0 ), 10, 10 )
assert len( pnts ) > 0, "GetEllipsoidSurfPnts returned nothing"
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
"""
return _vsp.GetEllipsoidSurfPnts(center, abc_rad, u_npts, w_npts)
[docs]
def GetFeatureLinePnts(geom_id):
r"""
Get the points along the feature lines of a particular Geom
.. code-block:: python
pid = AddGeom( "POD" )
Update()
pnts = GetFeatureLinePnts( pid )
assert len( pnts ) > 0, "GetFeatureLinePnts returned nothing"
: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
"""
return _vsp.GetFeatureLinePnts(geom_id)
[docs]
def GetEllipsoidCpDist(surf_pnt_vec, abc_rad, V_inf):
r"""
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.
.. code-block:: python
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
"""
return _vsp.GetEllipsoidCpDist(surf_pnt_vec, abc_rad, V_inf)
[docs]
def IntegrateEllipsoidFlow(abc_rad, abc_index):
r"""
Integrate the analytic potential flow solution over an ellipsoid. Used to check a panel or
surface solution against a case with a known answer.
.. code-block:: python
val = IntegrateEllipsoidFlow( vec3d( 1.0, 2.0, 3.0 ), 0 )
assert val != 0.0, "IntegrateEllipsoidFlow returned zero"
See also: GetEllipsoidSurfPnts
:param [in]: abc_rad vec3d Semi-axis lengths of the ellipsoid
:param [in]: abc_index int Index of the axis the flow is along, 0, 1 or 2
:rtype: float
:return: double Integrated value
"""
return _vsp.IntegrateEllipsoidFlow(abc_rad, abc_index)
[docs]
def GetAirfoilUpperPnts(xsec_id):
r"""
Get the coordinate points for the upper surface of an airfoil. The XSec must be of type XS_FILE_AIRFOIL
.. code-block:: python
# 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
"""
return _vsp.GetAirfoilUpperPnts(xsec_id)
[docs]
def GetAirfoilLowerPnts(xsec_id):
r"""
Get the coordinate points for the lower surface of an airfoil. The XSec must be of type XS_FILE_AIRFOIL
.. code-block:: python
# 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
"""
return _vsp.GetAirfoilLowerPnts(xsec_id)
[docs]
def GetUpperCSTCoefs(xsec_id):
r"""
Get the CST coefficients for the upper surface of an airfoil. The XSec must be of type XS_CST_AIRFOIL
.. code-block:: python
wid = AddGeom( "WING" )
xsec_surf = GetXSecSurf( wid, 0 )
ChangeXSecShape( xsec_surf, 1, XS_CST_AIRFOIL )
Update()
xsec = GetXSec( xsec_surf, 1 )
coefs = GetUpperCSTCoefs( xsec )
assert len( coefs ) > 0, "GetUpperCSTCoefs returned nothing"
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
"""
return _vsp.GetUpperCSTCoefs(xsec_id)
[docs]
def GetLowerCSTCoefs(xsec_id):
r"""
Get the CST coefficients for the lower surface of an airfoil. The XSec must be of type XS_CST_AIRFOIL
.. code-block:: python
wid = AddGeom( "WING" )
xsec_surf = GetXSecSurf( wid, 0 )
ChangeXSecShape( xsec_surf, 1, XS_CST_AIRFOIL )
Update()
xsec = GetXSec( xsec_surf, 1 )
coefs = GetLowerCSTCoefs( xsec )
assert len( coefs ) > 0, "GetLowerCSTCoefs returned nothing"
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
"""
return _vsp.GetLowerCSTCoefs(xsec_id)
[docs]
def GetUpperCSTDegree(xsec_id):
r"""
Get the CST degree for the upper surface of an airfoil. The XSec must be of type XS_CST_AIRFOIL
.. code-block:: python
wid = AddGeom( "WING" )
xsec_surf = GetXSecSurf( wid, 0 )
ChangeXSecShape( xsec_surf, 1, XS_CST_AIRFOIL )
Update()
xsec = GetXSec( xsec_surf, 1 )
assert GetUpperCSTDegree( xsec ) >= 1, "GetUpperCSTDegree returned a degenerate degree"
See also: SetUpperCST
:param [in]: xsec_id string XSec ID
:rtype: int
:return: int CST Degree for upper airfoil surface
"""
return _vsp.GetUpperCSTDegree(xsec_id)
[docs]
def GetLowerCSTDegree(xsec_id):
r"""
Get the CST degree for the lower surface of an airfoil. The XSec must be of type XS_CST_AIRFOIL
.. code-block:: python
wid = AddGeom( "WING" )
xsec_surf = GetXSecSurf( wid, 0 )
ChangeXSecShape( xsec_surf, 1, XS_CST_AIRFOIL )
Update()
xsec = GetXSec( xsec_surf, 1 )
assert GetLowerCSTDegree( xsec ) >= 1, "GetLowerCSTDegree returned a degenerate degree"
See also: SetLowerCST
:param [in]: xsec_id string XSec ID
:rtype: int
:return: int CST Degree for lower airfoil surface
"""
return _vsp.GetLowerCSTDegree(xsec_id)
[docs]
def SetUpperCST(xsec_id, deg, coefs):
r"""
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
.. code-block:: python
wid = AddGeom( "WING" )
xsec_surf = GetXSecSurf( wid, 0 )
ChangeXSecShape( xsec_surf, 1, XS_CST_AIRFOIL )
Update()
xsec = GetXSec( xsec_surf, 1 )
coefs = GetUpperCSTCoefs( xsec )
SetUpperCST( xsec, GetUpperCSTDegree( xsec ), coefs )
Update()
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
"""
return _vsp.SetUpperCST(xsec_id, deg, coefs)
[docs]
def SetLowerCST(xsec_id, deg, coefs):
r"""
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
.. code-block:: python
wid = AddGeom( "WING" )
xsec_surf = GetXSecSurf( wid, 0 )
ChangeXSecShape( xsec_surf, 1, XS_CST_AIRFOIL )
Update()
xsec = GetXSec( xsec_surf, 1 )
coefs = GetLowerCSTCoefs( xsec )
SetLowerCST( xsec, GetLowerCSTDegree( xsec ), coefs )
Update()
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
"""
return _vsp.SetLowerCST(xsec_id, deg, coefs)
[docs]
def DemoteCSTUpper(xsec_id):
r"""
Demote the CST for the upper airfoil surface. The XSec must be of type XS_CST_AIRFOIL
.. code-block:: python
wid = AddGeom( "WING" )
xsec_surf = GetXSecSurf( wid, 0 )
ChangeXSecShape( xsec_surf, 1, XS_CST_AIRFOIL )
Update()
xsec = GetXSec( xsec_surf, 1 )
PromoteCSTUpper( xsec )
deg = GetUpperCSTDegree( xsec )
DemoteCSTUpper( xsec )
assert GetUpperCSTDegree( xsec ) == deg - 1, "DemoteCSTUpper did not lower the degree"
See also: GetUpperCSTDegree
:param [in]: xsec_id string XSec ID
"""
return _vsp.DemoteCSTUpper(xsec_id)
[docs]
def DemoteCSTLower(xsec_id):
r"""
Demote the CST for the lower airfoil surface. The XSec must be of type XS_CST_AIRFOIL
.. code-block:: python
wid = AddGeom( "WING" )
xsec_surf = GetXSecSurf( wid, 0 )
ChangeXSecShape( xsec_surf, 1, XS_CST_AIRFOIL )
Update()
xsec = GetXSec( xsec_surf, 1 )
PromoteCSTLower( xsec )
deg = GetLowerCSTDegree( xsec )
DemoteCSTLower( xsec )
assert GetLowerCSTDegree( xsec ) == deg - 1, "DemoteCSTLower did not lower the degree"
See also: GetLowerCSTDegree
:param [in]: xsec_id string XSec ID
"""
return _vsp.DemoteCSTLower(xsec_id)
[docs]
def FitAfCST(xsec_surf_id, xsec_index, deg):
r"""
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.
.. code-block:: python
wid = AddGeom( "WING" )
xsec_surf = GetXSecSurf( wid, 0 )
Update()
FitAfCST( xsec_surf, 1, 5 )
Update()
:param [in]: xsec_surf_id string XsecSurf ID
:param [in]: xsec_index int XSec index
:param [in]: deg int CST degree
"""
return _vsp.FitAfCST(xsec_surf_id, xsec_index, deg)
[docs]
def AddBackground3D():
r"""
Add a Background3D to model
.. code-block:: python
nbg = GetNumBackground3Ds()
# Add Background3D
bg_id = AddBackground3D()
if GetNumBackground3Ds() != nbg + 1 :
print( "ERROR: AddBackground3D" )
assert False, "ERROR: AddBackground3D"
DelBackground3D( bg_id )
:rtype: string
:return: string ID for added Background3D
"""
return _vsp.AddBackground3D()
[docs]
def GetNumBackground3Ds():
r"""
Get Number of Background3D's in a model
.. code-block:: python
nbg = GetNumBackground3Ds()
# Add Background3D
bg_id = AddBackground3D()
if GetNumBackground3Ds() != nbg + 1 :
print( "ERROR: AddBackground3D" )
assert False, "ERROR: AddBackground3D"
DelBackground3D( bg_id )
:rtype: int
:return: int Number of Background3D's in model
"""
return _vsp.GetNumBackground3Ds()
[docs]
def GetAllBackground3Ds():
r"""
Get id's of all Background3Ds in model
.. code-block:: python
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()
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<string> Vector of Background3D IDs
"""
return _vsp.GetAllBackground3Ds()
[docs]
def ShowAllBackground3Ds():
r"""
Show all Background3Ds in model
.. code-block:: python
# 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"
"""
return _vsp.ShowAllBackground3Ds()
[docs]
def HideAllBackground3Ds():
r"""
Hide all Background3Ds in model
.. code-block:: python
# 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"
"""
return _vsp.HideAllBackground3Ds()
[docs]
def DelAllBackground3Ds():
r"""
Delete all Background3Ds in model
.. code-block:: python
# Add Background3D
AddBackground3D()
AddBackground3D()
AddBackground3D()
DelAllBackground3Ds()
nbg = GetNumBackground3Ds()
if nbg != 0 :
print( "ERROR: DelAllBackground3Ds" )
assert False, "ERROR: DelAllBackground3Ds"
"""
return _vsp.DelAllBackground3Ds()
[docs]
def DelBackground3D(id):
r"""
Delete specific Background3D frommodel
.. code-block:: python
# Add Background3D
AddBackground3D()
bg_id = AddBackground3D()
AddBackground3D()
nbg = GetNumBackground3Ds()
DelBackground3D( bg_id )
if GetNumBackground3Ds() != nbg -1 :
print( "ERROR: DelBackground3D" )
assert False, "ERROR: DelBackground3D"
:param [in]: id string Background3D ID to delete
"""
return _vsp.DelBackground3D(id)
[docs]
def GetAllBackground3DRelativePaths():
r"""
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.
.. code-block:: python
# 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()
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<string> Vector of relative paths to Background3D image files
"""
return _vsp.GetAllBackground3DRelativePaths()
[docs]
def GetAllBackground3DAbsolutePaths():
r"""
Get absolute paths to all Background3D images in model.
.. code-block:: python
# 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()
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<string> Vector of absolute paths to Background3D image files
"""
return _vsp.GetAllBackground3DAbsolutePaths()
[docs]
def GetBackground3DRelativePath(id):
r"""
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.
.. code-block:: python
# 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()
:param [in]: id string Background3D ID
:rtype: string
:return: string Relative path to Background3D image file
"""
return _vsp.GetBackground3DRelativePath(id)
[docs]
def GetBackground3DAbsolutePath(id):
r"""
Get absolute path to specified Background3D's image.
.. code-block:: python
# 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()
:param [in]: id string Background3D ID
:rtype: string
:return: string Absolute path to Background3D image file
"""
return _vsp.GetBackground3DAbsolutePath(id)
[docs]
def SetBackground3DRelativePath(id, fname):
r"""
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.
.. code-block:: python
# 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()
:param [in]: id string Background3D ID
:param [in]: fname string Relative path to Background3D image file
"""
return _vsp.SetBackground3DRelativePath(id, fname)
[docs]
def SetBackground3DAbsolutePath(id, fname):
r"""
Set absolute path to specified Background3D's image.
.. code-block:: python
# 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()
:param [in]: id string Background3D ID
:param [in]: fname string Absolute path to Background3D image file
"""
return _vsp.SetBackground3DAbsolutePath(id, fname)
[docs]
def CreateAndAddBogie(gear_id):
r"""
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.
.. code-block:: python
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
"""
return _vsp.CreateAndAddBogie(gear_id)
[docs]
def GetNumBogies(gear_id):
r"""
Get the number of Bogies in the specified GearGeom.
.. code-block:: python
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
"""
return _vsp.GetNumBogies(gear_id)
[docs]
def GetAllBogies(gear_id):
r"""
Get the ParmContainer IDs of all the Bogies in the specified GearGeom, in list order.
.. code-block:: python
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
"""
return _vsp.GetAllBogies(gear_id)
[docs]
def DelBogie(gear_id, bogie_id):
r"""
Delete the specified Bogie from the specified GearGeom.
.. code-block:: python
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
"""
return _vsp.DelBogie(gear_id, bogie_id)
[docs]
def DelAllBogies(gear_id):
r"""
Delete all Bogies from the specified GearGeom.
.. code-block:: python
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
"""
return _vsp.DelAllBogies(gear_id)
[docs]
def ReadAuxiliaryGeomCCEFile(geom_id, file_name):
r"""
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.
.. code-block:: python
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()
:param [in]: geom_id string AuxiliaryGeom Geom ID
:param [in]: file_name string Name of the .cce file to read
"""
return _vsp.ReadAuxiliaryGeomCCEFile(geom_id, file_name)
[docs]
def InitStackPreset(geom_id, preset):
r"""
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.
.. code-block:: python
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"
:param [in]: geom_id string StackGeom Geom ID
:param [in]: preset int Preset enum (see STACK_PRESETS)
"""
return _vsp.InitStackPreset(geom_id, preset)
[docs]
def GetNumRoutingPts(routing_id):
r"""
Get the number of routing points in a RoutingGeom
.. code-block:: python
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
"""
return _vsp.GetNumRoutingPts(routing_id)
[docs]
def AddRoutingPt(routing_id, geom_id, surf_index):
r"""
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.
.. code-block:: python
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
"""
return _vsp.AddRoutingPt(routing_id, geom_id, surf_index)
[docs]
def InsertRoutingPt(routing_id, index, geom_id, surf_index):
r"""
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.
.. code-block:: python
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
"""
return _vsp.InsertRoutingPt(routing_id, index, geom_id, surf_index)
[docs]
def DelRoutingPt(routing_id, index):
r"""
Delete a specified routing point from a RoutingGeom.
.. code-block:: python
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
"""
return _vsp.DelRoutingPt(routing_id, index)
[docs]
def DelAllRoutingPt(routing_id):
r"""
Delete all routing points from a RoutingGeom.
.. code-block:: python
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
"""
return _vsp.DelAllRoutingPt(routing_id)
[docs]
def MoveRoutingPt(routing_id, index, reorder_type):
r"""
Move a specified routing point within the route of a RoutingGeom.
.. code-block:: python
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)
"""
return _vsp.MoveRoutingPt(routing_id, index, reorder_type)
[docs]
def GetRoutingPtID(routing_id, index):
r"""
Get the ParmContainer ID of a routing point within a RoutingGeom.
.. code-block:: python
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
"""
return _vsp.GetRoutingPtID(routing_id, index)
[docs]
def GetAllRoutingPtIds(routing_id):
r"""
Get the ParmContainer IDs of all the routing points within a RoutingGeom. The vector will contain the IDs in order.
.. code-block:: python
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
"""
return _vsp.GetAllRoutingPtIds(routing_id)
[docs]
def GetRoutingPtParentID(pt_id):
r"""
Get the Geom ID of the geom a routing point is anchored to.
.. code-block:: python
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
"""
return _vsp.GetRoutingPtParentID(pt_id)
[docs]
def SetRoutingPtParentID(pt_id, parent_id):
r"""
Set the Geom ID of the geom a routing point is anchored to.
.. code-block:: python
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
"""
return _vsp.SetRoutingPtParentID(pt_id, parent_id)
[docs]
def GetMainRoutingPtCoord(pt_id):
r"""
Get the main coordinate location a routing point. The main location is the location of the base copy before
symmetry has been applied.
.. code-block:: python
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: :py:class:`vec3d`
:return: vec3d coordinate of main routing point
"""
return _vsp.GetMainRoutingPtCoord(pt_id)
[docs]
def GetRoutingPtCoord(routing_id, index, symm_index):
r"""
Get the coordinate location a routing point in a RoutingGeom. The main location is symm_index = 0.
.. code-block:: python
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: :py:class:`vec3d`
:return: vec3d coordinate of routing point
"""
return _vsp.GetRoutingPtCoord(routing_id, index, symm_index)
[docs]
def GetAllRoutingPtCoords(routing_id, symm_index):
r"""
Get the coordinate locations along a RoutingGeom. The main copy is symm_index = 0.
.. code-block:: python
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
"""
return _vsp.GetAllRoutingPtCoords(routing_id, symm_index)
[docs]
def GetRoutingCurve(routing_id, symm_index):
r"""
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.
.. code-block:: python
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
"""
return _vsp.GetRoutingCurve(routing_id, symm_index)
[docs]
def ChangeBORXSecShape(bor_id, type):
r"""
Set the XSec type for a BOR component
.. code-block:: python
# 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)
"""
return _vsp.ChangeBORXSecShape(bor_id, type)
[docs]
def GetBORXSecShape(bor_id):
r"""
Get the XSec type for a BOR component
.. code-block:: python
# 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"
:param [in]: bor_id string Body of revolution Geom ID
:rtype: int
:return: int XSec type enum (i.e. XS_ROUNDED_RECTANGLE)
"""
return _vsp.GetBORXSecShape(bor_id)
[docs]
def ReadBORFileXSec(bor_id, file_name):
r"""
Set the coordinate points for a specific BOR. The BOR XSecCurve must be of type XS_FILE_FUSE.
.. code-block:: python
# 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"
:param [in]: bor_id string Body of revolution Geom ID
:param [in]: file_name string Fuselage XSec file name
:rtype: std::vector< vec3d,std::allocator< vec3d > >
:return: vector<vec3d> Array of coordinate points read from the file and set to the XSec
"""
return _vsp.ReadBORFileXSec(bor_id, file_name)
[docs]
def GetBORXSecPnts(bor_id):
r"""
Set the coordinate points for a specific BOR. The BOR XSecCurve must be of type XS_FILE_FUSE.
.. code-block:: python
# 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"
:param [in]: bor_id string Body of revolution Geom ID
:param [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.
.. code-block:: python
# 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
"""
return _vsp.GetBORXSecPnts(bor_id)
[docs]
def SetBORXSecPnts(bor_id, pnt_vec):
r"""
Set the points of a body of revolution's file XSec. The BOR's XSec must be of type XS_FILE_FUSE.
.. code-block:: python
bid = AddGeom( "BODYOFREVOLUTION", "" )
ChangeBORXSecShape( bid, XS_FILE_FUSE )
Update()
# Take the section's own points and hand back a squashed copy of them.
pnt_vec = [ vec3d( p.x(), 0.5 * p.y(), p.z() ) for p in GetBORXSecPnts( bid ) ]
SetBORXSecPnts( bid, pnt_vec )
Update()
assert len( GetBORXSecPnts( bid ) ) == len( pnt_vec ), "SetBORXSecPnts did not take the points"
See also: GetBORXSecPnts, ChangeBORXSecShape
:param [in]: bor_id string Body of revolution Geom ID
:param [in]: pnt_vec vector<vec3d> Points defining the section
"""
return _vsp.SetBORXSecPnts(bor_id, pnt_vec)
[docs]
def ComputeBORXSecPnt(bor_id, fract):
r"""
Compute 3D coordinate for a point on a BOR XSecCurve given the parameter value (U) along the curve
.. code-block:: python
#==== 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"
:param [in]: bor_id string Body of revolution Geom ID
:param [in]: fract double Curve parameter value (range: 0 - 1)
:rtype: :py:class:`vec3d`
:return: vec3d Coordinate point on curve
"""
return _vsp.ComputeBORXSecPnt(bor_id, fract)
[docs]
def ComputeBORXSecTan(bor_id, fract):
r"""
Compute the tangent vector of a point on a BOR XSecCurve given the parameter value (U) along the curve
.. code-block:: python
# 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"
:param [in]: bor_id string Body of revolution Geom ID
:param [in]: fract double Curve parameter value (range: 0 - 1)
:rtype: :py:class:`vec3d`
:return: vec3d Tangent vector on curve
"""
return _vsp.ComputeBORXSecTan(bor_id, fract)
[docs]
def ReadBORFileAirfoil(bor_id, file_name):
r"""
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.
.. code-block:: python
# 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"
:param [in]: bor_id string Body of revolution Geom ID
:param [in]: file_name string Airfoil XSec file name
"""
return _vsp.ReadBORFileAirfoil(bor_id, file_name)
[docs]
def SetBORAirfoilUpperPnts(bor_id, up_pnt_vec):
r"""
Set the upper points for an airfoil on a BOR. The BOR XSecCurve must be of type XS_FILE_AIRFOIL.
.. code-block:: python
# 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"
:param [in]: bor_id string Body of revolution Geom ID
:param [in]: up_pnt_vec vector<vec3d> Vector of points defining the upper surface of the airfoil
"""
return _vsp.SetBORAirfoilUpperPnts(bor_id, up_pnt_vec)
[docs]
def SetBORAirfoilLowerPnts(bor_id, low_pnt_vec):
r"""
Set the lower points for an airfoil on a BOR. The BOR XSecCurve must be of type XS_FILE_AIRFOIL.
.. code-block:: python
# 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"
:param [in]: bor_id string Body of revolution Geom ID
:param [in]: low_pnt_vec vector<vec3d> Vector of points defining the lower surface of the airfoil
"""
return _vsp.SetBORAirfoilLowerPnts(bor_id, low_pnt_vec)
[docs]
def SetBORAirfoilPnts(bor_id, up_pnt_vec, low_pnt_vec):
r"""
Set the upper and lower points for an airfoil on a BOR. The BOR XSecCurve must be of type XS_FILE_AIRFOIL.
.. code-block:: python
# 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"
:param [in]: bor_id string Body of revolution Geom ID
:param [in]: up_pnt_vec vector<vec3d> Vector of points defining the upper surface of the airfoil
:param [in]: low_pnt_vec vector<_>vec3d> Vector of points defining the lower surface of the airfoil
"""
return _vsp.SetBORAirfoilPnts(bor_id, up_pnt_vec, low_pnt_vec)
[docs]
def GetBORAirfoilUpperPnts(bor_id):
r"""
Get the coordinate points for the upper surface of an airfoil on a BOR. The BOR XSecCurve must be of type XS_FILE_AIRFOIL
.. code-block:: python
# 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
"""
return _vsp.GetBORAirfoilUpperPnts(bor_id)
[docs]
def GetBORAirfoilLowerPnts(bor_id):
r"""
Get the coordinate points for the lower surface of an airfoil of a BOR. The XSecCurve must be of type XS_FILE_AIRFOIL
.. code-block:: python
# 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
"""
return _vsp.GetBORAirfoilLowerPnts(bor_id)
[docs]
def GetBORUpperCSTCoefs(bor_id):
r"""
Get the CST coefficients for the upper surface of an airfoil of a BOR. The XSecCurve must be of type XS_CST_AIRFOIL
.. code-block:: python
bid = AddGeom( "BODYOFREVOLUTION", "" )
ChangeBORXSecShape( bid, XS_CST_AIRFOIL )
Update()
coefs = GetBORUpperCSTCoefs( bid )
assert len( coefs ) > 0, "GetBORUpperCSTCoefs returned nothing"
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
"""
return _vsp.GetBORUpperCSTCoefs(bor_id)
[docs]
def GetBORLowerCSTCoefs(bor_id):
r"""
Get the CST coefficients for the lower surface of an airfoil of a BOR. The XSecCurve must be of type XS_CST_AIRFOIL
.. code-block:: python
bid = AddGeom( "BODYOFREVOLUTION", "" )
ChangeBORXSecShape( bid, XS_CST_AIRFOIL )
Update()
coefs = GetBORLowerCSTCoefs( bid )
assert len( coefs ) > 0, "GetBORLowerCSTCoefs returned nothing"
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
"""
return _vsp.GetBORLowerCSTCoefs(bor_id)
[docs]
def GetBORUpperCSTDegree(bor_id):
r"""
Get the CST degree for the upper surface of an airfoil of a BOR. The XSecCurve must be of type XS_CST_AIRFOIL
.. code-block:: python
bid = AddGeom( "BODYOFREVOLUTION", "" )
ChangeBORXSecShape( bid, XS_CST_AIRFOIL )
Update()
assert GetBORUpperCSTDegree( bid ) >= 1, "GetBORUpperCSTDegree returned a degenerate degree"
See also: SetUpperCST
:param [in]: bor_id string Body of revolution Geom ID
:rtype: int
:return: int CST Degree for upper airfoil surface
"""
return _vsp.GetBORUpperCSTDegree(bor_id)
[docs]
def GetBORLowerCSTDegree(bor_id):
r"""
Get the CST degree for the lower surface of an airfoil of a BOR. The XSecCurve must be of type XS_CST_AIRFOIL
.. code-block:: python
bid = AddGeom( "BODYOFREVOLUTION", "" )
ChangeBORXSecShape( bid, XS_CST_AIRFOIL )
Update()
assert GetBORLowerCSTDegree( bid ) >= 1, "GetBORLowerCSTDegree returned a degenerate degree"
See also: SetLowerCST
:param [in]: bor_id string Body of revolution Geom ID
:rtype: int
:return: int CST Degree for lower airfoil surface
"""
return _vsp.GetBORLowerCSTDegree(bor_id)
[docs]
def SetBORUpperCST(bor_id, deg, coefs):
r"""
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
.. code-block:: python
bid = AddGeom( "BODYOFREVOLUTION", "" )
ChangeBORXSecShape( bid, XS_CST_AIRFOIL )
Update()
coefs = GetBORUpperCSTCoefs( bid )
SetBORUpperCST( bid, GetBORUpperCSTDegree( bid ), coefs )
Update()
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
"""
return _vsp.SetBORUpperCST(bor_id, deg, coefs)
[docs]
def SetBORLowerCST(bor_id, deg, coefs):
r"""
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
.. code-block:: python
bid = AddGeom( "BODYOFREVOLUTION", "" )
ChangeBORXSecShape( bid, XS_CST_AIRFOIL )
Update()
coefs = GetBORLowerCSTCoefs( bid )
SetBORLowerCST( bid, GetBORLowerCSTDegree( bid ), coefs )
Update()
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
"""
return _vsp.SetBORLowerCST(bor_id, deg, coefs)
[docs]
def DemoteBORCSTUpper(bor_id):
r"""
Demote the CST for the upper airfoil surface of a BOR. The XSecCurve must be of type XS_CST_AIRFOIL
.. code-block:: python
bid = AddGeom( "BODYOFREVOLUTION", "" )
ChangeBORXSecShape( bid, XS_CST_AIRFOIL )
Update()
PromoteBORCSTUpper( bid )
deg = GetBORUpperCSTDegree( bid )
DemoteBORCSTUpper( bid )
assert GetBORUpperCSTDegree( bid ) == deg - 1, "DemoteBORCSTUpper did not lower the degree"
See also: GetUpperCSTDegree
:param [in]: bor_id string Body of revolution Geom ID
"""
return _vsp.DemoteBORCSTUpper(bor_id)
[docs]
def DemoteBORCSTLower(bor_id):
r"""
Demote the CST for the lower airfoil surface of a BOR. The XSecCurve must be of type XS_CST_AIRFOIL
.. code-block:: python
bid = AddGeom( "BODYOFREVOLUTION", "" )
ChangeBORXSecShape( bid, XS_CST_AIRFOIL )
Update()
PromoteBORCSTLower( bid )
deg = GetBORLowerCSTDegree( bid )
DemoteBORCSTLower( bid )
assert GetBORLowerCSTDegree( bid ) == deg - 1, "DemoteBORCSTLower did not lower the degree"
See also: GetLowerCSTDegree
:param [in]: bor_id string Body of revolution Geom ID
"""
return _vsp.DemoteBORCSTLower(bor_id)
[docs]
def FitBORAfCST(bor_id, deg):
r"""
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.
.. code-block:: python
bid = AddGeom( "BODYOFREVOLUTION", "" )
ChangeBORXSecShape( bid, XS_FOUR_SERIES )
Update()
FitBORAfCST( bid, 5 )
Update()
:param [in]: bor_id string Body of revolution Geom ID
:param [in]: deg int CST degree
"""
return _vsp.FitBORAfCST(bor_id, deg)
[docs]
def WriteBezierAirfoil(file_name, geom_id, foilsurf_u):
r"""
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.
.. code-block:: python
#==== 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"
:param [in]: file_name string Airfoil (\*.bz) 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)
"""
return _vsp.WriteBezierAirfoil(file_name, geom_id, foilsurf_u)
[docs]
def WriteSeligAirfoil(file_name, geom_id, foilsurf_u):
r"""
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.
.. code-block:: python
#==== 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)
"""
return _vsp.WriteSeligAirfoil(file_name, geom_id, foilsurf_u)
[docs]
def GetAirfoilCoordinates(geom_id, foilsurf_u):
r"""
Get the untwisted unit-length 2D coordinate points for the specified airfoil
.. code-block:: python
wid = AddGeom( "WING" )
Update()
pnts = GetAirfoilCoordinates( wid, 0.5 )
assert len( pnts ) > 0, "GetAirfoilCoordinates returned nothing"
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)
"""
return _vsp.GetAirfoilCoordinates(geom_id, foilsurf_u)
[docs]
def EditXSecInitShape(xsec_id):
r"""
Initialize the EditCurveXSec to the current value of m_ShapeType (i.e. EDIT_XSEC_ELLIPSE)
.. code-block:: python
# 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
"""
return _vsp.EditXSecInitShape(xsec_id)
[docs]
def EditXSecConvertTo(xsec_id, newtype):
r"""
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.
.. code-block:: python
# 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)
"""
return _vsp.EditXSecConvertTo(xsec_id, newtype)
[docs]
def GetEditXSecUVec(xsec_id):
r"""
Get the U parameter vector for an EditCurveXSec. The vector will be in increasing order with a range of 0 - 1.
.. code-block:: python
# 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"
:param [in]: xsec_id string XSec ID
:rtype: std::vector< double,std::allocator< double > >
:return: vector <double> Array of U parameter values
"""
return _vsp.GetEditXSecUVec(xsec_id)
[docs]
def GetEditXSecCtrlVec(xsec_id, non_dimensional=True):
r"""
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.
.. code-block:: python
# 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()}" )
:param [in]: xsec_id string XSec ID
:param [in]: non_dimensional bool True to get the points non-dimensionalized, False to get them scaled by m_Width and m_Height
:rtype: std::vector< vec3d,std::allocator< vec3d > >
:return: vector <vec3d> Array of control points
"""
return _vsp.GetEditXSecCtrlVec(xsec_id, non_dimensional)
[docs]
def SetEditXSecPnts(xsec_id, u_vec, control_pts, r_vec):
r"""
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].
.. code-block:: python
# 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"
:param [in]: xsec_id string XSec ID
:param [in]: u_vec vector <double> Array of U parameter values
:param [in]: r_vec vector <double> Array of R parameter values
:param [in]: control_pts vector <vec3d> Nondimensionalized array of control points
"""
return _vsp.SetEditXSecPnts(xsec_id, u_vec, control_pts, r_vec)
[docs]
def EditXSecDelPnt(xsec_id, indx):
r"""
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.
.. code-block:: python
# 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"
:param [in]: xsec_id string XSec ID
:param [in]: indx int Control point index
"""
return _vsp.EditXSecDelPnt(xsec_id, indx)
[docs]
def EditXSecSplit01(xsec_id, u):
r"""
Split the EditCurveXSec at the specified U value
.. code-block:: python
# 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"
:param [in]: xsec_id string XSec ID
:param [in]: u double U value to split the curve at (0 - 1)
:rtype: int
:return: int Index of the point added from the split
"""
return _vsp.EditXSecSplit01(xsec_id, u)
[docs]
def MoveEditXSecPnt(xsec_id, indx, new_pnt):
r"""
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.
.. code-block:: python
# 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"
:param [in]: xsec_id string XSec ID
:param [in]: indx int Control point index
:param [in]: new_pnt vec3d Coordinate of the new point
"""
return _vsp.MoveEditXSecPnt(xsec_id, indx, new_pnt)
[docs]
def ConvertXSecToEdit(geom_id, indx=0):
r"""
Convert any XSec type into an EditCurveXSec. This function will work for BOR Geoms, in which case the input XSec index is ignored.
.. code-block:: python
# 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"
:param [in]: geom_id string Geom ID
:param [in]: indx int XSec index
"""
return _vsp.ConvertXSecToEdit(geom_id, indx)
[docs]
def GetEditXSecFixedUVec(xsec_id):
r"""
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.
.. code-block:: python
# 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
"""
return _vsp.GetEditXSecFixedUVec(xsec_id)
[docs]
def SetEditXSecFixedUVec(xsec_id, fixed_u_vec):
r"""
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.
.. code-block:: python
# 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
"""
return _vsp.SetEditXSecFixedUVec(xsec_id, fixed_u_vec)
[docs]
def ReparameterizeEditXSec(xsec_id):
r"""
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.
.. code-block:: python
# 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
"""
return _vsp.ReparameterizeEditXSec(xsec_id)
[docs]
def GetNumSets():
r"""
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.
.. code-block:: python
if GetNumSets() <= 0 :
print( "---> Error: API GetNumSets " )
assert False, "---> Error: API GetNumSets"
:rtype: int
:return: int Number of sets
"""
return _vsp.GetNumSets()
[docs]
def SetSetName(index, name):
r"""
Set the name of a set at specified index
.. code-block:: python
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
"""
return _vsp.SetSetName(index, name)
[docs]
def GetSetName(index):
r"""
Get the name of a set at specified index
.. code-block:: python
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
"""
return _vsp.GetSetName(index)
[docs]
def GetGeomSetAtIndex(index):
r"""
Get an array of Geom IDs for the specified set index
.. code-block:: python
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
"""
return _vsp.GetGeomSetAtIndex(index)
[docs]
def GetGeomSet(name):
r"""
Get an array of Geom IDs for the specified set name
.. code-block:: python
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"
:param [in]: name string const string set name
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: array<string> array of Geom IDs
"""
return _vsp.GetGeomSet(name)
[docs]
def GetSetIndex(name):
r"""
Get the set index for the specified set name
.. code-block:: python
SetSetName( 3, "SetFromScript" )
if GetSetIndex("SetFromScript") != 3:
print("ERROR: GetSetIndex")
assert False, "ERROR: GetSetIndex"
:param [in]: name string Set name
:rtype: int
:return: int Set index
"""
return _vsp.GetSetIndex(name)
[docs]
def GetSetFlag(geom_id, set_index):
r"""
Check if a Geom is in the set at the specified set index
.. code-block:: python
# 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"
:param [in]: geom_id string Geom ID
:param [in]: set_index int Set index
:rtype: boolean
:return: bool True if geom is in the set, false otherwise
"""
return _vsp.GetSetFlag(geom_id, set_index)
[docs]
def SetSetFlag(geom_id, set_index, flag):
r"""
Set whether or not a Geom is a member of the set at specified set index
.. code-block:: python
# 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"
:param [in]: geom_id string Geom ID
:param [in]: set_index int Set index
:param [in]: flag bool Flag that indicates set membership
"""
return _vsp.SetSetFlag(geom_id, set_index, flag)
[docs]
def CopyPasteSet(copyIndex, pasteIndex):
r"""
Copies all the states of a geom set and pastes them into a specific set based on passed in indexs
.. code-block:: python
# 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"
:param [in]: copyIndex int Copy Index
:param [in]: pasteIndex int Paste Index
"""
return _vsp.CopyPasteSet(copyIndex, pasteIndex)
[docs]
def GetBBoxSet(set):
r"""
Get the corners of the bounding box of the specified Set.
.. code-block:: python
#==== 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"
:param [in]: set int Desired Set
:param [out]: xmin_out double Minimum bounding box X coordinate
:param [out]: ymin_out double Minimum bounding box Y coordinate
:param [out]: zmin_out double Minimum bounding box Z coordinate
:param [out]: xlen_out double Maximum bounding box X length
:param [out]: ylen_out double Maximum bounding box Y length
:param [out]: zlen_out double Maximum bounding box Z length
:rtype: boolean
:return: bool Flag indicating whether the set has members (is non-empty)
"""
return _vsp.GetBBoxSet(set)
[docs]
def GetScaleIndependentBBoxSet(set):
r"""
Get the corners of the scale independent bounding box of the specified Set.
.. code-block:: python
#==== 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"
:param [in]: set int Desired Set
:param [out]: xmin_out double Minimum bounding box X coordinate
:param [out]: ymin_out double Minimum bounding box Y coordinate
:param [out]: zmin_out double Minimum bounding box Z coordinate
:param [out]: xlen_out double Maximum bounding box X length
:param [out]: ylen_out double Maximum bounding box Y length
:param [out]: zlen_out double Maximum bounding box Z length
:rtype: boolean
:return: bool Flag indicating whether the set has members (is non-empty)
"""
return _vsp.GetScaleIndependentBBoxSet(set)
[docs]
def ScaleSet(set_index, scale):
r"""
Apply a scale factor to a set
.. code-block:: python
# 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"
:param [in]: set_index int Set index
:param [in]: scale double Scale factor
"""
return _vsp.ScaleSet(set_index, scale)
[docs]
def RotateSet(set_index, x_rot_deg, y_rot_deg, z_rot_deg):
r"""
Rotate a set about the global X, Y, and Z axes
.. code-block:: python
# 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"
:param [in]: set_index int Set index
: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)
"""
return _vsp.RotateSet(set_index, x_rot_deg, y_rot_deg, z_rot_deg)
[docs]
def TranslateSet(set_index, translation_vec):
r"""
Translate a set along a given vector
.. code-block:: python
# 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"
:param [in]: set_index int Set index
:param [in]: translation_vec vec3d Translation vector
"""
return _vsp.TranslateSet(set_index, translation_vec)
[docs]
def ValidParm(id):
r"""
Check if given Parm is valid
.. code-block:: python
#==== Add Pod Geometry ====//
pid = AddGeom( "POD" )
lenid = GetParm( pid, "Length", "Design" )
if not ValidParm( lenid ) :
print( "---> Error: API GetParm " )
assert False, "---> Error: API GetParm"
:param [in]: id string Parm ID
:rtype: boolean
:return: bool True if Parm ID is valid, false otherwise
"""
return _vsp.ValidParm(id)
[docs]
def SetParmVal(*args):
r"""
*Overload 1:*
Set the value of the specified Parm.
.. code-block:: python
# 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.
.. code-block:: python
# 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
"""
return _vsp.SetParmVal(*args)
[docs]
def SetParmValLimits(parm_id, val, lower_limit, upper_limit):
r"""
Set the value along with the upper and lower limits of the specified Parm
.. code-block:: python
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
"""
return _vsp.SetParmValLimits(parm_id, val, lower_limit, upper_limit)
[docs]
def SetParmValUpdate(*args):
r"""
*Overload 1:*
Set the value of the specified Parm and force an Update.
.. code-block:: python
#==== 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.
.. code-block:: python
#==== 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
"""
return _vsp.SetParmValUpdate(*args)
[docs]
def GetParmVal(*args):
r"""
*Overload 1:*
Get the value of the specified Parm. The data type of the Parm value will be cast to a double
.. code-block:: python
# 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"
:param [in]: parm_id string Parm ID
:rtype: float
:return: 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
.. code-block:: python
# 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"
:param [in]: geom_id string Geom ID
:param [in]: name string Parm name
:param [in]: group string Parm group name
:rtype: float
:return: double Parm value
"""
return _vsp.GetParmVal(*args)
[docs]
def GetIntParmVal(parm_id):
r"""
Get the value of the specified int type Parm
.. code-block:: python
#==== 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"
:param [in]: parm_id string Parm ID
:rtype: int
:return: double Parm value
"""
return _vsp.GetIntParmVal(parm_id)
[docs]
def GetBoolParmVal(parm_id):
r"""
Get the value of the specified bool type Parm
.. code-block:: python
#==== 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"
:param [in]: parm_id string Parm ID
:rtype: boolean
:return: bool Parm value
"""
return _vsp.GetBoolParmVal(parm_id)
[docs]
def SetParmUpperLimit(parm_id, val):
r"""
Set the upper limit value for the specified Parm
.. code-block:: python
# 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
"""
return _vsp.SetParmUpperLimit(parm_id, val)
[docs]
def GetParmUpperLimit(parm_id):
r"""
Get the upper limit value for the specified Parm
.. code-block:: python
#==== Add Prop Geometry ====//
prop_id = AddGeom( "PROP" )
num_blade_id = GetParm( prop_id, "NumBlade", "Design" )
max_blade = GetParmUpperLimit( num_blade_id )
:param [in]: parm_id string Parm ID
:rtype: float
:return: double Parm upper limit
"""
return _vsp.GetParmUpperLimit(parm_id)
[docs]
def SetParmLowerLimit(parm_id, val):
r"""
Set the lower limit value for the specified Parm
.. code-block:: python
# 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
"""
return _vsp.SetParmLowerLimit(parm_id, val)
[docs]
def GetParmLowerLimit(parm_id):
r"""
Get the lower limit value for the specified Parm
.. code-block:: python
#==== 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"
:param [in]: parm_id string Parm ID
:rtype: float
:return: double Parm lower limit
"""
return _vsp.GetParmLowerLimit(parm_id)
[docs]
def GetParmType(parm_id):
r"""
Get the data type for the specified Parm
.. code-block:: python
# 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)
"""
return _vsp.GetParmType(parm_id)
[docs]
def GetParmName(parm_id):
r"""
Get the name for the specified Parm
.. code-block:: python
#==== 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 )
:param [in]: parm_id string Parm ID
:rtype: string
:return: string Parm name
"""
return _vsp.GetParmName(parm_id)
[docs]
def GetParmGroupName(parm_id):
r"""
Get the group name for the specified Parm
.. code-block:: python
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 )
:param [in]: parm_id string Parm ID
:rtype: string
:return: string Parm group name
"""
return _vsp.GetParmGroupName(parm_id)
[docs]
def GetParmDisplayGroupName(parm_id):
r"""
Get the display group name for the specified Parm
.. code-block:: python
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 )
:param [in]: parm_id string Parm ID
:rtype: string
:return: string Parm display group name
"""
return _vsp.GetParmDisplayGroupName(parm_id)
[docs]
def GetParmContainer(parm_id):
r"""
Get Parm Container ID for the specified Parm
.. code-block:: python
# 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"
:param [in]: parm_id string Parm ID
:rtype: string
:return: string Parm Container ID
"""
return _vsp.GetParmContainer(parm_id)
[docs]
def SetParmDescript(parm_id, desc):
r"""
Set the description of the specified Parm
.. code-block:: python
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"
:param [in]: parm_id string Parm ID
:param [in]: desc string Parm description
"""
return _vsp.SetParmDescript(parm_id, desc)
[docs]
def GetParmDescript(parm_id):
r"""
Get the description of the specified Parm
.. code-block:: python
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 )
:param [in]: parm_id string Parm ID
:rtype: string
:return: string desc Parm description
"""
return _vsp.GetParmDescript(parm_id)
[docs]
def FindParm(parm_container_id, parm_name, group_name):
r"""
Find a Parm ID given the Parm Container ID, Parm name, and Parm group
.. code-block:: python
#==== 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
:param [in]: parm_container_id string Parm Container ID
:param [in]: parm_name string Parm name
:param [in]: group_name string Parm group name
:rtype: string
:return: string Parm ID
"""
return _vsp.FindParm(parm_container_id, parm_name, group_name)
[docs]
def FindContainers():
r"""
Get an array of all Parm Container IDs
.. code-block:: python
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 )
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<string> Array of Parm Container IDs
"""
return _vsp.FindContainers()
[docs]
def FindContainersWithName(name):
r"""
Get an array of Parm Container IDs for Containers with the specified name
.. code-block:: python
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] ) )
:param [in]: name string Parm Container name
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<string> Array of Parm Container IDs
"""
return _vsp.FindContainersWithName(name)
[docs]
def FindContainer(name, index):
r"""
Get the ID of a Parm Container with specified name at input index
.. code-block:: python
#===== 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
"""
return _vsp.FindContainer(name, index)
[docs]
def SetContainerName(parm_container_id, name):
r"""
Get the name of the specified Parm Container
.. code-block:: python
veh_id = FindContainer( "Vehicle", 0 )
if GetContainerName( veh_id) != "Vehicle":
print( "---> Error: API GetContainerName" )
assert False, "---> Error: API GetContainerName"
:param [in]: parm_container_id string Parm Container ID
:rtype: void
:return: 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.
.. code-block:: python
#==== 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
"""
return _vsp.SetContainerName(parm_container_id, name)
[docs]
def GetContainerName(parm_container_id):
r"""
Get the name of a Parm container.
.. code-block:: python
pid = AddGeom( "POD" )
SetGeomName( pid, "TestPod" )
Update()
assert GetContainerName( pid ) == "TestPod", "GetContainerName did not report the name"
See also: FindContainers, GetGeomName
:param [in]: parm_container_id string Parm container ID
:rtype: string
:return: string Parm container name
"""
return _vsp.GetContainerName(parm_container_id)
[docs]
def FindContainerGroupNames(parm_container_id):
r"""
Get an array of Parm group names included in the specified Container
.. code-block:: python
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 )
:param [in]: parm_container_id string Parm Container ID
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<string> Array of Parm group names
"""
return _vsp.FindContainerGroupNames(parm_container_id)
[docs]
def FindContainerParmIDs(parm_container_id):
r"""
Get an array of Parm IDs included in the specified Container
.. code-block:: python
#==== 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 )
:param [in]: parm_container_id string Parm Container ID
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<string> Array of Parm IDs
"""
return _vsp.FindContainerParmIDs(parm_container_id)
[docs]
def GetVehicleID():
r"""
Get the ID of the Vehicle Parm Container
.. code-block:: python
#===== Get Vehicle Parm Container ID ====//
veh_id = GetVehicleID()
assert len( veh_id ) > 0, "GetVehicleID returned nothing"
:rtype: string
:return: string Vehicle ID
"""
return _vsp.GetVehicleID()
[docs]
def GetNumUserParms():
r"""
Get the number of user parameters
.. code-block:: python
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"
:rtype: int
:return: int Number of user Parms
"""
return _vsp.GetNumUserParms()
[docs]
def GetNumPredefinedUserParms():
r"""
Get the number of pre-defined user parameters
.. code-block:: python
n = GetNumPredefinedUserParms()
assert n > 0, "GetNumPredefinedUserParms"
:rtype: int
:return: int Number of pre-defined user Parms
"""
return _vsp.GetNumPredefinedUserParms()
[docs]
def GetAllUserParms():
r"""
Get the vector of id's for all user parameters
.. code-block:: python
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 )
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector <string> Array of user parameter ids
"""
return _vsp.GetAllUserParms()
[docs]
def GetUserParmContainer():
r"""
Get the user parm container ID
.. code-block:: python
up_id = GetUserParmContainer()
assert len( up_id ) > 0, "GetUserParmContainer returned nothing"
:rtype: string
:return: string User parm container ID
"""
return _vsp.GetUserParmContainer()
[docs]
def AddUserParm(type, name, group):
r"""
Function to add a new user Parm of input type, name, and group
.. code-block:: python
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
"""
return _vsp.AddUserParm(type, name, group)
[docs]
def DeleteUserParm(id):
r"""
Get the user parm container ID
.. code-block:: python
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"
"""
return _vsp.DeleteUserParm(id)
[docs]
def DeleteAllUserParm():
r"""
Delete all user created Parms. The predefined User_0 through User_15 Parms
belong to the vehicle and are not removed.
.. code-block:: python
# 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"
"""
return _vsp.DeleteAllUserParm()
[docs]
def ComputeMinClearanceDistance(*args):
r"""
Compute the minimum clearance distance for the specified geometry
.. code-block:: python
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"
:param [in]: geom_id string Geom ID
:param [in]: set int Collision set enum (i.e. SET_ALL)
:param [in]: useMode bool Flag determine if mode is used instead of sets
:param [in]: modeID string ID of Mode to use
:rtype: float
:return: double Minimum clearance distance
"""
return _vsp.ComputeMinClearanceDistance(*args)
[docs]
def SnapParm(*args):
r"""
Snap the specified Parm to input target minimum clearance distance
.. code-block:: python
#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"
:param [in]: parm_id string Parm ID
:param [in]: target_min_dist double Target minimum clearance distance
:param [in]: inc_flag bool Direction indication flag. If true, upper parm limit is used and direction is set to positive
:param [in]: set int Collision set enum (i.e. SET_ALL)
:param [in]: useMode bool Flag determine if mode is used instead of sets
:param [in]: modeID string ID of Mode to use
:rtype: float
:return: double Minimum clearance distance
"""
return _vsp.SnapParm(*args)
[docs]
def ResetFitModel():
r"""
Clear the Fit Model Tool, removing every target point and every variable.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddFitModelTargetPt( pid, 0, vec3d( 3.0, 0.0, 0.0 ) )
ResetFitModel()
assert GetNumFitModelTargetPts() == 0, "ResetFitModel left target points behind"
See also: DelAllFitModelTargetPts, DelAllFitModelVars
"""
return _vsp.ResetFitModel()
[docs]
def AddFitModelTargetPt(*args):
r"""
Add a target point to the Fit Model Tool. The point is paired with the first surface of the given Geom. Each
direction may be pinned to the supplied surface coordinate ( FIT_MODEL_FIXED ) or left free to slide along the
surface ( FIT_MODEL_FREE ). The supplied coordinate is used for a pinned direction; a free one is searched onto the
nearest point of the surface as the point is added, so what is passed for it does not matter.
Called with a Geom and a point alone this leaves both directions free, matching AddFitModelTargetPts. It is the
general form: use it to walk a loop of points that each want their own pinned or free directions and their own
coordinates. Where every point in a group wants the same treatment, the named forms say so more plainly.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
pnt = CompPnt01( pid, 0, 0.5, 0.0 )
index = AddFitModelTargetPt( pid, 0, pnt, FIT_MODEL_FREE, FIT_MODEL_FREE )
assert index == 0, "AddFitModelTargetPt did not return the first index"
assert GetNumFitModelTargetPts() == 1, "AddFitModelTargetPt did not add a point"
See also: FIT_MODEL_TARGET_TYPE, AddFitModelTargetPtFixedU, AddFitModelTargetPtFixedW, AddFitModelTargetPtFixedUW, AddFitModelTargetPts
:param [in]: geom_id string Geom ID of the surface the point is matched to
:param [in]: surf_indx int Index of the surface of that Geom, from 0 to GetNumTotalSurfs() - 1
:param [in]: pt vec3d Point to be matched, in model coordinates
:param [in]: u_type int Fit model target type enum for the U direction (i.e. FIT_MODEL_FREE)
:param [in]: w_type int Fit model target type enum for the W direction (i.e. FIT_MODEL_FREE)
:param [in]: u double Starting U surface coordinate in [0, 1]
:param [in]: w double Starting W surface coordinate in [0, 1]
:rtype: int
:return: int Index of the new target point
"""
return _vsp.AddFitModelTargetPt(*args)
[docs]
def AddFitModelTargetPtFixedU(geom_id, surf_indx, pt, u):
r"""
Add one target point held at a U surface coordinate and free to slide in W. The single point counterpart of
AddFitModelTargetPtsFixedU. The W of the point is searched onto the surface as it is added.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddFitModelTargetPtFixedU( pid, 0, CompPnt01( pid, 0, 0.5, 0.25 ), 0.5 )
assert GetFitModelTargetPtUType( 0 ) == FIT_MODEL_FIXED, "AddFitModelTargetPtFixedU did not pin U"
assert abs( GetFitModelTargetPtU( 0 ) - 0.5 ) < 1e-6, "AddFitModelTargetPtFixedU did not use the given U"
assert UpdateFitModelDist() < 1e-4, "AddFitModelTargetPtFixedU did not place the point on the surface"
See also: AddFitModelTargetPtsFixedU, AddFitModelTargetPtFixedW, AddFitModelTargetPt
:param [in]: geom_id string Geom ID of the surface the point is matched to
:param [in]: surf_indx int Index of the surface of that Geom, from 0 to GetNumTotalSurfs() - 1
:param [in]: pt vec3d Point to be matched, in model coordinates
:param [in]: u double U surface coordinate in [0, 1] to hold the point at
:rtype: int
:return: int Index of the new target point
"""
return _vsp.AddFitModelTargetPtFixedU(geom_id, surf_indx, pt, u)
[docs]
def AddFitModelTargetPtFixedW(geom_id, surf_indx, pt, w):
r"""
Add one target point held at a W surface coordinate and free to slide in U. The single point counterpart of
AddFitModelTargetPtsFixedW. The U of the point is searched onto the surface as it is added.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddFitModelTargetPtFixedW( pid, 0, CompPnt01( pid, 0, 0.5, 0.25 ), 0.25 )
assert GetFitModelTargetPtWType( 0 ) == FIT_MODEL_FIXED, "AddFitModelTargetPtFixedW did not pin W"
assert abs( GetFitModelTargetPtW( 0 ) - 0.25 ) < 1e-6, "AddFitModelTargetPtFixedW did not use the given W"
assert UpdateFitModelDist() < 1e-4, "AddFitModelTargetPtFixedW did not place the point on the surface"
See also: AddFitModelTargetPtsFixedW, AddFitModelTargetPtFixedU, AddFitModelTargetPt
:param [in]: geom_id string Geom ID of the surface the point is matched to
:param [in]: surf_indx int Index of the surface of that Geom, from 0 to GetNumTotalSurfs() - 1
:param [in]: pt vec3d Point to be matched, in model coordinates
:param [in]: w double W surface coordinate in [0, 1] to hold the point at
:rtype: int
:return: int Index of the new target point
"""
return _vsp.AddFitModelTargetPtFixedW(geom_id, surf_indx, pt, w)
[docs]
def AddFitModelTargetPtFixedUW(geom_id, surf_indx, pt, u, w):
r"""
Add one target point pinned to a surface coordinate, free in neither direction. The single point counterpart of
AddFitModelTargetPtsFixedUW. Nothing is searched; the point contributes no degrees of freedom, so the fit has only
the model's own Parms to work with.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddFitModelTargetPtFixedUW( pid, 0, CompPnt01( pid, 0, 0.5, 0.25 ), 0.5, 0.25 )
assert GetNumFitModelOptVars() == 0, "AddFitModelTargetPtFixedUW left a direction free"
assert UpdateFitModelDist() < 1e-6, "AddFitModelTargetPtFixedUW did not land on the given coordinate"
See also: AddFitModelTargetPtsFixedUW, AddFitModelTargetPt
:param [in]: geom_id string Geom ID of the surface the point is matched to
:param [in]: surf_indx int Index of the surface of that Geom, from 0 to GetNumTotalSurfs() - 1
:param [in]: pt vec3d Point to be matched, in model coordinates
:param [in]: u double U surface coordinate in [0, 1] to hold the point at
:param [in]: w double W surface coordinate in [0, 1] to hold the point at
:rtype: int
:return: int Index of the new target point
"""
return _vsp.AddFitModelTargetPtFixedUW(geom_id, surf_indx, pt, u, w)
[docs]
def AddFitModelTargetPts(geom_id, surf_indx, pt_vec):
r"""
Add a group of target points to the Fit Model Tool, all matched to the same Geom, each free to slide anywhere on the
surface. This is the API's replacement for selecting points of a point cloud with the mouse. Every point is placed
on the nearest point of the surface as it is added, searching the whole surface, so no starting coordinate is asked
for: a caller is unlikely to have a useful guess for a free coordinate. Where the topology does tell you where a
point belongs, use one of the fixed variants instead.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
pts = []
pts.append( CompPnt01( pid, 0, 0.25, 0.0 ) )
pts.append( CompPnt01( pid, 0, 0.50, 0.0 ) )
pts.append( CompPnt01( pid, 0, 0.75, 0.0 ) )
AddFitModelTargetPts( pid, 0, pts )
assert GetNumFitModelTargetPts() == 3, "AddFitModelTargetPts did not add three points"
assert UpdateFitModelDist() < 1e-4, "AddFitModelTargetPts did not place the points on the surface"
See also: AddFitModelTargetPtsFixedU, AddFitModelTargetPtsFixedW, AddFitModelTargetPtsFixedUW, SearchFitModelTargetUW
:param [in]: geom_id string Geom ID of the surface the points are matched to
:param [in]: surf_indx int Index of the surface of that Geom, from 0 to GetNumTotalSurfs() - 1
:param [in]: pt_vec vector<vec3d> Points to be matched, in model coordinates
"""
return _vsp.AddFitModelTargetPts(geom_id, surf_indx, pt_vec)
[docs]
def AddFitModelTargetPtsFixedU(geom_id, surf_indx, pt_vec, u):
r"""
Add a group of target points held at one U surface coordinate and free to slide in W. Use this where the topology
says which station the points belong to but not where around it, such as points measured around one fuselage frame.
The W of each point is searched onto the surface as it is added.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
pts = []
pts.append( CompPnt01( pid, 0, 0.5, 0.10 ) )
pts.append( CompPnt01( pid, 0, 0.5, 0.35 ) )
pts.append( CompPnt01( pid, 0, 0.5, 0.60 ) )
AddFitModelTargetPtsFixedU( pid, 0, pts, 0.5 )
assert GetFitModelTargetPtUType( 0 ) == FIT_MODEL_FIXED, "AddFitModelTargetPtsFixedU did not pin U"
assert abs( GetFitModelTargetPtU( 0 ) - 0.5 ) < 1e-6, "AddFitModelTargetPtsFixedU did not use the given U"
See also: AddFitModelTargetPtsFixedUs, AddFitModelTargetPtsFixedW, AddFitModelTargetPts
:param [in]: geom_id string Geom ID of the surface the points are matched to
:param [in]: surf_indx int Index of the surface of that Geom, from 0 to GetNumTotalSurfs() - 1
:param [in]: pt_vec vector<vec3d> Points to be matched, in model coordinates
:param [in]: u double U surface coordinate in [0, 1] to hold every point at
"""
return _vsp.AddFitModelTargetPtsFixedU(geom_id, surf_indx, pt_vec, u)
[docs]
def AddFitModelTargetPtsFixedUs(geom_id, surf_indx, pt_vec, u_vec):
r"""
Add a group of target points, each held at its own U surface coordinate and free to slide in W. The two vectors are
paired by index and must be the same length. The W of each point is searched onto the surface as it is added.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
pts = []
us = []
for u in [ 0.25, 0.50, 0.75 ]:
pts.append( CompPnt01( pid, 0, u, 0.1 ) )
us.append( u )
AddFitModelTargetPtsFixedUs( pid, 0, pts, us )
assert abs( GetFitModelTargetPtU( 2 ) - 0.75 ) < 1e-6, "AddFitModelTargetPtsFixedUs did not use the given U values"
See also: AddFitModelTargetPtsFixedU, AddFitModelTargetPtsFixedWs
:param [in]: geom_id string Geom ID of the surface the points are matched to
:param [in]: surf_indx int Index of the surface of that Geom, from 0 to GetNumTotalSurfs() - 1
:param [in]: pt_vec vector<vec3d> Points to be matched, in model coordinates
:param [in]: u_vec vector<double> U surface coordinate in [0, 1] for each point, same length as pt_vec
"""
return _vsp.AddFitModelTargetPtsFixedUs(geom_id, surf_indx, pt_vec, u_vec)
[docs]
def AddFitModelTargetPtsFixedW(geom_id, surf_indx, pt_vec, w):
r"""
Add a group of target points held at one W surface coordinate and free to slide in U. Use this where the topology
says which line around the section the points belong to but not where along it, such as points measured along a
wing's leading edge. The U of each point is searched onto the surface as it is added.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
pts = []
pts.append( CompPnt01( pid, 0, 0.25, 0.5 ) )
pts.append( CompPnt01( pid, 0, 0.50, 0.5 ) )
pts.append( CompPnt01( pid, 0, 0.75, 0.5 ) )
AddFitModelTargetPtsFixedW( pid, 0, pts, 0.5 )
assert GetFitModelTargetPtWType( 0 ) == FIT_MODEL_FIXED, "AddFitModelTargetPtsFixedW did not pin W"
assert abs( GetFitModelTargetPtW( 0 ) - 0.5 ) < 1e-6, "AddFitModelTargetPtsFixedW did not use the given W"
See also: AddFitModelTargetPtsFixedWs, AddFitModelTargetPtsFixedU, AddFitModelTargetPts
:param [in]: geom_id string Geom ID of the surface the points are matched to
:param [in]: surf_indx int Index of the surface of that Geom, from 0 to GetNumTotalSurfs() - 1
:param [in]: pt_vec vector<vec3d> Points to be matched, in model coordinates
:param [in]: w double W surface coordinate in [0, 1] to hold every point at
"""
return _vsp.AddFitModelTargetPtsFixedW(geom_id, surf_indx, pt_vec, w)
[docs]
def AddFitModelTargetPtsFixedWs(geom_id, surf_indx, pt_vec, w_vec):
r"""
Add a group of target points, each held at its own W surface coordinate and free to slide in U. The two vectors are
paired by index and must be the same length. The U of each point is searched onto the surface as it is added.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
pts = []
ws = []
for w in [ 0.10, 0.35, 0.60 ]:
pts.append( CompPnt01( pid, 0, 0.3, w ) )
ws.append( w )
AddFitModelTargetPtsFixedWs( pid, 0, pts, ws )
assert abs( GetFitModelTargetPtW( 2 ) - 0.60 ) < 1e-6, "AddFitModelTargetPtsFixedWs did not use the given W values"
See also: AddFitModelTargetPtsFixedW, AddFitModelTargetPtsFixedUs
:param [in]: geom_id string Geom ID of the surface the points are matched to
:param [in]: surf_indx int Index of the surface of that Geom, from 0 to GetNumTotalSurfs() - 1
:param [in]: pt_vec vector<vec3d> Points to be matched, in model coordinates
:param [in]: w_vec vector<double> W surface coordinate in [0, 1] for each point, same length as pt_vec
"""
return _vsp.AddFitModelTargetPtsFixedWs(geom_id, surf_indx, pt_vec, w_vec)
[docs]
def AddFitModelTargetPtsFixedUW(geom_id, surf_indx, pt_vec, u, w):
r"""
Add a group of target points all held at one surface coordinate, free in neither direction. Every point is pinned to
the same place on the surface, which suits repeated measurements of one identifiable feature. To pin each point to
its own coordinate, use AddFitModelTargetPtsFixedUWs.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
pts = []
pts.append( CompPnt01( pid, 0, 0.5, 0.25 ) )
AddFitModelTargetPtsFixedUW( pid, 0, pts, 0.5, 0.25 )
assert GetFitModelTargetPtUType( 0 ) == FIT_MODEL_FIXED, "AddFitModelTargetPtsFixedUW did not pin U"
assert GetFitModelTargetPtWType( 0 ) == FIT_MODEL_FIXED, "AddFitModelTargetPtsFixedUW did not pin W"
assert UpdateFitModelDist() < 1e-6, "AddFitModelTargetPtsFixedUW did not land on the given coordinate"
See also: AddFitModelTargetPtsFixedUWs, AddFitModelTargetPt
:param [in]: geom_id string Geom ID of the surface the points are matched to
:param [in]: surf_indx int Index of the surface of that Geom, from 0 to GetNumTotalSurfs() - 1
:param [in]: pt_vec vector<vec3d> Points to be matched, in model coordinates
:param [in]: u double U surface coordinate in [0, 1] to hold every point at
:param [in]: w double W surface coordinate in [0, 1] to hold every point at
"""
return _vsp.AddFitModelTargetPtsFixedUW(geom_id, surf_indx, pt_vec, u, w)
[docs]
def AddFitModelTargetPtsFixedUWs(geom_id, surf_indx, pt_vec, u_vec, w_vec):
r"""
Add a group of target points, each pinned to its own surface coordinate and free in neither direction. The three
vectors are paired by index and must all be the same length. Use this where every point has been identified on the
surface already, so the fit has only the model's own Parms to work with.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
pts = []
us = []
ws = []
for u, w in [ ( 0.25, 0.1 ), ( 0.50, 0.4 ), ( 0.75, 0.7 ) ]:
pts.append( CompPnt01( pid, 0, u, w ) )
us.append( u )
ws.append( w )
AddFitModelTargetPtsFixedUWs( pid, 0, pts, us, ws )
assert GetNumFitModelOptVars() == 0, "AddFitModelTargetPtsFixedUWs left a direction free"
assert UpdateFitModelDist() < 1e-6, "AddFitModelTargetPtsFixedUWs did not land on the given coordinates"
See also: AddFitModelTargetPtsFixedUW, AddFitModelTargetPtsFixedUs, AddFitModelTargetPtsFixedWs
:param [in]: geom_id string Geom ID of the surface the points are matched to
:param [in]: surf_indx int Index of the surface of that Geom, from 0 to GetNumTotalSurfs() - 1
:param [in]: pt_vec vector<vec3d> Points to be matched, in model coordinates
:param [in]: u_vec vector<double> U surface coordinate in [0, 1] for each point, same length as pt_vec
:param [in]: w_vec vector<double> W surface coordinate in [0, 1] for each point, same length as pt_vec
"""
return _vsp.AddFitModelTargetPtsFixedUWs(geom_id, surf_indx, pt_vec, u_vec, w_vec)
[docs]
def DelFitModelTargetPt(index):
r"""
Delete one target point from the Fit Model Tool. The points after it move down one index.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddFitModelTargetPt( pid, 0, CompPnt01( pid, 0, 0.25, 0.0 ) )
AddFitModelTargetPt( pid, 0, CompPnt01( pid, 0, 0.75, 0.0 ) )
DelFitModelTargetPt( 0 )
assert GetNumFitModelTargetPts() == 1, "DelFitModelTargetPt did not remove a point"
See also: DelAllFitModelTargetPts
:param [in]: index int Target point index
"""
return _vsp.DelFitModelTargetPt(index)
[docs]
def DelAllFitModelTargetPts():
r"""
Delete every target point from the Fit Model Tool, leaving the variables alone.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddFitModelTargetPt( pid, 0, CompPnt01( pid, 0, 0.5, 0.0 ) )
DelAllFitModelTargetPts()
assert GetNumFitModelTargetPts() == 0, "DelAllFitModelTargetPts left points behind"
See also: DelFitModelTargetPt, ResetFitModel
"""
return _vsp.DelAllFitModelTargetPts()
[docs]
def SortFitModelTargetPtsByDist():
r"""
Reorder the target points worst fit first, by descending distance from each point to the surface it is matched to.
The distances are recomputed before sorting, so the order describes the model as it stands. Target points are
addressed by index, so this renumbers them -- an index held across the call names a different point afterwards.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
near_pnt = CompPnt01( pid, 0, 0.5, 0.25 )
far_pnt = vec3d( near_pnt.x(), near_pnt.y(), near_pnt.z() + 1.0 )
AddFitModelTargetPtFixedUW( pid, 0, near_pnt, 0.5, 0.25 )
AddFitModelTargetPtFixedUW( pid, 0, far_pnt, 0.5, 0.25 )
SortFitModelTargetPtsByDist()
assert abs( GetFitModelTargetPt( 0 ).z() - far_pnt.z() ) < 1e-6, "SortFitModelTargetPtsByDist did not put the worst fit first"
See also: UpdateFitModelDist, GetFitModelTargetPt
"""
return _vsp.SortFitModelTargetPtsByDist()
[docs]
def MoveFitModelTargetPt(index, reorder_type):
r"""
Move one target point within the Fit Model Tool's list, and return where it ended up. Target points are addressed by
index, so this renumbers them -- an index held across the call names a different point afterwards. Order does not
change the fit; it is the order the points are listed and stepped through in.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddFitModelTargetPt( pid, 0, CompPnt01( pid, 0, 0.25, 0.0 ) )
AddFitModelTargetPt( pid, 0, CompPnt01( pid, 0, 0.50, 0.0 ) )
last_pnt = CompPnt01( pid, 0, 0.75, 0.0 )
AddFitModelTargetPt( pid, 0, last_pnt )
newindex = MoveFitModelTargetPt( 2, REORDER_MOVE_TOP )
assert newindex == 0, "MoveFitModelTargetPt did not report the point at the top"
assert abs( GetFitModelTargetPt( 0 ).x() - last_pnt.x() ) < 1e-6, "MoveFitModelTargetPt did not move the point to the top"
See also: SortFitModelTargetPtsByDist, GetFitModelTargetPt, REORDER_TYPE
:param [in]: index int Index of target 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)
:rtype: int
:return: int Index the target point ended up at
"""
return _vsp.MoveFitModelTargetPt(index, reorder_type)
[docs]
def GetNumFitModelTargetPts():
r"""
Get the number of target points held by the Fit Model Tool.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddFitModelTargetPt( pid, 0, CompPnt01( pid, 0, 0.5, 0.0 ) )
assert GetNumFitModelTargetPts() == 1, "GetNumFitModelTargetPts did not count the point"
See also: AddFitModelTargetPt
:rtype: int
:return: int Number of target points
"""
return _vsp.GetNumFitModelTargetPts()
[docs]
def GetFitModelTargetPt(index):
r"""
Get the point a target point is trying to match. This is the point supplied when it was added, not the point
currently on the surface; for that, see GetFitModelTargetPtSurfPt.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
pnt = vec3d( 3.0, 1.0, 2.0 )
AddFitModelTargetPt( pid, 0, pnt )
pnt_out = GetFitModelTargetPt( 0 )
assert dist( pnt, pnt_out ) < 1e-6, "GetFitModelTargetPt did not report the point that was set"
See also: SetFitModelTargetPt, GetFitModelTargetPtSurfPt
:param [in]: index int Target point index
:rtype: :py:class:`vec3d`
:return: vec3d Point to be matched
"""
return _vsp.GetFitModelTargetPt(index)
[docs]
def SetFitModelTargetPt(index, pt):
r"""
Move the point a target point is trying to match.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddFitModelTargetPt( pid, 0, vec3d( 0.0, 0.0, 0.0 ) )
SetFitModelTargetPt( 0, vec3d( 3.0, 1.0, 2.0 ) )
assert dist( GetFitModelTargetPt( 0 ), vec3d( 3.0, 1.0, 2.0 ) ) < 1e-6, "SetFitModelTargetPt did not take"
See also: GetFitModelTargetPt
:param [in]: index int Target point index
:param [in]: pt vec3d Point to be matched, in model coordinates
"""
return _vsp.SetFitModelTargetPt(index, pt)
[docs]
def GetFitModelTargetPtGeom(index):
r"""
Get the Geom a target point is matched to.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddFitModelTargetPt( pid, 0, CompPnt01( pid, 0, 0.5, 0.0 ) )
assert GetFitModelTargetPtGeom( 0 ) == pid, "GetFitModelTargetPtGeom did not report the Geom that was set"
See also: SetFitModelTargetPtGeom
:param [in]: index int Target point index
:rtype: string
:return: string Geom ID of the matched surface
"""
return _vsp.GetFitModelTargetPtGeom(index)
[docs]
def SetFitModelTargetPtGeom(index, geom_id):
r"""
Match a target point to a different Geom.
.. code-block:: python
pid = AddGeom( "POD" )
fid = AddGeom( "FUSELAGE" )
Update()
AddFitModelTargetPt( pid, 0, CompPnt01( pid, 0, 0.5, 0.0 ) )
SetFitModelTargetPtGeom( 0, fid )
assert GetFitModelTargetPtGeom( 0 ) == fid, "SetFitModelTargetPtGeom did not take"
See also: GetFitModelTargetPtGeom
:param [in]: index int Target point index
:param [in]: geom_id string Geom ID of the surface the point is matched to
"""
return _vsp.SetFitModelTargetPtGeom(index, geom_id)
[docs]
def GetFitModelTargetPtSurfIndx(index):
r"""
Get the surface of the matched Geom a target point is paired with.
.. code-block:: python
pid = AddGeom( "POD" )
SetParmVal( FindParm( pid, "Sym_Planar_Flag", "Sym" ), SYM_XZ )
Update()
AddFitModelTargetPt( pid, 1, CompPnt01( pid, 1, 0.5, 0.25 ) )
assert GetFitModelTargetPtSurfIndx( 0 ) == 1, "GetFitModelTargetPtSurfIndx did not report the surface that was set"
assert UpdateFitModelDist() < 1e-4, "target point did not land on the second surface"
See also: SetFitModelTargetPtSurfIndx, GetFitModelTargetPtGeom
:param [in]: index int Target point index
:rtype: int
:return: int Index of the matched surface of the Geom
"""
return _vsp.GetFitModelTargetPtSurfIndx(index)
[docs]
def SetFitModelTargetPtSurfIndx(index, surf_indx):
r"""
Pair a target point with a different surface of the Geom it is already matched to. The index must be in range on that
Geom. Note that surfaces are numbered by position, so turning symmetry on or off, or changing the number of copies of
a Geom, changes which surface an index names.
.. code-block:: python
pid = AddGeom( "POD" )
SetParmVal( FindParm( pid, "Sym_Planar_Flag", "Sym" ), SYM_XZ )
Update()
AddFitModelTargetPt( pid, 0, CompPnt01( pid, 1, 0.5, 0.25 ) )
SetFitModelTargetPtSurfIndx( 0, 1 )
assert GetFitModelTargetPtSurfIndx( 0 ) == 1, "SetFitModelTargetPtSurfIndx did not take"
SearchFitModelTargetUW()
assert UpdateFitModelDist() < 1e-4, "target point did not land on the second surface"
See also: GetFitModelTargetPtSurfIndx, SetFitModelTargetPtGeom
:param [in]: index int Target point index
:param [in]: surf_indx int Index of the surface of that Geom, from 0 to GetNumTotalSurfs() - 1
"""
return _vsp.SetFitModelTargetPtSurfIndx(index, surf_indx)
[docs]
def GetFitModelTargetPtU(index):
r"""
Get the U surface coordinate of a target point.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddFitModelTargetPt( pid, 0, CompPnt01( pid, 0, 0.5, 0.25 ), FIT_MODEL_FIXED, FIT_MODEL_FIXED, 0.5, 0.25 )
assert abs( GetFitModelTargetPtU( 0 ) - 0.5 ) < 1e-6, "GetFitModelTargetPtU did not report the U that was set"
See also: GetFitModelTargetPtW, SetFitModelTargetPtUW
:param [in]: index int Target point index
:rtype: float
:return: double U surface coordinate in [0, 1]
"""
return _vsp.GetFitModelTargetPtU(index)
[docs]
def GetFitModelTargetPtW(index):
r"""
Get the W surface coordinate of a target point.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddFitModelTargetPt( pid, 0, CompPnt01( pid, 0, 0.5, 0.25 ), FIT_MODEL_FIXED, FIT_MODEL_FIXED, 0.5, 0.25 )
assert abs( GetFitModelTargetPtW( 0 ) - 0.25 ) < 1e-6, "GetFitModelTargetPtW did not report the W that was set"
See also: GetFitModelTargetPtU, SetFitModelTargetPtUW
:param [in]: index int Target point index
:rtype: float
:return: double W surface coordinate in [0, 1]
"""
return _vsp.GetFitModelTargetPtW(index)
[docs]
def GetFitModelTargetPtDist(index):
r"""
Get the distance from a target point to the surface point it is matched to.
The Fit Model browser shows this in its Dist column and the API can sort the target points
by it, so it was the one quantity a script could order by without being able to read.
Meaningful after Update, which is what recomputes it.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddFitModelTargetPt( pid, 0, CompPnt01( pid, 0, 0.5, 0.25 ), FIT_MODEL_FIXED, FIT_MODEL_FIXED, 0.5, 0.25 )
Update()
assert GetFitModelTargetPtDist( 0 ) < 1e-6, "a target point placed on the surface is not at zero distance"
See also: SortFitModelTargetPtsByDist
:param [in]: index int Target point index
:rtype: float
:return: double Distance from the target point to the surface
"""
return _vsp.GetFitModelTargetPtDist(index)
[docs]
def SetFitModelTargetPtUW(index, u, w):
r"""
Set the surface coordinate of a target point. For a fixed direction this is where the point is held; for a free
direction it is only where the search starts.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddFitModelTargetPt( pid, 0, CompPnt01( pid, 0, 0.5, 0.25 ) )
SetFitModelTargetPtUW( 0, 0.5, 0.25 )
assert abs( GetFitModelTargetPtU( 0 ) - 0.5 ) < 1e-6, "SetFitModelTargetPtUW did not take"
See also: GetFitModelTargetPtU, GetFitModelTargetPtW
:param [in]: index int Target point index
:param [in]: u double U surface coordinate in [0, 1]
:param [in]: w double W surface coordinate in [0, 1]
"""
return _vsp.SetFitModelTargetPtUW(index, u, w)
[docs]
def GetFitModelTargetPtUType(index):
r"""
Get whether the U direction of a target point is pinned or free.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddFitModelTargetPt( pid, 0, CompPnt01( pid, 0, 0.5, 0.0 ), FIT_MODEL_FIXED, FIT_MODEL_FREE )
assert GetFitModelTargetPtUType( 0 ) == FIT_MODEL_FIXED, "GetFitModelTargetPtUType did not report the type that was set"
See also: FIT_MODEL_TARGET_TYPE, SetFitModelTargetPtUType
:param [in]: index int Target point index
:rtype: int
:return: int Fit model target type enum (i.e. FIT_MODEL_FREE)
"""
return _vsp.GetFitModelTargetPtUType(index)
[docs]
def SetFitModelTargetPtUType(index, u_type):
r"""
Pin or free the U direction of a target point.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddFitModelTargetPt( pid, 0, CompPnt01( pid, 0, 0.5, 0.0 ) )
SetFitModelTargetPtUType( 0, FIT_MODEL_FIXED )
assert GetFitModelTargetPtUType( 0 ) == FIT_MODEL_FIXED, "SetFitModelTargetPtUType did not take"
See also: FIT_MODEL_TARGET_TYPE, GetFitModelTargetPtUType
:param [in]: index int Target point index
:param [in]: u_type int Fit model target type enum (i.e. FIT_MODEL_FREE)
"""
return _vsp.SetFitModelTargetPtUType(index, u_type)
[docs]
def GetFitModelTargetPtWType(index):
r"""
Get whether the W direction of a target point is pinned or free.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddFitModelTargetPt( pid, 0, CompPnt01( pid, 0, 0.5, 0.0 ), FIT_MODEL_FREE, FIT_MODEL_FIXED )
assert GetFitModelTargetPtWType( 0 ) == FIT_MODEL_FIXED, "GetFitModelTargetPtWType did not report the type that was set"
See also: FIT_MODEL_TARGET_TYPE, SetFitModelTargetPtWType
:param [in]: index int Target point index
:rtype: int
:return: int Fit model target type enum (i.e. FIT_MODEL_FREE)
"""
return _vsp.GetFitModelTargetPtWType(index)
[docs]
def SetFitModelTargetPtWType(index, w_type):
r"""
Pin or free the W direction of a target point. W often wraps around the surface, and a free W that has wandered to
the seam can leave the optimizer stuck; SearchFitModelTargetUW will lift it off.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddFitModelTargetPt( pid, 0, CompPnt01( pid, 0, 0.5, 0.0 ) )
SetFitModelTargetPtWType( 0, FIT_MODEL_FIXED )
assert GetFitModelTargetPtWType( 0 ) == FIT_MODEL_FIXED, "SetFitModelTargetPtWType did not take"
See also: FIT_MODEL_TARGET_TYPE, GetFitModelTargetPtWType, SearchFitModelTargetUW
:param [in]: index int Target point index
:param [in]: w_type int Fit model target type enum (i.e. FIT_MODEL_FREE)
"""
return _vsp.SetFitModelTargetPtWType(index, w_type)
[docs]
def GetFitModelTargetPtSurfPt(index):
r"""
Get the point currently on the surface at a target point's surface coordinate. The distance from here to the target
point is what the optimizer is driving to zero.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
pnt = CompPnt01( pid, 0, 0.5, 0.25 )
AddFitModelTargetPt( pid, 0, pnt, FIT_MODEL_FIXED, FIT_MODEL_FIXED, 0.5, 0.25 )
surf_pnt = GetFitModelTargetPtSurfPt( 0 )
assert dist( pnt, surf_pnt ) < 1e-6, "GetFitModelTargetPtSurfPt did not land on the target point"
See also: GetFitModelTargetPt, UpdateFitModelDist
:param [in]: index int Target point index
:rtype: :py:class:`vec3d`
:return: vec3d Point on the surface at the target point's surface coordinate
"""
return _vsp.GetFitModelTargetPtSurfPt(index)
[docs]
def AddFitModelVar(parm_id):
r"""
Nominate a Parm as a variable for the Fit Model Tool to adjust. Choosing Parms that are not independent of one
another, or that have much the same effect on the surface, can leave the optimizer a very long time in converging.
Nominating the same Parm twice does nothing and reports an error.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
length = GetParm( pid, "Length", "Design" )
AddFitModelVar( length )
assert GetNumFitModelVars() == 1, "AddFitModelVar did not add the variable"
See also: DelFitModelVar, OptimizeFitModel
:param [in]: parm_id string Parm ID
"""
return _vsp.AddFitModelVar(parm_id)
[docs]
def DelFitModelVar(parm_id):
r"""
Withdraw a Parm from the Fit Model Tool's variables.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
length = GetParm( pid, "Length", "Design" )
AddFitModelVar( length )
DelFitModelVar( length )
assert GetNumFitModelVars() == 0, "DelFitModelVar did not remove the variable"
See also: AddFitModelVar, DelAllFitModelVars
:param [in]: parm_id string Parm ID
"""
return _vsp.DelFitModelVar(parm_id)
[docs]
def DelAllFitModelVars():
r"""
Withdraw every Parm from the Fit Model Tool's variables, leaving the target points alone.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddFitModelVar( GetParm( pid, "Length", "Design" ) )
DelAllFitModelVars()
assert GetNumFitModelVars() == 0, "DelAllFitModelVars left variables behind"
See also: DelFitModelVar, ResetFitModel
"""
return _vsp.DelAllFitModelVars()
[docs]
def GetNumFitModelVars():
r"""
Get the number of Parms nominated as Fit Model Tool variables.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddFitModelVar( GetParm( pid, "Length", "Design" ) )
assert GetNumFitModelVars() == 1, "GetNumFitModelVars did not count the variable"
See also: AddFitModelVar
:rtype: int
:return: int Number of variables
"""
return _vsp.GetNumFitModelVars()
[docs]
def GetFitModelVar(index):
r"""
Get the Parm ID of one Fit Model Tool variable. The variables are held sorted by name, so this index need not follow
the order they were added in.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
length = GetParm( pid, "Length", "Design" )
AddFitModelVar( length )
assert GetFitModelVar( 0 ) == length, "GetFitModelVar did not report the variable that was added"
See also: GetFitModelVarVec
:param [in]: index int Variable index
:rtype: string
:return: string Parm ID
"""
return _vsp.GetFitModelVar(index)
[docs]
def GetFitModelVarVec():
r"""
Get the Parm IDs of every Fit Model Tool variable.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddFitModelVar( GetParm( pid, "Length", "Design" ) )
var_array = GetFitModelVarVec()
assert len( var_array ) == 1, "GetFitModelVarVec did not report the variable"
See also: GetFitModelVar
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<string> Parm IDs of every variable
"""
return _vsp.GetFitModelVarVec()
[docs]
def SearchFitModelTargetUW():
r"""
Move every free target point to the closest point on its surface, searching the whole surface rather than working
from where the point currently sits. This is slower than RefineFitModelTargetUW but does not depend on a good
starting coordinate, so it is what lifts a point off a seam it has become stuck against. Fixed directions are left
where they are.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
pnt = CompPnt01( pid, 0, 0.5, 0.25 )
AddFitModelTargetPt( pid, 0, pnt, FIT_MODEL_FREE, FIT_MODEL_FREE )
SearchFitModelTargetUW()
assert UpdateFitModelDist() < 1e-4, "SearchFitModelTargetUW did not find the point on the surface"
See also: RefineFitModelTargetUW, UpdateFitModelDist
"""
return _vsp.SearchFitModelTargetUW()
[docs]
def RefineFitModelTargetUW():
r"""
Move every free target point to the closest point on its surface, starting from where the point currently sits. This
is faster than SearchFitModelTargetUW but can settle on a nearby answer rather than the best one. Fixed directions
are left where they are.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
pnt = CompPnt01( pid, 0, 0.5, 0.25 )
AddFitModelTargetPt( pid, 0, pnt, FIT_MODEL_FREE, FIT_MODEL_FREE, 0.45, 0.25 )
RefineFitModelTargetUW()
assert UpdateFitModelDist() < 1e-4, "RefineFitModelTargetUW did not settle on the point"
See also: SearchFitModelTargetUW, UpdateFitModelDist
"""
return _vsp.RefineFitModelTargetUW()
[docs]
def UpdateFitModelDist():
r"""
Recompute and return how far the model is from the target points. The measure is the root mean square of the
distance from each target point to the point on its surface. Zero is the wanted answer, so it does not also stand for
having nothing to measure; with no target points this reports -1.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddFitModelTargetPt( pid, 0, CompPnt01( pid, 0, 0.5, 0.25 ), FIT_MODEL_FIXED, FIT_MODEL_FIXED, 0.5, 0.25 )
assert UpdateFitModelDist() < 1e-6, "UpdateFitModelDist did not report a matched point as matched"
See also: GetFitModelDist, OptimizeFitModel
:rtype: float
:return: double Root mean square distance from the target points to the surfaces, or -1 when there are no target points to measure
"""
return _vsp.UpdateFitModelDist()
[docs]
def GetFitModelDist():
r"""
Get the distance measure last computed, without recomputing it. Reports -1 if the last computation had no target
points to measure.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddFitModelTargetPt( pid, 0, CompPnt01( pid, 0, 0.5, 0.25 ), FIT_MODEL_FIXED, FIT_MODEL_FIXED, 0.5, 0.25 )
UpdateFitModelDist()
assert GetFitModelDist() < 1e-6, "GetFitModelDist did not report the distance last computed"
See also: UpdateFitModelDist
:rtype: float
:return: double Root mean square distance last computed
"""
return _vsp.GetFitModelDist()
[docs]
def GetNumFitModelOptVars():
r"""
Get the number of degrees of freedom the optimization problem has: one for each variable, plus one for each free
direction of each target point.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddFitModelTargetPt( pid, 0, CompPnt01( pid, 0, 0.5, 0.0 ), FIT_MODEL_FREE, FIT_MODEL_FREE )
AddFitModelVar( GetParm( pid, "Length", "Design" ) )
assert GetNumFitModelOptVars() == 3, "GetNumFitModelOptVars did not count one variable and two free directions"
See also: OptimizeFitModel
:rtype: int
:return: int Number of degrees of freedom
"""
return _vsp.GetNumFitModelOptVars()
[docs]
def OptimizeFitModel():
r"""
Adjust the variables, and any free target point surface coordinates, until the surfaces pass as close as they can to
the target points. A Levenberg-Marquardt algorithm solves the least squares problem, with three residuals per target
point. Least squares needs at least as many conditions as unknowns, so at least three target points are needed for
every three degrees of freedom; GetNumFitModelOptVars counts the latter. The return value is the termination code of
the solver: 0 reports that the inputs were not usable, which generally means the variables chosen are not independent
or do not move the surface at all.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
length = GetParm( pid, "Length", "Design" )
# Sample points from the pod, then stretch it away from them.
pts = []
pts.append( CompPnt01( pid, 0, 0.25, 0.0 ) )
pts.append( CompPnt01( pid, 0, 0.50, 0.0 ) )
pts.append( CompPnt01( pid, 0, 0.75, 0.0 ) )
len0 = GetParmVal( length )
SetParmVal( length, 1.4 * len0 )
Update()
AddFitModelTargetPts( pid, 0, pts )
AddFitModelVar( length )
OptimizeFitModel()
# Fitting the points back should have recovered the original length.
assert abs( GetParmVal( length ) - len0 ) < 1e-3, "OptimizeFitModel did not recover the original length"
See also: AddFitModelTargetPts, AddFitModelVar, UpdateFitModelDist
:rtype: int
:return: int Termination code of the least squares solver
"""
return _vsp.OptimizeFitModel()
[docs]
def CanUndoFitModel():
r"""
Check whether the last Fit Model operation can be undone. False before anything has been run,
after an undo has already been used, and when the variables or target points have changed since
-- a snapshot describes one arrangement of them and cannot be applied to another.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
assert not CanUndoFitModel(), "CanUndoFitModel is true before anything has been run"
pts = [ CompPnt01( pid, 0, 0.2, 0.3 ), CompPnt01( pid, 0, 0.5, 0.6 ) ]
AddFitModelTargetPts( pid, 0, pts )
AddFitModelVar( GetParm( pid, "Length", "Design" ) )
OptimizeFitModel()
assert CanUndoFitModel(), "CanUndoFitModel is false after a fit"
See also: UndoFitModel, OptimizeFitModel
:rtype: boolean
:return: bool True if there is something to undo
"""
return _vsp.CanUndoFitModel()
[docs]
def UndoFitModel():
r"""
Undo the last Fit Model operation, putting back the Parm values and the free surface coordinates
of the target points as they were before OptimizeFitModel, SearchFitModelTargetUW or
RefineFitModelTargetUW was run. One level deep: the snapshot is spent once it has been used.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
length = GetParm( pid, "Length", "Design" )
pts = [ CompPnt01( pid, 0, 0.2, 0.3 ), CompPnt01( pid, 0, 0.5, 0.6 ) ]
AddFitModelTargetPts( pid, 0, pts )
AddFitModelVar( length )
SetParmVal( length, 7.0 )
Update()
OptimizeFitModel()
assert UndoFitModel(), "UndoFitModel found nothing to undo"
#==== The Parm is back where it was before the fit ====#
assert abs( GetParmVal( length ) - 7.0 ) < 1e-6, "UndoFitModel did not restore the Parm"
#==== And there is nothing left to undo ====#
assert not UndoFitModel(), "UndoFitModel is repeatable, but it should be one level deep"
See also: CanUndoFitModel, OptimizeFitModel, SearchFitModelTargetUW, RefineFitModelTargetUW
:rtype: boolean
:return: bool True if a previous state was restored
"""
return _vsp.UndoFitModel()
[docs]
def SaveFitModelFile(file_name):
r"""
Write the Fit Model Tool's target points and variables to a .fit file.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddFitModelTargetPt( pid, 0, CompPnt01( pid, 0, 0.5, 0.0 ) )
AddFitModelVar( GetParm( pid, "Length", "Design" ) )
SaveFitModelFile( "TestFitModel.fit" )
See also: LoadFitModelFile
:param [in]: file_name string Name of the .fit file to write
"""
return _vsp.SaveFitModelFile(file_name)
[docs]
def LoadFitModelFile(file_name):
r"""
Read target points and variables from a .fit file, adding them to whatever the Fit Model Tool already holds. Call
ResetFitModel first to read into an empty tool.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddFitModelTargetPt( pid, 0, CompPnt01( pid, 0, 0.5, 0.0 ) )
SaveFitModelFile( "TestFitModel.fit" )
ResetFitModel()
LoadFitModelFile( "TestFitModel.fit" )
assert GetNumFitModelTargetPts() == 1, "LoadFitModelFile did not read the target point back"
See also: SaveFitModelFile, ResetFitModel
:param [in]: file_name string Name of the .fit file to read
:rtype: int
:return: int Zero on success, or a nonzero code describing why the file could not be read
"""
return _vsp.LoadFitModelFile(file_name)
[docs]
def CreatePtCloudGeomFromPts(pt_vec, name):
r"""
Make a Point Cloud Geom out of a set of points. This is how a set worked out in a script is put
back into the model, so it can be looked at in the GUI and saved with the file. The counterpart
of GetPtCloudPnts.
.. code-block:: python
pts = []
pts.append( vec3d( 0.0, 0.0, 0.0 ) )
pts.append( vec3d( 2.0, 0.0, 0.0 ) )
pts.append( vec3d( 4.0, 0.0, 0.0 ) )
pts.append( vec3d( 6.0, 0.0, 0.0 ) )
cloud_id = CreatePtCloudGeomFromPts( pts, "ScriptCloud" )
assert len( GetPtCloudPnts( cloud_id ) ) == 4, "CreatePtCloudGeomFromPts did not keep the points"
See also: GetPtCloudPnts, CreatePtCloudGeom
:param [in]: pt_vec vector<vec3d> Points to place in the new Geom
:param [in]: name string Name for the new Geom, or an empty string for the default
:rtype: string
:return: string Geom ID of the new Point Cloud Geom
"""
return _vsp.CreatePtCloudGeomFromPts(pt_vec, name)
[docs]
def KeepPtsInBBox(pt_vec, min_pt, max_pt):
r"""
Keep the points inside an axis aligned box. This is what the GUI's rectangle selection is
reaching for, done in three dimensions rather than through a screen projection.
.. code-block:: python
pts = []
pts.append( vec3d( 0.0, 0.0, 0.0 ) )
pts.append( vec3d( 2.0, 0.0, 0.0 ) )
pts.append( vec3d( 4.0, 0.0, 0.0 ) )
pts.append( vec3d( 6.0, 0.0, 0.0 ) )
inside = KeepPtsInBBox( pts, vec3d( 1.0, -1.0, -1.0 ), vec3d( 5.0, 1.0, 1.0 ) )
assert len( inside ) == 2, "KeepPtsInBBox did not keep the points inside the box"
See also: RemovePtsInBBox, KeepPtsInRange
:param [in]: pt_vec vector<vec3d> Points to filter
:param [in]: min_pt vec3d Corner of the box with the smallest coordinates
:param [in]: max_pt vec3d Corner of the box with the largest coordinates
:rtype: std::vector< vec3d,std::allocator< vec3d > >
:return: vector<vec3d> Points inside the box
"""
return _vsp.KeepPtsInBBox(pt_vec, min_pt, max_pt)
[docs]
def RemovePtsInBBox(pt_vec, min_pt, max_pt):
r"""
Drop the points inside an axis aligned box, keeping the rest. The complement of KeepPtsInBBox,
which is how a selection is inverted.
.. code-block:: python
pts = []
pts.append( vec3d( 0.0, 0.0, 0.0 ) )
pts.append( vec3d( 2.0, 0.0, 0.0 ) )
pts.append( vec3d( 4.0, 0.0, 0.0 ) )
pts.append( vec3d( 6.0, 0.0, 0.0 ) )
outside = RemovePtsInBBox( pts, vec3d( 1.0, -1.0, -1.0 ), vec3d( 5.0, 1.0, 1.0 ) )
assert len( outside ) == 2, "RemovePtsInBBox did not drop the points inside the box"
See also: KeepPtsInBBox
:param [in]: pt_vec vector<vec3d> Points to filter
:param [in]: min_pt vec3d Corner of the box with the smallest coordinates
:param [in]: max_pt vec3d Corner of the box with the largest coordinates
:rtype: std::vector< vec3d,std::allocator< vec3d > >
:return: vector<vec3d> Points outside the box
"""
return _vsp.RemovePtsInBBox(pt_vec, min_pt, max_pt)
[docs]
def KeepPtsInRange(pt_vec, dir_index, low, high):
r"""
Keep the points whose coordinate along one axis falls between two values, inclusive.
.. code-block:: python
pts = []
pts.append( vec3d( 0.0, 0.0, 0.0 ) )
pts.append( vec3d( 2.0, 0.0, 0.0 ) )
pts.append( vec3d( 4.0, 0.0, 0.0 ) )
pts.append( vec3d( 6.0, 0.0, 0.0 ) )
mid = KeepPtsInRange( pts, X_DIR, 1.0, 5.0 )
assert len( mid ) == 2, "KeepPtsInRange did not keep the points in range"
See also: RemovePtsInRange, KeepPtsAbove, KeepPtsBelow
:param [in]: pt_vec vector<vec3d> Points to filter
:param [in]: dir_index int Direction index enum (i.e. X_DIR)
:param [in]: low double Lowest coordinate to keep
:param [in]: high double Highest coordinate to keep
:rtype: std::vector< vec3d,std::allocator< vec3d > >
:return: vector<vec3d> Points within the range
"""
return _vsp.KeepPtsInRange(pt_vec, dir_index, low, high)
[docs]
def RemovePtsInRange(pt_vec, dir_index, low, high):
r"""
Drop the points whose coordinate along one axis falls between two values, keeping the rest.
.. code-block:: python
pts = []
pts.append( vec3d( 0.0, 0.0, 0.0 ) )
pts.append( vec3d( 2.0, 0.0, 0.0 ) )
pts.append( vec3d( 4.0, 0.0, 0.0 ) )
pts.append( vec3d( 6.0, 0.0, 0.0 ) )
ends = RemovePtsInRange( pts, X_DIR, 1.0, 5.0 )
assert len( ends ) == 2, "RemovePtsInRange did not drop the points in range"
See also: KeepPtsInRange
:param [in]: pt_vec vector<vec3d> Points to filter
:param [in]: dir_index int Direction index enum (i.e. X_DIR)
:param [in]: low double Lowest coordinate to drop
:param [in]: high double Highest coordinate to drop
:rtype: std::vector< vec3d,std::allocator< vec3d > >
:return: vector<vec3d> Points outside the range
"""
return _vsp.RemovePtsInRange(pt_vec, dir_index, low, high)
[docs]
def KeepPtsAbove(pt_vec, dir_index, val):
r"""
Keep the points whose coordinate along one axis is greater than a value. Together with
KeepPtsBelow this splits a set in two: the two answers are complements, so no separate remove
call is wanted.
.. code-block:: python
pts = []
pts.append( vec3d( 0.0, 0.0, 0.0 ) )
pts.append( vec3d( 2.0, 0.0, 0.0 ) )
pts.append( vec3d( 4.0, 0.0, 0.0 ) )
pts.append( vec3d( 6.0, 0.0, 0.0 ) )
aft = KeepPtsAbove( pts, X_DIR, 3.0 )
assert len( aft ) == 2, "KeepPtsAbove did not keep the points above the value"
See also: KeepPtsBelow, KeepPtsInRange
:param [in]: pt_vec vector<vec3d> Points to filter
:param [in]: dir_index int Direction index enum (i.e. X_DIR)
:param [in]: val double Value to compare against
:rtype: std::vector< vec3d,std::allocator< vec3d > >
:return: vector<vec3d> Points above the value
"""
return _vsp.KeepPtsAbove(pt_vec, dir_index, val)
[docs]
def KeepPtsBelow(pt_vec, dir_index, val):
r"""
Keep the points whose coordinate along one axis is less than or equal to a value. The
complement of KeepPtsAbove.
.. code-block:: python
pts = []
pts.append( vec3d( 0.0, 0.0, 0.0 ) )
pts.append( vec3d( 2.0, 0.0, 0.0 ) )
pts.append( vec3d( 4.0, 0.0, 0.0 ) )
pts.append( vec3d( 6.0, 0.0, 0.0 ) )
fwd = KeepPtsBelow( pts, X_DIR, 3.0 )
assert len( fwd ) == 2, "KeepPtsBelow did not keep the points below the value"
See also: KeepPtsAbove, KeepPtsInRange
:param [in]: pt_vec vector<vec3d> Points to filter
:param [in]: dir_index int Direction index enum (i.e. X_DIR)
:param [in]: val double Value to compare against
:rtype: std::vector< vec3d,std::allocator< vec3d > >
:return: vector<vec3d> Points at or below the value
"""
return _vsp.KeepPtsBelow(pt_vec, dir_index, val)
[docs]
def KeepPtsNearPt(pt_vec, center, radius):
r"""
Keep the points within a distance of a given point.
.. code-block:: python
pts = []
pts.append( vec3d( 0.0, 0.0, 0.0 ) )
pts.append( vec3d( 2.0, 0.0, 0.0 ) )
pts.append( vec3d( 4.0, 0.0, 0.0 ) )
pts.append( vec3d( 6.0, 0.0, 0.0 ) )
near = KeepPtsNearPt( pts, vec3d( 4.0, 0.0, 0.0 ), 1.0 )
assert len( near ) == 1, "KeepPtsNearPt did not keep the points near the point"
See also: RemovePtsNearPt
:param [in]: pt_vec vector<vec3d> Points to filter
:param [in]: center vec3d Point to measure from
:param [in]: radius double Distance within which to keep points
:rtype: std::vector< vec3d,std::allocator< vec3d > >
:return: vector<vec3d> Points within the radius
"""
return _vsp.KeepPtsNearPt(pt_vec, center, radius)
[docs]
def RemovePtsNearPt(pt_vec, center, radius):
r"""
Drop the points within a distance of a given point, keeping the rest.
.. code-block:: python
pts = []
pts.append( vec3d( 0.0, 0.0, 0.0 ) )
pts.append( vec3d( 2.0, 0.0, 0.0 ) )
pts.append( vec3d( 4.0, 0.0, 0.0 ) )
pts.append( vec3d( 6.0, 0.0, 0.0 ) )
far = RemovePtsNearPt( pts, vec3d( 4.0, 0.0, 0.0 ), 1.0 )
assert len( far ) == 3, "RemovePtsNearPt did not drop the points near the point"
See also: KeepPtsNearPt
:param [in]: pt_vec vector<vec3d> Points to filter
:param [in]: center vec3d Point to measure from
:param [in]: radius double Distance within which to drop points
:rtype: std::vector< vec3d,std::allocator< vec3d > >
:return: vector<vec3d> Points outside the radius
"""
return _vsp.RemovePtsNearPt(pt_vec, center, radius)
[docs]
def KeepPtsNearGeom(pt_vec, geom_id, surf_indx, tol):
r"""
Keep the points lying within tol of a surface. This narrows a cloud -- a slice through a whole
model, say -- down to the component being fitted. Unlike the other filters this one costs a
surface projection for every point rather than a comparison, so on a large cloud it is worth
cutting the set down with one of the cheap filters first.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
pts = []
pts.append( CompPnt01( pid, 0, 0.5, 0.25 ) )
pts.append( vec3d( 0.0, 100.0, 0.0 ) )
on_body = KeepPtsNearGeom( pts, pid, 0, 1e-4 )
assert len( on_body ) == 1, "KeepPtsNearGeom did not keep the point on the surface"
See also: RemovePtsNearGeom, KeepPtsInBBox
:param [in]: pt_vec vector<vec3d> Points to filter
:param [in]: geom_id string Geom ID of the surface to measure against
:param [in]: surf_indx int Index of the surface of that Geom, from 0 to GetNumTotalSurfs() - 1
:param [in]: tol double Distance within which to keep points
:rtype: std::vector< vec3d,std::allocator< vec3d > >
:return: vector<vec3d> Points lying within tol of the surface
"""
return _vsp.KeepPtsNearGeom(pt_vec, geom_id, surf_indx, tol)
[docs]
def RemovePtsNearGeom(pt_vec, geom_id, surf_indx, tol):
r"""
Drop the points lying within tol of a surface, keeping the rest. Useful for taking one
component's points out of a cloud that covers several. Costs a surface projection per point.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
pts = []
pts.append( CompPnt01( pid, 0, 0.5, 0.25 ) )
pts.append( vec3d( 0.0, 100.0, 0.0 ) )
off_body = RemovePtsNearGeom( pts, pid, 0, 1e-4 )
assert len( off_body ) == 1, "RemovePtsNearGeom did not drop the point on the surface"
See also: KeepPtsNearGeom
:param [in]: pt_vec vector<vec3d> Points to filter
:param [in]: geom_id string Geom ID of the surface to measure against
:param [in]: surf_indx int Index of the surface of that Geom, from 0 to GetNumTotalSurfs() - 1
:param [in]: tol double Distance within which to drop points
:rtype: std::vector< vec3d,std::allocator< vec3d > >
:return: vector<vec3d> Points lying further than tol from the surface
"""
return _vsp.RemovePtsNearGeom(pt_vec, geom_id, surf_indx, tol)
[docs]
def UniquePts(pt_vec, tol):
r"""
Drop the repeated points of a set, keeping one of each group that falls within tol of one
another. Answered with a spatial tree rather than by comparing every pair.
.. code-block:: python
pts = []
pts.append( vec3d( 0.0, 0.0, 0.0 ) )
pts.append( vec3d( 2.0, 0.0, 0.0 ) )
pts.append( vec3d( 4.0, 0.0, 0.0 ) )
pts.append( vec3d( 6.0, 0.0, 0.0 ) )
twice = pts + pts
once = UniquePts( twice, 1e-8 )
assert len( once ) == 4, "UniquePts did not drop the repeats"
See also: UnionPts
:param [in]: pt_vec vector<vec3d> Points to filter
:param [in]: tol double Distance within which two points count as the same point
:rtype: std::vector< vec3d,std::allocator< vec3d > >
:return: vector<vec3d> Points with the repeats removed
"""
return _vsp.UniquePts(pt_vec, tol)
[docs]
def UnionPts(pt_vec_a, pt_vec_b, tol):
r"""
Put two sets of points together, keeping one of any that fall within tol of one another.
.. code-block:: python
pts = []
pts.append( vec3d( 0.0, 0.0, 0.0 ) )
pts.append( vec3d( 2.0, 0.0, 0.0 ) )
pts.append( vec3d( 4.0, 0.0, 0.0 ) )
pts.append( vec3d( 6.0, 0.0, 0.0 ) )
fwd = KeepPtsBelow( pts, X_DIR, 3.0 )
aft = KeepPtsAbove( pts, X_DIR, 3.0 )
all_pts = UnionPts( fwd, aft, 1e-8 )
assert len( all_pts ) == 4, "UnionPts did not put the two halves back together"
See also: SubtractPts, IntersectPts, UniquePts
:param [in]: pt_vec_a vector<vec3d> First set of points
:param [in]: pt_vec_b vector<vec3d> Second set of points
:param [in]: tol double Distance within which two points count as the same point
:rtype: std::vector< vec3d,std::allocator< vec3d > >
:return: vector<vec3d> Points of either set
"""
return _vsp.UnionPts(pt_vec_a, pt_vec_b, tol)
[docs]
def IntersectPts(pt_vec_a, pt_vec_b, tol):
r"""
Keep the points of the first set that also appear, within tol, in the second. Answered with a
spatial tree over the second set rather than by comparing every pair.
.. code-block:: python
pts = []
pts.append( vec3d( 0.0, 0.0, 0.0 ) )
pts.append( vec3d( 2.0, 0.0, 0.0 ) )
pts.append( vec3d( 4.0, 0.0, 0.0 ) )
pts.append( vec3d( 6.0, 0.0, 0.0 ) )
mid = KeepPtsInRange( pts, X_DIR, 1.0, 5.0 )
both = IntersectPts( pts, mid, 1e-8 )
assert len( both ) == 2, "IntersectPts did not keep the shared points"
See also: SubtractPts, UnionPts
:param [in]: pt_vec_a vector<vec3d> Set to take points from
:param [in]: pt_vec_b vector<vec3d> Set to test against
:param [in]: tol double Distance within which two points count as the same point
:rtype: std::vector< vec3d,std::allocator< vec3d > >
:return: vector<vec3d> Points of the first set that appear in the second
"""
return _vsp.IntersectPts(pt_vec_a, pt_vec_b, tol)
[docs]
def SubtractPts(pt_vec_a, pt_vec_b, tol):
r"""
Keep the points of the first set that do not appear, within tol, in the second. This is how a
group already dealt with is taken back out of a working set.
.. code-block:: python
pts = []
pts.append( vec3d( 0.0, 0.0, 0.0 ) )
pts.append( vec3d( 2.0, 0.0, 0.0 ) )
pts.append( vec3d( 4.0, 0.0, 0.0 ) )
pts.append( vec3d( 6.0, 0.0, 0.0 ) )
mid = KeepPtsInRange( pts, X_DIR, 1.0, 5.0 )
rest = SubtractPts( pts, mid, 1e-8 )
assert len( rest ) == 2, "SubtractPts did not remove the shared points"
See also: IntersectPts, UnionPts
:param [in]: pt_vec_a vector<vec3d> Set to take points from
:param [in]: pt_vec_b vector<vec3d> Set to remove
:param [in]: tol double Distance within which two points count as the same point
:rtype: std::vector< vec3d,std::allocator< vec3d > >
:return: vector<vec3d> Points of the first set that do not appear in the second
"""
return _vsp.SubtractPts(pt_vec_a, pt_vec_b, tol)
[docs]
def AddVarPresetGroup(group_name):
r"""
Add a Variable Preset Group
.. code-block:: python
# Add Pod Geom
pod1 = AddGeom( "POD", "" )
gid = AddVarPresetGroup( "Tess" )
:param [in]: group_name string Name for Var Preset Group
:rtype: string
:return: string Var Preset Group ID
"""
return _vsp.AddVarPresetGroup(group_name)
[docs]
def AddVarPresetSetting(group_id, setting_name):
r"""
Add a Setting to the Variable Preset Group
.. code-block:: python
# Add Pod Geom
pod1 = AddGeom( "POD", "" )
gid = AddVarPresetGroup( "Tess" )
sid = AddVarPresetSetting( gid, "Coarse" )
:param [in]: group_id string Var Preset Group ID
:param [in]: setting_name string Var Preset Setting Name
:rtype: string
:return: string Var Preset Setting ID
"""
return _vsp.AddVarPresetSetting(group_id, setting_name)
[docs]
def AddVarPresetParm(group_id, parm_id):
r"""
Add a Parm to the Variable Preset Group
.. code-block:: python
# 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()
:param [in]: group_id string Var Preset Group ID
:param [in]: parm_id string Parm ID
"""
return _vsp.AddVarPresetParm(group_id, parm_id)
[docs]
def DeleteAllVarPresetGroups():
r"""
Delete Variable Preset Group (and all contained settings)
.. code-block:: python
# 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"
:param [in]: group_id string Var Preset Group ID
Delete every Variable Preset Group, along with all the settings they contain
.. code-block:: python
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
"""
return _vsp.DeleteAllVarPresetGroups()
[docs]
def DeleteVarPresetGroup(group_id):
r"""
Delete a variable preset group and every setting in it.
.. code-block:: python
gid = AddVarPresetGroup( "TestGroup" )
DeleteVarPresetGroup( gid )
assert len( GetVarPresetGroups() ) == 0, "DeleteVarPresetGroup did not delete the group"
See also: AddVarPresetGroup, GetVarPresetGroups
:param [in]: group_id string Variable preset group ID
"""
return _vsp.DeleteVarPresetGroup(group_id)
[docs]
def DeleteAllVarPresetSettings(group_id):
r"""
Delete Variable Preset Setting
.. code-block:: python
# 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"
:param [in]: group_id string Var Preset Group ID
:param [in]: setting_id string Var Preset Setting ID
Delete every setting in a Variable Preset Group, leaving the group itself in place
.. code-block:: python
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
"""
return _vsp.DeleteAllVarPresetSettings(group_id)
[docs]
def DeleteVarPresetSetting(group_id, setting_id):
r"""
Delete one setting from a variable preset group, leaving the group.
.. code-block:: python
gid = AddVarPresetGroup( "TestGroup" )
sid = AddVarPresetSetting( gid, "TestSetting" )
DeleteVarPresetSetting( gid, sid )
assert len( GetVarPresetSettings( gid ) ) == 0, "DeleteVarPresetSetting did not delete the setting"
See also: AddVarPresetSetting, GetVarPresetSettings
:param [in]: group_id string Variable preset group ID
:param [in]: setting_id string Setting ID within that group
"""
return _vsp.DeleteVarPresetSetting(group_id, setting_id)
[docs]
def DeleteVarPresetParm(group_id, parm_id):
r"""
Delete Parm from Variable Preset Group
.. code-block:: python
# 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"
:param [in]: group_id string Var Preset Group ID
:param [in]: parm_id string Var Parm ID
"""
return _vsp.DeleteVarPresetParm(group_id, parm_id)
[docs]
def SetVarPresetParmVal(group_id, setting_id, parm_id, parm_val):
r"""
Set value for Parm in Var Preset Setting
.. code-block:: python
# 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"
:param [in]: group_id string Var Preset Group ID
:param [in]: setting_id string Var Preset Setting ID
:param [in]: parm_id string Var Parm ID
:param [in]: parm_val double Parm value
"""
return _vsp.SetVarPresetParmVal(group_id, setting_id, parm_id, parm_val)
[docs]
def GetVarPresetParmVal(group_id, setting_id, parm_id):
r"""
Get value for Parm in Var Preset Setting
.. code-block:: python
# 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"
:param [in]: group_id string Var Preset Group ID
:param [in]: setting_id string Var Preset Setting ID
:param [in]: parm_id string Var Parm ID
:rtype: float
:return: double Var Preset Parm value
"""
return _vsp.GetVarPresetParmVal(group_id, setting_id, parm_id)
[docs]
def GetGroupName(group_id):
r"""
Get Variable Preset group name
.. code-block:: python
# Add Pod Geom
pod1 = AddGeom( "POD", "" )
gid = AddVarPresetGroup( "Tess" )
name = GetGroupName( gid )
assert len( name ) > 0, "GetGroupName returned nothing"
:param [in]: group_id string Var Preset Group ID
:rtype: string
:return: string Var Preset Group name
"""
return _vsp.GetGroupName(group_id)
[docs]
def GetSettingName(setting_id):
r"""
Get Variable Preset Setting name
.. code-block:: python
# Add Pod Geom
pod1 = AddGeom( "POD", "" )
gid = AddVarPresetGroup( "Tess" )
sid = AddVarPresetSetting( gid, "Coarse" )
name = GetSettingName( sid )
assert len( name ) > 0, "GetSettingName returned nothing"
:param [in]: setting_id string Var Preset Setting ID
:rtype: string
:return: string Var Preset Setting name
"""
return _vsp.GetSettingName(setting_id)
[docs]
def SetGroupName(group_id, group_name):
r"""
Set Variable Preset group name
.. code-block:: python
# Add Pod Geom
pod1 = AddGeom( "POD", "" )
gid = AddVarPresetGroup( "Tess" )
SetGroupName( gid, "Resolution" )
assert GetGroupName( gid ) == "Resolution", "SetGroupName did not take"
:param [in]: group_id string Var Preset Group ID
:param [in]: group_name string New Var Preset Group name
"""
return _vsp.SetGroupName(group_id, group_name)
[docs]
def SetSettingName(setting_id, setting_name):
r"""
Set Variable Preset Setting name
.. code-block:: python
# Add Pod Geom
pod1 = AddGeom( "POD", "" )
gid = AddVarPresetGroup( "Tess" )
sid = AddVarPresetSetting( gid, "Coarse" )
SetSettingName( sid, "Low" )
assert GetSettingName( sid ) == "Low", "SetSettingName did not take"
:param [in]: setting_id string Var Preset Setting ID
:param [in]: setting_name string New Var Preset Setting name
"""
return _vsp.SetSettingName(setting_id, setting_name)
[docs]
def GetVarPresetGroups():
r"""
Get group_ids for Variable Preset Groups
.. code-block:: python
# 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"
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: array<string> Array of Variable Preset Group IDs
"""
return _vsp.GetVarPresetGroups()
[docs]
def GetVarPresetSettings(group_id):
r"""
Get Setting IDs for Variable Preset Group
.. code-block:: python
# 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"
:param [in]: group_id string Var Preset Group ID
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: array<string> Array of Variable Preset Group ParmIDs
"""
return _vsp.GetVarPresetSettings(group_id)
[docs]
def GetVarPresetParmIDs(group_id):
r"""
Get ParmIDs for Variable Preset Group
.. code-block:: python
# 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"
:param [in]: group_id string Var Preset Group ID
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: array<string> Array of Variable Preset Group ParmIDs
"""
return _vsp.GetVarPresetParmIDs(group_id)
[docs]
def GetVarPresetParmVals(setting_id):
r"""
Get Parm values for Variable Preset Setting
.. code-block:: python
# 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"
:param [in]: setting_id string Var Preset Setting ID
:rtype: std::vector< double,std::allocator< double > >
:return: array<double> Var Preset Parm values for Setting
"""
return _vsp.GetVarPresetParmVals(setting_id)
[docs]
def SetVarPresetParmVals(setting_id, parm_vals):
r"""
Set Parm values for Variable Preset Setting
.. code-block:: python
# 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"
:param [in]: setting_id string Var Preset Setting ID
:param [in]: parm_vals array<double> Array of Variable Preset Group Parm values
"""
return _vsp.SetVarPresetParmVals(setting_id, parm_vals)
[docs]
def SaveVarPresetParmVals(group_id, setting_id):
r"""
Save current Parm values to Variable Preset Setting
.. code-block:: python
# 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"
:param [in]: group_id string Var Preset Group ID
:param [in]: setting_id string Var Preset Setting ID
"""
return _vsp.SaveVarPresetParmVals(group_id, setting_id)
[docs]
def ApplyVarPresetSetting(group_id, setting_id):
r"""
Apply Parm values for Var Preset Setting
.. code-block:: python
# 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"
:param [in]: group_id string Var Preset Group ID
:param [in]: setting_id string Var Preset Setting ID
"""
return _vsp.ApplyVarPresetSetting(group_id, setting_id)
[docs]
def CreateAndAddMode(name, normal_set, degen_set):
r"""
Create a Mode -- a combination of Sets and Variable Presets
.. code-block:: python
# 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"
:param [in]: name string Name for new Mode
:param [in]: normal_set int Normal set for Mode
:param [in]: degen_set int Degen set for Mode
:rtype: string
:return: string Mode ID for new Mode
"""
return _vsp.CreateAndAddMode(name, normal_set, degen_set)
[docs]
def GetNumModes():
r"""
Get number of Modes in model.
.. code-block:: python
# 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"
:rtype: int
:return: int Number of Modes in model.
"""
return _vsp.GetNumModes()
[docs]
def GetAllModes():
r"""
Get all ModeID's in model.
.. code-block:: python
# 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"
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: array<string> array of Mode IDs
"""
return _vsp.GetAllModes()
[docs]
def DelMode(mid):
r"""
Delete a mode from the model.
.. code-block:: python
# 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"
:param [in]: mid string Mode ID of mode to delete
"""
return _vsp.DelMode(mid)
[docs]
def DelAllModes():
r"""
Delete all modes from the model.
.. code-block:: python
# 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"
"""
return _vsp.DelAllModes()
[docs]
def GetModeName(mid):
r"""
Apply Parm settings corresponding to a Mode.
.. code-block:: python
# 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"
:param [in]: mid string Mode ID of mode to apply
Get the name of a Mode.
.. code-block:: python
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
"""
return _vsp.GetModeName(mid)
[docs]
def SetModeName(mid, name):
r"""
Set the name of a Mode.
.. code-block:: python
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
"""
return _vsp.SetModeName(mid, name)
[docs]
def ApplyModeSettings(mid):
r"""
Apply a mode's variable preset settings to the model.
.. code-block:: python
mid = CreateAndAddMode( "TestMode", SET_ALL, SET_NONE )
ApplyModeSettings( mid )
See also: CreateAndAddMode
:param [in]: mid string Mode ID
"""
return _vsp.ApplyModeSettings(mid)
[docs]
def ShowOnlyMode(mid):
r"""
Show-only a mode in a model.
.. code-block:: python
# 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()
:param [in]: mid string Mode ID of mode to show-only
"""
return _vsp.ShowOnlyMode(mid)
[docs]
def ModeAddGroupSetting(mid, gid, sid):
r"""
Add a variable preset group and setting to a mode.
.. code-block:: python
# 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"
:param [in]: mid string Mode ID to add variable preset to
:param [in]: gid string Variable preset group ID to add to mode
:param [in]: sid string Variable preset setting ID to add to mode
"""
return _vsp.ModeAddGroupSetting(mid, gid, sid)
[docs]
def ModeGetGroup(mid, indx):
r"""
Get the group ID of var preset indx from a mode.
.. code-block:: python
# 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"
:param [in]: mid string Mode ID to return GroupID
:param [in]: indx int Index of Variable preset to return GroupID
:rtype: string
:return: string Group ID for Mode Variable preset indx
"""
return _vsp.ModeGetGroup(mid, indx)
[docs]
def ModeGetSetting(mid, indx):
r"""
Get the setting ID of var preset indx from a mode.
.. code-block:: python
# 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"
:param [in]: mid string Mode ID to return settingID
:param [in]: indx int Index of Variable preset to return SettingID
:rtype: string
:return: string Setting ID for Mode Variable preset indx
"""
return _vsp.ModeGetSetting(mid, indx)
[docs]
def ModeGetAllGroups(mid):
r"""
Get all var preset group IDs in model.
.. code-block:: python
# 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"
:param [in]: mid string Mode ID to return all group IDs
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: array<string> array of Group IDs
"""
return _vsp.ModeGetAllGroups(mid)
[docs]
def ModeGetAllSettings(mid):
r"""
Get all var preset setting IDs in model.
.. code-block:: python
# 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"
:param [in]: mid string Mode ID to return all group IDs
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: array<string> array of Group IDs
"""
return _vsp.ModeGetAllSettings(mid)
[docs]
def RemoveGroupSetting(mid, indx):
r"""
Remove the indx'th variable preset group and setting from the specified mode.
.. code-block:: python
# 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"
:param [in]: mid string Mode ID to remove varible preset group and setting from
:param [in]: indx int Index of Variable preset to remove
"""
return _vsp.RemoveGroupSetting(mid, indx)
[docs]
def RemoveAllGroupSettings(mid):
r"""
Remove all variable preset groups and settings from mode.
.. code-block:: python
# 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"
:param [in]: mid string Mode ID to remove all variable presets from
"""
return _vsp.RemoveAllGroupSettings(mid)
[docs]
def SetPCurve(geom_id, pcurveid, tvec, valvec, newtype):
r"""
Set the parameters, values, and curve type of a propeller blade curve (P Curve)
.. code-block:: python
prop_id = AddGeom( "PROP" )
Update()
tvec = PCurveGetTVec( prop_id, PROP_CHORD )
valvec = PCurveGetValVec( prop_id, PROP_CHORD )
SetPCurve( prop_id, PROP_CHORD, tvec, valvec, PCurveGetType( prop_id, PROP_CHORD ) )
Update()
assert len( PCurveGetTVec( prop_id, PROP_CHORD ) ) == len( tvec ), "SetPCurve did not take"
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)
"""
return _vsp.SetPCurve(geom_id, pcurveid, tvec, valvec, newtype)
[docs]
def PCurveConvertTo(geom_id, pcurveid, newtype):
r"""
Change the type of a propeller blade curve (P Curve)
.. code-block:: python
prop_id = AddGeom( "PROP" )
Update()
PCurveConvertTo( prop_id, PROP_CHORD, LINEAR )
Update()
assert PCurveGetType( prop_id, PROP_CHORD ) == LINEAR, "PCurveConvertTo did not change the type"
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)
"""
return _vsp.PCurveConvertTo(geom_id, pcurveid, newtype)
[docs]
def PCurveGetType(geom_id, pcurveid):
r"""
Get the type of a propeller blade curve (P Curve)
.. code-block:: python
prop_id = AddGeom( "PROP" )
Update()
t = PCurveGetType( prop_id, PROP_CHORD )
assert t >= 0, "PCurveGetType returned a bad type"
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)
"""
return _vsp.PCurveGetType(geom_id, pcurveid)
[docs]
def PCurveGetTVec(geom_id, pcurveid):
r"""
Get the parameters of a propeller blade curve (P Curve). Each parameter is a fraction of propeller radius.
.. code-block:: python
prop_id = AddGeom( "PROP" )
Update()
tvec = PCurveGetTVec( prop_id, PROP_CHORD )
assert len( tvec ) > 0, "PCurveGetTVec returned nothing"
: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
"""
return _vsp.PCurveGetTVec(geom_id, pcurveid)
[docs]
def PCurveGetValVec(geom_id, pcurveid):
r"""
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.).
.. code-block:: python
prop_id = AddGeom( "PROP" )
Update()
valvec = PCurveGetValVec( prop_id, PROP_CHORD )
assert len( valvec ) > 0, "PCurveGetValVec returned nothing"
assert len( valvec ) == len( PCurveGetTVec( prop_id, PROP_CHORD ) ), "PCurveGetValVec disagrees with the T vector"
: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
"""
return _vsp.PCurveGetValVec(geom_id, pcurveid)
[docs]
def PCurveDeletePt(geom_id, pcurveid, indx):
r"""
Delete a propeller blade curve (P Curve) point
.. code-block:: python
prop_id = AddGeom( "PROP" )
Update()
# A cubic edit curve holds its points in groups and will not give one up on its own, so put
# the curve into a form where a single point can go.
PCurveConvertTo( prop_id, PROP_CHORD, LINEAR )
Update()
n = len( PCurveGetTVec( prop_id, PROP_CHORD ) )
PCurveDeletePt( prop_id, PROP_CHORD, 1 )
Update()
assert len( PCurveGetTVec( prop_id, PROP_CHORD ) ) < n, "PCurveDeletePt did not remove a point"
:param [in]: geom_id string Parent Geom ID
:param [in]: pcurveid int P Curve index
:param [in]: indx int Point index
"""
return _vsp.PCurveDeletePt(geom_id, pcurveid, indx)
[docs]
def PCurveSplit(geom_id, pcurveid, tsplit):
r"""
Split a propeller blade curve (P Curve) at the specified 1D parameter
.. code-block:: python
prop_id = AddGeom( "PROP" )
Update()
n = len( PCurveGetTVec( prop_id, PROP_CHORD ) )
PCurveSplit( prop_id, PROP_CHORD, 0.55 )
Update()
assert len( PCurveGetTVec( prop_id, PROP_CHORD ) ) > n, "PCurveSplit did not add a point"
: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
"""
return _vsp.PCurveSplit(geom_id, pcurveid, tsplit)
[docs]
def ApproximateAllPropellerPCurves(geom_id):
r"""
Approximate all propeller blade curves with cubic Bezier curves.
.. code-block:: python
# 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"
:param [in]: geom_id string Geom ID
"""
return _vsp.ApproximateAllPropellerPCurves(geom_id)
[docs]
def ResetPropellerThickness(geom_id):
r"""
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.
.. code-block:: python
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
"""
return _vsp.ResetPropellerThickness(geom_id)
[docs]
def ResetPropellerThicknessCurve(geom_id):
r"""
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.
.. code-block:: python
# 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()
:param [in]: geom_id string Geom ID
"""
return _vsp.ResetPropellerThicknessCurve(geom_id)
[docs]
def AutoGroupVSPAEROControlSurfaces():
r"""
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.
.. code-block:: python
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
"""
return _vsp.AutoGroupVSPAEROControlSurfaces()
[docs]
def AddCpSlice(cut_type, location):
r"""
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.
.. code-block:: python
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.
.. code-block:: python
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.
.. code-block:: python
# 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
"""
return _vsp.AddCpSlice(cut_type, location)
[docs]
def GetNumCpSlices():
r"""
Get the number of Cp slices in the VSPAERO Cp Slicer
.. code-block:: python
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
"""
return _vsp.GetNumCpSlices()
[docs]
def GetCpSliceID(slice_index):
r"""
Get the ID of the Cp slice at the specified index
.. code-block:: python
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
"""
return _vsp.GetCpSliceID(slice_index)
[docs]
def DelCpSlice(slice_index):
r"""
Delete a single Cp slice from the VSPAERO Cp Slicer
.. code-block:: python
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
"""
return _vsp.DelCpSlice(slice_index)
[docs]
def DeleteAllCpSlices():
r"""
Delete all Cp slices from the VSPAERO Cp Slicer
.. code-block:: python
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
"""
return _vsp.DeleteAllCpSlices()
[docs]
def DeleteVSPAEROControlSurfaceGroup(CSGroupIndex):
r"""
Delete one VSPAERO control surface group, by index.
.. code-block:: python
wid = AddGeom( "WING" )
Update()
CreateVSPAEROControlSurfaceGroup()
DeleteVSPAEROControlSurfaceGroup( 0 )
assert GetNumControlSurfaceGroups() == 0, "DeleteVSPAEROControlSurfaceGroup did not delete the group"
See also: CreateVSPAEROControlSurfaceGroup
:param [in]: CSGroupIndex int Index of the control surface group to delete
"""
return _vsp.DeleteVSPAEROControlSurfaceGroup(CSGroupIndex)
[docs]
def CreateVSPAEROControlSurfaceGroup():
r"""
Add a VSPAERO control surface group.
.. code-block:: python
wid = AddGeom( "WING" )
Update()
group_index = CreateVSPAEROControlSurfaceGroup()
assert GetNumControlSurfaceGroups() == 1, "CreateVSPAEROControlSurfaceGroup did not add the group"
See also: DeleteVSPAEROControlSurfaceGroup, GetNumControlSurfaceGroups
:rtype: int
:return: int Index of the new control surface group
"""
return _vsp.CreateVSPAEROControlSurfaceGroup()
[docs]
def AddAllToVSPAEROControlSurfaceGroup(CSGroupIndex):
r"""
Add all available control surfaces to the control surface group at the specified index
.. code-block:: python
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"
:param [in]: CSGroupIndex int Index of the control surface group
"""
return _vsp.AddAllToVSPAEROControlSurfaceGroup(CSGroupIndex)
[docs]
def RemoveAllFromVSPAEROControlSurfaceGroup(CSGroupIndex):
r"""
Remove all used control surfaces from the control surface group at the specified index
.. code-block:: python
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"
:param [in]: CSGroupIndex int Index of the control surface group
"""
return _vsp.RemoveAllFromVSPAEROControlSurfaceGroup(CSGroupIndex)
[docs]
def GetActiveCSNameVec(CSGroupIndex):
r"""
Get the names of each active (used) control surface in the control surface group at the specified index
.. code-block:: python
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] )
:param [in]: CSGroupIndex int Index of the control surface group
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector <string> Array of active control surface names
"""
return _vsp.GetActiveCSNameVec(CSGroupIndex)
[docs]
def GetCompleteCSNameVec():
r"""
Get the names of all control surfaces. Some may be active (used) while others may be available.
.. code-block:: python
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] )
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector <string> Array of all control surface names
"""
return _vsp.GetCompleteCSNameVec()
[docs]
def GetAvailableCSNameVec(CSGroupIndex):
r"""
Get the names of each available (not used) control surface in the control surface group at the specified index
.. code-block:: python
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"
:param [in]: CSGroupIndex int Index of the control surface group
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector <string> Array of active control surface names
"""
return _vsp.GetAvailableCSNameVec(CSGroupIndex)
[docs]
def SetVSPAEROControlGroupName(name, CSGroupIndex):
r"""
Set the name for the control surface group at the specified index
.. code-block:: python
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 ) )
:param [in]: name string Name to set for the control surface group
:param [in]: CSGroupIndex int Index of the control surface group
"""
return _vsp.SetVSPAEROControlGroupName(name, CSGroupIndex)
[docs]
def GetVSPAEROControlGroupName(CSGroupIndex):
r"""
Get the name of the control surface group at the specified index
.. code-block:: python
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 ) )
:param [in]: CSGroupIndex int Index of the control surface group
"""
return _vsp.GetVSPAEROControlGroupName(CSGroupIndex)
[docs]
def AddSelectedToCSGroup(selected, CSGroupIndex):
r"""
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.
.. code-block:: python
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
"""
return _vsp.AddSelectedToCSGroup(selected, CSGroupIndex)
[docs]
def RemoveSelectedFromCSGroup(selected, CSGroupIndex):
r"""
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.
.. code-block:: python
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
"""
return _vsp.RemoveSelectedFromCSGroup(selected, CSGroupIndex)
[docs]
def GetNumControlSurfaceGroups():
r"""
Get the total number of control surface groups
.. code-block:: python
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"
:rtype: int
:return: int Number of control surface groups
"""
return _vsp.GetNumControlSurfaceGroups()
[docs]
def FindControlSurfaceGroup(group_index):
r"""
Get the ID of a VSPAERO control surface group, so that its Parms can be reached the way any
other container's are. A group carries an ActiveFlag and a DeflectionAngle, both in Parm
group "ControlSurfaceGroup". Everything else about these groups is addressed by index;
this is what lets a script set a deflection without knowing the index a group happens to
hold.
.. code-block:: python
#==== A wing with a control surface on it ====#
wid = AddGeom( "WING", "" )
subsurf_id = AddSubSurf( wid, SS_CONTROL, 0 )
Update()
#==== Group it, the way the VSPAERO screen does ====#
AutoGroupVSPAEROControlSurfaces()
Update()
assert GetNumControlSurfaceGroups() > 0, "no control surface group was made"
group_id = FindControlSurfaceGroup( 0 )
assert len( group_id ) > 0, "FindControlSurfaceGroup found nothing"
#==== And its deflection is a Parm like any other ====#
SetParmVal( FindParm( group_id, "DeflectionAngle", "ControlSurfaceGroup" ), 7.0 )
Update()
deflected = GetParmVal( group_id, "DeflectionAngle", "ControlSurfaceGroup" )
assert abs( deflected - 7.0 ) < 1e-6, "the group did not take the deflection it was given"
See also: GetNumControlSurfaceGroups, AutoGroupVSPAEROControlSurfaces
:param [in]: group_index int Control surface group index
:rtype: string
:return: string Control surface group ID
"""
return _vsp.FindControlSurfaceGroup(group_index)
[docs]
def FindActuatorDisk(disk_index):
r"""
Get the ID of a VSPAERO actuator disk at the specified index. An empty string is returned if
the index is out of range.
.. code-block:: python
# 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
"""
return _vsp.FindActuatorDisk(disk_index)
[docs]
def GetNumActuatorDisks():
r"""
Get the number of actuator disks in the current VSPAERO set. This is equivalent to the number of disk surfaces in the VSPAERO set.
.. code-block:: python
# 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
"""
return _vsp.GetNumActuatorDisks()
[docs]
def FindUnsteadyGroup(group_index):
r"""
Get the ID of the VSPAERO unsteady group at the specified index. An empty string is returned if
the index is out of range.
.. code-block:: python
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
"""
return _vsp.FindUnsteadyGroup(group_index)
[docs]
def GetUnsteadyGroupName(group_index):
r"""
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.
.. code-block:: python
# 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()
:param [in]: group_index int Unsteady group index for the current VSPAERO set
:rtype: string
:return: string Unsteady group name
"""
return _vsp.GetUnsteadyGroupName(group_index)
[docs]
def GetUnsteadyGroupCompIDs(group_index):
r"""
Get an array of IDs for all components in the unsteady group at the specified index.
.. code-block:: python
# 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
"""
return _vsp.GetUnsteadyGroupCompIDs(group_index)
[docs]
def GetUnsteadyGroupSurfIndexes(group_index):
r"""
Get an array of surface indexes for all components in the unsteady group at the specified index.
.. code-block:: python
# 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
"""
return _vsp.GetUnsteadyGroupSurfIndexes(group_index)
[docs]
def GetNumUnsteadyGroups():
r"""
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.
.. code-block:: python
# 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
"""
return _vsp.GetNumUnsteadyGroups()
[docs]
def GetNumUnsteadyRotorGroups():
r"""
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.
.. code-block:: python
# 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
"""
return _vsp.GetNumUnsteadyRotorGroups()
[docs]
def AddExcrescence(excresName, excresType, excresVal):
r"""
Add an Excresence to the Parasite Drag Tool
.. code-block:: python
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
"""
return _vsp.AddExcrescence(excresName, excresType, excresVal)
[docs]
def GetNumExcrescences():
r"""
Delete an Excresence from the Parasite Drag Tool
.. code-block:: python
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()
:param [in]: index int Index of the Excressence to delete
Get the number of Excresences in the Parasite Drag Tool
.. code-block:: python
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
"""
return _vsp.GetNumExcrescences()
[docs]
def DeleteAllExcrescences():
r"""
Delete all Excresences from the Parasite Drag Tool
.. code-block:: python
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
"""
return _vsp.DeleteAllExcrescences()
[docs]
def DeleteExcrescence(index):
r"""
Delete one excrescence from the Parasite Drag tool, by index.
.. code-block:: python
AddExcrescence( "TestExcrescence", EXCRESCENCE_COUNT, 2.0 )
DeleteExcrescence( 0 )
assert GetNumExcrescences() == 0, "DeleteExcrescence did not delete the excrescence"
See also: AddExcrescence, GetNumExcrescences
:param [in]: index int Index of the excrescence to delete
"""
return _vsp.DeleteExcrescence(index)
[docs]
def UpdateParasiteDrag():
r"""
Update any reference geometry, atmospheric properties, excressences, etc. in the Parasite Drag Tool
.. code-block:: python
pid = AddGeom( "POD" )
Update()
UpdateParasiteDrag()
"""
return _vsp.UpdateParasiteDrag()
[docs]
def ExportParasiteDragToCSV(file_name):
r"""
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.
.. code-block:: python
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
"""
return _vsp.ExportParasiteDragToCSV(file_name)
[docs]
def WriteAtmosphereCSVFile(file_name, atmos_type):
r"""
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
.. code-block:: python
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)
"""
return _vsp.WriteAtmosphereCSVFile(file_name, atmos_type)
[docs]
def CalcAtmosphere(alt, delta_temp, atmos_type):
r"""
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.
.. code-block:: python
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
"""
return _vsp.CalcAtmosphere(alt, delta_temp, atmos_type)
[docs]
def WriteBodyFFCSVFile(file_name):
r"""
Calculate the form factor from each body FF equation (i.e. Hoerner Streamlined Body) and write the results to a CSV output file
.. code-block:: python
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"
:param [in]: file_name string Output CSV file
"""
return _vsp.WriteBodyFFCSVFile(file_name)
[docs]
def WriteWingFFCSVFile(file_name):
r"""
Calculate the form factor from each wing FF equation (i.e. Schemensky 4 Series Airfoil) and write the results to a CSV output file
.. code-block:: python
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"
:param [in]: file_name string Output CSV file
"""
return _vsp.WriteWingFFCSVFile(file_name)
[docs]
def WriteCfEqnCSVFile(file_name):
r"""
Calculate the coefficient of friction from each Cf equation (i.e. Power Law Blasius) and write the results to a CSV output file
.. code-block:: python
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"
:param [in]: file_name string Output CSV file
Write a CSV file of the skin friction coefficient equations over a range of Reynolds numbers.
.. code-block:: python
WriteCfEqnCSVFile( "TestCfEqn.csv" )
See also: WritePartialCfMethodCSVFile
:param [in]: file_name string Name of the CSV file to write
"""
return _vsp.WriteCfEqnCSVFile(file_name)
[docs]
def WritePartialCfMethodCSVFile(file_name):
r"""
Calculate the partial coefficient of friction and write the results to a CSV output file
.. code-block:: python
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"
:param [in]: file_name string Output CSV file
Write a CSV file of the partial turbulence skin friction methods.
.. code-block:: python
WritePartialCfMethodCSVFile( "TestPartialCf.csv" )
See also: WriteCfEqnCSVFile
:param [in]: file_name string Name of the CSV file to write
"""
return _vsp.WritePartialCfMethodCSVFile(file_name)
[docs]
def CompPnt01(geom_id, surf_indx, u, w):
r"""
Calculate the 3D coordinate equivalent for the input surface coordinate point
.. code-block:: python
# 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"
:param [in]: geom_id string Parent Geom ID
:param [in]: surf_indx int Main surface index from the parent Geom
:param [in]: u double U (0 - 1) surface coordinate
:param [in]: w double W (0 - 1) surface coordinate
:rtype: :py:class:`vec3d`
:return: vec3d Normal vector3D coordinate point
"""
return _vsp.CompPnt01(geom_id, surf_indx, u, w)
[docs]
def CompNorm01(geom_id, surf_indx, u, w):
r"""
Calculate the normal vector on the specified surface at input surface coordinate
.. code-block:: python
# 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()} )" )
:param [in]: geom_id string Parent Geom ID
:param [in]: surf_indx int Main surface index from the parent Geom
:param [in]: u double U (0 - 1) surface coordinate
:param [in]: w double W (0 - 1) surface coordinate
:rtype: :py:class:`vec3d`
:return: vec3d Normal vector
"""
return _vsp.CompNorm01(geom_id, surf_indx, u, w)
[docs]
def CompTanU01(geom_id, surf_indx, u, w):
r"""
Calculate the vector tangent to the specified surface at input surface coordinate in the U direction
.. code-block:: python
# 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()} )" )
:param [in]: geom_id string Parent Geom ID
:param [in]: surf_indx int Main surface index from the parent Geom
:param [in]: u double U (0 - 1) surface coordinate
:param [in]: w double W (0 - 1) surface coordinate
:rtype: :py:class:`vec3d`
:return: vec3d Tangent vector in U direction
"""
return _vsp.CompTanU01(geom_id, surf_indx, u, w)
[docs]
def CompTanW01(geom_id, surf_indx, u, w):
r"""
Calculate the vector tangent to the specified surface at input surface coordinate in the W direction
.. code-block:: python
# 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()} )" )
:param [in]: geom_id string Parent Geom ID
:param [in]: surf_indx int Main surface index from the parent Geom
:param [in]: u double U (0 - 1) surface coordinate
:param [in]: w double W (0 - 1) surface coordinate
:rtype: :py:class:`vec3d`
:return: vec3d Tangent vector in W direction
"""
return _vsp.CompTanW01(geom_id, surf_indx, u, w)
[docs]
def CompCurvature01(geom_id, surf_indx, u, w):
r"""
Determine the curvature of a specified surface at the input surface coordinate point
.. code-block:: python
# 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"
:param [in]: geom_id string Parent Geom ID
:param [in]: surf_indx int Main surface index from the parent Geom
:param [in]: u double U (0 - 1) surface coordinate
:param [in]: w double W (0 - 1) surface coordinate
:param [out]: k1_out double Output value of maximum principal curvature
:param [out]: k2_out double Output value of minimum principal curvature
:param [out]: ka_out double Output value of mean curvature
:param [out]: kg_out double Output value of Gaussian curvature
"""
return _vsp.CompCurvature01(geom_id, surf_indx, u, w)
[docs]
def ProjPnt01(geom_id, surf_indx, pt):
r"""
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.
.. code-block:: python
# 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
"""
return _vsp.ProjPnt01(geom_id, surf_indx, pt)
[docs]
def ProjPnt01I(geom_id, pt):
r"""
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.
.. code-block:: python
# 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
"""
return _vsp.ProjPnt01I(geom_id, pt)
[docs]
def ProjPnt01Guess(geom_id, surf_indx, pt, u0, w0):
r"""
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.
.. code-block:: python
# 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
"""
return _vsp.ProjPnt01Guess(geom_id, surf_indx, pt, u0, w0)
[docs]
def AxisProjPnt01(geom_id, surf_indx, iaxis, pt):
r"""
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.
.. code-block:: python
# 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
"""
return _vsp.AxisProjPnt01(geom_id, surf_indx, iaxis, pt)
[docs]
def AxisProjPnt01I(geom_id, iaxis, pt):
r"""
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.
.. code-block:: python
# 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
"""
return _vsp.AxisProjPnt01I(geom_id, iaxis, pt)
[docs]
def AxisProjPnt01Guess(geom_id, surf_indx, iaxis, pt, u0, w0):
r"""
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.
.. code-block:: python
# 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
"""
return _vsp.AxisProjPnt01Guess(geom_id, surf_indx, iaxis, pt, u0, w0)
[docs]
def InsideSurf(geom_id, surf_indx, pt):
r"""
Test whether a given point is inside a specified surface.
.. code-block:: python
# 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.
"""
return _vsp.InsideSurf(geom_id, surf_indx, pt)
[docs]
def CompPntRST(geom_id, surf_indx, r, s, t):
r"""
Calculate the (X, Y, Z) coordinate for the input volume (R, S, T) coordinate point
.. code-block:: python
# 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"
:param [in]: geom_id string Parent Geom ID
:param [in]: surf_indx 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
:rtype: :py:class:`vec3d`
:return: vec3d coordinate point
"""
return _vsp.CompPntRST(geom_id, surf_indx, r, s, t)
[docs]
def FindRST(geom_id, surf_indx, pt):
r"""
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.
.. code-block:: python
# 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
"""
return _vsp.FindRST(geom_id, surf_indx, pt)
[docs]
def FindRSTGuess(geom_id, surf_indx, pt, r0, s0, t0):
r"""
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.
.. code-block:: python
# 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
"""
return _vsp.FindRSTGuess(geom_id, surf_indx, pt, r0, s0, t0)
[docs]
def ConvertRSTtoLMN(geom_id, surf_indx, r, s, t):
r"""
Convert RST volumetric coordinates to LMN coordinates.
.. code-block:: python
# 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"
:param [in]: geom_id string Parent Geom ID
:param [in]: surf_indx 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 [out]: l_out double L (0 - 1) linear volume coordinate
:param [out]: m_out double M (0 - 1) linear volume coordinate
:param [out]: n_out double N (0 - 1) linear volume coordinate
"""
return _vsp.ConvertRSTtoLMN(geom_id, surf_indx, r, s, t)
[docs]
def ConvertRtoL(geom_id, surf_indx, r):
r"""
Convert R volumetric coordinate to L coordinate.
.. code-block:: python
# 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"
:param [in]: geom_id string Parent Geom ID
:param [in]: surf_indx int Main surface index from the parent Geom
:param [in]: r double R (0 - 1) volume coordinate
:param [out]: l_out double L (0 - 1) linear volume coordinate
"""
return _vsp.ConvertRtoL(geom_id, surf_indx, r)
[docs]
def ConvertLMNtoRST(geom_id, surf_indx, l, m, n):
r"""
Convert LMN volumetric coordinates to RST coordinates.
.. code-block:: python
# 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"
:param [in]: geom_id string Parent Geom ID
:param [in]: surf_indx int Main surface index from the parent Geom
:param [in]: l double L (0 - 1) linear volume coordinate
:param [in]: m double M (0 - 1) linear volume coordinate
:param [in]: n double N (0 - 1) linear volume coordinate
:param [out]: r_out double R (0 - 1) volume coordinate
:param [out]: s_out double S (0 - 1) volume coordinate
:param [out]: t_out double T (0 - 1) volume coordinate
"""
return _vsp.ConvertLMNtoRST(geom_id, surf_indx, l, m, n)
[docs]
def ConvertLtoR(geom_id, surf_indx, l):
r"""
Convert L volumetric coordinate to R coordinate.
.. code-block:: python
# 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"
:param [in]: geom_id string Parent Geom ID
:param [in]: surf_indx int Main surface index from the parent Geom
:param [in]: l double L (0 - 1) volume coordinate
:param [out]: r_out double R (0 - 1) linear volume coordinate
"""
return _vsp.ConvertLtoR(geom_id, surf_indx, l)
[docs]
def ConvertUtoEta(geom_id, u):
r"""
Convert U coordinate to eta wing coordinate.
.. code-block:: python
# 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"
:param [in]: geom_id string Parent Geom ID
:param [in]: u double U (0 - 1) surface coordinate
:param [out]: eta_out double Eta (0 - 1) wing spanwise coordinate
"""
return _vsp.ConvertUtoEta(geom_id, u)
[docs]
def ConvertEtatoU(geom_id, eta):
r"""
Convert eta wing coordinate to u coordinate.
.. code-block:: python
# 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"
:param [in]: geom_id string Parent Geom ID
:param [in]: eta double Eta (0 - 1) wing spanwise coordinate
:param [out]: u_out double U (0 - 1) surface coordinate
"""
return _vsp.ConvertEtatoU(geom_id, eta)
[docs]
def CompVecPnt01(geom_id, surf_indx, u_in_vec, w_in_vec):
r"""
Determine 3D coordinate for each surface coordinate point in the input arrays
.. code-block:: python
# 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 )
:param [in]: geom_id string Parent Geom ID
:param [in]: surf_indx int Main surface index from the parent Geom
:param [in]: u_in_vec vector<double> Input vector of U (0 - 1) surface coordinates
:param [in]: w_in_vec vector<double> Input vector of W (0 - 1) surface coordinates
:rtype: std::vector< vec3d,std::allocator< vec3d > >
:return: vector<vec3d> Vector of 3D coordinate points
"""
return _vsp.CompVecPnt01(geom_id, surf_indx, u_in_vec, w_in_vec)
[docs]
def CompVecDegenPnt01(geom_id, surf_indx, degen_type, u_in_vec, w_in_vec):
r"""
Determine 3D coordinate for each degen surface coordinate point in the input arrays
.. code-block:: python
# 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 )
:param [in]: geom_id string Parent Geom ID
:param [in]: surf_indx int Main surface index from the parent Geom
:param [in]: degen_type int Type of degen surface (0-S, 1-V, 2-H, 3-C)
:param [in]: u_in_vec vector<double> Input vector of U (0 - 1) surface coordinates
:param [in]: w_in_vec vector<double> Input vector of W (0 - 1) surface coordinates
:rtype: std::vector< vec3d,std::allocator< vec3d > >
:return: vector<vec3d> Vector of 3D coordinate points
"""
return _vsp.CompVecDegenPnt01(geom_id, surf_indx, degen_type, u_in_vec, w_in_vec)
[docs]
def CompVecNorm01(geom_id, surf_indx, us, ws):
r"""
Determine the normal vector on a surface for each surface coordinate point in the input arrays
.. code-block:: python
# 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"
:param [in]: geom_id string Parent Geom ID
:param [in]: surf_indx int Main surface index from the parent Geom
:param [in]: us vector<double> Input vector of U (0 - 1) surface coordinates
:param [in]: ws vector<double> Input vector of W (0 - 1) surface coordinates
:rtype: std::vector< vec3d,std::allocator< vec3d > >
:return: vector<vec3d> Vector of 3D normal vectors
"""
return _vsp.CompVecNorm01(geom_id, surf_indx, us, ws)
[docs]
def CompVecCurvature01(geom_id, surf_indx, us, ws):
r"""
Determine the curvature of a specified surface at each surface coordinate point in the input arrays
.. code-block:: python
# 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 )
:param [in]: geom_id string Parent Geom ID
:param [in]: surf_indx int Main surface index from the parent Geom
:param [in]: us vector<double> Input vector of U (0 - 1) surface coordinates
:param [in]: ws vector<double> Input vector of W (0 - 1) surface coordinates
:param [out]: k1_out_vec vector<double> Output vector of maximum principal curvatures
:param [out]: k2_out_vec vector<double> Output vector of minimum principal curvatures
:param [out]: ka_out_vec vector<double> Output vector of mean curvatures
:param [out]: kg_out_vec vector<double> Output vector of Gaussian curvatures
"""
return _vsp.CompVecCurvature01(geom_id, surf_indx, us, ws)
[docs]
def ProjVecPnt01(geom_id, surf_indx, pts):
r"""
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.
.. code-block:: python
# 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
"""
return _vsp.ProjVecPnt01(geom_id, surf_indx, pts)
[docs]
def ProjVecPnt01Guess(geom_id, surf_indx, pts, u0s, w0s):
r"""
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.
.. code-block:: python
# 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
"""
return _vsp.ProjVecPnt01Guess(geom_id, surf_indx, pts, u0s, w0s)
[docs]
def AxisProjVecPnt01(geom_id, surf_indx, iaxis, pts):
r"""
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.
.. code-block:: python
# 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
"""
return _vsp.AxisProjVecPnt01(geom_id, surf_indx, iaxis, pts)
[docs]
def AxisProjVecPnt01Guess(geom_id, surf_indx, iaxis, pts, u0s, w0s):
r"""
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.
.. code-block:: python
# 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
"""
return _vsp.AxisProjVecPnt01Guess(geom_id, surf_indx, iaxis, pts, u0s, w0s)
[docs]
def VecInsideSurf(geom_id, surf_indx, pts):
r"""
Test whether a vector of points are inside a specified surface.
.. code-block:: python
# 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.
"""
return _vsp.VecInsideSurf(geom_id, surf_indx, pts)
[docs]
def CompVecPntRST(geom_id, surf_indx, r_in_vec, s_in_vec, t_in_vec):
r"""
Determine 3D coordinate for each volume coordinate point in the input arrays
.. code-block:: python
# 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 )
:param [in]: geom_id string Parent Geom ID
:param [in]: surf_indx int Main surface index from the parent Geom
:param [in]: r_in_vec vector<double> Input vector of R (0 - 1.0) volume coordinates
:param [in]: s_in_vec vector<double> Input vector of S (0 - 1.0) volume coordinates
:param [in]: t_in_vec vector<double> Input vector of T (0 - 1.0) volume coordinates
:rtype: std::vector< vec3d,std::allocator< vec3d > >
:return: vector<vec3d> Vector of 3D coordinate points
"""
return _vsp.CompVecPntRST(geom_id, surf_indx, r_in_vec, s_in_vec, t_in_vec)
[docs]
def FindRSTVec(geom_id, surf_indx, pts):
r"""
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.
.. code-block:: python
# 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
"""
return _vsp.FindRSTVec(geom_id, surf_indx, pts)
[docs]
def FindRSTVecGuess(geom_id, surf_indx, pts, r0s, s0s, t0s):
r"""
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.
.. code-block:: python
# 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
"""
return _vsp.FindRSTVecGuess(geom_id, surf_indx, pts, r0s, s0s, t0s)
[docs]
def ConvertRSTtoLMNVec(geom_id, surf_indx, r_vec, s_vec, t_vec):
r"""
Convert vector of RST volumetric coordinates to LMN coordinates.
.. code-block:: python
# 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
"""
return _vsp.ConvertRSTtoLMNVec(geom_id, surf_indx, r_vec, s_vec, t_vec)
[docs]
def ConvertLMNtoRSTVec(geom_id, surf_indx, l_vec, m_vec, n_vec):
r"""
Convert vector of LMN volumetric coordinates to RST coordinates.
.. code-block:: python
# 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
"""
return _vsp.ConvertLMNtoRSTVec(geom_id, surf_indx, l_vec, m_vec, n_vec)
[docs]
def GetUWTess01(geom_id, surf_indx):
r"""
Get the surface coordinate point of each intersection of the tessellated wireframe for a particular surface
.. code-block:: python
# 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 )
:param [in]: geom_id string Parent Geom ID
:param [in]: surf_indx int Main surface index from the parent Geom
:param [out]: u_out_vec vector<double> Output vector of U (0 - 1) surface coordinates
:param [out]: w_out_vec vector<double> Output vector of W (0 - 1) surface coordinates
"""
return _vsp.GetUWTess01(geom_id, surf_indx)
[docs]
def ShowAllRulers():
r"""
Create a new Ruler and add it to the Measure Tool
.. code-block:: python
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 )
:param [in]: startgeomid string Start parent Geom ID
:param [in]: startsurfindx int Main surface index from the staring parent Geom
:param [in]: startu double Surface u (0 - 1) start coordinate
:param [in]: startw double Surface w (0 - 1) start coordinate
:param [in]: endgeomid string End parent Geom ID
:param [in]: endsurfindx int Main surface index on the end parent Geom
:param [in]: endu double Surface u (0 - 1) end coordinate
:param [in]: endw double Surface w (0 - 1) end coordinate
:param [in]: name string Ruler name
:rtype: void
:return: 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.
.. code-block:: python
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.
.. code-block:: python
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
"""
return _vsp.ShowAllRulers()
[docs]
def HideAllRulers():
r"""
Hide every Ruler in the Measure Tool.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddRuler( pid, 0, 0.2, 0.0, pid, 0, 0.8, 0.0, "R" )
HideAllRulers()
See also: ShowAllRulers
"""
return _vsp.HideAllRulers()
[docs]
def ShowAllProbes():
r"""
Show every Probe in the Measure Tool.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddProbe( pid, 0, 0.5, 0.5, "P" )
ShowAllProbes()
See also: HideAllProbes
"""
return _vsp.ShowAllProbes()
[docs]
def HideAllProbes():
r"""
Hide every Probe in the Measure Tool.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddProbe( pid, 0, 0.5, 0.5, "P" )
HideAllProbes()
See also: ShowAllProbes
"""
return _vsp.HideAllProbes()
[docs]
def ShowAllProtractors():
r"""
Show every Protractor in the Measure Tool.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddProtractor( pid, 0, 0.2, 0.0, pid, 0, 0.5, 0.0, pid, 0, 0.8, 0.0, "P" )
ShowAllProtractors()
See also: HideAllProtractors
"""
return _vsp.ShowAllProtractors()
[docs]
def HideAllProtractors():
r"""
Hide every Protractor in the Measure Tool.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddProtractor( pid, 0, 0.2, 0.0, pid, 0, 0.5, 0.0, pid, 0, 0.8, 0.0, "P" )
HideAllProtractors()
See also: ShowAllProtractors
"""
return _vsp.HideAllProtractors()
[docs]
def ShowAllRSTProbes():
r"""
Show every RST Probe in the Measure Tool.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddRSTProbe( pid, 0, 0.5, 0.5, 0.5, "P" )
ShowAllRSTProbes()
See also: HideAllRSTProbes
"""
return _vsp.ShowAllRSTProbes()
[docs]
def HideAllRSTProbes():
r"""
Hide every RST Probe in the Measure Tool.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
AddRSTProbe( pid, 0, 0.5, 0.5, 0.5, "P" )
HideAllRSTProbes()
See also: ShowAllRSTProbes
"""
return _vsp.HideAllRSTProbes()
[docs]
def AddProtractor(startgeomid, startsurfindx, startu, startw, midgeomid, midsurfindx, midu, midw, endgeomid, endsurfindx, endu, endw, name):
r"""
Add a protractor measuring the angle at a middle point between two others, each given as a
surface coordinate on a Geom.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
prid = AddProtractor( pid, 0, 0.2, 0.0, pid, 0, 0.5, 0.0, pid, 0, 0.8, 0.0, "TestProtractor" )
assert len( prid ) > 0, "AddProtractor returned no ID"
assert len( GetAllProtractors() ) == 1, "AddProtractor did not add the protractor"
See also: GetAllProtractors, DelProtractor
:param [in]: startgeomid string Geom ID the first leg starts on
:param [in]: startsurfindx int Surface index on that Geom
:param [in]: startu double U coordinate of the start, in [0, 1]
:param [in]: startw double W coordinate of the start, in [0, 1]
:param [in]: midgeomid string Geom ID the corner sits on
:param [in]: midsurfindx int Surface index on that Geom
:param [in]: midu double U coordinate of the corner, in [0, 1]
:param [in]: midw double W coordinate of the corner, in [0, 1]
:param [in]: endgeomid string Geom ID the second leg ends on
:param [in]: endsurfindx int Surface index on that Geom
:param [in]: endu double U coordinate of the end, in [0, 1]
:param [in]: endw double W coordinate of the end, in [0, 1]
:param [in]: name string Name for the protractor
:rtype: string
:return: string Protractor ID
"""
return _vsp.AddProtractor(startgeomid, startsurfindx, startu, startw, midgeomid, midsurfindx, midu, midw, endgeomid, endsurfindx, endu, endw, name)
[docs]
def GetAllProtractors():
r"""
Get an array of all Protractor IDs from the Measure Tool
.. code-block:: python
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
"""
return _vsp.GetAllProtractors()
[docs]
def DelProtractor(id):
r"""
Delete a particular Protractor from the Measure Tool
.. code-block:: python
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
"""
return _vsp.DelProtractor(id)
[docs]
def DeleteAllProtractors():
r"""
Delete all Protractors from the Measure Tool
.. code-block:: python
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
"""
return _vsp.DeleteAllProtractors()
[docs]
def AddRSTProbe(geomid, surfindx, r, s, t, name):
r"""
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.
.. code-block:: python
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
"""
return _vsp.AddRSTProbe(geomid, surfindx, r, s, t, name)
[docs]
def GetAllRSTProbes():
r"""
Get an array of all RST Probe IDs from the Measure Tool
.. code-block:: python
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
"""
return _vsp.GetAllRSTProbes()
[docs]
def DelRSTProbe(id):
r"""
Delete a particular RST Probe from the Measure Tool
.. code-block:: python
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
"""
return _vsp.DelRSTProbe(id)
[docs]
def DeleteAllRSTProbes():
r"""
Delete all RST Probes from the Measure Tool
.. code-block:: python
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
"""
return _vsp.DeleteAllRSTProbes()
[docs]
def AddRuler(startgeomid, startsurfindx, startu, startw, endgeomid, endsurfindx, endu, endw, name):
r"""
Add a ruler between two points on the model, each given as a surface coordinate on a Geom.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
rid = AddRuler( pid, 0, 0.2, 0.0, pid, 0, 0.8, 0.0, "TestRuler" )
assert len( rid ) > 0, "AddRuler returned no ID"
assert len( GetAllRulers() ) == 1, "AddRuler did not add the ruler"
See also: GetAllRulers, DelRuler
:param [in]: startgeomid string Geom ID the ruler starts on
:param [in]: startsurfindx int Surface index on the starting Geom
:param [in]: startu double U coordinate of the start, in [0, 1]
:param [in]: startw double W coordinate of the start, in [0, 1]
:param [in]: endgeomid string Geom ID the ruler ends on
:param [in]: endsurfindx int Surface index on the ending Geom
:param [in]: endu double U coordinate of the end, in [0, 1]
:param [in]: endw double W coordinate of the end, in [0, 1]
:param [in]: name string Name for the ruler
:rtype: string
:return: string Ruler ID
"""
return _vsp.AddRuler(startgeomid, startsurfindx, startu, startw, endgeomid, endsurfindx, endu, endw, name)
[docs]
def GetAllRulers():
r"""
Get an array of all Ruler IDs from the Measure Tool
.. code-block:: python
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] )
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<string> Vector of Ruler IDs
"""
return _vsp.GetAllRulers()
[docs]
def DelRuler(id):
r"""
Delete a particular Ruler from the Measure Tool
.. code-block:: python
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"
:param [in]: id string Ruler ID
"""
return _vsp.DelRuler(id)
[docs]
def DeleteAllRulers():
r"""
Delete all Rulers from the Measure Tool
.. code-block:: python
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"
"""
return _vsp.DeleteAllRulers()
[docs]
def AddProbe(geomid, surfindx, u, w, name):
r"""
Create a new Probe and add it to the Measure Tool
.. code-block:: python
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 )
:param [in]: geomid string Parent Geom ID
:param [in]: surfindx int Main surface index from the parent Geom
:param [in]: u double Surface u (0 - 1) coordinate
:param [in]: w double Surface w (0 - 1) coordinate
:param [in]: name string Probe name
:rtype: string
:return: string Probe ID
"""
return _vsp.AddProbe(geomid, surfindx, u, w, name)
[docs]
def GetAllProbes():
r"""
Get an array of all Probe IDs from the Measure Tool
.. code-block:: python
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] )
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<string> Array of Probe IDs
"""
return _vsp.GetAllProbes()
[docs]
def DelProbe(id):
r"""
Delete a specific Probe from the Measure Tool
.. code-block:: python
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"
:param [in]: id string Probe ID
"""
return _vsp.DelProbe(id)
[docs]
def DeleteAllProbes():
r"""
Delete all Probes from the Measure Tool
.. code-block:: python
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"
"""
return _vsp.DeleteAllProbes()
[docs]
def CopyAirfoil(geom_id, index):
r"""
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.
.. code-block:: python
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.
.. code-block:: python
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
"""
return _vsp.CopyAirfoil(geom_id, index)
[docs]
def PasteAirfoil(geom_id, index):
r"""
Paste the airfoil clipboard onto a wing section
.. code-block:: python
wid = AddGeom( "WING" )
Update()
CopyAirfoil( wid, 1 )
# A default wing has two sections, so there is nowhere past 1 to paste to.
PasteAirfoil( wid, 1 )
Update()
See also: CopyAirfoil, PasteXSec
:param [in]: geom_id string Wing Geom ID
:param [in]: index int Wing section index
"""
return _vsp.PasteAirfoil(geom_id, index)
[docs]
def ClearSkinning(geom_id, index=-1):
r"""
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.
.. code-block:: python
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
"""
return _vsp.ClearSkinning(geom_id, index)
[docs]
def ResetGeomScale(geom_id):
r"""
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.
.. code-block:: python
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"
:param [in]: geom_id string Geom ID
"""
return _vsp.ResetGeomScale(geom_id)
[docs]
def AcceptGeomScale(geom_id):
r"""
Turn a MeshGeom into a Point Cloud Geom made of its mesh nodes. This is the Mesh screen's
Convert to Point Cloud button.
.. code-block:: python
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.
.. code-block:: python
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
"""
return _vsp.AcceptGeomScale(geom_id)
[docs]
def GetPtCloudPnts(geom_id):
r"""
Get the points of a Point Cloud Geom
.. code-block:: python
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
"""
return _vsp.GetPtCloudPnts(geom_id)
[docs]
def CreatePtCloudGeom(geom_id):
r"""
Make a Point Cloud Geom out of the vertices of a MeshGeom. This is the Mesh screen's Convert to
Point Cloud button, and it is the usual way into a fit: take a planar slice of a model, which
leaves a MeshGeom, and turn that into points to match.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
mesh_id = ComputePlaneSlice( SET_ALL, 3, vec3d( 1.0, 0.0, 0.0 ), True )
cloud_id = CreatePtCloudGeom( mesh_id )
assert len( GetPtCloudPnts( cloud_id ) ) > 0, "CreatePtCloudGeom made no points"
See also: GetPtCloudPnts, CreatePtCloudGeomFromPts, ComputePlaneSlice
:param [in]: geom_id string MeshGeom ID to take the vertices of
:rtype: string
:return: string Geom ID of the new Point Cloud Geom
"""
return _vsp.CreatePtCloudGeom(geom_id)
[docs]
def CreateNGonMeshGeom(geom_id):
r"""
Turn a MeshGeom into an NGon Mesh Geom. This is the Mesh screen's Convert to NGon Mesh button.
.. code-block:: python
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
"""
return _vsp.CreateNGonMeshGeom(geom_id)
[docs]
def CreateConvexHull(geom_id):
r"""
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.
.. code-block:: python
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
"""
return _vsp.CreateConvexHull(geom_id)
[docs]
def ProjectPtCloudPts(geom_id, target_geom_id, surf_index, dir_index):
r"""
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.
.. code-block:: python
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)
"""
return _vsp.ProjectPtCloudPts(geom_id, target_geom_id, surf_index, dir_index)
[docs]
def ShowSet(set_index):
r"""
Show every Geom in a set, leaving the rest of the model as it is. This is the Geom browser's
Show Set button.
.. code-block:: python
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
"""
return _vsp.ShowSet(set_index)
[docs]
def NoShowSet(set_index):
r"""
Hide every Geom in a set, leaving the rest of the model as it is.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
SetSetFlag( pid, SET_FIRST_USER, True )
NoShowSet( SET_FIRST_USER )
See also: ShowSet, ShowOnlySet
:param [in]: set_index int Set index
"""
return _vsp.NoShowSet(set_index)
[docs]
def ShowOnlySet(set_index):
r"""
Show every Geom in a set and hide everything else. This is the Geom browser's Show Only Set
button.
.. code-block:: python
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
"""
return _vsp.ShowOnlySet(set_index)
[docs]
def AddParmLink(parm_a_id, parm_b_id):
r"""
Link one Parm to another, so changing the first drives the second.
.. code-block:: python
pid = AddGeom( "POD" )
Update()
len_parm = GetParm( pid, "Length", "Design" )
dia_parm = GetParm( pid, "FineRatio", "Design" )
link_id = AddParmLink( len_parm, dia_parm )
assert len( link_id ) > 0, "AddParmLink returned no ID"
assert GetNumParmLinks() == 1, "AddParmLink did not add the link"
See also: GetNumParmLinks, DeleteParmLink
:param [in]: parm_a_id string Parm ID that drives
:param [in]: parm_b_id string Parm ID that follows
:rtype: string
:return: string Parm link ID
"""
return _vsp.AddParmLink(parm_a_id, parm_b_id)
[docs]
def GetNumParmLinks():
r"""
Get the number of simple Parm Links in the model
.. code-block:: python
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
"""
return _vsp.GetNumParmLinks()
[docs]
def GetParmLinkID(index):
r"""
Get the ID of the Parm Link at the specified index
.. code-block:: python
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
"""
return _vsp.GetParmLinkID(index)
[docs]
def GetParmLinkAParm(link_id):
r"""
Get the driving Parm of a Parm Link
.. code-block:: python
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
"""
return _vsp.GetParmLinkAParm(link_id)
[docs]
def GetParmLinkBParm(link_id):
r"""
Get the driven Parm of a Parm Link
.. code-block:: python
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
"""
return _vsp.GetParmLinkBParm(link_id)
[docs]
def SetParmLinkAParm(link_id, parm_id):
r"""
Set the driving Parm of a Parm Link
.. code-block:: python
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
"""
return _vsp.SetParmLinkAParm(link_id, parm_id)
[docs]
def SetParmLinkBParm(link_id, parm_id):
r"""
Set the driven Parm of a Parm Link
.. code-block:: python
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
"""
return _vsp.SetParmLinkBParm(link_id, parm_id)
[docs]
def DelParmLink(link_id):
r"""
Delete a single Parm Link
.. code-block:: python
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
"""
return _vsp.DelParmLink(link_id)
[docs]
def DelAllParmLinks():
r"""
Delete every simple Parm Link in the model. Advanced Links are a separate list and are left alone.
.. code-block:: python
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
"""
return _vsp.DelAllParmLinks()
[docs]
def SortParmLinksByA():
r"""
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.
.. code-block:: python
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
"""
return _vsp.SortParmLinksByA()
[docs]
def SortParmLinksByB():
r"""
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.
.. code-block:: python
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
"""
return _vsp.SortParmLinksByB()
[docs]
def LinkAllComp(parm_a_id, parm_b_id):
r"""
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.
.. code-block:: python
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
"""
return _vsp.LinkAllComp(parm_a_id, parm_b_id)
[docs]
def LinkAllGroup(parm_a_id, parm_b_id):
r"""
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.
.. code-block:: python
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
"""
return _vsp.LinkAllGroup(parm_a_id, parm_b_id)
[docs]
def GetParmLinkOffsetFlag(link_id):
r"""
Get whether a Parm Link applies its offset
.. code-block:: python
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
"""
return _vsp.GetParmLinkOffsetFlag(link_id)
[docs]
def SetParmLinkOffsetFlag(link_id, flag):
r"""
Set whether a Parm Link applies its offset. The value itself is the link's
Offset Parm, reached with FindParm on the link ID.
.. code-block:: python
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
"""
return _vsp.SetParmLinkOffsetFlag(link_id, flag)
[docs]
def GetParmLinkScaleFlag(link_id):
r"""
Get whether a Parm Link applies its scale
.. code-block:: python
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
"""
return _vsp.GetParmLinkScaleFlag(link_id)
[docs]
def SetParmLinkScaleFlag(link_id, flag):
r"""
Set whether a Parm Link applies its scale. The value itself is the link's
Scale Parm, reached with FindParm on the link ID.
.. code-block:: python
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
"""
return _vsp.SetParmLinkScaleFlag(link_id, flag)
[docs]
def GetParmLinkLowerLimitFlag(link_id):
r"""
Get whether a Parm Link applies its lower limit
.. code-block:: python
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
"""
return _vsp.GetParmLinkLowerLimitFlag(link_id)
[docs]
def SetParmLinkLowerLimitFlag(link_id, flag):
r"""
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.
.. code-block:: python
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
"""
return _vsp.SetParmLinkLowerLimitFlag(link_id, flag)
[docs]
def GetParmLinkUpperLimitFlag(link_id):
r"""
Get whether a Parm Link applies its upper limit
.. code-block:: python
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
"""
return _vsp.GetParmLinkUpperLimitFlag(link_id)
[docs]
def SetParmLinkUpperLimitFlag(link_id, flag):
r"""
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.
.. code-block:: python
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
"""
return _vsp.SetParmLinkUpperLimitFlag(link_id, flag)
[docs]
def GetAdvLinkNames():
r"""
Get an array of all advanced link names
.. code-block:: python
#==== 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] )
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<string> Array of advanced link names
"""
return _vsp.GetAdvLinkNames()
[docs]
def GetLinkIndex(name):
r"""
Find the index of a specific advanced link.
.. code-block:: python
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"
:param [in]: name string Name for advanced link
:rtype: int
:return: int index for advanced link
"""
return _vsp.GetLinkIndex(name)
[docs]
def GetAdvLinkName(index):
r"""
Delete an advanced link specified by index
.. code-block:: python
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"
:param [in]: index int Index for advanced link
Get the name of an advanced link.
.. code-block:: python
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
"""
return _vsp.GetAdvLinkName(index)
[docs]
def SetAdvLinkName(index, name):
r"""
Set the name of an advanced link.
.. code-block:: python
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
"""
return _vsp.SetAdvLinkName(index, name)
[docs]
def DelAdvLink(index):
r"""
Delete one advanced link, by index.
.. code-block:: python
AddAdvLink( "TestLink" )
DelAdvLink( 0 )
assert len( GetAdvLinkNames() ) == 0, "DelAdvLink did not delete the link"
See also: AddAdvLink, GetAdvLinkNames
:param [in]: index int Index of the advanced link to delete
"""
return _vsp.DelAdvLink(index)
[docs]
def DelAllAdvLinks():
r"""
Delete all advanced links
.. code-block:: python
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"
"""
return _vsp.DelAllAdvLinks()
[docs]
def AddAdvLink(name):
r"""
Add an advanced link
.. code-block:: python
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"
:param [in]: name string Name for advanced link
"""
return _vsp.AddAdvLink(name)
[docs]
def AddAdvLinkOutput(index, parm_id, var_name):
r"""
Add an output variable to an advanced link
.. code-block:: python
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"
:param [in]: index int Advanced link index
:param [in]: parm_id string Parameter ID for advanced link output variable
:param [in]: var_name string Name for advanced link output variable
"""
return _vsp.AddAdvLinkOutput(index, parm_id, var_name)
[docs]
def DelAllAdvLinkOutputs(index):
r"""
Delete all output variables from an advanced link
.. code-block:: python
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
"""
return _vsp.DelAllAdvLinkOutputs(index)
[docs]
def DelAdvLinkOutput(index, var_name):
r"""
Delete an output variable from an advanced link
.. code-block:: python
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"
:param [in]: index int Advanced link index
:param [in]: var_name string Name for advanced link output variable to delete
"""
return _vsp.DelAdvLinkOutput(index, var_name)
[docs]
def GetAdvLinkOutputNames(index):
r"""
Get the Parm IDs of all the outputs to a specified advanced link index
.. code-block:: python
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] )
:param [in]: index int Advanced link index
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<string> Array of advanced link output names
"""
return _vsp.GetAdvLinkOutputNames(index)
[docs]
def GetAdvLinkOutputParms(index):
r"""
Get the Parm IDs of all the outputs to a specified advanced link index
.. code-block:: python
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] )
:param [in]: index int Advanced link index
:rtype: std::vector< std::string,std::allocator< std::string > >
:return: vector<string> Array of advanced link output Parm IDs
"""
return _vsp.GetAdvLinkOutputParms(index)
[docs]
def ValidateAdvLinkParms(index):
r"""
Validate the input and output parameters for an advanced link
.. code-block:: python
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." )
:param [in]: index int Index for advanced link
:rtype: boolean
:return: bool Flag indicating whether parms are valid
"""
return _vsp.ValidateAdvLinkParms(index)
[docs]
def SetAdvLinkCode(index, code):
r"""
Get the code from an advanced link
.. code-block:: python
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"
:param [in]: index int Index for advanced link
:param [in]: code string Code for advanced link
"""
return _vsp.SetAdvLinkCode(index, code)
[docs]
def GetAdvLinkCode(index):
r"""
Get the code from an advanced link
.. code-block:: python
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 )
:param [in]: index int Index for advanced link
:rtype: string
:return: string String containing advanced link code
"""
return _vsp.GetAdvLinkCode(index)
[docs]
def SearchReplaceAdvLinkCode(index, _from, to):
r"""
Search and replace strings in the advanced link code
.. code-block:: python
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"
:param [in]: index int Index for advanced link
:param [in]: from string Search token
:param [in]: to string Replace token
"""
return _vsp.SearchReplaceAdvLinkCode(index, _from, to)
[docs]
def BuildAdvLinkScript(index):
r"""
Build (ready for execution and perform syntax check) an advanced link.
.. code-block:: python
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." )
:param [in]: index int Index for advanced link
:rtype: boolean
:return: bool Flag indicating whether advanced link build was successful
"""
return _vsp.BuildAdvLinkScript(index)
[docs]
def WriteAdvLinkCodeFile(index, file_name):
r"""
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.
.. code-block:: python
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
"""
return _vsp.WriteAdvLinkCodeFile(index, file_name)
[docs]
def ReorderAdvLinkOutput(index, var_name, reorder_type):
r"""
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.
.. code-block:: python
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)
"""
return _vsp.ReorderAdvLinkOutput(index, var_name, reorder_type)
[docs]
def ReadAdvLinkCodeFile(index, file_name):
r"""
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.
.. code-block:: python
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
"""
return _vsp.ReadAdvLinkCodeFile(index, file_name)
[docs]
def SortAdvLinkOutputsVar(index):
r"""
Sort the output variables of an advanced link into alphabetical order by variable name.
.. code-block:: python
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
"""
return _vsp.SortAdvLinkOutputsVar(index)
[docs]
def SortAdvLinkOutputsCGP(index):
r"""
Sort the output variables of an advanced link by the Parm they drive, ordering on container
name, then group name, then Parm name.
.. code-block:: python
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
"""
return _vsp.SortAdvLinkOutputsCGP(index)
def AddVec3D(INOUT, x, y, z):
r"""AddVec3D(Vec3dVec INOUT, double x, double y, double z)"""
return _vsp.AddVec3D(INOUT, x, y, z)
[docs]
class vec3d(object):
r"""
vec3d is typically used to describe coordinate points and vectors in 3D space.
All 3 elements in the vector are of type double.
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
v = property(_vsp.vec3d_v_get, _vsp.vec3d_v_set, doc=r"""v : a(3).double""")
def __init__(self, *args):
r"""
__init__(vec3d self) -> vec3d
__init__(vec3d self, vec3d a) -> vec3d
__init__(vec3d self, double xx, double yy, double zz) -> vec3d
__init__(vec3d self, threed_point_type const & a) -> vec3d
__init__(vec3d self, double const [3] a) -> vec3d
__init__(vec3d self, float const [3] a) -> vec3d
__init__(vec3d self, DoubleVector a) -> vec3d
"""
_vsp.vec3d_swiginit(self, _vsp.new_vec3d(*args))
[docs]
def as_vec2d_xy(self):
r"""as_vec2d_xy(vec3d self) -> vec2d"""
return _vsp.vec3d_as_vec2d_xy(self)
[docs]
def set_xyz(self, xx, yy, zz):
r"""
Set all three elements of the vec3d vector
.. code-block:: python
#==== Test Vec3d ====
a = vec3d() # Default Constructor
a.set_xyz( 2.0, 4.0, 6.0 )
:param [in]: xx New X value
:param [in]: yy New Y value
:param [in]: zz New Z value
:rtype: :py:class:`vec3d`
:return: Updated vec3d
"""
return _vsp.vec3d_set_xyz(self, xx, yy, zz)
[docs]
def set_vec(self, a):
r"""
Set all three coordinates from a vector of three doubles.
.. code-block:: python
a = vec3d()
a.set_vec( [ 1.0, 2.0, 3.0 ] )
assert abs( a.x() - 1.0 ) < 1e-12, "set_vec did not set x"
assert abs( a.z() - 3.0 ) < 1e-12, "set_vec did not set z"
See also: set_xyz
:param [in]: a vector<double> Three coordinates, X, Y and Z
:rtype: :py:class:`vec3d`
:return: vec3d Updated vec3d
"""
return _vsp.vec3d_set_vec(self, a)
[docs]
def set_arr(self, *args):
r"""
set_arr(vec3d self, double const [] a) -> vec3d
set_arr(vec3d self, float const [] a) -> vec3d
"""
return _vsp.vec3d_set_arr(self, *args)
[docs]
def set_x(self, xx):
r"""
Set the X coordinate (index 0) of the vec3d
.. code-block:: python
#==== Test Vec3d ====
a = vec3d() # Default Constructor
a.set_x( 2.0 )
:param [in]: xx New X value
:rtype: :py:class:`vec3d`
:return: Updated vec3d
"""
return _vsp.vec3d_set_x(self, xx)
[docs]
def set_y(self, yy):
r"""
Set the Y coordinate (index 1) of the vec3d
.. code-block:: python
#==== Test Vec3d ====
a = vec3d() # Default Constructor
a.set_y( 4.0 )
:param [in]: yy New Y value
:rtype: :py:class:`vec3d`
:return: Updated vec3d
"""
return _vsp.vec3d_set_y(self, yy)
[docs]
def set_z(self, zz):
r"""
Set the z coordinate (index 2) of the vec3d
.. code-block:: python
#==== Test Vec3d ====
a = vec3d() # Default Constructor
a.set_z( 6.0 )
:param [in]: zz in double new z value
:rtype: :py:class:`vec3d`
:return: vec3d result
"""
return _vsp.vec3d_set_z(self, zz)
[docs]
def set_refx(self, a):
r"""
Set this vec3d to another reflected about the YZ plane, negating X.
.. code-block:: python
a = vec3d( 1.0, 2.0, 3.0 )
b = vec3d()
b.set_refx( a )
assert abs( b.x() + 1.0 ) < 1e-12, "set_refx did not negate x"
assert abs( b.y() - 2.0 ) < 1e-12, "set_refx disturbed y"
See also: set_refy, set_refz, reflect_yz
:param [in]: a vec3d Point to reflect
:rtype: :py:class:`vec3d`
:return: vec3d Updated vec3d
"""
return _vsp.vec3d_set_refx(self, a)
[docs]
def set_refy(self, a):
r"""
Set this vec3d to another reflected about the XZ plane, negating Y.
.. code-block:: python
a = vec3d( 1.0, 2.0, 3.0 )
b = vec3d()
b.set_refy( a )
assert abs( b.y() + 2.0 ) < 1e-12, "set_refy did not negate y"
assert abs( b.x() - 1.0 ) < 1e-12, "set_refy disturbed x"
See also: set_refx, set_refz, reflect_xz
:param [in]: a vec3d Point to reflect
:rtype: :py:class:`vec3d`
:return: vec3d Updated vec3d
"""
return _vsp.vec3d_set_refy(self, a)
[docs]
def set_refz(self, a):
r"""
Set this vec3d to another reflected about the XY plane, negating Z.
.. code-block:: python
a = vec3d( 1.0, 2.0, 3.0 )
b = vec3d()
b.set_refz( a )
assert abs( b.z() + 3.0 ) < 1e-12, "set_refz did not negate z"
assert abs( b.x() - 1.0 ) < 1e-12, "set_refz disturbed x"
See also: set_refx, set_refy, reflect_xy
:param [in]: a vec3d Point to reflect
:rtype: :py:class:`vec3d`
:return: vec3d Updated vec3d
"""
return _vsp.vec3d_set_refz(self, a)
[docs]
def get_pnt(self, *args):
r"""
get_pnt(vec3d self, double [3] pnt)
get_pnt(vec3d self, float [3] pnt)
get_pnt(vec3d self, threed_point_type & pnt)
"""
return _vsp.vec3d_get_pnt(self, *args)
[docs]
def x(self):
r"""
Get the X coordinate (index 0) of the vec3d
.. code-block:: python
a = vec3d() # Default Constructor
a.set_xyz( 2.0, 4.0, 6.0 )
assert abs( a.x() - 2.0 ) < 1e-12, "x did not return the coordinate"
assert abs( a[0] - 2.0 ) < 1e-12, "indexing disagrees with x()"
:rtype: float
:return: X value
"""
return _vsp.vec3d_x(self)
[docs]
def y(self):
r"""
Get the Y coordinate (index 1) of the vec3d
.. code-block:: python
a = vec3d() # Default Constructor
a.set_xyz( 2.0, 4.0, 6.0 )
assert abs( a.y() - 4.0 ) < 1e-12, "y did not return the coordinate"
assert abs( a[1] - 4.0 ) < 1e-12, "indexing disagrees with y()"
:rtype: float
:return: Y value
"""
return _vsp.vec3d_y(self)
[docs]
def z(self):
r"""
Get the Z coordinate (index 2) of the vec3d
.. code-block:: python
a = vec3d() # Default Constructor
a.set_xyz( 2.0, 4.0, 6.0 )
assert abs( a.z() - 6.0 ) < 1e-12, "z did not return the coordinate"
assert abs( a[2] - 6.0 ) < 1e-12, "indexing disagrees with z()"
:rtype: float
:return: Z value
"""
return _vsp.vec3d_z(self)
[docs]
def data(self):
r"""data(vec3d self) -> double *"""
return _vsp.vec3d_data(self)
[docs]
def FlipNormal(self):
r"""FlipNormal(vec3d self)"""
return _vsp.vec3d_FlipNormal(self)
[docs]
def rotate_x(self, theta):
r"""
Rotate the vec3d about the X axis.
.. code-block:: python
import math
#==== Test Vec3d ====
a = vec3d() # Default Constructor
PI = 3.14
a.set_xyz( 1.0, 0.0, 0.0 )
a.rotate_x( 0.5 * PI )
:param [in]: theta double Rotation angle in radians
"""
return _vsp.vec3d_rotate_x(self, theta)
[docs]
def rotate_y(self, theta):
r"""
Rotate the vec3d about the Y axis.
.. code-block:: python
import math
#==== Test Vec3d ====
a = vec3d() # Default Constructor
PI = 3.14
a.set_xyz( 1.0, 0.0, 0.0 )
a.rotate_y( 0.5 * PI )
:param [in]: theta double Rotation angle in radians
"""
return _vsp.vec3d_rotate_y(self, theta)
[docs]
def rotate_z(self, theta):
r"""
Rotate the vec3d about the Z axis.
.. code-block:: python
import math
#==== Test Vec3d ====
a = vec3d() # Default Constructor
PI = 3.14
a.set_xyz( 1.0, 0.0, 0.0 )
a.rotate_z( 0.5 * PI )
:param [in]: theta double Rotation angle in radians
"""
return _vsp.vec3d_rotate_z(self, theta)
[docs]
def scale_x(self, scale):
r"""
Scale the X coordinate of the vec3d
.. code-block:: python
#==== Test Vec3d ====
a = vec3d() # Default Constructor
#===== Test Scale ====
a.set_xyz( 2.0, 2.0, 2.0 )
a.scale_x( 2.0 )
:param [in]: scale Scaling factor for the X value
"""
return _vsp.vec3d_scale_x(self, scale)
[docs]
def scale_y(self, scale):
r"""
Scale the Y coordinate of the vec3d
.. code-block:: python
#==== Test Vec3d ====
a = vec3d() # Default Constructor
#===== Test Scale ====
a.set_xyz( 2.0, 2.0, 2.0 )
a.scale_y( 2.0 )
:param [in]: scale Scaling factor for the Y value
"""
return _vsp.vec3d_scale_y(self, scale)
[docs]
def scale_z(self, scale):
r"""
Scale the Z coordinate of the vec3d
.. code-block:: python
#==== Test Vec3d ====
a = vec3d() # Default Constructor
#===== Test Scale ====
a.set_xyz( 2.0, 2.0, 2.0 )
a.scale_z( 2.0 )
:param [in]: scale Scaling factor for the Z value
"""
return _vsp.vec3d_scale_z(self, scale)
[docs]
def offset_x(self, offset):
r"""
Offset the X coordinate of the vec3d
.. code-block:: python
#==== Test Vec3d ====
a = vec3d() # Default Constructor
#===== Test Offset ====
a.set_xyz( 2.0, 2.0, 2.0 )
a.offset_x( 10.0 )
:param [in]: offset Offset for the X value
"""
return _vsp.vec3d_offset_x(self, offset)
[docs]
def offset_y(self, offset):
r"""
Offset the Y coordinate of the vec3d
.. code-block:: python
#==== Test Vec3d ====
a = vec3d() # Default Constructor
#===== Test Offset ====
a.set_xyz( 2.0, 2.0, 2.0 )
a.offset_y( 10.0 )
:param [in]: offset Offset for the Y value
"""
return _vsp.vec3d_offset_y(self, offset)
[docs]
def offset_z(self, offset):
r"""
Offset the Z coordinate of the vec3d
.. code-block:: python
#==== Test Vec3d ====
a = vec3d() # Default Constructor
#===== Test Offset ====
a.set_xyz( 2.0, 2.0, 2.0 )
a.offset_z( 10.0 )
:param [in]: offset Offset for the Z value
"""
return _vsp.vec3d_offset_z(self, offset)
[docs]
def offset_i(self, offset, idir):
r"""
Offset one coordinate, chosen by index: 0 for X, 1 for Y, 2 for Z. The indexed counterpart of
offset_x, offset_y and offset_z.
.. code-block:: python
a = vec3d( 1.0, 2.0, 3.0 )
a.offset_i( 0.5, 1 )
assert abs( a.y() - 2.5 ) < 1e-12, "offset_i did not offset the Y coordinate"
assert abs( a.x() - 1.0 ) < 1e-12, "offset_i disturbed a coordinate it should not have"
See also: offset_x, offset_y, offset_z
:param [in]: offset double Amount to offset by
:param [in]: idir int Coordinate index, 0 for X, 1 for Y, 2 for Z
"""
return _vsp.vec3d_offset_i(self, offset, idir)
[docs]
def reflect_xy(self):
r"""
Reflect the vec3d across the XY plane
.. code-block:: python
#==== Test Vec3d ====
a = vec3d() # Default Constructor
b = vec3d()
#===== Test Reflect ====
a.set_xyz( 1.0, 2.0, 3.0 )
b = a.reflect_xy()
:rtype: :py:class:`vec3d`
:return: Reflected vec3d
"""
return _vsp.vec3d_reflect_xy(self)
[docs]
def reflect_xz(self):
r"""
Reflect the vec3d across the XZ plane
.. code-block:: python
#==== Test Vec3d ====
a = vec3d() # Default Constructor
b = vec3d()
#===== Test Reflect ====
a.set_xyz( 1.0, 2.0, 3.0 )
b = a.reflect_xz()
:rtype: :py:class:`vec3d`
:return: Reflected vec3d
"""
return _vsp.vec3d_reflect_xz(self)
[docs]
def reflect_yz(self):
r"""
Reflect the vec3d across the YZ plane
.. code-block:: python
#==== Test Vec3d ====
a = vec3d() # Default Constructor
b = vec3d()
#===== Test Reflect ====
a.set_xyz( 1.0, 2.0, 3.0 )
b = a.reflect_yz()
:rtype: :py:class:`vec3d`
:return: Reflected vec3d
"""
return _vsp.vec3d_reflect_yz(self)
[docs]
def swap_xy(self):
r"""swap_xy(vec3d self) -> vec3d"""
return _vsp.vec3d_swap_xy(self)
[docs]
def swap_xz(self):
r"""swap_xz(vec3d self) -> vec3d"""
return _vsp.vec3d_swap_xz(self)
[docs]
def swap_yz(self):
r"""swap_yz(vec3d self) -> vec3d"""
return _vsp.vec3d_swap_yz(self)
def __imul__(self, b):
r"""__imul__(vec3d self, double b) -> vec3d"""
return _vsp.vec3d___imul__(self, b)
def __iadd__(self, *args):
r"""
__iadd__(vec3d self, vec3d b) -> vec3d
__iadd__(vec3d self, double [] b) -> vec3d
__iadd__(vec3d self, float [] b) -> vec3d
"""
return _vsp.vec3d___iadd__(self, *args)
def __isub__(self, *args):
r"""
__isub__(vec3d self, vec3d b) -> vec3d
__isub__(vec3d self, double [] b) -> vec3d
__isub__(vec3d self, float [] b) -> vec3d
"""
return _vsp.vec3d___isub__(self, *args)
[docs]
def mag(self):
r"""
Get the magnitude of a vec3d
.. code-block:: python
import math
#==== Test Vec3d ====
a = vec3d() # Default Constructor
#==== Test Mag ====
a.set_xyz( 1.0, 2.0, 3.0 )
assert not ( abs( a.mag() - math.sqrt( 14 ) ) > 1e-6 ), "Vec3d Mag"
:rtype: float
:return: Magnitude
"""
return _vsp.vec3d_mag(self)
[docs]
def magsq(self):
r"""
Get the square of the magnitude. Cheaper than mag, which has to take a square root, and enough on its own when magnitudes are only being compared.
.. code-block:: python
a = vec3d( 1.0, 2.0, 3.0 )
assert abs( a.magsq() - 14.0 ) < 1e-12, "magsq did not return the squared magnitude"
See also: mag
:rtype: float
:return: double Squared magnitude
"""
return _vsp.vec3d_magsq(self)
[docs]
def normalize(self):
r"""
Normalize the vec3d
.. code-block:: python
#==== Test Vec3d ====
a = vec3d() # Default Constructor
b = vec3d()
c = vec3d()
#==== 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()
"""
return _vsp.vec3d_normalize(self)
[docs]
def major_comp(self):
r"""
Get the index of the largest coordinate: 0 for X, 1 for Y, 2 for Z.
.. code-block:: python
a = vec3d( 1.0, 5.0, 3.0 )
assert a.major_comp() == 1, "major_comp did not find the largest coordinate"
See also: minor_comp
:rtype: int
:return: int Index of the largest coordinate
"""
return _vsp.vec3d_major_comp(self)
[docs]
def minor_comp(self):
r"""
Get the index of the smallest coordinate: 0 for X, 1 for Y, 2 for Z.
.. code-block:: python
a = vec3d( 1.0, 5.0, 3.0 )
assert a.minor_comp() == 0, "minor_comp did not find the smallest coordinate"
See also: major_comp
:rtype: int
:return: int Index of the smallest coordinate
"""
return _vsp.vec3d_minor_comp(self)
[docs]
def isnan(self):
r"""
Test whether any coordinate is NaN.
.. code-block:: python
a = vec3d( 1.0, 2.0, 3.0 )
assert not a.isnan(), "isnan reported a NaN in an ordinary point"
See also: isinf, isfinite
:rtype: boolean
:return: bool True if any coordinate is NaN
"""
return _vsp.vec3d_isnan(self)
[docs]
def isinf(self):
r"""
Test whether any coordinate is infinite.
.. code-block:: python
a = vec3d( 1.0, 2.0, 3.0 )
assert not a.isinf(), "isinf reported an infinity in an ordinary point"
See also: isnan, isfinite
:rtype: boolean
:return: bool True if any coordinate is infinite
"""
return _vsp.vec3d_isinf(self)
[docs]
def isfinite(self):
r"""
Test whether every coordinate is finite -- neither infinite nor NaN.
.. code-block:: python
a = vec3d( 1.0, 2.0, 3.0 )
assert a.isfinite(), "isfinite rejected an ordinary point"
See also: isnan, isinf
:rtype: boolean
:return: bool True if all three coordinates are finite
"""
return _vsp.vec3d_isfinite(self)
def _print(self, *args):
r"""
Print the vec3d to stdout, for debugging. Writes to the console rather than returning anything, so there is nothing for an example to check.
.. code-block:: python
a = vec3d( 1.0, 2.0, 3.0 )
a.print( "a" )
assert abs( a.x() - 1.0 ) < 1e-12, "print changed the point"
:param [in]: label string Label to print in front of the coordinates
"""
return _vsp.vec3d__print(self, *args)
[docs]
def as_numpy(self):
return _vsp.vec3d_as_numpy(self)
[docs]
def __add__(self, b):
r"""__add__(vec3d self, vec3d b) -> vec3d"""
return _vsp.vec3d___add__(self, b)
[docs]
def __sub__(self, b):
r"""__sub__(vec3d self, vec3d b) -> vec3d"""
return _vsp.vec3d___sub__(self, b)
[docs]
def __mul__(self, *args):
r"""
__mul__(vec3d self, double b) -> vec3d
__mul__(vec3d self, vec3d b) -> vec3d
"""
return _vsp.vec3d___mul__(self, *args)
[docs]
def __rmul__(self, b):
r"""__rmul__(vec3d self, double b) -> vec3d"""
return _vsp.vec3d___rmul__(self, b)
[docs]
def __truediv__(self, b):
r"""__truediv__(vec3d self, double b) -> vec3d"""
return _vsp.vec3d___truediv__(self, b)
[docs]
def __neg__(self):
r"""__neg__(vec3d self) -> vec3d"""
return _vsp.vec3d___neg__(self)
def __eq__(self, b):
r"""__eq__(vec3d self, vec3d b) -> bool"""
return _vsp.vec3d___eq__(self, b)
def __ne__(self, b):
r"""__ne__(vec3d self, vec3d b) -> bool"""
return _vsp.vec3d___ne__(self, b)
def _getitem(self, i):
r"""_getitem(vec3d self, int i) -> double"""
return _vsp.vec3d__getitem(self, i)
def _setitem(self, i, val):
r"""_setitem(vec3d self, int i, double val)"""
return _vsp.vec3d__setitem(self, i, val)
[docs]
def __len__(self):
r"""__len__(vec3d self) -> int"""
return _vsp.vec3d___len__(self)
[docs]
def __getitem__( self, i ):
if i < 0:
i += 3
if i < 0 or i > 2:
raise IndexError( "vec3d index out of range" )
return self._getitem( i )
[docs]
def __setitem__( self, i, val ):
if i < 0:
i += 3
if i < 0 or i > 2:
raise IndexError( "vec3d index out of range" )
self._setitem( i, val )
[docs]
def __repr__(self):
r"""__repr__(vec3d self) -> std::string"""
return _vsp.vec3d___repr__(self)
__hash__ = object.__hash__
__swig_destroy__ = _vsp.delete_vec3d
# Register vec3d in _vsp:
_vsp.vec3d_swigregister(vec3d)
cvar = _vsp.cvar
cstdout = cvar.cstdout
[docs]
def signed_angle(a, b, ref):
r"""signed_angle(vec3d a, vec3d b, vec3d ref) -> double"""
return _vsp.signed_angle(a, b, ref)
def radius_of_circle(p1, p2, p3):
r"""radius_of_circle(vec3d p1, vec3d p2, vec3d p3) -> double"""
return _vsp.radius_of_circle(p1, p2, p3)
def center_of_circle(p1, p2, p3, center):
r"""center_of_circle(vec3d p1, vec3d p2, vec3d p3, vec3d center)"""
return _vsp.center_of_circle(p1, p2, p3, center)
def triangle_plane_intersect_test(org, norm, p1, p2, p3):
r"""triangle_plane_intersect_test(vec3d org, vec3d norm, vec3d p1, vec3d p2, vec3d p3) -> bool"""
return _vsp.triangle_plane_intersect_test(org, norm, p1, p2, p3)
def triangle_plane_minimum_dist(org, norm, p1, p2, p3, pa, pb):
r"""triangle_plane_minimum_dist(vec3d org, vec3d norm, vec3d p1, vec3d p2, vec3d p3, vec3d pa, vec3d pb) -> double"""
return _vsp.triangle_plane_minimum_dist(org, norm, p1, p2, p3, pa, pb)
def triangle_plane_maximum_dist(org, norm, p1, p2, p3, pa, pb):
r"""triangle_plane_maximum_dist(vec3d org, vec3d norm, vec3d p1, vec3d p2, vec3d p3, vec3d pa, vec3d pb) -> double"""
return _vsp.triangle_plane_maximum_dist(org, norm, p1, p2, p3, pa, pb)
def plane_plane_intersection(p0, n0, p1, n1, p, v):
r"""plane_plane_intersection(vec3d p0, vec3d n0, vec3d p1, vec3d n1, vec3d p, vec3d v) -> bool"""
return _vsp.plane_plane_intersection(p0, n0, p1, n1, p, v)
def angle_pnt_2_plane(*args):
r"""
angle_pnt_2_plane(vec3d ptplane, vec3d norm, vec3d ptaxis, vec3d axis, vec3d pt, int ccw, vec3d prot) -> double
angle_pnt_2_plane(vec3d ptplane, vec3d norm, vec3d ptaxis, vec3d axis, vec3d pt, int ccw, vec3d prot1, vec3d prot2, double & theta1, double & theta2)
"""
return _vsp.angle_pnt_2_plane(*args)
def signed_dist_pnt_2_plane(org, norm, pnt):
r"""signed_dist_pnt_2_plane(vec3d org, vec3d norm, vec3d pnt) -> double"""
return _vsp.signed_dist_pnt_2_plane(org, norm, pnt)
def dist_pnt_2_plane(org, norm, pnt):
r"""dist_pnt_2_plane(vec3d org, vec3d norm, vec3d pnt) -> double"""
return _vsp.dist_pnt_2_plane(org, norm, pnt)
def dist_pnt_2_line(line_pt1, line_pt2, pnt):
r"""dist_pnt_2_line(vec3d line_pt1, vec3d line_pt2, vec3d pnt) -> double"""
return _vsp.dist_pnt_2_line(line_pt1, line_pt2, pnt)
def dist_pnt_2_ray(line_pt1, dir_unit_vec, pnt):
r"""dist_pnt_2_ray(vec3d line_pt1, vec3d dir_unit_vec, vec3d pnt) -> double"""
return _vsp.dist_pnt_2_ray(line_pt1, dir_unit_vec, pnt)
def proj_u_on_v(u, v):
r"""proj_u_on_v(vec3d u, vec3d v) -> vec3d"""
return _vsp.proj_u_on_v(u, v)
def proj_pnt_on_ray(*args):
r"""
proj_pnt_on_ray(vec3d line_pt1, vec3d line_dir, vec3d pnt) -> vec3d
proj_pnt_on_ray(vec3d line_pt1, vec3d line_dir, vec3d pnt, double & t) -> vec3d
"""
return _vsp.proj_pnt_on_ray(*args)
def proj_pnt_on_line(line_pt1, line_pt2, pnt):
r"""proj_pnt_on_line(vec3d line_pt1, vec3d line_pt2, vec3d pnt) -> vec3d"""
return _vsp.proj_pnt_on_line(line_pt1, line_pt2, pnt)
def proj_pnt_to_plane(org, plane_ln1, plane_ln2, pnt):
r"""proj_pnt_to_plane(vec3d org, vec3d plane_ln1, vec3d plane_ln2, vec3d pnt) -> vec3d"""
return _vsp.proj_pnt_to_plane(org, plane_ln1, plane_ln2, pnt)
def proj_vec_to_plane(vec, norm):
r"""proj_vec_to_plane(vec3d vec, vec3d norm) -> vec3d"""
return _vsp.proj_vec_to_plane(vec, norm)
def tri_seg_intersect(A, B, C, D, E, u, w, t):
r"""tri_seg_intersect(vec3d A, vec3d B, vec3d C, vec3d D, vec3d E, double & u, double & w, double & t) -> int"""
return _vsp.tri_seg_intersect(A, B, C, D, E, u, w, t)
def tri_ray_intersect(A, B, C, D, E, u, w, t):
r"""tri_ray_intersect(vec3d A, vec3d B, vec3d C, vec3d D, vec3d E, double & u, double & w, double & t) -> int"""
return _vsp.tri_ray_intersect(A, B, C, D, E, u, w, t)
def plane_ray_intersect(*args):
r"""
plane_ray_intersect(vec3d A, vec3d B, vec3d C, vec3d D, vec3d E, double & t) -> int
plane_ray_intersect(vec3d orig, vec3d norm, vec3d D, vec3d E, double & t) -> int
"""
return _vsp.plane_ray_intersect(*args)
def ray_ray_intersect(A, B, C, D, int_pnt1, int_pnt2):
r"""ray_ray_intersect(vec3d A, vec3d B, vec3d C, vec3d D, vec3d int_pnt1, vec3d int_pnt2) -> int"""
return _vsp.ray_ray_intersect(A, B, C, D, int_pnt1, int_pnt2)
def tetra_volume(A, B, C):
r"""tetra_volume(vec3d A, vec3d B, vec3d C) -> double"""
return _vsp.tetra_volume(A, B, C)
def area(A, B, C):
r"""area(vec3d A, vec3d B, vec3d C) -> double"""
return _vsp.area(A, B, C)
def dist3D_Segment_to_Segment(*args):
r"""
dist3D_Segment_to_Segment(vec3d S1P0, vec3d S1P1, vec3d S2P0, vec3d S2P1) -> double
dist3D_Segment_to_Segment(vec3d S1P0, vec3d S1P1, vec3d S2P0, vec3d S2P1, double * Lt, vec3d Ln, double * St, vec3d Sn) -> double
"""
return _vsp.dist3D_Segment_to_Segment(*args)
def nearSegSeg(L0, L1, S0, S1, Lt, Ln, St, Sn):
r"""nearSegSeg(vec3d L0, vec3d L1, vec3d S0, vec3d S1, double * Lt, vec3d Ln, double * St, vec3d Sn) -> double"""
return _vsp.nearSegSeg(L0, L1, S0, S1, Lt, Ln, St, Sn)
def pointLineDistSquared(p, lp0, lp1, t, pon):
r"""pointLineDistSquared(vec3d p, vec3d lp0, vec3d lp1, double & t, vec3d pon) -> double"""
return _vsp.pointLineDistSquared(p, lp0, lp1, t, pon)
def pointSegDistSquared(p, sp0, sp1, t, pon):
r"""pointSegDistSquared(vec3d p, vec3d sp0, vec3d sp1, double & t, vec3d pon) -> double"""
return _vsp.pointSegDistSquared(p, sp0, sp1, t, pon)
def point_on_line(lp0, lp1, t):
r"""point_on_line(vec3d lp0, vec3d lp1, double const & t) -> vec3d"""
return _vsp.point_on_line(lp0, lp1, t)
def MapToPlane(p, planeOrig, planeVec1, planeVec2):
r"""MapToPlane(vec3d p, vec3d planeOrig, vec3d planeVec1, vec3d planeVec2) -> vec2d"""
return _vsp.MapToPlane(p, planeOrig, planeVec1, planeVec2)
def MapFromPlane(uw, planeOrig, planeVec1, planeVec2):
r"""MapFromPlane(vec2d uw, vec3d planeOrig, vec3d planeVec1, vec3d planeVec2) -> vec3d"""
return _vsp.MapFromPlane(uw, planeOrig, planeVec1, planeVec2)
def plane_half_space(planeOrig, planeNorm, pnt):
r"""plane_half_space(vec3d planeOrig, vec3d planeNorm, vec3d pnt) -> int"""
return _vsp.plane_half_space(planeOrig, planeNorm, pnt)
def line_line_intersect(p1, p2, p3, p4, s, t):
r"""line_line_intersect(vec3d p1, vec3d p2, vec3d p3, vec3d p4, double * s, double * t) -> bool"""
return _vsp.line_line_intersect(p1, p2, p3, p4, s, t)
[docs]
def RotateArbAxis(p, theta, r):
r"""RotateArbAxis(vec3d p, double theta, vec3d r) -> vec3d"""
return _vsp.RotateArbAxis(p, theta, r)
def PtInTri(v0, v1, v2, p):
r"""PtInTri(vec3d v0, vec3d v1, vec3d v2, vec3d p) -> bool"""
return _vsp.PtInTri(v0, v1, v2, p)
def BarycentricWeights(v0, v1, v2, p):
r"""BarycentricWeights(vec3d v0, vec3d v1, vec3d v2, vec3d p) -> vec3d"""
return _vsp.BarycentricWeights(v0, v1, v2, p)
def BilinearWeights(p0, p1, p, weights):
r"""BilinearWeights(vec3d p0, vec3d p1, vec3d p, DoubleVector weights)"""
return _vsp.BilinearWeights(p0, p1, p, weights)
def tri_tri_min_dist(v0, v1, v2, v3, v4, v5, p1, p2):
r"""tri_tri_min_dist(vec3d v0, vec3d v1, vec3d v2, vec3d v3, vec3d v4, vec3d v5, vec3d p1, vec3d p2) -> double"""
return _vsp.tri_tri_min_dist(v0, v1, v2, v3, v4, v5, p1, p2)
def pnt_tri_min_dist(v0, v1, v2, pnt, pnearest):
r"""pnt_tri_min_dist(vec3d v0, vec3d v1, vec3d v2, vec3d pnt, vec3d pnearest) -> double"""
return _vsp.pnt_tri_min_dist(v0, v1, v2, pnt, pnearest)
def slerp(a, b, t):
r"""slerp(vec3d a, vec3d b, double const & t) -> vec3d"""
return _vsp.slerp(a, b, t)
def printpt(v):
r"""printpt(vec3d v)"""
return _vsp.printpt(v)
def ToSpherical(v):
r"""ToSpherical(vec3d v) -> vec3d"""
return _vsp.ToSpherical(v)
def ToSpherical2(v, vdet):
r"""ToSpherical2(vec3d v, vec3d vdet) -> vec3d"""
return _vsp.ToSpherical2(v, vdet)
def ToCartesian(v):
r"""ToCartesian(vec3d v) -> vec3d"""
return _vsp.ToCartesian(v)
[docs]
def FitPlane(pts, cen, norm):
r"""FitPlane(Vec3dVec pts, vec3d cen, vec3d norm)"""
return _vsp.FitPlane(pts, cen, norm)
[docs]
def to_string(v):
r"""
Format a vec3d as a string, for printing or writing to a file.
.. code-block:: python
a = vec3d( 1.0, 2.0, 3.0 )
s = to_string( a )
assert len( s ) > 0, "to_string returned nothing"
:param [in]: v vec3d Point to format
:rtype: string
:return: string The formatted point
"""
return _vsp.to_string(v)
[docs]
def compsum(x):
r"""
Sum a vector of vec3d using compensated summation, which keeps the rounding error down over a long list.
.. code-block:: python
pts = Vec3dVec( [ vec3d( 1.0, 0.0, 0.0 ), vec3d( 0.0, 2.0, 0.0 ), vec3d( 0.0, 0.0, 3.0 ) ] )
s = compsum( pts )
assert abs( s.x() - 1.0 ) < 1e-12, "compsum is wrong in x"
assert abs( s.z() - 3.0 ) < 1e-12, "compsum is wrong in z"
:param [in]: x vector<vec3d> Points to sum
:rtype: :py:class:`vec3d`
:return: vec3d Sum of the points
"""
return _vsp.compsum(x)
def raySphereIntersectionFromInside(p, v, c, r, x):
r"""raySphereIntersectionFromInside(vec3d p, vec3d v, vec3d c, double r, vec3d x) -> bool"""
return _vsp.raySphereIntersectionFromInside(p, v, c, r, x)
[docs]
def dist(*args):
r"""
dist(vec3d a, vec3d b) -> double
dist(vec2d a, vec2d b) -> double
"""
return _vsp.dist(*args)
[docs]
def dist_squared(*args):
r"""
dist_squared(vec3d a, vec3d b) -> double
dist_squared(vec2d a, vec2d b) -> double
"""
return _vsp.dist_squared(*args)
[docs]
def cross(*args):
r"""
cross(vec3d a, vec3d b) -> vec3d
cross(vec2d a, vec2d b) -> double
"""
return _vsp.cross(*args)
[docs]
def dot(*args):
r"""
dot(vec3d a, vec3d b) -> double
dot(vec2d a, vec2d b) -> double
"""
return _vsp.dot(*args)
[docs]
def angle(*args):
r"""
angle(vec3d a, vec3d b) -> double
angle(vec2d a, vec2d b) -> double
"""
return _vsp.angle(*args)
[docs]
def cos_angle(*args):
r"""
cos_angle(vec3d a, vec3d b) -> double
cos_angle(vec2d a, vec2d b) -> double
"""
return _vsp.cos_angle(*args)
[docs]
def seg_seg_intersect(pnt_A, pnt_B, pnt_C, pnt_D):
r"""seg_seg_intersect(vec2d pnt_A, vec2d pnt_B, vec2d pnt_C, vec2d pnt_D) -> int"""
return _vsp.seg_seg_intersect(pnt_A, pnt_B, pnt_C, pnt_D)
[docs]
def proj_pnt_on_line_seg(*args):
r"""
proj_pnt_on_line_seg(vec3d line_pt1, vec3d line_pt2, vec3d pnt) -> vec3d
proj_pnt_on_line_seg(vec2d line_A, vec2d line_B, vec2d pnt) -> vec2d
"""
return _vsp.proj_pnt_on_line_seg(*args)
[docs]
def proj_pnt_on_line_u(line_A, line_B, pnt):
r"""proj_pnt_on_line_u(vec2d line_A, vec2d line_B, vec2d pnt) -> double"""
return _vsp.proj_pnt_on_line_u(line_A, line_B, pnt)
[docs]
def PointInPolygon(R, pnts):
r"""PointInPolygon(vec2d R, Vec2dVec pnts) -> bool"""
return _vsp.PointInPolygon(R, pnts)
[docs]
def det(p0, p1, offset):
r"""det(vec2d p0, vec2d p1, vec2d offset) -> double"""
return _vsp.det(p0, p1, offset)
[docs]
def poly_area(*args):
r"""
poly_area(Vec3dVec pnt_vec) -> double
poly_area(Vec2dVec pnt_vec) -> double
"""
return _vsp.poly_area(*args)
[docs]
def poly_centroid(pnt_vec):
r"""poly_centroid(Vec2dVec pnt_vec) -> vec2d"""
return _vsp.poly_centroid(pnt_vec)
[docs]
def orient2d(p0, p1, p):
r"""orient2d(vec2d p0, vec2d p1, vec2d p) -> double"""
return _vsp.orient2d(p0, p1, p)
[docs]
def bi_lin_interp(p0, p1, p2, p3, s, t):
r"""bi_lin_interp(vec2d p0, vec2d p1, vec2d p2, vec2d p3, double s, double t)"""
return _vsp.bi_lin_interp(p0, p1, p2, p3, s, t)
[docs]
def inverse_bi_lin_interp(p0, p1, p2, p3, p):
r"""inverse_bi_lin_interp(vec2d p0, vec2d p1, vec2d p2, vec2d p3, vec2d p) -> int"""
return _vsp.inverse_bi_lin_interp(p0, p1, p2, p3, p)
[docs]
class vec2d(object):
r"""
vec2d is typically used to describe coordinate points and vectors in 2D space.
Both elements in the vector are of type double.
"""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
v = property(_vsp.vec2d_v_get, _vsp.vec2d_v_set, doc=r"""v : a(2).double""")
def __init__(self, *args):
r"""
Construct a vec2d from its two coordinates. The default constructor leaves the coordinates
uninitialized, so prefer this one unless the value is about to be overwritten.
.. code-block:: python
a = vec2d( 3.0, 4.0 )
assert abs( a.x() - 3.0 ) < 1e-12, "vec2d did not store x"
assert abs( a.y() - 4.0 ) < 1e-12, "vec2d did not store y"
:param [in]: xx double X coordinate
:param [in]: yy double Y coordinate
"""
_vsp.vec2d_swiginit(self, _vsp.new_vec2d(*args))
[docs]
def set_xy(self, xx, yy):
r"""
Set both coordinates of the vec2d
.. code-block:: python
a = vec2d()
a.set_xy( 2.0, 4.0 )
assert abs( a.x() - 2.0 ) < 1e-12, "set_xy did not set x"
assert abs( a.y() - 4.0 ) < 1e-12, "set_xy did not set y"
See also: set_x, set_y
:param [in]: xx double New X value
:param [in]: yy double New Y value
:rtype: :py:class:`vec2d`
:return: vec2d Updated vec2d
"""
return _vsp.vec2d_set_xy(self, xx, yy)
[docs]
def set_x(self, xx):
r"""
Set the X coordinate (index 0) of the vec2d
.. code-block:: python
a = vec2d( 0.0, 4.0 )
a.set_x( 2.0 )
assert abs( a.x() - 2.0 ) < 1e-12, "set_x did not set x"
assert abs( a.y() - 4.0 ) < 1e-12, "set_x disturbed y"
See also: set_xy, set_y
:param [in]: xx double New X value
:rtype: :py:class:`vec2d`
:return: vec2d Updated vec2d
"""
return _vsp.vec2d_set_x(self, xx)
[docs]
def set_y(self, yy):
r"""
Set the Y coordinate (index 1) of the vec2d
.. code-block:: python
a = vec2d( 2.0, 0.0 )
a.set_y( 4.0 )
assert abs( a.y() - 4.0 ) < 1e-12, "set_y did not set y"
assert abs( a.x() - 2.0 ) < 1e-12, "set_y disturbed x"
See also: set_xy, set_x
:param [in]: yy double New Y value
:rtype: :py:class:`vec2d`
:return: vec2d Updated vec2d
"""
return _vsp.vec2d_set_y(self, yy)
[docs]
def x(self):
r"""
Get the X coordinate (index 0) of the vec2d
.. code-block:: python
a = vec2d( 3.0, 4.0 )
assert abs( a.x() - 3.0 ) < 1e-12, "x did not return the X coordinate"
See also: y
:rtype: float
:return: double X value
"""
return _vsp.vec2d_x(self)
[docs]
def y(self):
r"""
Get the Y coordinate (index 1) of the vec2d
.. code-block:: python
a = vec2d( 3.0, 4.0 )
assert abs( a.y() - 4.0 ) < 1e-12, "y did not return the Y coordinate"
See also: x
:rtype: float
:return: double Y value
"""
return _vsp.vec2d_y(self)
def __iadd__(self, b):
r"""__iadd__(vec2d self, vec2d b) -> vec2d"""
return _vsp.vec2d___iadd__(self, b)
def __isub__(self, b):
r"""__isub__(vec2d self, vec2d b) -> vec2d"""
return _vsp.vec2d___isub__(self, b)
def __imul__(self, b):
r"""__imul__(vec2d self, double b) -> vec2d"""
return _vsp.vec2d___imul__(self, b)
[docs]
def mag(self):
r"""
Get the magnitude of a vec2d
.. code-block:: python
a = vec2d( 3.0, 4.0 )
assert abs( a.mag() - 5.0 ) < 1e-12, "mag did not return the magnitude"
See also: normalize
:rtype: float
:return: double Magnitude
"""
return _vsp.vec2d_mag(self)
[docs]
def normalize(self):
r"""
Scale a vec2d to unit length, in place
.. code-block:: python
a = vec2d( 3.0, 4.0 )
a.normalize()
assert abs( a.mag() - 1.0 ) < 1e-12, "normalize did not produce a unit vector"
assert abs( a.x() - 0.6 ) < 1e-12, "normalize did not keep the direction"
See also: mag
"""
return _vsp.vec2d_normalize(self)
[docs]
def __add__(self, b):
r"""__add__(vec2d self, vec2d b) -> vec2d"""
return _vsp.vec2d___add__(self, b)
[docs]
def __sub__(self, b):
r"""__sub__(vec2d self, vec2d b) -> vec2d"""
return _vsp.vec2d___sub__(self, b)
[docs]
def __mul__(self, *args):
r"""
__mul__(vec2d self, double b) -> vec2d
__mul__(vec2d self, vec2d b) -> vec2d
"""
return _vsp.vec2d___mul__(self, *args)
[docs]
def __rmul__(self, b):
r"""__rmul__(vec2d self, double b) -> vec2d"""
return _vsp.vec2d___rmul__(self, b)
[docs]
def __truediv__(self, b):
r"""__truediv__(vec2d self, double b) -> vec2d"""
return _vsp.vec2d___truediv__(self, b)
def _getitem(self, i):
r"""_getitem(vec2d self, int i) -> double"""
return _vsp.vec2d__getitem(self, i)
def _setitem(self, i, val):
r"""_setitem(vec2d self, int i, double val)"""
return _vsp.vec2d__setitem(self, i, val)
[docs]
def __len__(self):
r"""__len__(vec2d self) -> int"""
return _vsp.vec2d___len__(self)
[docs]
def __getitem__( self, i ):
if i < 0:
i += 2
if i < 0 or i > 1:
raise IndexError( "vec2d index out of range" )
return self._getitem( i )
[docs]
def __setitem__( self, i, val ):
if i < 0:
i += 2
if i < 0 or i > 1:
raise IndexError( "vec2d index out of range" )
self._setitem( i, val )
[docs]
def __repr__(self):
r"""__repr__(vec2d self) -> std::string"""
return _vsp.vec2d___repr__(self)
__swig_destroy__ = _vsp.delete_vec2d
# Register vec2d in _vsp:
_vsp.vec2d_swigregister(vec2d)
[docs]
class Matrix4d(object):
r"""Matrix4d is typically used to perform rotations, translations, scaling, projections, and other transformations in 3D space."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
def __init__(self):
r"""__init__(Matrix4d self) -> Matrix4d"""
_vsp.Matrix4d_swiginit(self, _vsp.new_Matrix4d())
[docs]
def loadIdentity(self):
r"""
Create a 4x4 identity matrix
.. code-block:: python
#==== Test Matrix4d ====
m = Matrix4d() # Default Constructor
m.loadIdentity()
"""
return _vsp.Matrix4d_loadIdentity(self)
def _print(self, *args):
r"""_print(Matrix4d self, std::string const & header="")"""
return _vsp.Matrix4d__print(self, *args)
[docs]
@staticmethod
def setIdentity(m):
r"""setIdentity(double * m)"""
return _vsp.Matrix4d_setIdentity(m)
[docs]
def translatef(self, x, y, z):
r"""
Translate the Matrix4d along the given axes values
.. code-block:: python
#==== Test Matrix4d ====
m = Matrix4d() # Default Constructor
m.loadIdentity()
m.translatef( 1.0, 0.0, 0.0 )
:param [in]: x Translation along the X axis
:param [in]: y Translation along the Y axis
:param [in]: z Translation along the Z axis
"""
return _vsp.Matrix4d_translatef(self, x, y, z)
[docs]
def translatev(self, v):
r"""
Translate the matrix by a vec3d. The vec3d counterpart of translatef.
.. code-block:: python
m = Matrix4d()
m.loadIdentity()
m.translatev( vec3d( 1.0, 2.0, 3.0 ) )
p = m.xform( vec3d( 0.0, 0.0, 0.0 ) )
assert abs( p.x() - 1.0 ) < 1e-12, "translatev did not move the origin"
assert abs( p.z() - 3.0 ) < 1e-12, "translatev did not move in z"
See also: translatef, getTranslation
:param [in]: v vec3d Translation to apply
"""
return _vsp.Matrix4d_translatev(self, v)
[docs]
def rotateX(self, ang):
r"""
Rotate the Matrix4d about the X axis
.. code-block:: python
#==== Test Matrix4d ====
m = Matrix4d() # Default Constructor
m.loadIdentity()
m.rotateX( 90.0 )
:param [in]: ang Angle of rotation (degrees)
"""
return _vsp.Matrix4d_rotateX(self, ang)
[docs]
def rotateY(self, ang):
r"""
Rotate the Matrix4d about the Y axis
.. code-block:: python
#==== Test Matrix4d ====
m = Matrix4d() # Default Constructor
m.loadIdentity()
m.rotateY( 90.0 )
:param [in]: ang Angle of rotation (degrees)
"""
return _vsp.Matrix4d_rotateY(self, ang)
[docs]
def rotateZ(self, ang):
r"""
Rotate the Matrix4d about the Z axis
.. code-block:: python
#==== Test Matrix4d ====
m = Matrix4d() # Default Constructor
m.loadIdentity()
m.rotateZ( 90.0 )
:param [in]: ang Angle of rotation (degrees)
"""
return _vsp.Matrix4d_rotateZ(self, ang)
[docs]
def rotate(self, angle, axis):
r"""
Rotate the Matrix4d about an arbitrary axis
.. code-block:: python
#==== Test Matrix4d ====
m = Matrix4d() # Default Constructor
PI = 3.14
m.loadIdentity()
m.rotate( PI / 4, vec3d( 0.0, 0.0, 1.0 ) ) # Radians
:param [in]: angle Angle of rotation (rad)
:param [in]: axis Vector to rotate about
"""
return _vsp.Matrix4d_rotate(self, angle, axis)
[docs]
def rotatealongX(self, dir1):
r"""
Rotate the matrix so that its X axis points along a given direction.
.. code-block:: python
m = Matrix4d()
m.loadIdentity()
m.rotatealongX( vec3d( 0.0, 1.0, 0.0 ) )
p = m.xform( vec3d( 1.0, 0.0, 0.0 ) )
assert abs( p.y() - 1.0 ) < 1e-12, "rotatealongX did not take X onto the given direction"
:param [in]: dir1 vec3d Direction the X axis should point along
"""
return _vsp.Matrix4d_rotatealongX(self, dir1)
[docs]
def zeroTranslations(self):
r"""
Clear the translation part of the matrix, leaving the rotation and scaling alone.
.. code-block:: python
m = Matrix4d()
m.loadIdentity()
m.translatev( vec3d( 1.0, 2.0, 3.0 ) )
m.zeroTranslations()
t = m.getTranslation()
assert abs( t.x() ) < 1e-12 and abs( t.z() ) < 1e-12, "zeroTranslations left a translation behind"
See also: getTranslation, translatev
"""
return _vsp.Matrix4d_zeroTranslations(self)
[docs]
def affineInverse(self):
r"""
Perform an affine transform on the Matrix4d
.. code-block:: python
#==== Test Matrix4d ====
m = Matrix4d() # Default Constructor
m.loadIdentity()
m.rotateY( 10.0 )
m.rotateX( 20.0 )
m.rotateZ( 30.0 )
c = m.xform( vec3d( 1.0, 1.0, 1.0 ) )
m.affineInverse()
"""
return _vsp.Matrix4d_affineInverse(self)
[docs]
def scale(self, scale):
r"""
Multiply the Matrix4d by a scalar value
.. code-block:: python
#==== Test Matrix4d ====
m = Matrix4d() # Default Constructor
m.loadXZRef()
m.scale( 10.0 )
:param [in]: scale Value to scale by
"""
return _vsp.Matrix4d_scale(self, scale)
[docs]
def scalex(self, scalex):
r"""
Scale the matrix along X alone. Unlike scale, which scales all three axes together.
.. code-block:: python
m = Matrix4d()
m.loadIdentity()
m.scalex( 2.0 )
p = m.xform( vec3d( 1.0, 1.0, 1.0 ) )
assert abs( p.x() - 2.0 ) < 1e-12, "scalex did not scale X"
assert abs( p.y() - 1.0 ) < 1e-12, "scalex scaled an axis it should not have"
See also: scale
:param [in]: scalex double Scale factor for X
"""
return _vsp.Matrix4d_scalex(self, scalex)
[docs]
def scaley(self, scaley):
r"""
Scale the matrix along Y alone. Unlike scale, which scales all three axes together.
.. code-block:: python
m = Matrix4d()
m.loadIdentity()
m.scaley( 2.0 )
p = m.xform( vec3d( 1.0, 1.0, 1.0 ) )
assert abs( p.y() - 2.0 ) < 1e-12, "scaley did not scale Y"
assert abs( p.z() - 1.0 ) < 1e-12, "scaley scaled an axis it should not have"
See also: scale
:param [in]: scaley double Scale factor for Y
"""
return _vsp.Matrix4d_scaley(self, scaley)
[docs]
def scalez(self, scalez):
r"""
Scale the matrix along Z alone. Unlike scale, which scales all three axes together.
.. code-block:: python
m = Matrix4d()
m.loadIdentity()
m.scalez( 2.0 )
p = m.xform( vec3d( 1.0, 1.0, 1.0 ) )
assert abs( p.z() - 2.0 ) < 1e-12, "scalez did not scale Z"
assert abs( p.x() - 1.0 ) < 1e-12, "scalez scaled an axis it should not have"
See also: scale
:param [in]: scalez double Scale factor for Z
"""
return _vsp.Matrix4d_scalez(self, scalez)
[docs]
def flipx(self):
r"""
Flip the matrix about the YZ plane, negating X.
.. code-block:: python
m = Matrix4d()
m.loadIdentity()
m.flipx()
p = m.xform( vec3d( 1.0, 2.0, 3.0 ) )
assert abs( p.x() + 1.0 ) < 1e-12, "flipx did not negate x"
assert abs( p.y() - 2.0 ) < 1e-12, "flipx disturbed y"
See also: loadYZRef
"""
return _vsp.Matrix4d_flipx(self)
[docs]
def getMat(self, m):
r"""getMat(Matrix4d self, double * m)"""
return _vsp.Matrix4d_getMat(self, m)
[docs]
def matMult(self, *args):
r"""
Multiply this matrix by another, this * m, and keep the result.
.. code-block:: python
a = Matrix4d()
b = Matrix4d()
a.loadIdentity()
a.translatev( vec3d( 1.0, 0.0, 0.0 ) )
b.loadIdentity()
b.scale( 2.0 )
a.matMult( b )
p = a.xform( vec3d( 1.0, 0.0, 0.0 ) )
assert abs( p.x() - 3.0 ) < 1e-12, "matMult did not apply both transformations"
See also: postMult, initMat
:param [in]: m Matrix4d Matrix to multiply by
"""
return _vsp.Matrix4d_matMult(self, *args)
[docs]
def postMult(self, *args):
r"""
Multiply another matrix by this one, m * this, and keep the result. The other order from matMult.
.. code-block:: python
a = Matrix4d()
b = Matrix4d()
a.loadIdentity()
a.translatev( vec3d( 1.0, 0.0, 0.0 ) )
b.loadIdentity()
b.scale( 2.0 )
a.postMult( b )
p = a.xform( vec3d( 1.0, 0.0, 0.0 ) )
assert abs( p.x() - 4.0 ) < 1e-12, "postMult did not apply the transformations in the other order"
See also: matMult, initMat
:param [in]: m Matrix4d Matrix to multiply by
"""
return _vsp.Matrix4d_postMult(self, *args)
[docs]
def initMat(self, *args):
r"""
Copy another matrix into this one, replacing whatever was here.
.. code-block:: python
a = Matrix4d()
b = Matrix4d()
b.loadIdentity()
b.translatev( vec3d( 5.0, 0.0, 0.0 ) )
a.initMat( b )
p = a.xform( vec3d( 0.0, 0.0, 0.0 ) )
assert abs( p.x() - 5.0 ) < 1e-12, "initMat did not copy the matrix"
See also: matMult, postMult
:param [in]: m Matrix4d Matrix to copy
"""
return _vsp.Matrix4d_initMat(self, *args)
[docs]
def mult(self, _in, out):
r"""mult(Matrix4d self, double const [4] _in, double [4] out)"""
return _vsp.Matrix4d_mult(self, _in, out)
[docs]
def data(self):
r"""data(Matrix4d self) -> double *"""
return _vsp.Matrix4d_data(self)
[docs]
def const_data(self):
r"""const_data(Matrix4d self) -> double const *"""
return _vsp.Matrix4d_const_data(self)
[docs]
def loadXZRef(self):
r"""
Load an identy Matrix4d and set the Y coordinate of the diagonal (index 5) to -1
.. code-block:: python
#==== Test Matrix4d ====
m = Matrix4d() # Default Constructor
m.loadXZRef()
b = m.xform( vec3d( 1, 2, 3 ) )
"""
return _vsp.Matrix4d_loadXZRef(self)
[docs]
def loadXYRef(self):
r"""
Load an identy Matrix4d and set the Z coordinate of the diagonal (index 10) to -1
.. code-block:: python
#==== Test Matrix4d ====
m = Matrix4d() # Default Constructor
m.loadXYRef()
b = m.xform( vec3d( 1, 2, 3 ) )
"""
return _vsp.Matrix4d_loadXYRef(self)
[docs]
def loadYZRef(self):
r"""
Load an identy Matrix4d and set the X coordinate of the diagonal (index 0) to -1
.. code-block:: python
#==== Test Matrix4d ====
m = Matrix4d() # Default Constructor
m.loadYZRef()
b = m.xform( vec3d( 1, 2, 3 ) )
"""
return _vsp.Matrix4d_loadYZRef(self)
[docs]
def mirrory(self):
r"""
Transform the Matrix4d by the given vector
.. code-block:: python
#==== Test Matrix4d ====
m = Matrix4d() # Default Constructor
m.loadIdentity()
a = m.xform( vec3d( 1.0, 2.0, 3.0 ) )
"""
return _vsp.Matrix4d_mirrory(self)
[docs]
def getAngles(self):
r"""
Calculate the Matrix4d's angles between the X, Y and Z axes
.. code-block:: python
mat = Matrix4d()
PI = 3.14
mat.loadIdentity()
mat.rotate( PI / 4, vec3d( 0.0, 0.0, 1.0 ) ) # Radians
angles = mat.getAngles()
:rtype: :py:class:`vec3d`
:return: Angle measurement between each axis (degrees)
"""
return _vsp.Matrix4d_getAngles(self)
[docs]
def getArcballAngles(self):
r"""
Get the rotation as the arcball angles the GUI trackball uses.
.. code-block:: python
m = Matrix4d()
m.loadIdentity()
a = m.getArcballAngles()
assert abs( a.x() ) < 1e-12, "getArcballAngles found a rotation in an identity matrix"
See also: getAngles
:rtype: :py:class:`vec3d`
:return: vec3d Arcball angles
"""
return _vsp.Matrix4d_getArcballAngles(self)
[docs]
def getTranslation(self):
r"""
Get the translation part of the matrix.
.. code-block:: python
m = Matrix4d()
m.loadIdentity()
m.translatev( vec3d( 1.0, 2.0, 3.0 ) )
t = m.getTranslation()
assert abs( t.x() - 1.0 ) < 1e-12, "getTranslation is wrong in x"
assert abs( t.z() - 3.0 ) < 1e-12, "getTranslation is wrong in z"
See also: translatev, zeroTranslations
:rtype: :py:class:`vec3d`
:return: vec3d Translation
"""
return _vsp.Matrix4d_getTranslation(self)
[docs]
def getBasis(self, xdir, ydir, zdir):
r"""
Get the three axis directions of the matrix. The vec3d passed in are filled in rather than returned.
.. code-block:: python
m = Matrix4d()
m.loadIdentity()
xdir = vec3d()
ydir = vec3d()
zdir = vec3d()
m.getBasis( xdir, ydir, zdir )
assert abs( xdir.x() - 1.0 ) < 1e-12, "getBasis did not report the X axis"
assert abs( zdir.z() - 1.0 ) < 1e-12, "getBasis did not report the Z axis"
See also: setBasis
:param [out]: xdir vec3d X axis direction
:param [out]: ydir vec3d Y axis direction
:param [out]: zdir vec3d Z axis direction
"""
return _vsp.Matrix4d_getBasis(self, xdir, ydir, zdir)
[docs]
def setBasis(self, xdir, ydir, zdir):
r"""
Set the rotation of the matrix from three axis directions.
.. code-block:: python
m = Matrix4d()
m.loadIdentity()
m.setBasis( vec3d( 0.0, 1.0, 0.0 ), vec3d( -1.0, 0.0, 0.0 ), vec3d( 0.0, 0.0, 1.0 ) )
p = m.xform( vec3d( 1.0, 0.0, 0.0 ) )
assert abs( p.y() - 1.0 ) < 1e-12, "setBasis did not take X onto the given direction"
See also: getBasis
:param [in]: xdir vec3d X axis direction
:param [in]: ydir vec3d Y axis direction
:param [in]: zdir vec3d Z axis direction
"""
return _vsp.Matrix4d_setBasis(self, xdir, ydir, zdir)
[docs]
def getRotationAxis(self, axis_dir, axis_pnt):
r"""
Reduce the matrix to a single rotation about an axis: the direction of the axis, a point on it, and the angle turned through in radians.
.. code-block:: python
import math
m = Matrix4d()
m.loadIdentity()
m.rotateZ( 90.0 )
axis_dir = vec3d()
axis_pnt = vec3d()
angle = m.getRotationAxis( axis_dir, axis_pnt )
assert abs( abs( axis_dir.z() ) - 1.0 ) < 1e-9, "getRotationAxis did not find the Z axis"
assert abs( abs( angle ) - 0.5 * math.pi ) < 1e-9, "getRotationAxis did not measure the angle"
See also: toQuat, getAngles
:param [out]: axis_dir vec3d Direction of the rotation axis
:param [out]: axis_pnt vec3d A point on the rotation axis
:param [out]: angle_out double Angle turned through, in radians
"""
return _vsp.Matrix4d_getRotationAxis(self, axis_dir, axis_pnt)
[docs]
def toQuat(self):
r"""
Decompose the matrix into a rotation quaternion and a translation.
.. code-block:: python
m = Matrix4d()
m.loadIdentity()
qw, qx, qy, qz, tx, ty, tz = m.toQuat()
assert abs( qw - 1.0 ) < 1e-12, "toQuat did not give the identity quaternion"
assert abs( qx ) + abs( qy ) + abs( qz ) < 1e-12, "toQuat found a rotation in an identity matrix"
assert abs( tx ) + abs( ty ) + abs( tz ) < 1e-12, "toQuat found a translation in an identity matrix"
See also: getRotationAxis
:param [out]: qw_out double Scalar part of the rotation quaternion
:param [out]: qx_out double X part of the rotation quaternion
:param [out]: qy_out double Y part of the rotation quaternion
:param [out]: qz_out double Z part of the rotation quaternion
:param [out]: tx_out double X translation
:param [out]: ty_out double Y translation
:param [out]: tz_out double Z translation
"""
return _vsp.Matrix4d_toQuat(self)
__swig_destroy__ = _vsp.delete_Matrix4d
# Register Matrix4d in _vsp:
_vsp.Matrix4d_swigregister(Matrix4d)
# **Placeholder start**
def IsFacade():
"""
Returns True if the facade API is in use.
.. code-block:: python
is_facade = IsFacade()
"""
return False
def IsGUIRunning():
"""
Returns True if the GUI event loop is running.
.. code-block:: python
is_gui_active = IsGUIRunning()
"""
return False