Extract the specified value type from the vtkVariant, where the type is in the following format: 'int', 'unsigned int', etc. for numeric types, and 'string' for strings. You can also use an integer VTK type constant for the type. Set the type to 'None" to extract the value in
(v, t=None)
| 78 | |
| 79 | |
| 80 | def vtkVariantExtract(v, t=None): |
| 81 | """ |
| 82 | Extract the specified value type from the vtkVariant, where the type is |
| 83 | in the following format: 'int', 'unsigned int', etc. for numeric types, |
| 84 | and 'string' for strings. You can also use an |
| 85 | integer VTK type constant for the type. Set the type to 'None" to |
| 86 | extract the value in its native type. |
| 87 | """ |
| 88 | v = vtkCommonCore.vtkVariant(v) |
| 89 | |
| 90 | if t == None: |
| 91 | t = v.GetType() |
| 92 | elif not issubclass(type(t), int): |
| 93 | t = _variant_type_map[t] |
| 94 | |
| 95 | if getattr(v, _variant_check_map[t])(): |
| 96 | return getattr(v, _variant_method_map[t])() |
| 97 | else: |
| 98 | return None |
| 99 | |
| 100 | |
| 101 | def vtkVariantCast(v, t): |