FreeCAD Logo FreeCAD 1.0
  • 英語 アフリカーンス語 アラビア語 ベラルーシ語 カタロニア語 チェコ語 ドイツ語 ギリシャ語 スペイン語 スペイン語 バスク語 フィンランド語 フィリピン語 フランス語 ガリシア語 クロアチア語 ハンガリー語 インドネシア語 イタリア語 日本語 カビル語 韓国語 リトアニア語 オランダ語 ブークモール・ノルウェー語 ポーランド語 ポルトガル語 ポルトガル語 ルーマニア語 ロシア語 スロバキア語 スロベニア語 セルビア語 スウェーデン語 トルコ語 ウクライナ語 バレンシア語 ベトナム語 中国語 中国語
  • 特徴
  • ダウンロード
  • ブログ
  • ドキュメント
    ドキュメントの目次 初めての方へ ユーザー ドキュメント FreeCAD マニュアル ワークベンチのドキュメント Python コーディングドキュメント C++ コーディングドキュメント チュートリアル よくある質問 プライバシーポリシー FreeCADについて
  • 協力する
    協力するには Sponsor バグを報告 プルリクエストを作成 雇用と資金援助 コントリビューション ガイドライン 開発者ハンドブック 翻訳
  • コミュニティ
    行動規範 フォーラム The FPA GitHub GitLab Codeberg Mastodon Matrix IRC IRC via Webchat Gitter Discord Reddit Twitter Facebook LinkedIn カレンダー
  • ♥ Donate

Donate

$
SEPA 情報
SEPA 銀行振込を設定してください。:
Beneficiary: The FreeCAD project association
IBAN: BE04 0019 2896 4531
BIC/SWIFT: GEBABEBBXXX
銀行振込サービス: BNP Paribas Fortis
アドレス: 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 and macros
Scripts
Index

Introduction

マクロはFreeCADに複雑なアクションを作成するための便利な方法です。簡単にあなたが行う操作を記録したものを名前をつけて保存し、いつでも好きなときに再生することができます。マクロはpythonコマンドで記述されているので、それらを編集して非常に複雑なスクリプトを作成することができます。

While Python scripts normally have the .py extension, FreeCAD macros should have the .FCMacro extension. A collection of macros written by experienced users is found in the macros recipes page.

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

操作方法

コンソール出力(メニュー Edit -> Preferences -> General -> Macros -> Show scripts commands in python console)を有効にした場合は、FreeCADでは、ボタンを押すのなどのあなたが行うすべてのアクションがpythonコマンドを出力していることがわかります。 このコマンドはマクロに記録することができるものです。マクロを作成するための主なツールはマクロのツールバーです。それには、4つのボタンがあります:「記録」、「記録終了」、「編集」、「マクロの実行」です。

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.

それを使用することは非常に簡単です:「記録」ボタンを押すと、マクロに名前を付けるように求められます。その後、いくつかのアクションを実行します。作業が完了したら、「記録終了」ボタンをクリックして、あなたの行ったアクションが保存されます。ここで「編集」ボタンを押すとマクロダイアログを開くことができます。

マクロダイアログには、あなたのマクロを管理、編集、削除、新規作成ができます。マクロを編集する場合、コードに変更を加えることができるエディタウィンドウが開きます。 新しいマクロはAddon ManagerにリンクするAddons ...ボタンを使ってインストールできます。

例

「記録」ボタンを押して名前をつけてみましょう。"cylinder 10×10"にします。その後、パートワークベンチで、半径= 10、高さ= 10でシリンダを作成します。そして、「記録停止」ボタンを押してください。マクロ編集のダイアログでは、記録されているPythonのコードを見ることができ、必要に応じて変更を加えることができます。マクロを実行する簡単な方法は、マクロをエディタで開きツールバー上の「実行」ボタンを押します。 マクロは常にディスクに保存され、あなたが行ったすべての変更、または新しく作成したマクロはFreeCADを次回起動時も利用できるようになっています。

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.

カスタマイズ

もちろん、マクロを使用するたびに、エディタでマクロを開くのは実用的ではありません。 FreeCADは、マクロにキーボードショートカットを割り当てる、メニューのエントリに追加するなど、マクロを使用するためのはるかに優れた方法を提供します。マクロが作成されると、Tools -> Customize メニューから設定を行うことができます

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.

Customize Toolbars この方法であなたのマクロをFreeCADの標準ツールのように使うことができます。これは、FreeCADのpythonスクリプトの力のおかげで、インターフェイスに独自のツールを簡単に追加することができます。Pythonスクリプティングについて詳細をお知りになりたい場合はScriptingページを参照してください。

See Customize Toolbars for a more detailed description.

記録せずにマクロを作成する

How to install macros また、直接GUI操作を記録せずに、マクロにpythonコードをコピー/ペーストすることができます。新しいマクロを作成・編集して、コードを貼り付けます。あなたのマクロはFreeCADの文書を保存するのと同じ方法で保存することができます。FreeCADを次回起動する時には、マクロは「Macro」メニューの"Installed Macros"項目の下に表示されます。

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.

マクロリポジトリ

Macros recipesページには、あなたのFreeCADに追加できるいくつかの便利なマクロが紹介されています。

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.

Links

Installing more workbenches

  • Automatically run macro at startup
  • Installing more workbenches

Tutorials

How to install additional workbenches

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


Image Workbench/ja
Introduction to Python/ja
インデックス

このページは以下から取得されています https://wiki.freecad.org/Macros

お問い合わせ
Forum GitHub Mastodon Matrix IRC Gitter.im Discord Reddit Twitter Facebook LinkedIn

© The FreeCAD チーム. ホームページの画像クレジット(上から下へ): ppemawm, r-frank, epileftric, regis, rider_mortagnais, bejant.

このプロジェクトは次の人によってサポートされています: , KiCad Services Corp. および その他のスポンサー

GitHubGitHub でこのページを改善する