FreeCAD Logo FreeCAD 1.0
  • angielski afrykanerski arabski białoruski kataloński czeski niemiecki grecki hiszpański hiszpański baskijski fiński filipiński francuski galicyjski chorwacki węgierski Indonezyjski włoski japoński kabylski koreański litewski duński Norweski Bokmal polski portugalski portugalski rumuński rosyjski słowacki słoweński serbski szwedzki turecki ukraiński walenciański wietnamski chiński chiński
  • Funkcjonalność programu
  • Pobierz
  • Blog
  • Dokumentacja
    Spis dokumentacji Jak zacząć Dokumentacja użytkowników Podręcznik do programu FreeCAD Dokumentacja środowisk pracy Dokumentacja skryptów środowiska Python Dokumentacja kodowania C++ Poradniki Najczęściej zadawane pytania Polityka prywatności O FreeCAD
  • Przyłącz się do projektu
    Jak pomóc Sponsor Zgłoś błąd Utwórz pull request Praca i finansowanie Zasady współpracy Podręcznik dla programistów Tłumaczenia
  • Społeczność
    Kodeks postępowania Forum The FPA GitHub GitLab Codeberg Mastodon Matrix IRC IRC via Webchat Gitter Discord Reddit Twitter Facebook LinkedIn Kalendarz
  • ♥ Donate

Donate

$
Informacje o SEPA
Skonfiguruj przelew bankowy SEPA do:
Beneficiary: The FreeCAD project association
IBAN: BE04 0019 2896 4531
BIC/SWIFT: GEBABEBBXXX
Bank: BNP Paribas Fortis
Adres: 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!

Macro FC element selector

Opis
To makro wyświetla wszystkie elementy znajdujące się poniżej kursora (wyświetlane będą również wszystkie elementy zakryte przez inne elementy).

Macro version: 01.00
Last modified: 2016-12-26
FreeCAD version: Wszystkie
Download: Ikonka paska narzędzi
Autor: HoWil
Autor
HoWil
Do pobrania
Ikonka paska narzędzi
Odnośniki
Przepisy na makropolecenia
Jak zainstalować makrodefinicje
Dostosowanie pasków narzędzi
Wersja Makrodefinicji
01.00
Data zmian
2016-12-26
Wersja FreeCAD
Wszystkie
Domyślny skrót
Brak
Zobacz również
Makro Mouse over cb

Opis

To makro wyświetla w widoku raportu wszystkie elementy znajdujące się poniżej kursora (wyświetlane będą również wszystkie elementy zakryte przez inne elementy).

Użycie

Uruchom makro.

Skrypt

Ikonka paska narzędzi

Macro FC element selector.FCMacro

#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 26 22:29:29 2016

@author: HoWil
License: LGPL v 2.1

Concept:
 After starting the process by clicking on "Start here..." one can click into the 3D view to get all elements below the the cursor click.
 The found elements are then listed in a pulldown-menu.

Hint:
  Does not work with Part-Design-Next 'Part'-elements and childs of them in the tree.
