如何得到顶点,我点击OCC小工具?

2024-05-15 23:26:14 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用OCC和python来可视化.igs和.stl格式。在.stl文件中,我的模型上有一个网格,我想知道这个网格上的哪个顶点被点击了。我看到我选择的模型在没有任何设置的情况下自动高亮显示,所以我想有一种方法可以做到这一点。但是我找不到任何关于它的信息。 Model with mesh


Tags: 文件方法模型信息网格可视化格式情况
1条回答
网友
1楼 · 发布于 2024-05-15 23:26:14

好的,找到了。万一有人需要:

 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()

这就是我在其他例子中发现的所有模式。请,如果你发现更多,写在一个评论,该资源。你知道吗

相关问题 更多 >