FreeCAD Logo FreeCAD 1.0
  • Anglais Afrikaans Arabe Biélorusse Catalan Tchèque Allemand Grec Espagnol Espagnol Basque Finnois Philippin Français Galicien Croate Hongrois Indonésien Italien Japonais Kabyle Coréen Lituanien Néerlandais Norvégien classique Polonais Portugais Portugais Roumain Russe Slovaque Slovène Serbe Suédois Turc Ukrainien Valencien Vietnamien Chinois Chinois
  • Fonctions
  • Télécharger
  • Blog
  • Documentation
    Index de la documentation Premiers pas Documentation pour les utilisateurs Manuel de FreeCAD Documentation des ateliers Documentation sur le codage en Python Documentation pour les développeurs Tutoriels Foire aux questions Politique de confidentialité À propos de FreeCAD
  • Contribuer
    Comment aider Sponsor Signaler un bogue Faire une demande de modification (PR) Emplois et financements Guide pour les contributions Manuel pour les développeurs Traductions
  • Communauté
    Code de conduite Forum The FPA GitHub GitLab Codeberg Mastodon Matrix IRC IRC via Webchat Gitter Discord Reddit Twitter Facebook LinkedIn Calendrier
  • ♥ Donate

Donate

$
Informations SEPA
Veuillez configurer votre virement bancaire SEPA pour:
Beneficiary: The FreeCAD project association
IBAN: BE04 0019 2896 4531
BIC/SWIFT: GEBABEBBXXX
Agence bancaire: BNP Paribas Fortis
Adresse: Rue de la Station 64, 1360 Perwez, Belgium

While Stripe doesn't support monthly donations, you can still become a sponsor! Simply make a one-time donation equivalent to 12 months of support, and you'll gain access to the corresponding sponsoring tier. It's an easy and flexible way to contribute.

If you are not sure or not able to commit to a regular donation, but still want to help the project, you can do a one-time donation, of any amount.

Choose freely the amount you wish to donate one time only.

You can support FreeCAD by sponsoring it as an individual or organization through various platforms. Sponsorship provides a steady income for developers, allowing the FPA to plan ahead and enabling greater investment in FreeCAD. To encourage sponsorship, we offer different tiers, and unless you choose to remain anonymous, your name or company logo will be featured on our website accordingly.

from 1 USD / 1 EUR per month. You will not have your name displayed here, but you will have helped the project a lot anyway. Together, normal sponsors maintain the project on its feet as much as the bigger sponsors.

from 25 USD / 25 EUR per month. Your name or company name is displayed on this page.

from 100 USD / 100 EUR per month. Your name or company name is displayed on this page, with a link to your website, and a one-line description text.

from 200 USD / 200 EUR per month. Your name or company name and logo displayed on this page, with a link to your website and a custom description text. Companies that have helped FreeCAD early on also appear under Gold sponsors.

Instead of donating each month, you might find it more comfortable to make a one-time donation that, when divided by twelve, would give you right to enter a sponsoring tier. Don't hesitate to do so!

Choose freely the amount you wish to donate each month.

Please inform your forum name or twitter handle as a notein your transfer, or reach to us, so we can give you proper credits!

Visibility_Manager

Description
Utilisez-le pour gérer la visibilité des objets de document.

Il existe 2 modes de fonctionnement : Show All et Show Types.
En mode Show Types (par défaut), vous ne voyez qu'une liste des types d'objets, par exemple les corps, esquissses, protrusions, extrusions.
Le fait de désactiver ou d'activer l'un des types définit la visibilité de tous les objets document de ce type dans le document actif.
En mode Show All (appuyez sur la touche Maj tout en exécutant la macro), une case à cocher différente apparaît pour chaque objet de document, triés par ordre alphabétique.
Vous pouvez activer ou désactiver l’affichage de chaque objet.

Version macro : 1.06
Date dernière modification : 2020-06-18
Version FreeCAD : Toutes
Téléchargement : Icône de la barre d'outils
Auteur: TheMarkster

Auteur
TheMarkster
Téléchargement
Icône de la barre d'outils
Liens
Page des macros
Comment installer une macro
Comment créer une barre d'outils
Version Macro
1.06
Dernière modification
2020-06-18
Version(s) FreeCAD
Toutes
Raccourci clavier
None
Voir aussi
None

