FreeCAD二次开发-鼠标处创建点

class MyMouseCreatePointCommand:
    def GetResources(self):
        return {'Pixmap': 'a2p_Solver', 'MenuText': '鼠标创建点', 'ToolTip': '创建点'}

    def Activated(self): #点击按钮执行的动作
        """Do something here"""
        import Draft
        import Part
        from FreeCAD import Base
        # 遍历选择的对象
        for o in FreeCADGui.Selection.getSelectionEx():
            o.PickedPoints[0]
        # 创建点
        Draft.makePoint(o.PickedPoints[0])
        # 打印点坐标
        print(o.PickedPoints[0])

    def IsActive(self):
        """Here you can define if the command must be active or not (greyed) if certain conditions
        are met or not. This function is optional."""
        return True
FreeCADGui.addCommand('MyMouseCreatePointCommand', MyMouseCreatePointCommand())

程序员阿飞
2021年4月21日

程序员阿飞

2021年4月21日

作者: 阿飞

出处: https://www.cnblogs.com/nxopen2018/>

关于作者:......

如有问题, 可在底部(留言)咨询.

原文地址:https://www.cnblogs.com/nxopen2018/p/14687075.html