136 lines
6.1 KiB
HTML
136 lines
6.1 KiB
HTML
<html><head><title>Macro Duplicate Selection/fr</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><link type='text/css' href='wiki.css' rel='stylesheet'></head><body><h1>Macro Duplicate Selection/fr</h1></div>
|
|
|
|
<div id="mw-content-text" lang="fr" dir="ltr" class="mw-content-ltr"><hr/><div class="mw-parser-output"><table class="fcinfobox wikitable ct" width="100%" style="float: right; width: 230px; margin-left: 10px;">
|
|
<tr>
|
|
<td class="ctTitle">
|
|
<h3><span class="mw-headline" id="Macro_Duplicate_Selection"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Text-x-python.png" class="image"><img alt="Text-x-python.png" src="32px-Text-x-python.png" width="32" height="32" srcset="/wiki/images/2/2c/Text-x-python.png 1.5x" /></a> Macro_Duplicate_Selection</span></h3>
|
|
</td></tr>
|
|
<tr>
|
|
<th class="ctOdd">Description
|
|
</th></tr>
|
|
<tr>
|
|
<td class="ctEven left">Cette macro change le curseur de la souris si une sélection est dupliquée.
|
|
</td></tr>
|
|
<tr>
|
|
<th class="ctOdd">Auteur
|
|
</th></tr>
|
|
<tr>
|
|
<td class="ctEven"><a href="https://www.freecadweb.org/wiki/index.php?title=User:Mario52" title="User:Mario52">Mario52</a>
|
|
</td></tr>
|
|
<tr>
|
|
<th class="ctOdd">Liens
|
|
</th></tr>
|
|
<tr>
|
|
<td class="ctEven"><a href="https://www.freecadweb.org/wiki/index.php?title=Macros_recipes/fr" title="Macros recipes/fr">Recettes macros</a><br /><a href="https://www.freecadweb.org/wiki/index.php?title=How_to_install_macros/fr" title="How to install macros/fr">Comment installer une macro</a><br /><a href="https://www.freecadweb.org/wiki/index.php?title=Customize_Toolbars/fr" title="Customize Toolbars/fr">Comment ajouter une barre d'outils</a>
|
|
</td></tr>
|
|
<tr>
|
|
<th class="ctOdd">Version
|
|
</th></tr>
|
|
<tr>
|
|
<td class="ctEven macro-version">00.00
|
|
</td></tr>
|
|
<tr>
|
|
<th class="ctOdd">Date dernière modification
|
|
</th></tr>
|
|
<tr>
|
|
<td class="ctEven macro-date">2016-06-06
|
|
</td></tr>
|
|
<tr>
|
|
<th class="ctOdd">
|
|
</th></tr>
|
|
<tr>
|
|
<td class="ctToc"><br /><div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
|
|
<ul>
|
|
<li class="toclevel-1"><a href="#Macro_Duplicate_Selection"><span class="tocnumber">1</span> <span class="toctext">Macro_Duplicate_Selection</span></a></li>
|
|
<li class="toclevel-1 tocsection-1"><a href="#Description"><span class="tocnumber">2</span> <span class="toctext">Description</span></a></li>
|
|
<li class="toclevel-1 tocsection-2"><a href="#Utilisation"><span class="tocnumber">3</span> <span class="toctext">Utilisation</span></a></li>
|
|
<li class="toclevel-1 tocsection-3"><a href="#Script"><span class="tocnumber">4</span> <span class="toctext">Script</span></a></li>
|
|
<li class="toclevel-1 tocsection-4"><a href="#Liens"><span class="tocnumber">5</span> <span class="toctext">Liens</span></a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
</td></tr>
|
|
</table>
|
|
<p><br />
|
|
</p>
|
|
<h2><span class="mw-headline" id="Description">Description</span></h2>
|
|
<p>Cette macro change le curseur de la souris si une sélection est dupliquée.
|
|
Sélectionnez vos objets dans la vue 3D , si une sélection est dupliquée le curseur de la souris change en "ForbiddenCursor" et reste dans cet état tan que la sélection est dupliquée.
|
|
</p><p>Cette macro reste résidente.
|
|
</p>
|
|
<h2><span class="mw-headline" id="Utilisation">Utilisation</span></h2>
|
|
<p>Lancez la macro , elle reste résidente en mémoire et active.
|
|
</p><p>Sélectionnez vos objets dans la vue 3D , si une sélection est dupliquée le curseur de la souris change en "ForbiddenCursor" et reste dans cet état tan que la sélection est dupliquée.
|
|
</p>
|
|
<h2><span class="mw-headline" id="Script">Script</span></h2>
|
|
<p><b>Macro_Duplicate_Selection.FCMacro</b>
|
|
<b>Macro_Duplicate_Selection.FCMacro</b>
|
|
</p>
|
|
<pre># -*- coding: utf-8 -*-
|
|
import FreeCADGui
|
|
import PySide
|
|
from PySide import QtGui ,QtCore
|
|
from PySide.QtGui import *
|
|
from PySide.QtCore import *
|
|
|
|
__title__ = "Macro_Duplicate_Selection"
|
|
__author__ = "Mario52"
|
|
__url__ = "http://www.freecadweb.org/index-fr.html"
|
|
__version__ = "00.00"
|
|
__date__ = "06/06/2016"
|
|
|
|
__Help__ = "Start the macro select the object IN THE 3D VIEW the ForbiddenCursor stay if the selection is duplicate"
|
|
|
|
def selectionObject():
|
|
sel = FreeCADGui.Selection.getSelection()
|
|
x = []
|
|
del x[:]
|
|
for a in range(len(sel)):
|
|
x.append(sel[a].Name)
|
|
doublet = 0
|
|
for i in range(len(sel)):
|
|
for ii in range((i+1),len(sel)):
|
|
if x[i] == x[ii]:
|
|
doublet = 1
|
|
break
|
|
if doublet == 1:
|
|
QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.ForbiddenCursor))
|
|
# FreeCAD.Console.PrintError("HELP "+sel[-1].Name+" duplicate selection"+"\n")
|
|
else:
|
|
QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
|
|
|
|
class SelObserver:
|
|
def addSelection(self,doc,obj,sub,pnt): # Selection
|
|
selectionObject()
|
|
def removeSelection(self,doc,obj,sub): # Effacer l'objet salectionne
|
|
selectionObject()
|
|
def setPreselection(self, doc, obj, sub):
|
|
selectionObject()
|
|
def clearSelection(self,doc): # Si clic sur l'ecran, effacer la selection
|
|
selectionObject()
|
|
# def setSelection(self,doc): # Selection dans Combo View pour quitter la fonction
|
|
# App.Console.PrintMessage("Fin Macro_Duplicate"+"\n")
|
|
# QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
|
|
# FreeCADGui.Selection.removeObserver(s)# desinstalle la fonction residente
|
|
|
|
s=SelObserver()
|
|
FreeCADGui.Selection.addObserver(s) # installe la fonction en mode resident </pre>
|
|
<h2><span class="mw-headline" id="Liens">Liens</span></h2>
|
|
<p>La discussion sur le forum <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/viewtopic.php?f=3&t=15994">Duplicate Objects when more than one face selected</a>
|
|
</p>
|
|
<div style="clear:both"></div>
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div><div class="printfooter">
|
|
Online version: "<a dir="ltr" href="https://www.freecadweb.org/wiki/index.php?title=Macro_Duplicate_Selection/fr&oldid=239941">http://www.freecadweb.org/wiki/index.php?title=Macro_Duplicate_Selection/fr&oldid=239941</a>"</div>
|
|
<div id="catlinks" class="catlinks" data-mw="interface"></div><div class="visualClear"></div>
|
|
</div>
|
|
</div>
|
|
<div id="mw-navigation">
|
|
<h2>Navigation menu</h2>
|
|
|
|
</body></html> |