import maya.cmds as cmds
import maya.api.OpenMaya as om
# 创建一个平面
plane = cmds.polyPlane(width=5, height=5)[0]
# 获取平面上的一个顶点
vertex_index = 10
vertex_position = cmds.xform(plane + ".vtx[{0}]".format(vertex_index), q=True, translation=True, ws=True)
# 获取平面的面法线
m_selectionList = om.MSelectionList()
m_selectionList.add(plane)
dagPath = m_selectionList.getDagPath(0)
mfnMesh = om.MFnMesh(dagPath)
face_normal = mfnMesh.getPolygonNormal(0)
# 将法线向量转换为Python列表
normal_vector = [face_normal.x, face_normal.y, face_normal.z]
# 打印法线向量
print("平面上点的法线向量:", normal_vector)