FreeCAD Logo FreeCAD 1.0
  • Inglês Africânder Árabe Belarusian Catalão Checo Alemão Grego Espanhol Espanhol Basco Finlandês Filipino Francês Galego Croata Húngaro Indonésio Italiano Japonês Kabyle Coreano Lituano Holandês Norwegian Bokmal Polaco Português Português Romeno Russo Eslovaco Esloveno Sérvio Sueco Turco Ucraniano Valenciano Vietnamita Chinês Chinês
  • Funcionalidades
  • Transferir
  • Blog
  • Documentação
    Índice de documentação Por onde começar Documentação para utilizadores O manual do FreeCAD Documentação das bancadas de trabalho Documentação de programação Python C++ coding documentation Tutoriais Frequently asked questions Política de privacidade Sobre o FreeCAD
  • Contribua
    Como pode ajudar Sponsor Report a bug Make a pull request Empregos e financiamento Contribution guidelines Manual do desenvolvedor Translations
  • Comunidade
    Código de conduta Fórum The FPA GitHub GitLab Codeberg Mastodon Matrix IRC IRC via Webchat Gitter Discord Reddit Twitter Facebook LinkedIn Calendário
  • ♥ Donate

Donate

$
Informação SEPA
Por favor, configure a sua transferência bancária SEPA para:
Beneficiary: The FreeCAD project association
IBAN: BE04 0019 2896 4531
BIC/SWIFT: GEBABEBBXXX
Agência bancária: BNP Paribas Fortis
Morada: 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!

Scripting e macros
Scripts
Index

Introdução

Macros são uma forma conveniente de reproduzir tarefas complexas no FreeCAD. Simplesmente grava uma sequência de acções à medida que as executa, depois grava essa sequência com um nome, e já pode repetir a sequência quando quiser. Uma vez que Macros são realmente uma sequência de comandos Python, pode editá-los, e criar scripts muito complexos.

Uma vez que os scripts Python normalmente têm uma extensão de ficheiro .py, as Macros FreeCAD devem ter a extensão .FCMacro. Uma colecção de Macros escrita por utilizadoes experientes encontra-se na página Receitas de Macros.

See the Power users hub to learn more about the Python programming language, and about writing macros. In particular, you should start with these pages:

  • Introduction to Python
  • Python scripting tutorial
  • FreeCAD Scripting Basics

How it works

Enable the console output in the menu Edit → Preferences → Python → Macro → Show scripts commands in python console. You will see that in FreeCAD, every action you do, such as pressing a button, outputs a Python command. Those commands are what can be recorded in a macro. The main tool for making macros is the macros toolbar: . On it you have 4 buttons: Record, stop recording, edit and play the current macro.

It is very simple to use: Press the record button, you will be asked to give a name to your macro, then perform some actions. When you are done, click the stop recording button, and your actions will be saved. You can now access the macro dialog with the edit button.

There you can manage your macros, delete, edit, duplicate, install or create new ones from scratch. If you edit a macro, it will be opened in an editor window where you can make changes to its code. New macros can be installed using the Addons... button, which links to the Addon Manager.

Example

Press the record button, give a name, let's say "cylinder 10x10", then, in the Part Workbench, create a cylinder with radius = 10 and height = 10. Then, press the "stop recording" button. In the edit macros dialog, you can see the python code that has been recorded, and, if you want, make alterations to it. To execute your macro, simply press the execute button on the toolbar while your macro is in the editor. You macro is always saved to disk, so any change you make, or any new macro you create, will always be available next time you start FreeCAD.

Customizing

Of course it is not practical to load a macro in the editor in order to use it. FreeCAD provides much better ways to use your macro, such as assigning a keyboard shortcut to it or putting an entry in the menu. Once your macro is created, all this can be done via the Tools → Customize menu.

This way you can make your macro become a real tool, just like any standard FreeCAD tool. This, added to the power of python scripting within FreeCAD, makes it possible to easily add your own tools to the interface.

See Customize Toolbars for a more detailed description.

Creating macros without recording

You can also directly copy/paste python code into a macro, without recording GUI action. Simply create a new macro, edit it, and paste your code. You can then save your macro the same way as you save a FreeCAD document. Next time you start FreeCAD, the macro will appear under the "Installed Macros" item of the Macro menu.

See How to install macros for a more detailed description.

Macro repositories

There are two main places for macros. The first one is the official peer-reviewed macro repository on GitHub. The second one is the Macros recipes page from which you can pick some useful macros to add to your FreeCAD installation. Macros from both repositories can be installed via the Addon Manager directly from FreeCAD.

Additional information

  • Automatically run macro at startup
  • Installing more workbenches

Tutorials

You can manually install extensions, however, it is much simpler to just use the Addon Manager.

  • How to install macros
  • How to install additional workbenches


Standard Menu/pt
Introduction to Python/pt
Índice

Esta página foi obtida de https://wiki.freecad.org/Macros

Mantenha o contacto!
Forum GitHub Mastodon Matrix IRC Gitter.im Discord Reddit Twitter Facebook LinkedIn

© Equipa do FreeCAD. Créditos da imagem da página inicial (de cima para baixo): ppemawm, r-frank, epileftric, regis, rider_mortagnais, bejant.

Este projeto é suportado por: , KiCad Services Corp. e outros patrocinadores

GitHubMelhore esta página no GitHub