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!

SimpleProperties

Description
Cette macro donne des propriétés simples de l'objet sélectionné (volume, boîte englobante, ...)

Version macro : 0.7
Date dernière modification : 2019-06-10
Version FreeCAD : 0.17+
Téléchargement : Icône de la barre d'outils
Auteur: OpenBrain
Auteur
OpenBrain
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
0.7
Dernière modification
2019-06-10
Version(s) FreeCAD
0.17+
Raccourci clavier
None
Voir aussi
Arch_Survey, Macro_FCInfo

Description

Contexte

Cette macro a été écrite principalement pour que l'utilisateur puisse accéder à une information rapide et concise sur les propriétés physiques d'un objet. Cela vise en particulier à préparer un emballage d'objet & livraison.

Utilisation

Sélectionnez un objet et exécutez la macro. Il affichera dans une boîte de message:

  • Volume de l'objet en litres
  • Dimensions de la boîte englobante en millimètres
  • Si un objet a été sélectionné en cliquant sur un bord, sa longueur est affichée en millimètres
  • Si un objet a été sélectionné en cliquant sur une face, sa zone est affichée en mètres carrés.

Installation

La macro est disponible via le Gestionnaire des extensions. Le code est fourni sur cette page pour plus de commodité au cas où votre système n'ait pas git-python. Bien qu'elle devrait être à jour, la dernière version de la macro est toujours disponible sur dépôt FreeCAD-macro

Pour des explications plus détaillées, consultez la page Comment installer les macros.

Script

Limitations

  • Un seul objet à la fois

Code

Icône de la barre d'outils

Macro_SimpleProperties.FCMacro

#!/usr/bin/python
#####################################
# Copyright (c) openBrain 2019
# Licensed under LGPL v2
#
# This FreeCAD macro will give basic properties of the selected object (volume, boundbox, ...)
#
#
# Version history :
# *0.7 : some typo improvement + commenting
# *0.6 : check if selected object has a valid shape
# *0.5 : beta release
#
#####################################

__Name__ = 'SimpleProperties'
__Comment__ = 'Gives basic properties of object (volume, boundbox, ...)'
__Author__ = 'openBrain'
__Version__ = '0.7'
__Date__ = '2019-06-10'
__License__ = 'LGPL v2'
__Web__ = 'https://wiki.freecad.org/Macro_SimpleProperties'
__Wiki__ = 'https://wiki.freecad.org/Macro_SimpleProperties'
__Icon__ = ''
__Help__ = 'Select an object and run the macro'
__Status__ = 'Beta'
__Requires__ = 'FreeCAD >= 0.17'

__dbg__ = False #True for debugging
SIGNUM = '%.3g' #Set the display format of numbers

from PySide import QtGui

def cslM(msg): #Print message in console
    FreeCAD.Console.PrintMessage('\n')
    FreeCAD.Console.PrintMessage(msg)

def cslW(msg): #Print warning in console
    FreeCAD.Console.PrintMessage('\n')
    FreeCAD.Console.PrintWarning(msg)

def cslE(msg): #Print error in console
    FreeCAD.Console.PrintMessage('\n')
    FreeCAD.Console.PrintError(msg)

def cslD(msg): #Print debug message in console
    if __dbg__:
        FreeCAD.Console.PrintMessage('\n')
        FreeCAD.Console.PrintMessage("Debug : " + str(msg))

if __dbg__:  ##Clear report view in debug mode
    FreeCADGui.getMainWindow().findChild(QtGui.QTextEdit, "Report view").clear()

cslM("Starting Simple Properties macro")

if len(Gui.Selection.getSelection()) != 1: ##If not exactly one object selected, warn user & quit
    cslE("One and only one object shall be selected ... Exiting")
elif not ("Shape" in Gui.Selection.getSelection()[0].PropertiesList): ##If selected object has no shape, warn user & exit
    cslE("Selected object has no valid shape ... Exiting") 
else:
    obj = Gui.Selection.getSelection()[0] #Get selected object
    retStr = ""
    if len(Gui.Selection.getSelectionEx()[0].SubObjects) != 1: #If several object subobjects have been selected, ignore & warn user
        cslW("No or several subobject(s) selected, will be ignored")
    else:
        objEx = Gui.Selection.getSelectionEx()[0].SubObjects[0] #If one subobject selected
        if isinstance(objEx, Part.Edge): ##If it's an edge, print its length
            retStr += "Edge length : " + '%s' % float(SIGNUM % (objEx.Length)) + " mm\n"
        elif isinstance(objEx, Part.Face): ##If it's a face, print its area
            retStr += "Face area : " + '%s' % float(SIGNUM % (objEx.Area/1000000)) + " m2\n"
        else: ##If other (unsupported) type, warn user
            cslD("Subobject type : " + str(objEx.ShapeType))
            cslW("Unsupported type of subobject")
    retStr += "Object volume : " + '%s' % float(SIGNUM % (obj.Shape.Volume/1000000)) + " l\n" #Print object volume
    bb = obj.Shape.BoundBox #Get object boundbox
    retStr += "Object boundbox : " + '%s' % float(SIGNUM % (bb.XLength)) + " x " + '%s' % float(SIGNUM % (bb.YLength)) + " x " + '%s' % float(SIGNUM % (bb.ZLength)) + " mm" + "\n" #Print object boundbox dimensions
    QtGui.QMessageBox(QtGui.QMessageBox.Information, "Object Simple Props",retStr).exec_() #Display information in a message box
    cslM("End")

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

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