Python 如何获取我在OCC小部件上单击的顶点?
我使用OCC和python来可视化.igs和.stl格式。在.stl文件中,我的模型上有一个网格,我想知道该网格上的哪个顶点被单击。我发现我选择的模型自动高亮显示,没有任何设置,所以我想有一种方法可以做到这一点。但是我找不到任何关于它的信息。Python 如何获取我在OCC小部件上单击的顶点?,python,python-3.x,opencascade,Python,Python 3.x,Opencascade,我使用OCC和python来可视化.igs和.stl格式。在.stl文件中,我的模型上有一个网格,我想知道该网格上的哪个顶点被单击。我发现我选择的模型自动高亮显示,没有任何设置,所以我想有一种方法可以做到这一点。但是我找不到任何关于它的信息。 好的,找到了。如果其他人需要它: display = self.occWidget._display display.SetSelectionModeVertex() # This is the required function display.r
好的,找到了。如果其他人需要它:
display = self.occWidget._display
display.SetSelectionModeVertex() # This is the required function
display.register_select_callback(recognize_clicked)
你在哪里
def recognize_clicked(shp, *kwargs):
""" This is the function called every time
a face is clicked in the 3d view
"""
for shape in shp:
print("Face selected: ", shape)
面选择-SetSelectionModeFace()
顶点选择-SetSelectionModeVertex()
边缘选择-SetSelectionModeEdge()
形状选择-SetSelectionModeShape()
中性(默认)选择-SetSelectionModeNeutral()
这就是我在其他例子中发现的所有模式。请,如果你发现更多,写在评论中的资源