FreeCAD Logo FreeCAD 1.0
  • Engleski Afrički Arapski Bjeloruski Katalonski Češki Njemački Grčki Španjolski Španjolski Baskijski Finski Filipinski Francuski Galicijski Hrvatski Mađarski Indonezijski Talijanski Japanski Kabilski Korejski Litvanski Nizozemski Norveški (Bokmal) Poljski Portugalski Portugalski Rumunjski Ruski Slovački Slovenski Srpski Švedski Turski Ukrajinski Valencijski Vijetnamski Kineski Kineski
  • Osobine
  • Preuzmi
  • Blog
  • Dokumentacija
    Sadržaj dokumentacije Prvi koraci Korisnička dokumentacija Uputstvo za korisnike FreeCAD-a Radne Površine Dokumentacija Python dokumentacija programiranja C++ coding dokumentacija Vježbe Često postavljena pitanja Privacy policy O FreeCAD-u
  • Doprinesi
    Kako pomoči Sponsor Prijavi grešku Stvorite zahtjev za povlačenjem Radna mjesta i financijranje Pravila sudjelovanja Priručnik za programere Prijevodi
  • Zajednica
    Code of conduct Forum The FPA GitHub GitLab Codeberg Mastodon Matrix IRC IRC via Webchat Gitter Discord Reddit Twitter Facebook LinkedIn Calendar
  • ♥ Donate

Donate

$
SEPA informacija
Molimo postavite svoj SEPA bankovni prijenos na:
Beneficiary: The FreeCAD project association
IBAN: BE04 0019 2896 4531
BIC/SWIFT: GEBABEBBXXX
Agencija banke: BNP Paribas Fortis
Adresa: 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!

Odabir elementa za makro FC

Description
Ovaj makro prikazuje sve elemente ispod pokazivača (prikazat će se i svi elementi koje pokrivaju drugi elementi).

Macro version: 01.00
Last modified: 2016-12-26
FreeCAD version: All
Download: ToolBar Icon
Author: HoWil
Author
HoWil
Download
ToolBar Icon
Links
Macros recipes
How to install macros
How to customize toolbars
Macro Version
01.00
Date last modified
2016-12-26
FreeCAD Version(s)
All
Default shortcut
None
See also
Macro Mouse over cb

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 makronaredbu.

Skripta

ToolBar Icon

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()

Poveznice

Rasprava na forumu Selecting internal faces of a pressure vessel

Drugi slični makro Macro Mouse over cb

Ova stranica je preuzeta s https://wiki.freecad.org/Macro_FC_element_selector

Kontaktirajte nas!
Forum GitHub Mastodon Matrix IRC Gitter.im Discord Reddit Twitter Facebook LinkedIn

© The FreeCAD Team. Homepage image credits (top to bottom): ppemawm, r-frank, epileftric, regis, rider_mortagnais, bejant.

Ovaj projekt je podržan od: , KiCad Services Corp. i drugi sponzori

GitHubPoboljšaj ovu stranicu na GitHub-u