Macro Mouse over cb

From FreeCAD Documentation
Jump to navigation Jump to search
This page is a translated version of the page Macro Mouse over cb and the translation is 90% complete.
Outdated translations are marked like this.
Other languages:
English • ‎français • ‎hrvatski • ‎italiano

Macro Mouse over cb.png Makro Miš iznad cb

Description
Ova makronaredba prikazuje sve elemente ispod pokazivača.

Macro version: 00.00
Last modified: 2016-12-13
FreeCAD version: All
Download: Toolbar icon
Author: Chris_G
Author
Chris_G
Download
Toolbar icon
Links
Macro Version
00.00
Date last modified
2016-12-13
FreeCAD Version(s)
All
Default shortcut
None
See also
Macro FC element selector

Opis

Ovaj prikaz makronaredbe u izvješću prikazuje sve elemente ispod pokazivača (prikazat će se i svi elementi obuhvaćeni drugim elementima)

Kako koristiti

Pokrenite makro, makro ostaje u memoriji.

skripta

Toolbar icon Macro Mouse over cb.png

Macro_Mouse_over_cb.FCMacro

from pivy import coin
import FreeCADGui

def mouse_over_cb( event_callback):
    event = event_callback.getEvent()
    pos = event.getPosition().getValue()
    listObjects = FreeCADGui.ActiveDocument.ActiveView.getObjectsInfo((int(pos[0]),int(pos[1])))
    obj = []
    if listObjects:
        FreeCAD.Console.PrintMessage("\n *** Objects under mouse pointer ***")
        for o in listObjects:
            label = str(o["Object"])
            if not label in obj:
                obj.append(label)
        FreeCAD.Console.PrintMessage("\n"+str(obj))


view = FreeCADGui.ActiveDocument.ActiveView

mouse_over = view.addEventCallbackPivy( coin.SoLocation2Event.getClassTypeId(), mouse_over_cb )

# to remove Callback :
#view.removeEventCallbackPivy( coin.SoLocation2Event.getClassTypeId(), mouse_over_cb)

Poveznice

Rasprava na forumu finding/selecting all elements below cursor

Drugi slični makro Selecting internal faces of a pressure vessel (preuzmite datoteku FC_element_selector_v1p1p1.py)