Macro Select Hovering: Difference between revisions

From FreeCAD Documentation
(Marked this version for translation)
(Marked this version for translation)
 
(18 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<languages/>
<translate>
<translate>
<!--T:1-->
<!--T:1-->
{{Macro
{{Macro|Icon=Macro Select Hovering|Name=Macro Select Hovering|Description=This macro select a choice Face, Edge, Vertex hovering by the mouse.|Author=Mario52|Version=00.02|Date=2017-12-26}}
|Name=Macro Select Hovering
</translate>
|Icon=Macro_Select_Hovering.png
[[File:Macro Select Hovering 00.png|Macro Select Hovering]]
|Description=This macro select a choice Face, Edge, Vertex hovering by the mouse.<br/>PS: For unselected one face (or other) click the {{KEY|Pause grab}} and use the standard procedure : CTRL + Click
{{clear}}
|Author=Mario52
<translate>
|Version=00.04
|Date=2024-01-11
|FCVersion=All
|Download=[https://www.freecadweb.org/wiki/images/d/d8/Macro_Select_Hovering.png ToolBar Icon]
}}

==Description== <!--T:2-->
==Description== <!--T:2-->

</translate>
<translate>
<!--T:3-->
<!--T:3-->
this macro select a choice Face, Edge, Vertex hovering by the mouse.
this macro select a choice Face, Edge, Vertex hovering by the mouse.

</translate>
<translate>
==How To Use== <!--T:4-->
</translate>
<translate>
<!--T:5-->
Hovering element by the mouse.
</translate>
<translate>
===Icons=== <!--T:6-->
</translate>
<translate>
<!--T:7-->
The icon must be copied into the same directory as the macro
</translate>
<translate>
==Script== <!--T:8-->
</translate>
<translate>
<!--T:9-->
The icon ToolBar [[File:Macro Select Hovering.png|Macro Select Hovering]]
</translate>
</translate>


'''Macro Select Hovering.FCMacro'''
[[File:Select_Hovering00.gif|Macro Select Hovering]]


{{Code|code=
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
#
"""
***************************************************************************
* Copyright (c) 2017 <mario52> *
* *
* This file is a supplement to the FreeCAD CAx development system. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License (LGPL) *
* as published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* for detail see the LICENCE text file. *
* *
* This software is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this macro; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA *
***************************************************************************
* WARNING! All changes in this file will be lost and *
* may cause malfunction of the program *
***************************************************************************
"""
#
#Macro_ _01-25/12/2017 02-26/12/2017
#
#OS: Windows 10
#Word size of OS: 64-bit
#Word size of FreeCAD: 64-bit
#Version: 0.16.6712 (Git)
#Build type: Release
#Branch: releases/FreeCAD-0-16
#Hash: da2d364457257a7a8c6fb2137cea12c45becd71a
#Python version: 2.7.8
#Qt version: 4.8.7
#Coin version: 4.0.0a
#OCC version: 6.8.0.oce-0.17
#
__title__ = "Macro_Select_Hovering"
__author__ = "Mario52"
__url__ = "http://www.freecadweb.org/index-fr.html"
__Wiki__ = "http://www.freecadweb.org/wiki/index.php?title=Macro_Select_Hovering"
__version__ = "00.02"
__date__ = "26/12/2017"


{{Codeextralink|https://gist.githubusercontent.com/mario52a/7ebe6b3fd047441114d9d0e08ceddd63/raw/f9dea03a0327b48c76a7c3e9d7cd391b5093a8cf/Macro%2520Select%2520Hovering.FCMacro}}
import PySide
from PySide import QtGui ,QtCore
from PySide.QtGui import *
from PySide.QtCore import *
import Draft, Part, PartGui, FreeCADGui, FreeCAD


<translate>
Gui = FreeCADGui
App = FreeCAD


<!--T:13-->
global ui ; ui = ""
[[File:Macro Select Hovering 00.png|Macro Select Hovering]]
global s ; s = ""


<!--T:14-->
try:
PS: For deselect one face (or other) click the {{KEY|Pause grab}} and use the standard procedure : CTRL + Click
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s


==How To Use== <!--T:4-->
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)


<!--T:5-->
class Ui_MainWindow(object):
Hovering element by the mouse.


</translate>
def __init__(self, MainWindow):
====Section Face====
self.window = MainWindow
<translate>
#################################################################################
#self.path = FreeCAD.ConfigGet("AppHomePath")
#self.path = FreeCAD.ConfigGet("UserAppData")
#self.path = "your path"
param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macro")# macro path
self.path = param.GetString("MacroPath","") + "/" # macro path
self.path = self.path.replace("\\","/")
# print "Path for the icons : " , self.path
#################################################################################
self.FontImpost = "Arial"
self.fontGlobal_08 = QtGui.QFont() # pour compatibilite Windows Linux
self.fontGlobal_08.setFamily(self.FontImpost) # pour compatibilite Windows Linux
self.fontGlobal_08.setPointSize(8.0) # pour compatibilite Windows Linux
#self.xxxx.setFont(self.fontGlobal_08) # pour W L
#self.xxxx.setFont(QtGui.QFont(self.FontImpost,weight=QtGui.QFont.Bold)) # Bold
#################################################################################


<!--T:19-->
self.comptFace = 0
{{CheckBox}} Select Face → 3 number of face(s)
self.comptEdge = 0
{{LineEdit|300.0}} area total of selections
self.comptVertex = 0
{{LineEdit|100.0}} area of the latest selection
self.Stop_Grab = 1
self.comptSurfaceFace = 0.0
self.comptSurfaceTotal = 0.0
self.comptLengthObject = 0.0
self.comptLengthTotal = 0.0
self.tableauSurface = []
self.tableauSurEdge = []
self.tableauSurVertex = []


</translate>
def setupUi(self, MainWindow):
====Section Edge====
MainWindow.resize(197, 307)
<translate>
MainWindow.setMinimumSize(QtCore.QSize(197, 307))
MainWindow.setMaximumSize(QtCore.QSize(197, 307))
self.centralwidget = QtGui.QWidget(MainWindow)
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))


<!--T:20-->
self.GBOX_01_Face = QtGui.QGroupBox(self.centralwidget)
{{CheckBox}} Select Edge → 4 number of edge(s)
self.GBOX_01_Face.setGeometry(QtCore.QRect(10, 10, 176, 91))
{{LineEdit|40.0}} length total of selections
self.GBOX_01_Face.setFont(self.fontGlobal_08) # pour W L
{{LineEdit|10.0}} length of the latest selection
self.GBOX_01_Face.setObjectName(_fromUtf8("GBOX_01_Face"))


</translate>
self.LE_02_Area_Object = QtGui.QLineEdit(self.GBOX_01_Face)
====Section Vertex====
self.LE_02_Area_Object.setGeometry(QtCore.QRect(90, 60, 75, 20))
<translate>
self.LE_02_Area_Object.setFont(self.fontGlobal_08) # pour W L
self.LE_02_Area_Object.setObjectName(_fromUtf8("LE_02_Area_Object"))


<!--T:33-->
self.LAB_05_Area_Object = QtGui.QLabel(self.GBOX_01_Face)
{{CheckBox}} Select Vertex → 1 number of vertex(s)
self.LAB_05_Area_Object.setGeometry(QtCore.QRect(90, 40, 71, 16))
self.LAB_05_Area_Object.setFont(self.fontGlobal_08) # pour W L
self.LAB_05_Area_Object.setObjectName(_fromUtf8("LAB_05_Area_Object"))


</translate>
self.CB_01_Sel_Face = QtGui.QCheckBox(self.GBOX_01_Face)
====Section Main====
self.CB_01_Sel_Face.setGeometry(QtCore.QRect(10, 20, 91, 17))
<translate>
self.CB_01_Sel_Face.setFont(self.fontGlobal_08) # pour W L
self.CB_01_Sel_Face.setObjectName(_fromUtf8("CB_01_Sel_Face"))


<!--T:22-->
self.LE_01_Area_Total = QtGui.QLineEdit(self.GBOX_01_Face)
Title display info of the :
self.LE_01_Area_Total.setGeometry(QtCore.QRect(10, 60, 75, 20))
*( Obj: 1 ) : number object(s) selected
self.LE_01_Area_Total.setFont(self.fontGlobal_08) # pour W L
*( Sub: 8 ) : number of Sub object(s) selected
self.LE_01_Area_Total.setObjectName(_fromUtf8("LE_01_Area_Total"))
*( Tot: 9 ) : Somme Obj + Sub


</translate>
self.LAB_01_Face = QtGui.QLabel(self.GBOX_01_Face)
{{LineEdit|Unnamed: Box. Face6 (1.34,2.64,10.0)}}
self.LAB_01_Face.setGeometry(QtCore.QRect(110, 23, 56, 16))
<translate>
self.LAB_01_Face.setFont(self.fontGlobal_08) # pour W L
self.LAB_01_Face.setObjectName(_fromUtf8("LAB_01_Face"))


<!--T:23-->
self.LAB_04_Area_Total = QtGui.QLabel(self.GBOX_01_Face)
* display little info and info below the cursor mouse
self.LAB_04_Area_Total.setGeometry(QtCore.QRect(10, 40, 56, 16))
self.LAB_04_Area_Total.setFont(self.fontGlobal_08) # pour W L
self.LAB_04_Area_Total.setObjectName(_fromUtf8("LAB_04_Area_Total"))


</translate>
{{ComboBox|Unnamed: 1 : (8 sel.) (Obj. 1, Fa. 3, Ed. 4, Ve. 1) }}
<translate>


<!--T:24-->
self.GBOX_02_Edge = QtGui.QGroupBox(self.centralwidget)
*Name of document
self.GBOX_02_Edge.setGeometry(QtCore.QRect(10, 105, 176, 91))
*8 selections
self.GBOX_02_Edge.setFont(self.fontGlobal_08) # pour W L
*Obj. 1 object
self.GBOX_02_Edge.setObjectName(_fromUtf8("GBOX_02_Edge"))
*Fa. 3 faces
*Ed. 4 edges
*Ve. 1 vertex
*If you use several document the macro restores only the selection in the document open (to work)
*The toolTip display the listing of the selected document Name and subObject


</translate>
self.LAB_02_Edge = QtGui.QLabel(self.GBOX_02_Edge)
[[File:Macro_Select_Hovering_01.png|Info objects memorized displayed]]
self.LAB_02_Edge.setGeometry(QtCore.QRect(110, 25, 56, 16))
<translate>
self.LAB_02_Edge.setFont(self.fontGlobal_08) # pour W L
self.LAB_02_Edge.setObjectName(_fromUtf8("LAB_02_Edge"))


</translate>
self.CB_02_Sel_Edge = QtGui.QCheckBox(self.GBOX_02_Edge)
{{Button|Selected by Box}}
self.CB_02_Sel_Edge.setGeometry(QtCore.QRect(10, 20, 91, 17))
<translate>
self.CB_02_Sel_Edge.setFont(self.fontGlobal_08) # pour W L
self.CB_02_Sel_Edge.setObjectName(_fromUtf8("CB_02_Sel_Edge"))


<!--T:25-->
self.LE_03_Length_Total = QtGui.QLineEdit(self.GBOX_02_Edge)
*if you select by the Box selection this button select all objects checked of the selection
self.LE_03_Length_Total.setGeometry(QtCore.QRect(10, 60, 75, 20))
*Other think you check the vertex option and you want selected all vertexes of the object ... click this button
self.LE_03_Length_Total.setFont(self.fontGlobal_08) # pour W L
self.LE_03_Length_Total.setObjectName(_fromUtf8("LE_03_Length_Total"))


</translate>
self.LE_04_Length_Object = QtGui.QLineEdit(self.GBOX_02_Edge)
{{Button|Reset Data}}
self.LE_04_Length_Object.setGeometry(QtCore.QRect(90, 60, 75, 20))
<translate>
self.LE_04_Length_Object.setFont(self.fontGlobal_08) # pour W L
self.LE_04_Length_Object.setObjectName(_fromUtf8("LE_04_Length_Object"))


<!--T:26-->
self.LAB_06_Length_Total = QtGui.QLabel(self.GBOX_02_Edge)
*Reset all data in the macro (not the memo)
self.LAB_06_Length_Total.setGeometry(QtCore.QRect(10, 40, 71, 16))
self.LAB_06_Length_Total.setFont(self.fontGlobal_08) # pour W L
self.LAB_06_Length_Total.setObjectName(_fromUtf8("LAB_06_Length_Total"))


</translate>
self.LAB_07_Length_Obgect = QtGui.QLabel(self.GBOX_02_Edge)
{{Button|Reset Memo}}
self.LAB_07_Length_Obgect.setGeometry(QtCore.QRect(90, 40, 71, 16))
<translate>
self.LAB_07_Length_Obgect.setFont(self.fontGlobal_08) # pour W L
self.LAB_07_Length_Obgect.setObjectName(_fromUtf8("LAB_07_Length_Obgect"))


<!--T:27-->
*Reset the memo


</translate>
self.GBOX_03_Vertex = QtGui.QGroupBox(self.centralwidget)
{{Button|Remove selection}}
self.GBOX_03_Vertex.setGeometry(QtCore.QRect(10, 200, 176, 46))
<translate>
self.GBOX_03_Vertex.setFont(self.fontGlobal_08) # pour W L
self.GBOX_03_Vertex.setObjectName(_fromUtf8("GBOX_03_Vertex"))


<!--T:28-->
self.LAB_03_Vertex = QtGui.QLabel(self.GBOX_03_Vertex)
*Remove the selections in the current document
self.LAB_03_Vertex.setGeometry(QtCore.QRect(110, 25, 56, 16))
''('''PS:''' if several document are open on click mouse in the 3D view remove all selection in all documents)''
self.LAB_03_Vertex.setFont(self.fontGlobal_08) # pour W L
self.LAB_03_Vertex.setObjectName(_fromUtf8("LAB_03_Vertex"))


</translate>
self.CB_03_Sel_Vertex = QtGui.QCheckBox(self.GBOX_03_Vertex)
{{Button|Quit}}
self.CB_03_Sel_Vertex.setGeometry(QtCore.QRect(10, 22, 91, 17))
<translate>
self.CB_03_Sel_Vertex.setFont(self.fontGlobal_08) # pour W L
self.CB_03_Sel_Vertex.setObjectName(_fromUtf8("CB_03_Sel_Vertex"))


<!--T:29-->
*Quit the macro


</translate>
self.GBOX_04_Main = QtGui.QGroupBox(self.centralwidget)
{{Button|Pause grab/Refresh}}
self.GBOX_04_Main.setGeometry(QtCore.QRect(10, 250, 176, 51))
<translate>
self.GBOX_04_Main.setFont(self.fontGlobal_08) # pour W L
self.GBOX_04_Main.setObjectName(_fromUtf8("GBOX_04_Main"))


<!--T:30-->
self.PB_02_Stop_Grab = QtGui.QPushButton(self.GBOX_04_Main)
*Pause the macro for ex: deselect on of many object
self.PB_02_Stop_Grab.setGeometry(QtCore.QRect(90, 20, 75, 23))
*after pause click for return on macro and upgrade al info in the macro
self.PB_02_Stop_Grab.setFont(self.fontGlobal_08) # pour W L
*Can be use for upgrade the selections in the macro (all time)
self.PB_02_Stop_Grab.setObjectName(_fromUtf8("PB_02_Stop_Grab"))
*Ex: many object are selected before run the macro
self.PB_02_Stop_Grab.clicked.connect(self.on_PB_02_Stop_Grab_clicked)
*The macro adapts and detect all change of document


===Icons=== <!--T:6-->
self.PB_01_Quit = QtGui.QPushButton(self.GBOX_04_Main)
self.PB_01_Quit.setGeometry(QtCore.QRect(5, 20, 75, 23))
self.PB_01_Quit.setFont(self.fontGlobal_08) # pour W L
self.PB_01_Quit.setObjectName(_fromUtf8("PB_01_Quit"))
self.PB_01_Quit.clicked.connect(self.on_PB_Quit_clicked)


<!--T:7-->
MainWindow.setCentralWidget(self.centralwidget)
The icon must be copied into the same directory as the macro
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)


<!--T:31-->
def retranslateUi(self, MainWindow):
The icon ToolBar [[File:Macro Select Hovering.png|Macro Select Hovering]]
MainWindow.setWindowTitle("Select_Hovering")
MainWindow.setWindowIcon(QtGui.QIcon(self.path + __title__ +".png"))#
self.GBOX_01_Face.setTitle("Face")
self.CB_01_Sel_Face.setText("Select Face")
self.LAB_01_Face.setText("0")
self.LAB_04_Area_Total.setText("Area Total")
self.LAB_05_Area_Object.setText("Area Object")


==Script== <!--T:8-->
self.GBOX_02_Edge.setTitle("Edge")
self.CB_02_Sel_Edge.setText("Select Edge")
self.LAB_02_Edge.setText("0")
self.LAB_06_Length_Total.setText("Length Total")
self.LAB_07_Length_Obgect.setText("Length Object")


</translate>
self.GBOX_03_Vertex.setTitle("Vertex")
'''Macro_Select_Hovering.FCMacro'''
self.CB_03_Sel_Vertex.setText("Select Vertex")
self.LAB_03_Vertex.setText("0")


{{CodeDownload|https://gist.github.com/mario52a/7ebe6b3fd047441114d9d0e08ceddd63| Download latest version of the macro}}
self.GBOX_04_Main.setTitle("Main")
<translate>
self.PB_01_Quit.setText("Quit")
self.PB_02_Stop_Grab.setText("Pause grab")


==Version== <!--T:10-->
MainWindow.setWindowFlags(PySide.QtCore.Qt.WindowStaysOnTopHint) # PySide cette fonction met la fenetre en avant


<!--T:32-->
ver 00.04 (11/01/2024) : add:
*LineEdit info,
*ComboBox memo selection,
*Button Memo selection,
*Button Selected by body
*Button Reset Data
*Button Reset Memo
*Button Remove Selection


<!--T:16-->
def on_PB_02_Stop_Grab_clicked(self):
ver 00.03b (28/10/2020) : add print'''()''' for Python 3
global s


<!--T:15-->
if self.Stop_Grab == 1:
ver 00.03 (26/12/2017) : replace test with (FreeCAD.ActiveDocument.getObject(obj), sub) == False)
FreeCADGui.Selection.removeObserver(s) # desinstalle la fonction residente SelObserver
self.Stop_Grab = 0
self.PB_02_Stop_Grab.setText("Active grab")
print "Grab pause"
else:
s=SelObserver()
FreeCADGui.Selection.addObserver(s) # installe la fonction en mode resident
self.Stop_Grab = 1
self.PB_02_Stop_Grab.setText("Pause grab")
print "Grab active"


<!--T:11-->
def on_PB_Quit_clicked(self):
ver 00.02 (26/12/2017) :
global s


<!--T:12-->
FreeCADGui.Selection.removeObserver(s) # desinstalle la fonction residente SelObserver
ver 00.01 (25/12/2017) :
self.window.hide() # hide the window and close the macro
print "Quit ",__title__


==Link== <!--T:17-->
##################################################################################################
class SelObserver:
global ui


<!--T:18-->
def setPreselection(self,doc,obj,sub): # preselection
[https://forum.freecadweb.org/viewtopic.php?f=3&t=26370 Multiple face selection to convert a shape to a solid]
global ui


if ui.CB_01_Sel_Face.isChecked():
passFace = 1
for i in ui.tableauSurface:
if obj == i[0] and sub == i[1]:
passFace = 0
break


if (sub[:4] == "Face") and (passFace == 1):
Gui.Selection.addSelection(FreeCAD.ActiveDocument.getObject(obj), sub)
ui.comptFace += 1
ui.LAB_01_Face.setText(str(ui.comptFace))

ui.tableauSurface.append([obj, sub])
ui.comptSurfaceFace = FreeCAD.ActiveDocument.getObject(obj).Shape.Faces[int(sub[4:])-1].Area
ui.comptSurfaceTotal += ui.comptSurfaceFace
ui.LE_01_Area_Total.setText(str(ui.comptSurfaceTotal))
ui.LE_02_Area_Object.setText(str(ui.comptSurfaceFace))


if ui.CB_02_Sel_Edge.isChecked():
passEdge = 1
for i in ui.tableauSurEdge:
if obj == i[0] and sub == i[1]:
passEdge = 0
break

if (sub[:4] == "Edge") and (passEdge == 1):
objetSelect = Gui.Selection.addSelection(FreeCAD.ActiveDocument.getObject(obj), sub)

ui.comptEdge += 1
ui.LAB_02_Edge.setText(str(ui.comptEdge))

ui.tableauSurEdge.append([obj, sub])
ui.comptLengthObject = FreeCAD.ActiveDocument.getObject(obj).Shape.Edges[int(sub[4:])-1].Length
ui.comptLengthTotal += ui.comptLengthObject
ui.LE_03_Length_Total.setText(str(ui.comptLengthTotal))
ui.LE_04_Length_Object.setText(str(ui.comptLengthObject))


if ui.CB_03_Sel_Vertex.isChecked():
passVertex = 1
for i in ui.tableauSurVertex:
if obj == i[0] and sub == i[1]:
passVertex = 0
break

if sub[:6] == "Vertex" and (passVertex == 1):
Gui.Selection.addSelection(FreeCAD.ActiveDocument.getObject(obj), sub)
ui.comptVertex += 1
ui.LAB_03_Vertex.setText(str(ui.comptVertex))

ui.tableauSurVertex.append([obj, sub])


# def removePreselection(self,doc,obj,sub) #
# print "removePreselection"
# def addSelection(self,doc,obj,sub,pnt): # Selection
# print "addSelection"
# def removeSelection(self,doc,obj,sub): # Effacer l'objet selectionne
# print "removeSelection"
# def setSelection(self,doc): # Selection dans ComboView
# FreeCADGui.Selection.removeObserver(s)
# print "setSelection quit"

def clearSelection(self,doc): # Si clic sur l'ecran, effacer la selection
global ui

ui.comptFace = 0
ui.comptEdge = 0
ui.comptVertex = 0
del ui.tableauSurface[:]
del ui.tableauSurEdge[:]
del ui.tableauSurVertex[:]
ui.comptSurfaceFace = 0.0
ui.comptSurfaceTotal = 0.0
ui.comptLengthObject = 0.0
ui.comptLengthTotal = 0.0
ui.LAB_01_Face.setText(str(ui.comptFace))
ui.LAB_02_Edge.setText(str(ui.comptEdge))
ui.LAB_03_Vertex.setText(str(ui.comptVertex))
ui.LE_01_Area_Total.setText(str(ui.comptSurfaceTotal))
ui.LE_02_Area_Object.setText(str(ui.comptSurfaceFace))
ui.LE_03_Length_Total.setText(str(ui.comptLengthTotal))
ui.LE_04_Length_Object.setText(str(ui.comptLengthObject))
# print "clearSelection"

s=SelObserver()
FreeCADGui.Selection.addObserver(s) # installe la fonction en mode resident
###################################################################################################

doc = FreeCAD.ActiveDocument
if doc == None:
doc = FreeCAD.newDocument()

MainWindow = QtGui.QMainWindow()
ui = Ui_MainWindow(MainWindow)
ui.setupUi(MainWindow)
MainWindow.show()



}}
<translate>
==Version== <!--T:10-->
</translate>
</translate>
<translate>
<!--T:11-->
ver 00.02 (26/12/2017) :
</translate>

<translate>
<!--T:12-->
ver 00.01 (25/12/2017) :
</translate>

<languages/>

Latest revision as of 20:30, 11 January 2024

Other languages:

Macro Select Hovering

Description
This macro select a choice Face, Edge, Vertex hovering by the mouse.
PS: For unselected one face (or other) click the Pause grab and use the standard procedure : CTRL + Click

Macro version: 00.04
Last modified: 2024-01-11
FreeCAD version: All
Download: ToolBar Icon
Author: Mario52
Author
Mario52
Download
ToolBar Icon
Links
Macro Version
00.04
Date last modified
2024-01-11
FreeCAD Version(s)
All
Default shortcut
None
See also
None

Description

this macro select a choice Face, Edge, Vertex hovering by the mouse.


Macro Select Hovering


Temporary code for external macro link. Do not use this code. This code is used exclusively by Addon Manager. Link for optional manual installation: Macro


# This code is copied instead of the original macro code
# to guide the user to the online download page.
# Use it if the code of the macro is larger than 64 KB and cannot be included in the wiki
# or if the RAW code URL is somewhere else in the wiki.

from PySide import QtGui, QtCore

diag = QtGui.QMessageBox(QtGui.QMessageBox.Information,
    "Information",
    "This macro must be downloaded from this link\n"
    "\n"
    "https://gist.githubusercontent.com/mario52a/7ebe6b3fd047441114d9d0e08ceddd63/raw/f9dea03a0327b48c76a7c3e9d7cd391b5093a8cf/Macro%2520Select%2520Hovering.FCMacro" + "\n"
    "\n"
    "Quit this window to access the download page")

diag.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
diag.setWindowModality(QtCore.Qt.ApplicationModal)
diag.exec_()

import webbrowser 
webbrowser.open("https://gist.githubusercontent.com/mario52a/7ebe6b3fd047441114d9d0e08ceddd63/raw/f9dea03a0327b48c76a7c3e9d7cd391b5093a8cf/Macro%2520Select%2520Hovering.FCMacro")


Macro Select Hovering

PS: For deselect one face (or other) click the Pause grab and use the standard procedure : CTRL + Click

How To Use

Hovering element by the mouse.

Section Face

Select Face → 3 number of face(s) 300.0 area total of selections 100.0 area of the latest selection

Section Edge

Select Edge → 4 number of edge(s) 40.0 length total of selections 10.0 length of the latest selection

Section Vertex

Select Vertex → 1 number of vertex(s)

Section Main

Title display info of the :

  • ( Obj: 1 ) : number object(s) selected
  • ( Sub: 8 ) : number of Sub object(s) selected
  • ( Tot: 9 ) : Somme Obj + Sub

Unnamed: Box. Face6 (1.34,2.64,10.0)

  • display little info and info below the cursor mouse

Unnamed: 1 : (8 sel.) (Obj. 1, Fa. 3, Ed. 4, Ve. 1)

  • Name of document
  • 8 selections
  • Obj. 1 object
  • Fa. 3 faces
  • Ed. 4 edges
  • Ve. 1 vertex
  • If you use several document the macro restores only the selection in the document open (to work)
  • The toolTip display the listing of the selected document Name and subObject

Info objects memorized displayed

Selected by Box

  • if you select by the Box selection this button select all objects checked of the selection
  • Other think you check the vertex option and you want selected all vertexes of the object ... click this button

Reset Data

  • Reset all data in the macro (not the memo)

Reset Memo

  • Reset the memo

Remove selection

  • Remove the selections in the current document

(PS: if several document are open on click mouse in the 3D view remove all selection in all documents)

Quit

  • Quit the macro

Pause grab/Refresh

  • Pause the macro for ex: deselect on of many object
  • after pause click for return on macro and upgrade al info in the macro
  • Can be use for upgrade the selections in the macro (all time)
  • Ex: many object are selected before run the macro
  • The macro adapts and detect all change of document

Icons

The icon must be copied into the same directory as the macro

The icon ToolBar Macro Select Hovering

Script

Macro_Select_Hovering.FCMacro


Version

ver 00.04 (11/01/2024) : add:

  • LineEdit info,
  • ComboBox memo selection,
  • Button Memo selection,
  • Button Selected by body
  • Button Reset Data
  • Button Reset Memo
  • Button Remove Selection

ver 00.03b (28/10/2020) : add print() for Python 3

ver 00.03 (26/12/2017)  : replace test with (FreeCAD.ActiveDocument.getObject(obj), sub) == False)

ver 00.02 (26/12/2017)  :

ver 00.01 (25/12/2017)  :

Link

Multiple face selection to convert a shape to a solid