Description

Utilisez cette macro pour gérer la visibilité des objets de document par type ou individuellement.

Script

Icône de la barre d'outils

Macro_Visibility_Manager.FCMacro

# -*- coding: utf-8 -*-
"""
***************************************************************************
*   Copyright (c) 2019 <TheMarkster>                                 *
*                                                                         *
*   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.                   *
*                                                                         *
*   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 at http://www.gnu.org/licenses     *
*   for more details.                                                     *
*                                                                         *
*   For more information about the GNU Library General Public License     *
*   write to the Free Software Foundation, Inc., 59 Temple Place,         *
*   Suite 330, Boston, MA  02111-1307 USA                                 *
*                                                                         *
***************************************************************************
"""

"""
Visibility_Manager Macro

Use this to manage the visibility of document objects.

There are 2 modes of operation: Show All and Show Types.

In Show Types mode (the default) you only see a list of the types
of objects, e.g. Body, Sketch, Pad, Extrude.

Toggling one of the types off/on will set the visibility of all document
objects of that type in the active document.

In Show All mode (Press Shift key while executing the macro) you see 
a different checkbox for each and every document object, sorted
alphabetically.  You can toggle each object's visibility individually.

"""

__title__ = "Visibility_Manager"
__author__ = "TheMarkster"
__url__ = ""
__Wiki__ = "https://wiki.freecad.org/Macro_Visibility_Manager"
__date__ = "2020.06.18"
__version__ = 1.06

import FreeCAD
from PySide import QtCore, QtGui
import time