"""

#==============================================================================
#
#==============================================================================
from PySide import QtGui, QtCore
import FreeCADGui
import FreeCAD
from pivy.coin import SoMouseButtonEvent


class element_selector():

# ========================================================
#  GUI
# ========================================================
    def __init__(self):

        self.dialog = None
        self.dialog = QtGui.QDialog()
        self.dialog.resize(500,150)
        self.dialog.setWindowTitle("Find all components and related objects below cursor click.")
 
        self.view = None
        self.root = None
        self.hm = None

        self.elements_list = []
        self.objects_list = []
        self.components_list = []
        self.element_selection_data = []

        self.element_selection = QtGui.QComboBox()
        self.element_selection.setToolTip("Lists all found components")
        self.element_selection.currentIndexChanged.connect(self.selection_manager)
        self.element_selection.setMinimumContentsLength = 40
        self.element_selection.setMinimumSize(300,30)
        self.element_selection.addItems(['Found elements will be listed here.'])
        self.element_selection.setEditable(False) # Set the combo-box not-editalbe
        
        self.get_click = QtGui.QPushButton("Start here before clicking on an object in the draw window.")
        self.get_click.clicked.connect(self.start_mouse_over_cb)
        
        cancle_button = QtGui.QDialogButtonBox(self.dialog)
        cancle_button.setOrientation(QtCore.Qt.Horizontal)
        cancle_button.setStandardButtons(QtGui.QDialogButtonBox.Close)

        
        grid = QtGui.QGridLayout()             #    rot, column, alignment
        grid.setSpacing(10)

        # Run
        grid.addWidget(self.get_click,              0, 0, 1, 1)
        # Elements
        grid.addWidget(self.element_selection,      1, 0, 1, 1)
        # Cancel
        grid.addWidget(cancle_button,                       2, 0, 1, 1)

        self.dialog.setLayout(grid)

        QtCore.QObject.connect(cancle_button, QtCore.SIGNAL("rejected()"), self.close)

        QtCore.QMetaObject.connectSlotsByName(self.dialog)
        self.dialog.show()
        self.dialog.exec_()
        
    def start_mouse_over_cb(self):
        self.element_selection.clear() # Clear all elements in the combo-box
        self.element_selection.setEditable(True) # Set the combo-box editalbe
        self.view = FreeCADGui.ActiveDocument.ActiveView

        view = FreeCADGui.ActiveDocument.ActiveView.getViewer()
        root = view.getSceneGraph()
        hm = root.highlightMode.getValue() # store the original highlightMode
        root.highlightMode.setValue(2) # switch highlightMode off
        self.root = root
        self.hm = hm
        
        self.callback = self.view.addEventCallbackPivy(SoMouseButtonEvent.getClassTypeId(), self.mouse_over_cb)
        
        
    def mouse_over_cb(self, event_callback):
        event = event_callback.getEvent()
        
        if event.getState() == SoMouseButtonEvent.DOWN:
            pos = event.getPosition().getValue()

            element_list = FreeCADGui.ActiveDocument.ActiveView.getObjectsInfo((int(pos[0]), int(pos[1])))
            FreeCADGui.Selection.clearSelection()
            
            self.element_selection.clear() # clear pull down dialog
            self.element_selection_data = []
        
            self.elements_list = element_list # store all elements found
            
            self.objects_list = [] # reset objects_list
            self.components_list = [] # restet components_list
            
            if element_list: # if there were elements found
            
                FreeCAD.Console.PrintMessage("\n *** Elements found under mouse pointer (Part-Desing-Next- 'Parts' do not work yet!) ***\n")
                
                for e in element_list:
                    label_object = str(e["Object"])
                    label_component = str(e["Component"])
                    label_object_plus_component = label_object + ' - ' + label_component

                    if label_object not in self.element_selection_data:
                        self.objects_list.append(e["Object"])
                        self.components_list.append(None)
                        
                        FreeCAD.Console.PrintMessage(" " + str(label_object) + "\n")
                        
                        self.element_selection.addItem(label_object)
                        self.element_selection_data.append(label_object)
                    
                    if label_object_plus_component not in self.element_selection_data:
                        self.objects_list.append(e["Object"])
                        self.components_list.append(e["Component"])
                            
                        FreeCAD.Console.PrintMessage(" " + str(label_object_plus_component) + "\n")
        
                        self.element_selection.addItem(label_object_plus_component)
                        self.element_selection_data.append(label_object_plus_component)
                        
        
        self.view.removeEventCallbackPivy(SoMouseButtonEvent.getClassTypeId(), self.callback)    
        
        self.root.highlightMode.setValue(self.hm) # restore the original highlightMode
        FreeCADGui.Selection.clearSelection()

        self.element_selection.removeItem(self.element_selection.findText('tmp'))

#==============================================================================
# Highligthing the choice from GUI
#==============================================================================
    def selection_manager(self):
        try:
            FreeCADGui.Selection.clearSelection()
            if self.element_selection.isEditable():
                sel_index = self.element_selection.currentIndex()
                
                if self.components_list[sel_index] == None :
                    # An object was selected in combobox
                    FreeCADGui.Selection.addSelection(FreeCAD.ActiveDocument.getObject(self.objects_list[sel_index]))
                else:
                    # An element of an object was selected in combobox
                    FreeCADGui.Selection.addSelection(FreeCAD.ActiveDocument.getObject(self.objects_list[sel_index]), self.components_list[sel_index])

        except:
            FreeCAD.Console.PrintError("Unable to complete the element selection/highlighting.\n")
            self.close()

    def close(self):
        self.dialog.hide()

element_selector()

Łącza

Dyskusja na forum Selecting internal faces of a pressure vessel

Inne podobne makro Makro Mouse over cb

Ta strona pochodzi z https://wiki.freecad.org/Macro_FC_element_selector

Bądźmy w kontakcie!
Forum GitHub Mastodon Matrix IRC Gitter.im Discord Reddit Twitter Facebook LinkedIn

© Załoga FreeCAD. Autorami grafiki na stronie głównej (od góry do dołu) są: ppemawm, r-frank, epileftric, regis, rider_mortagnais, bejant.

Ten projekt jest wspierany przez: , KiCad Services Corp. oraz pozostałych sponsorów

GitHubUlepsz tę stronę na GitHub