get_keypoints#
- LegacyGeometry.get_keypoints(return_as_list=False, return_as_array=False, return_ids_in_array=False)#
Obtain the keypoints geometry.
Obtain the selected keypoints as a
pyvista.PolyDataobject or a list ofpyvista.PolyData.- パラメーター:
- return_as_listbool,
optional Whether to return the data as a list. The default is
False, in which case the data is returned as a PyVistaPolyDataobject.- return_as_arraybool,
optional Whether to return the data as a
numpy array. The default isFalse, in which case the data is returned as a PyVistaPolyDataobject.- return_ids_in_arraybool,
optional Whether to return the keypoint IDs in the output array. The default is
False, in which case the data is as anumpy arrayobject with only the coordinates. This parameter is only valid whenreturn_as_array=True.
- return_as_listbool,
- Returns:
Union[NDArray[Any],pv.PolyData,list[pv.PolyData]]
- 戻り値の型:
Union[ndarray[tuple[int,...],dtype[Any]],PolyData,List[PolyData]]
Examples
Return a single merged mesh.
>>> kps = mapdl.geometry.get_keypoints() >>> kps PolyData (0x147d5b580) N Cells: 26 N Points: 26 N Strips: 0 X Bounds: -1.588e-02, 1.588e-02 Y Bounds: -7.620e-03, 1.778e-02 Z Bounds: -3.180e-03, 1.524e-02 N Arrays: 1
Return a list of keypoints as individual grids
>>> keypoints = mapdl.geometry.get_keypoints(return_as_list=True) >>> keypoints [PolyData (0x147ca4be...rrays: 1, PolyData (0x147d5b8e...rrays: 1, PolyData (0x1491a42e...rrays: 1, PolyData (0x1491a440...rrays: 1, PolyData (0x1491a47c...rrays: 1, PolyData (0x1491a470...rrays: 1, PolyData (0x1491a4b2...rrays: 1, PolyData (0x1491a4e2...rrays: 1, PolyData (0x1491a49a...rrays: 1, PolyData (0x1491a4f4...rrays: 1, PolyData (0x1491a458...rrays: 1, PolyData (0x1491a4b8...rrays: 1, PolyData (0x1491a4dc...rrays: 1, PolyData (0x1491a506...rrays: 1, ...]
Return the keypoints coordinates as a numpy array:
>>> keypoints = mapdl.geometry.get_keypoints(return_as_array=True) array([[ 0.00000000e+00, 1.77800000e-02, -3.18000000e-03], [ 0.00000000e+00, -7.62000000e-03, -3.18000000e-03], [ 1.58750000e-02, 1.77800000e-02, -3.18000000e-03], [ 1.58750000e-02, -7.62000000e-03, -3.18000000e-03], [ 0.00000000e+00, -7.62000000e-03, 0.00000000e+00], ...
When returning an array, you can also choose to output the keypoint ids as the first column:
>>> keypoints = mapdl.geometry.get_keypoints(return_ids_in_array=True) array([[ 1.00000000e+00, 0.00000000e+00, 1.77800000e-02, -3.18000000e-03], [ 2.00000000e+00, 0.00000000e+00, -7.62000000e-03, -3.18000000e-03], [ 3.00000000e+00, 1.58750000e-02, 1.77800000e-02, -3.18000000e-03], [ 4.00000000e+00, 1.58750000e-02, -7.62000000e-03, -3.18000000e-03], [ 5.00000000e+00, 0.00000000e+00, -7.62000000e-03, 0.00000000e+00], [ 6.00000000e+00, 1.58750000e-02, -7.62000000e-03, ...