class Dlg(QtGui.QDialog):
    def __init__(self, bShowAll=False):
        QtGui.QDialog.__init__(self)
        self.types={} #dict of types
        self.showAll = bShowAll
        self.reload = False
        self.infoLabel = QtGui.QLabel()
        self.infoLabel.mousePressEvent = self.label_clicked
        if self.showAll:
            self.infoLabel.setText("Show All mode")
        else:
            self.infoLabel.setText("Show by Type mode")
        checkboxLayout = QtGui.QVBoxLayout()
        self.checkboxes = []
        widget = QtGui.QWidget() #will hold scroll area
        checkboxLayout = QtGui.QVBoxLayout()
        self.addCheckboxes(checkboxLayout)  
        widget.setLayout(checkboxLayout)

        #Scroll Area Properties
        scroll = QtGui.QScrollArea()
        scroll.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
        scroll.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        scroll.setWidgetResizable(True)
        scroll.setWidget(widget)
        vLayout = QtGui.QVBoxLayout()
        vLayout.addWidget(scroll)

        #buttons = QtGui.QDialogButtonBox(
        #    QtGui.QDialogButtonBox.Ok.__or__(QtGui.QDialogButtonBox.Cancel),
        #    QtCore.Qt.Horizontal, self)
        buttons = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok, QtCore.Qt.Horizontal,self)
        buttons.addButton(QtGui.QDialogButtonBox.Cancel)
        mode_button = buttons.addButton('Switch Mode', QtGui.QDialogButtonBox.ActionRole)
        mode_button.clicked.connect(self.label_clicked)
        buttons.accepted.connect(self.accept)
        buttons.rejected.connect(self.reject)
        buttons.setCenterButtons(True)
        layout = QtGui.QVBoxLayout()
        layout.addWidget(self.infoLabel)
        layout.addLayout(vLayout)
        layout.addWidget(buttons)
        self.setLayout(layout)

    def label_clicked(self, event):
        self.reload = True
        self.close()
        QtGui.QApplication.processEvents()
        time.sleep(0.1)

    def addCheckboxes (self, cbLayout):
        objectList = FreeCAD.ActiveDocument.findObjects()
        objectList.sort(key=lambda x: x.Name, reverse=False)
        nameList = []
        for obj in objectList:
            if not self.nameInList(obj.Name, nameList):
                nameList.append(obj.Name)
                self.newType(obj.Name)

        all = QtGui.QCheckBox("All", self)
        all.setObjectName("all")
        all.toggled.connect(self.allToggled)
        cbLayout.addWidget(all)
        self.checkboxes = [all]
        for name in nameList:
            for nn in range(0,len(self.types[name])):
                objLabel = getattr(FreeCAD.ActiveDocument,self.types[name][nn]).Label
                objName = self.types[name][nn]
                if objLabel != objName and self.showAll:
                    ck = QtGui.QCheckBox(self.types[name][nn]+" ("+objLabel+")", self)
                else:
                    ck = QtGui.QCheckBox(objName,self)
                ck.setObjectName(objName)

                if getattr(FreeCAD.ActiveDocument,self.types[name][nn]).ViewObject.Visibility:
                    ck.setCheckState(QtCore.Qt.Checked)
                else:
                    ck.setCheckState(QtCore.Qt.Unchecked)
                if nn != 0 and not self.showAll:
                    ck.hide()
                cbLayout.addWidget(ck)
                self.checkboxes.append(ck)
    
    def addToTypes(self, typeName, name):
        self.types[typeName].append(name)

    def newType(self, typeName):
        self.types[typeName] = [typeName]
    
    def nameInList(self, name, nameList):
        """ check if name is in nameList
            e.g. name = "Extrude002"
            nameList = ["Extrude", "Extrude001", "Extrude002"...]
        """
        for nl in nameList:
            if nl in name and nl[:3] == name[:3]:
                self.addToTypes(nl,name)
                return True
        return False

    def allToggled(self):
        """all checkbox was toggled"""
        allState = self.checkboxes[0].checkState()
        for ii in range(1,len(self.checkboxes)):
            self.checkboxes[ii].setCheckState(allState)

    def accept(self):
        """user clicked Ok"""
        self.setWindowOpacity(0.85)
        self.infoLabel.setText("Working...")
        if self.showAll:
            for ii in range(1, len(self.checkboxes)):
                name = self.checkboxes[ii].objectName()
                state = self.checkboxes[ii].checkState()
            
                if state == QtCore.Qt.Checked:
                    obj = getattr(FreeCAD.ActiveDocument, name)
                    if not obj.ViewObject.Visibility:
                        obj.ViewObject.Visibility = True
                else:
                    obj = getattr(FreeCAD.ActiveDocument, name)
                    if obj.ViewObject.Visibility:
                        obj.ViewObject.Visibility = False
                QtGui.QApplication.processEvents()
                time.sleep(0.01)
        else: #show type mode
            for ii in range(1, len(self.checkboxes)):
                if not self.checkboxes[ii].isVisible():
                    continue
                name = self.checkboxes[ii].objectName()
                state = self.checkboxes[ii].checkState()
            
                if state == QtCore.Qt.Checked:
                    for n in self.types[name]:
                        obj = getattr(FreeCAD.ActiveDocument, n)
                        obj.ViewObject.Visibility = True
                else:
                    for n in self.types[name]:
                        obj = getattr(FreeCAD.ActiveDocument, n)
                        obj.ViewObject.Visibility = False
                QtGui.QApplication.processEvents()
                time.sleep(0.01)
        self.close()


showAll = False
modifiers = QtGui.QApplication.keyboardModifiers()
if modifiers == QtCore.Qt.ShiftModifier:
    showAll = True
if FreeCAD.ActiveDocument:
    dlg = Dlg(showAll)
    dlg.setWindowTitle("Visibility Manager v"+str(__version__))
    result = dlg.exec_()
    while dlg.reload:
        showAll = not dlg.showAll
        dlg = Dlg(showAll)
        dlg.setWindowTitle("Visibility Manager v"+str(__version__))
        result = dlg.exec_()
else:
    FreeCAD.Console.PrintWarning("Visibility Manager v"+str(__version__)+": no active document\n")

Cette page est extraite de https://wiki.freecad.org/Macro_Visibility_Manager

Contactez-nous !
Forum GitHub Mastodon Matrix IRC Gitter.im Discord Reddit Twitter Facebook LinkedIn

© L'équipe FreeCAD. Crédits des images de la page d'accueil (de haut en bas) : ppemawm, r-frank, epileftric, regis, rider_mortagnais, bejant.

Ce projet est soutenu par : , KiCad Services Corp. et autres parrains

GitHubAméliorer cette page sur GitHub