MCPcopy Create free account
hub / github.com/Kitware/VTK / vtkVariantExtract

Function vtkVariantExtract

Wrapping/Python/vtkmodules/util/vtkVariant.py:80–98  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

78
79
80def 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
101def vtkVariantCast(v, t):

Callers 1

testVariantExtractMethod · 0.90

Calls 3

vtkVariantMethod · 0.80
typeEnum · 0.50
GetTypeMethod · 0.45

Tested by 1

testVariantExtractMethod · 0.72